// Get description in search listing

function getDescription(dv, rcd, wht) { 	

$.ajax({
  url: '/handle_business_description.php?rcd='+rcd+"&dv="+dv+"&wht="+wht,  
  success: function(data){
var res = data;
var resArr = data.split("|||");
document.getElementById(resArr[1]).innerHTML = resArr[0];
  }
});


}


// Get description in category listing

function getDescriptionInCat(dv, rcd, wht, catid) { 	

$.ajax({
  url: '/handle_business_description_in_category.php?rcd='+rcd+"&dv="+dv+"&wht="+wht+"&catid="+catid,  
  success: function(data){
var res = data;
var resArr = data.split("|||");
document.getElementById(resArr[1]).innerHTML = resArr[0];	
  }
});

}




function searchTab(index)
{
/*	   if(index==1)
	   {
		   document.getElementById('listval').value ='main';
	   }
	   else if(index==2)
	   {
	    document.getElementById('listval').value ='map';
	   }
	   else if(index==3)
	   {
	    document.getElementById('listval').value ='mostlike';
	   }
	   else
	   {
	    document.getElementById('listval').value ='coupon';
	   }*/
	   
	   
	   if(index==1)
	   {		   
		   setTabs('main')
	   }
	   else if(index==2)
	   {	    
		setTabs('map')
	   }
	   else if(index==3)
	   {	    
		setTabs('mostlike')
	   }
	   else
	   {	    
		setTabs('coupon')
	   }
	
	
	for(var i=1; i<=4; i++)
	{
		if(i==index)
		{
		document.getElementById('container'+i).style.display = 'block';
		document.getElementById('link'+i).className = 'selected';
		}
		else
		{
		document.getElementById('container'+i).style.display = 'none';
		document.getElementById('link'+i).className = 'map';
		}
		
	}
}


 function setTabs(tab) { 	
	$.ajax({
  url: '/set_tab.php?tab='+tab,  
  success: function(data){
    //alert('inside success');	
  }
});
	
}


function saveCoupon(rcd)
{
SaveMyCoupon(rcd);
}


function SaveMyCoupon(rcd) { 				 

$.ajax({
  url: '/save_coupon.php?rcd='+rcd,  
  success: function(data){
    document.getElementById('my_coupon').style.display = '';	
  }
});

}




function open_win(url_add, w, h, title)
   {	
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
window.open(url_add, title,'width='+w+',height='+h+',menubar=no,status=no,location=no,toolbar=no,scrollbars=no top='+top+', left='+left);   
   }
   
   
    
   function open_coupon_win(url_add, w, h, title,bid)
   {    
	
	$.ajax({
  url: '/twitter_record.php?q='+bid,  
  success: function(data){
    //alert('inside success');	
  }
});
	
	
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
window.open(url_add, title,'width='+w+',height='+h+',menubar=no,status=no,location=no,toolbar=no,scrollbars=no top='+top+', left='+left);   
   }
   
   
   
function handle_summary(wht, cnt)
   {   
	  	document.getElementById('short_summary'+cnt).style.display = ((wht=='full')?'none':'block');
		document.getElementById('full_summary'+cnt).style.display = ((wht=='shrt')?'none':'block');
   }
   
function handle_summary_mostlike(wht, cnt)
   {   
	  	document.getElementById('short_summary_mostlike'+cnt).style.display = ((wht=='full')?'none':'block');
		document.getElementById('full_summary_mostlike'+cnt).style.display = ((wht=='shrt')?'none':'block');
   }




