
_cntnames = "";
_cntnamesHtml = "";
_cntnamesEmailCN = "";
_cntnamesEmailPN = "";
var continentcnt;
var matchcnt;
var EFHeight = 0;
var emailFormCntnt;
var search_results_content;
var paging_content;
var matchvariable;
function hideFullDetail() {
		document.getElementById("search_results").innerHTML = search_results_content;
		document.getElementById("paging").innerHTML  = paging_content;
		insertdisplaytoggle("paging");
		insertdisplaytoggle("total_results");


}
function doSomething(obj){
var a="popup.html?"+obj.href;

var winl = (screen.width-500)/2;
var wint = (screen.height-400)/2;

window.open(a,'popup','toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300,left = '+winl+',top = '+wint+'') ;

}

function showFullDetail(restid) {
		search_results_content = "";
		paging_content = "";
		msgfulldetail = "";
		removedisplaytoggle("paging");
		removedisplaytoggle("total_results");
		search_results_content = document.getElementById("search_results").innerHTML;
		paging_content = document.getElementById("paging").innerHTML;
		msgfulldetail += "<table width='100%'><tr><td colspan='2'  width='100%'><table width='100%'><tr><td width='25%'><font size='2'><b>" + restaurantDetails[restid].nombre + "</b></font></td><td width='60%' background='../../../images/restaurantimages/fondo_nombre.gif' align='left'></td><td width='10%' valign='top'><img src='../../../images/restaurantimages/lacalificacion.gif'></td></tr><tr><td colspan='2'  width='100%' height='5'></td></tr></table></td></tr><tr><td width = '400' valign='top'><table valign=top width='500'><tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_comida.gif' width='45' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'><font size ='1' color = '#666666' >" + restaurantDetails[restid].restaurantcomdin + "</font></td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_direccion.gif' width='52' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";if(restaurantDetails[restid].restaurantdireccion != "none"){
		msgfulldetail += "<font size ='1' color = '#666666' >" + restaurantDetails[restid].restaurantdireccion + "</font>";}			msgfulldetail += "</td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_telefono.gif' width='49' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";if(restaurantDetails[restid].restauranttelefono != "none"){
		msgfulldetail += "<font size ='1' color = '#666666' >" + restaurantDetails[restid].restauranttelefono + "</font>";}
		msgfulldetail += "</td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_zona.gif' width='31' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'><font size ='1' color = '#666666' >" + restaurantDetails[restid].restaurantzona + "</font></td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_referencia.gif' width='57' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";
		if(restaurantDetails[restid].restaurantreferencia != "none"){
		msgfulldetail += "<font size ='1' color = '#666666' >" + restaurantDetails[restid].restaurantreferencia + "</font>";}
		msgfulldetail += "</td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_especialidad.gif' width='69' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";
		if(restaurantDetails[restid].restaurantespecialadad != "none"){
		msgfulldetail += "<font size ='1' color = '#666666' >" + restaurantDetails[restid].restaurantespecialadad + "</font>";}
		msgfulldetail += "</td></tr>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_horario.gif' width='43' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";
		if(restaurantDetails[restid].horario != "none"){
		msgfulldetail +="<font size ='1' color = '#666666' >" + restaurantDetails[restid].horario + "</font>";};
		msgfulldetail +="</td></tr>";

		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/resena_title.gif' width='43' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";
		if(restaurantDetails[restid].description != "none"){
		msgfulldetail +="<font size ='1' color = '#666666' >" + restaurantDetails[restid].description + "</font>";};
		msgfulldetail +="</td></tr>";

		msgfulldetail += "<tr><td width='123' height='15' align = 'right'><img src='../../../images/restaurantimages/info_rango.gif' width='97' height='15'></td><td width ='509' height='18'align='left' style='padding-left: 10px;'>";if(restaurantDetails[restid].rango != "none"){
		msgfulldetail +="<font size ='1' color = '#666666' >" + restaurantDetails[restid].rango + "</font>";}
		msgfulldetail +="</td></tr></td>";
		msgfulldetail += "<tr><td width='123' height='15' align = 'right'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' ><a href='javascript:hideFullDetail()'>Close</a></font></td></tr></table>";if(restaurantDetails[restid].imgsmallsize != "none"){
		msgfulldetail += "<td align= 'left'><img src =" + restaurantDetails[restid].imgbigsize + "></td>";}
		msgfulldetail += "</tr></table>";
		document.getElementById("search_results").innerHTML = msgfulldetail;
}

var restaurantResult = new Array();

function displayPage(zone,meal,resname) {
	location.href="search_restaurants.html?zonesel="+zone+"&mealsel="+meal+"&resnamegiven="+resname;
	displayResults();	
}

