function doBlink() {
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}
function startBlink() {
  if (document.all)
    setInterval("doBlink()",1000)
}
window.onload = startBlink;

function isEmail(Ml)
{
  if(!Ml){return true}
  if(Ml.indexOf("@")<=0 || Ml.indexOf("@")==Ml.length-1 || Ml.indexOf(".")<=0 || Ml.indexOf(".")==Ml.length-1 || Ml.indexOf("..")!=-1 || Ml.indexOf("@@")!=-1 || Ml.indexOf("@.")!=-1 || Ml.indexOf(".@")!=-1)
  {
      return false
  }
  else
  {
      return true
  }
}
function Trim (s){return LTrim(RTrim(' '+s));}
function LTrim (s)
{
    if(!s){return '';}
    while(s.charAt(0)==' ')
        s = s.substring(1,s.length);
    return s;
}
//..............
function RTrim (s)
{
    if(!s || s==' '){return '';}
    if (s.length > 1)
    {
        while(s.charAt(s.length-1)==' ')
            s = s.substring(0,s.length-2);
        return s;
    }
}
function ValidSet(frm)
{
	var txt="";
    if(!frm.city_id.value)
	{   
	   txt+="     Select City Name.\n";
	}
    if(!frm.site_title.value)
	{   
	   txt+="     Site Title should not be blank.\n";
	}
	
	if(!frm.admin_mail.value)
	{
	   txt+="     Admin Email Address should not be blank.\n";
	}
	if(!frm.meta_keys.value) 
	{
	   txt+="     Meta Keys should not be blank.\n";
	}
	if(!frm.meta_desc.value) 
	{
	   txt+="     Meta Description should not be blank.\n";
 	}
	if(txt)
	{
   	  alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	  return false
	}
    return true	
}
function ValidPass(frm)
{
    var txt="";   
    if(!frm.pass.value || frm.pass.value.length<4) 
	{
	   txt+="     Password should not be blank or password less than 4 chars.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}



function ValidCon(frm)
{
    var txt="";
	
	if(!frm.name.value)
	{
		txt+="     Name should not be empty.\n"
	}
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	
	if(!frm.description.value)
	{
		txt+="     You did not put any Comment.\n"
	}  
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function ChkLogin(frm)
{
    var txt="";
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email ID.\n"
	}
	
	if(!frm.password.value)
	{
		txt+="     You did not put Password.\n"
	}  
   	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function validulogin(frm)
{
    var txt="";  
	if(!frm.Login.value) 
	{
	   txt+="     Username should not be blank.\n"
	}
    if(!frm.Password.value) 
	{
	   txt+="     Password should not be blank.\n"
	}	
 	if(txt)
	{
   		alert("Sorry!! Following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	 

}


function ValidContact(frm)
{
    var txt="";
	
	if(!frm.name.value)
	{
		txt+="     Please enter your name.\n"
	}
	if(!frm.phone.value)
	{
		txt+="     Please enter your phone number.\n"
	}	
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	 
	if(!frm.message.value)
	{
		txt+="     You did not put any message.\n"
	} 
	if(!frm.verificationcode.value || frm.verificationcode.value.length<6 || frm.verificationcode.value.length>6)
	{
		txt+="     Wrong Verification Code.\n"
	}
   	if(txt)
	{
   		alert("Sorry. The following errors have been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function ValidContactsp(frm)
{
    var txt="";
	
	if(!frm.name.value)
	{
		txt+="     Debe rellenar su Nombre.\n"
	}
	if(!frm.phone.value)
	{
		txt+="     No ha puesto ningún número de teléfono.\n"
	}	
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Incorpore el email address válido.\n"
       
 	}
	 
	if(!frm.message.value)
	{
		txt+="     Usted no puso ningún mensaje.\n"
	} 
	if(!frm.verificationcode.value || frm.verificationcode.value.length<6 || frm.verificationcode.value.length>6)
	{
		txt+="     Código de Verificación incorrecto.\n"
	}
   	if(txt)
	{
   		alert("Lo sentimos!! No ha rellenado todos los campos obligatorios:\n\n"+ txt +"\n     Por favor revisar");
  	 	return false
	}
    return true	
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('renpopup.php', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=975,height=700,center = 0,top = 0');");
}


function isbookingForm(frm)
{
  	var txt="";
	if(!frm.fname.value)
	{
		txt+="     Name should not be empty.\n"
	}
	if(!frm.lname.value)
	{
		txt+="     Sur name should not be empty.\n"
	}
	if(!frm.address.value)
	{
		txt+="     Address should not be empty.\n"
	}
	if(!frm.phone.value)
	{
		txt+="     Phone No should not be empty.\n"
	}	
	
	if(!frm.email.value || !isEmail(frm.email.value))
	{
	   txt+="     Enter valid email address.\n"
       
 	}
	 
	if(!frm.sdate.value)
	{
		txt+="     Stating Date should not be empty.\n"
	} 
	if(!frm.ddate.value)
	{
		txt+="     Departure Date should not be empty.\n"
	}
	if(!frm.people_no.value)
	{
		txt+="     Number of people should not be empty.\n"
	}
	if(!frm.comments.value)
	{
		txt+="     Please enter your comments.\n"
	}
	
	
   	if(txt)
	{
   		alert("Sorry. you left some mandatory fields :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}