function openWindow(url,width,height) {
    x = (640 - width)/2, y = (480 - height)/2;
	if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
	window.open(url,'newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',scrollbars=yes');
}

function countCaracteres(cual,counter,maxlength){
	var max_chars=maxlength;
	remainder=max_chars-cual.length;
	counter.value = remainder;
}
function trackclick(id,table) {
   if(document.images){ 
       (new Image()).src="http://www.gabinotravel.com/trackclick.php?id="+id+"&table="+table+""; 
    } 
    return true;
}
function AddBookmark(theUrl, theText){
	alertText_en = "Please Press Ctrl+D to Bookmark this Page";
	alertText_es = "Por Favor Presione Ctrl+D para Recordar esta Página";
	alertText_de = "Bitte, Drücken Sie auf Ctrl+D, um Diese Seite zu Bewahren";
	alertText_fr = "S'il Vous Plaît, Appuyez sur Ctrl+D Pour Conserver cette Page";
	ver = navigator.appName;
	num = parseInt(navigator.appVersion);
	if (ver == "Microsoft Internet Explorer" && num>=4)
	{
		window.external.AddFavorite(theUrl, theText);
	}
	else
	{
		window.alert(alertText_es)
	}
}

function validNum(formField,fieldLabel,required){
	var result = true;
	if (required && !validRequired(formField,fieldLabel))
    	result = false;
	if (result){
		var num = parseInt(formField.value,10);
     	if (isNaN(num)){
       		alert('Please enter a number for the "' + fieldLabel +'" field.');
      		formField.focus();    
      		result = false;
    	}
  	} 
	return result;
}



function NoneWithCheck(ss) {
	for(var i = 0; i < ss.length; i++) {
		if(ss[i].checked) { 
			return false; 
		}
	}
	return true;
}


//Make reference to the selected link
function makeLink(object,BASE_URL,LANG,link_type) {
	var country	=	object.options[object.selectedIndex].value;
	if(country!="-"){
		//alert(country);
		var new_url	=	"http://"+country+BASE_URL+"/"+LANG+"/search/";
		window.top.location.href =new_url; 
	}
}
//Make reference to the selected link
function makeLink2(object,URL) {
	var area	=	object.options[object.selectedIndex].value;
	if(area!="-"){
		//alert(country);
		var new_url	=	URL+"/"+area+"/";
		window.top.location.href =new_url; 
	}
}
function makeLink3(object,country,URL) {
	var area	=	object.options[object.selectedIndex].value;
	if(area!="-"){
		//alert(country);
		var new_url	=	country+"/"+URL+"/"+area+"/";
		window.top.location.href =new_url; 
	}
}

//	NEW VALIDATE FUNCTIONS - 24-02-2005

function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}

function validNum(the_num){
	if(the_num.value.length == 0) { 
		return false; 
    }
	if (isNaN(the_num.value)){
       	return false; 
  	} 
	return true;
}

function validEmail(the_email){
	 if(the_email.value.length == 0) { 
      //the_email.focus(); 
      //alert("Please enter your email."); 
      return false; 
    }
	if(-1 == the_email.value.indexOf("@")) { 
      //  the_email.focus(); 
       //alert("Your email must have a '@'."); 
       return false; 
    }
    if(-1 != the_email.value.indexOf(",")) { 
       the_email.focus(); 
      // alert("Your email must not have a ',' in it"); 
       return false; 
    }
    if(-1 != the_email.value.indexOf("#")) { 
      // the_email.focus(); 
      // alert("Your email must not have an '#' in it." ); 
       return false; 
    }
    if(-1 != the_email.value.indexOf("!")) { 
     //  the_email.focus(); 
      // alert("Your email must not have a '!' in it." ); 
       return false; 
    }
    if(-1 != the_email.value.indexOf(" ")) { 
     //  the_email.focus(); 
       //alert("Your email must not have a space in it." ); 
       return false; 
    }
    if(the_email.value.length == (the_email.value.indexOf("@")+1) ) {
     //  the_email.focus();
       //alert("Your email must have a domain name after the '@'.");
       return false;
    }
	return true;
}



//	redirect ferom select list
function goto_URL(object) {
    theUrl	=	object.options[object.selectedIndex].value;
	if(theUrl!='')	window.location.href = theUrl;
}

function subdomain_jump(theUrl) {
  //  theUrl	=	object.options[object.selectedIndex].value;
	//alert(theUrl);
	if(theUrl!='')	window.location.href = theUrl;
}

function display_image(theimage,width,height) {
PreView = window.open("", "Foto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+width+",height="+height+"");
PreView.document.open();
PreView.document.write("<HTML><HEAD>");
PreView.document.write("<TITLE>GabinoTravel</TITLE>");
PreView.document.write("</HEAD>");
PreView.document.write("<link rel='stylesheet' href='http://www.gabinohome.com/css/style_3.css' type='text/css'>");
PreView.document.write("<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onload='self.focus();'>");
PreView.document.write("<IMG HSPACE=0 VSPACE=0 " + "SRC='" + theimage + "'>");
//PreView.document.write("<INPUT TYPE='button' VALUE='<?php $contents.= $lang_bt_close[$idioma]; ?>' " + "onClick='window.close()'>");

PreView.document.write("</BODY></HTML>");
PreView.document.close();
    }
	
	function changeImage(filename){
  mainimage.src = filename;
}

function show_hide(showIt){ 
	var el = document.getElementById(showIt) 
	if (el.style.display=="none"){ 
		el.style.display=""; //show element 
	}else{ 
		el.style.display="none"; //hide element 
	} 
} 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}