function displayResults()
{
	var zonesel = document.form.zone.options[document.form.zone.selectedIndex].text;
	var mealsel = document.form.meals.options[document.form.meals.selectedIndex].text;
	var resnamegiven = document.form.resname.value;
	var def = "Seleccione";
	var resnamelen = resnamegiven.length;
	resnamegiven = resnamegiven.toLowerCase();
	
	
	clearResults();
	for (var cls = 0; cls<restaurantDetails.length; cls++)
	{
		if(resnamelen == 0){
			if (restaurantDetails[cls].restaurantzona == zonesel && restaurantDetails[cls].restaurantcomdin == mealsel)
			{
				
				restaurantResult[restaurantResult.length++] = cls;
			}
			else if(restaurantDetails[cls].restaurantzona == zonesel && mealsel == def)
			{
				restaurantResult[restaurantResult.length++] = cls;
			}
			else if(zonesel == def && mealsel == def)
			{
				restaurantResult[restaurantResult.length++] = cls;	
			}
			else if(zonesel == def && mealsel == restaurantDetails[cls].restaurantcomdin)
			{
				restaurantResult[restaurantResult.length++] = cls;	
			}
		}
		else if(resnamelen > 0){

			var existres = restaurantDetails[cls].nombre.toLowerCase();
			if (restaurantDetails[cls].restaurantzona == zonesel && restaurantDetails[cls].restaurantcomdin == mealsel && resnamegiven == existres)
			{
				restaurantResult[restaurantResult.length++] = cls;
			}
			else if(restaurantDetails[cls].restaurantzona == zonesel && mealsel == def && resnamegiven == existres)
			{
				restaurantResult[restaurantResult.length++] = cls;
			}
			else if(zonesel == def && resnamegiven == existres)
			{
				restaurantResult[restaurantResult.length++] = cls;	
			}
			else if(zonesel == def && mealsel == restaurantDetails[cls].restaurantcomdin == mealsel && resnamegiven == existres)
			{
				restaurantResult[restaurantResult.length++] = cls;	
			}			
			
		}		
	}
	msg.length =0;
	if (restaurantResult.length == 0){
		msg = "<font color = 'grey' size ='2' align = 'center'>No se encontraron resultados</font>"	
		document.getElementById("search_results").innerHTML =  msg;
	}	
	else
	showdetails();
	totalresults = "<table><tr><td align='left' width='10%'><font size='2'><b>Resultados</b></font>&nbsp;&nbsp;</td><td align='left' width='90%' background='../../../images/restaurantimages/fondo_nombre.gif'></td></tr></table>";
	totalresults += "<font size ='1' color = '#7C0909'><b>Total de resultados: " + restaurantResult.length + "</b></font>";
	document.getElementById("total_results").innerHTML = totalresults;
}

function showdetails(msg)
{
	
	msg = "<table><tr><td valign=top>";
	document.getElementById("search_results").innerHTML =  msg;
	var zone1 = document.form.zone.options[document.form.zone.selectedIndex].text;
	var meal1 = document.form.meals.options[document.form.meals.selectedIndex].text;
	var def = "Seleccione";
	if(restaurantResult.length<=6){
		if (zone1 != def && meal1 == def)
		{
			
			for (i=0; i<restaurantResult.length; i++ )
			{	
				
				if (i == 0)
				{
					msg += "<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr></table>";
				}
				msg +="<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}

				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td>";
				msg +="<td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				msg += "<tr><td colspan='2' width='65' height='18' align='top'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>";
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
					
					if (i==2)
					{	
						msg += "</td><td valign=top>";
					}
			}
			msg += "</td></tr></table>";
		}










		else if (zone1 == def && meal1 != def)
		{
		
			for (i=0; i<restaurantResult.length; i++ )
			{	
				
				if (i == 0)
				{
					msg += "<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr></table>";
				}
				msg +="<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}

				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td>";
				msg +="<td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				msg += "<tr><td colspan='2' width='65' height='18' align='top'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>";
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
					
					if (i==2)
					{	
						msg += "</td><td valign=top>";
					}
			}
			msg += "</td></tr></table>";
		}



















		else if (zone1 != def && meal1 != def)
		{
			

			
			for (i=0; i<restaurantResult.length; i++ )
			{	
			
				if (i == 0)
				{
				msg +="<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr>";
				msg +="<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr></table>";
				}
				msg +="<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}

				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				msg += "<tr><td colspan='2' width='65' height='18' align='top'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>";
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
					
					if (i==2)
					{	
						msg += "</td><td valign=top>";
					}
			}
			msg += "</td></tr></table>";
		}
		else if(zone1 == def && meal1 == def)
		{			
			for (i=0; i<restaurantResult.length; i++ )
			{	
				msg +="<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}
				msg += "<td width='200'><table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr>";
				msg += "<tr><td colspan='2' width='65' height='18' align='top'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>";
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
				if (i==2)
				{	
					msg += "</td><td valign=top>";
				}
			}
			msg += "</td></tr></table>";
		}




		document.getElementById("search_results").innerHTML =  msg;		
		document.getElementById("paging").innerHTML =  "1";	
	}
	else if(restaurantResult.length>6){
		showdetails1(1);
	}
}


