$(function()
	{
	var HOST = '';

	$('.listing_head').find('.phoneNo').each(function () {
		var label = $(this).attr('rev').split('|');
		$(this).html('<a href="javascript:;">'+ label[0] +'</a>');

		if (HOST=='')
			HOST = label[1];

		if (label[2]=='buzz')
			$(this).attr('rev','buzz');
		else
			$(this).attr('rev','');
		});

	$(".phoneNo").click(function()
		{
		var coInfo = $(this).attr('rel').split('|');
		$(this).html( '<img style="padding-left:4px;" src="/img/icons/ajax-loader-fb.gif" />' );
		
		$.ajax({
		   type: "POST",
		   async: false,
		   url: HOST+"/inc/log_general.php",
		   data: "log_type=" + coInfo[0] + "&src=advert&co_id=" + coInfo[1]
		   });
		
		$(this).html( coInfo[2] );
		});
	
	
	var emailForm=function(hash)
		{
		var HOST_URI = $(hash.t).attr('rev');
		$.ajax({
			type: "POST",
			url: HOST_URI+"/_/contact_biz.php",
			data: "mode=load&coID=" + $(hash.t).attr('rel'),
			success: function(php_output) {
				$('#emailBox').html(php_output);
				
				Recaptcha.create("6LejowwAAAAAAJexXv5FuX4L-DWHAj2OqRf7PCu_", 'recapTarget', {
					theme: 'white',
					tabindex: 0,
					callback: Recaptcha.focus_response_field
					});
				}
			});
		  hash.w.show();
		};

	$('#email_pop')
		.jqDrag('.jqDrag')
		.jqm({ trigger:'.emailPopLnk',
		   modal:true,
		   onShow: emailForm
		 });


	if (!$.browser.msie)
		{
		$.xLazyLoader({
			js: 'http://s7.addthis.com/js/200/addthis_widget.js',
		    success: function(){
		        $(".addThis").css("display", "block"); }
			});
		}
	
	});