function showdetails1(argval)
{
	
	var zone1 = document.form.zone.options[document.form.zone.selectedIndex].text;
	var meal1 = document.form.meals.options[document.form.meals.selectedIndex].text;
	
	var def = "Seleccione";
	
	msg = "<table width='350'><tr><td valign=top width='350'>";
	var len = Math.round((restaurantResult.length/6)-0.49999999999);
	len++;
	if(argval < len )
	{
		endval = argval * 6;
		startval = endval - 6;
	}
	else
	{
		startval = ((argval-1)*6);
		endval = startval + restaurantResult.length%6;
	}
	j = 1;
	if (zone1 != def && meal1 == def)
		{
			
			for (i=startval;i<endval;i++)
			{
				
				
				if ((i%6) == 0)
				{
					msg += "<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr></table>";
				}
				msg += "<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}
				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				if(restaurantDetails[restaurantResult[i]].linkurl!="none") {
				msg += "<tr><td colspan='2' width='65' height='18' align='top' id='Show'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>"; }
				else {
				msg += "<tr><td colspan='2' width='65' height='18' align='top'></td></tr></table></td>"; }
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
				if ((j%3) == 0)
				{	
					msg += "</td><td valign=top>";
				}
				j++;
			}
			msg += "</td></tr></table>";
			document.getElementById("search_results").innerHTML= msg;
			showcurresults(argval);
		}











else if (zone1 == def && meal1 != def)
		{
			
			for (i=startval;i<endval;i++)
			{
				
				
				if ((i%6) == 0)
				{
					msg += "<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr></table>";
				}
				msg += "<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg +="<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}
				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				if(restaurantDetails[restaurantResult[i]].linkurl!="none") {
				msg += "<tr><td colspan='2' width='65' height='18' align='top' id='Show'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>"; }
				else {
				msg += "<tr><td colspan='2' width='65' height='18' align='top'></td></tr></table></td>"; }
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
				if ((j%3) == 0)
				{	
					msg += "</td><td valign=top>";
				}
				j++;
			}
			msg += "</td></tr></table>";
			document.getElementById("search_results").innerHTML= msg;
			showcurresults(argval);
		}


























		else if(zone1 != def && meal1 != def)
		{
			for (i=startval;i<endval;i++)
			{
				
				if ((i%6) == 0)
				{
					msg +="<table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr><tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr></table>";
				}
				msg += "<table width='300'><tr>";
				if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
				msg += "<td valign=left width='70'>";
				msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}
				msg += "<td width='200'><table valign=top width='280'>";
				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

				msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
				if(restaurantDetails[restaurantResult[i]].linkurl!="none") {
				msg += "<tr><td colspan='2' width='65' height='18' align='top' id='Show'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>"; }
				else {
				msg += "<tr><td colspan='2' width='65' height='18' align='top'></td></tr></table></td>"; }
				msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";	
				if ((j%3) == 0)
				{	
					msg += "</td><td valign=top>";
				}
				j++;
			}
			msg += "</td></tr></table>";
			document.getElementById("search_results").innerHTML= msg;
			showcurresults(argval);
		}

	else
	{
		for (i=startval;i<endval;i++)
		{
			
			msg +="<table width='300'><tr>";
			if(restaurantDetails[restaurantResult[i]].imgsmallsize != "none"){
			msg +="<td valign=left width='70'>";
			msg += "<img src =" + restaurantDetails[restaurantResult[i]].imgsmallsize + " width = '70' height = '70'></td>";}
			msg += "<td width='200'><table valign=top width='280'><tr><td width='65' height='18'><img src='../../../images/restaurantimages/tit_nombre.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].nombre + "</font></td></tr>";
			msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_comida.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantcomdin + "</font></td></tr>";
			msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_direccion.jpg' width='56' height='18'></td><td width ='209' height='18'align='left'>";
				if(restaurantDetails[restaurantResult[i]].restaurantdireccion != "none"){
				msg += "<font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantdireccion + "</font>";}
				msg += "</td></tr>";

			msg += "<tr><td width='65' height='18' align='top'><img src='../../../images/restaurantimages/tit_zona.jpg' width='56' height='18'></td><td width ='209' height='18' align='left'><font size ='1' color = '#666666' >" + restaurantDetails[restaurantResult[i]].restaurantzona + "</font></td></tr>";
			if(restaurantDetails[restaurantResult[i]].linkurl!="none") {
						msg += "<tr><td colspan='2' width='65' height='18' align='top'><a href='"+restaurantDetails[restaurantResult[i]].linkurl+"' id='showLink' onclick='doSomething(this); return false'><img src='../../../images/restaurantimages/bot_reserva.jpg' width='124' height='16' border='0'></a></td></tr></table></td>"; }
			else {
			msg += "<tr><td colspan='2' width='65' height='18' align='top'></td></tr></table></td>"; }
			msg += "<tr><td colspan='2' align='left'><a href='javascript:showFullDetail(" + restaurantResult[i] + ")'><img src='../../../images/restaurantimages/bot_vermas.gif' alt='Ver m&aacute;s' width='54' height='10' border='0' ></a></td></tr></table>";
			if ((j%3) == 0)
			{	
				msg += "</td><td valign=top>";
			}
			j++;
		}
		msg += "</td></tr></table>";
		document.getElementById("search_results").innerHTML= msg;
		showcurresults(argval);
	}
	
}

function showcurresults(currentpage)
{
	
	moddata = Math.round((restaurantResult.length/6)-0.49999999999);
	pagingval = "";
	if(restaurantResult.length%6 > 0)
	{
		moddata++;
	}
	
	pagingval +="<table width = '100'><tr>";
	for (i=1;i<=moddata;i++)
	{
		
		if (i == 1 && currentpage > 1)
		{
			k = currentpage-1;		
			pagingval +="<td width = '3'><a href='javascript:showdetails1(" + k + ")'><img src='../../../images/restaurantimages/flecha_izq.gif' alt = 'Anterior' width ='8' height ='11'border ='0'></a></td>";
		}

		if (currentpage == i)
			pagingval +="<td width = '3'><font size = '3'>" + i + "</td>";
		else{
			pagingval += "<td width = '3'><a href='javascript:showdetails1(" + i + ")'><font size = '1'>" + i + "</a></td>";
			}
			
			if (i == moddata && currentpage < moddata)
		{
			m = currentpage + 1;
			pagingval +="<td width = '3'><a href='javascript:showdetails1(" + m + ")'><img src='../../../images/restaurantimages/flecha_der.gif' alt = 'Siguiente' width ='8' height ='11' border ='0'></a></td>";
		}
	}
	pagingval +="</tr></table>";
	document.getElementById("paging").innerHTML= pagingval;

}


function clearResults()
{
	restaurantResult.length = 0;
	document.getElementById("paging").innerHTML= "";

}

function loadValues(inputvalue,cntval,loadObj)
{
	if (browsername == 'ns')
	{	
		anOption = new Option(inputvalue,cntval);
		sellgth = document.form.elements[loadObj].options.length;
		document.form.elements[loadObj].options[sellgth]= anOption;
	}
	else if (browsername == 'ie')
	{
		anOption = document.createElement("OPTION");
		document.form.elements[loadObj].options.add(anOption);
		anOption.innerText = inputvalue;
		anOption.Value = cntval; 
	}
}

function sortByRestaurantName(a, b) {
    var x = a.restaurantzona.toLowerCase();
    var y = b.restaurantzona.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
function sortByRestaurantFood(a, b) {
    var x = a.restaurantcomdin.toLowerCase();
    var y = b.restaurantcomdin.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function uniquezona(a) {
	tmp = new Array(0);
	for(i=0;i<a.length;i++){
		if(!contains(tmp, a[i].restaurantzona)){
			tmp.length+=1;
			tmp[tmp.length-1]=a[i].restaurantzona;
		}
	}
	tmp.sort();
	return tmp;
}
function uniquemeals1(a) {
	tmp = new Array(0);
	for(i=0;i<a.length;i++){
	if(!contains(tmp, a[i].restaurantcomdin)){
			//alert("direct: "+a[i].restaurantcomdin);
			tmp.length+=1;
			tmp[tmp.length-1]=a[i].restaurantcomdin;
			
		}
	}
	tmp.sort();

		for (var cls1 = 0; cls1<tmp.length; cls1++)
	{
		//alert("comdins: "+tmp[cls1]);
		loadValues(tmp[cls1],cls1,'meals');
	}return tmp;
}
function contains(a, e) {
	for(j=0;j<a.length;j++)if(a[j]==e)return true;
	return false;
}
function uniquecomdin(a) {
	tmp = new Array(0);
	for(i=0;i<a.length;i++){
		if(!contains(tmp, a[i].restaurantcomdin)){
			tmp.length+=1;
			tmp[tmp.length-1]=a[i].restaurantcomdin;
		}
	}
	tmp.sort();
	return tmp;
}


function loadZoneandloc()
{

	zonas = uniquezona(restaurantDetails);
	zonacnt = zonas.length;
	restaurantDetails.sort(sortByRestaurantName);
	for (var cls = 0; cls<zonas.length; cls++)
	{
		
		loadValues(zonas[cls],cls,'zone');
	}
	comdins = uniquemeals1(restaurantDetails);

	//restaurantDetails.sort(sortByRestaurantFood);

	if (location.search != '')
	{
		var locsrcharr = new Array();
		var valuesarr = new Array();
		locsrch = location.search;
		locsrcharr = locsrch.split("\&");
		for ( keyVar in locsrcharr ) {
		   args = locsrcharr[keyVar];
			valuesarr = args.split("=");
			switch (valuesarr[0])
			{
				case "?zonesel":
					zonesel = valuesarr[1];
				case "mealsel":
					mealsel = valuesarr[1];
				case "resnamegiven":
					resnamegiven = valuesarr[1];
			
			}
		}	
		for (zonecnt = 0; zonecnt <= document.form.zone.options.length; zonecnt++)
		{
			if (browsername = 'ns')
			{
				if (encodeURIComponent(document.form.zone.options[zonecnt].text) == zonesel)
				{
					document.form.zone.options[zonecnt].selected = true;
					break;
				}
			}
			if (browsername = 'ie')
			{
				if (document.form.zone.options[zonecnt].text == zonesel)
				{
					document.form.zone.options[zonecnt].selected = true;
					break;
				}
			}
		}
		displaymeals(mealsel,1);
		document.form.resname.value = resnamegiven;
		displayResults();
	}
}


function allcomida(){

comdins = uniquemeals1(restaurantDetails);

}


function displaymeals(mealselval,lookurlstatus)
{
	var testmeal=mealselval;
	
	var mealArr = new Array();
	document.form.meals.length = 1;
	var zoneSel = document.form.zone.options[document.form.zone.selectedIndex].text;
	if(zoneSel == "Seleccione"){allcomida();
		for (mealcnt = 0; mealcnt <= document.form.meals.options.length; mealcnt++)
		{
			if (browsername = 'ns')
			{
				if (encodeURIComponent(document.form.meals.options[mealcnt].text) == mealselval)
				{
					document.form.meals.options[mealcnt].selected = true;
					break;
				}
			}
			if (browsername = 'ie')
			{
				if (document.form.meals.options[mealcnt].text == mealselval)
				{
					document.form.meals.options[mealcnt].selected = true;
					break;
				}
			}
		}

	}else{
	for (var cls = 0; cls<restaurantDetails.length; cls++)
	{
		if (restaurantDetails[cls].restaurantzona == zoneSel)
		{
			if(restaurantDetails[cls].restaurantcomdin == "&nbsp;"){
			}
			else{
			mealArr[mealArr.length++] = restaurantDetails[cls].restaurantcomdin;
			}
		}
	}	
	
	mealArr = uniquemeals(mealArr);

	for (var cls = 0; cls<mealArr.length; cls++)
	{
		loadValues(mealArr[cls],cls,'meals');
	}

	if (mealselval != '' && lookurlstatus == 1)
	{
		for (mealcnt = 0; mealcnt <= document.form.meals.options.length; mealcnt++)
		{
			if (browsername = 'ns')
			{
				if (encodeURIComponent(document.form.meals.options[mealcnt].text) == mealselval)
				{
					document.form.meals.options[mealcnt].selected = true;
					break;
				}
			}
			if (browsername = 'ie')
			{
				if (document.form.meals.options[mealcnt].text == mealselval)
				{
					document.form.meals.options[mealcnt].selected = true;
					break;
				}
			}
		}

	}}
}
function uniquemeals(a) {
	tmp = new Array(0);
	for(i=0;i<a.length;i++){
		if(!contains(tmp, a[i])){
			tmp.length+=1;
			tmp[tmp.length-1]=a[i];
		}
	}
	tmp.sort();
	return tmp;
}
function removedisplaytoggle(d){
	document.getElementById(d).style.display="none";
}
function insertdisplaytoggle(d){
	document.getElementById(d).style.display="";
}
	