// JavaScript Document

function P7_ExpMenu(){ //v1.1.0.2 by PVII-www.projectseven.com
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv='p7menubar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
function get_https_path()
{
    var path_original = document.location.href;
    var compro;
    compro=path_original.substring(0,5);
    if (compro=='http:')
    {
      path_original = document.location.href;
      path_original=path_original.replace('http://','https://');
      document.location.href=path_original;
      return true;
    }
}

function Check_Fields(ResID)
{



	var ErrMessage='Please fill in the fields: \n';
	var ErrorFlag=0;



	if (document.yacht["clcreferencenum"].value=='')
	{
	  ErrMessage=ErrMessage+" CLC reference number \n";
  	  ErrorFlag=1;
	}

	if (document.yacht["name"].value=='')
	{
	  ErrMessage=ErrMessage+" Name\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["email"].value=='')
	{
	  ErrMessage=ErrMessage+" email\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["day"].value=='')
	{
	  ErrMessage=ErrMessage+" Day fof birth\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["month"].value=='')
	{
	  ErrMessage=ErrMessage+" Month of birth\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["year"].value=='')
	{
	  ErrMessage=ErrMessage+" Year of birth\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["passport"].value=='')
	{
	  ErrMessage=ErrMessage+" Passport\n";
  	  ErrorFlag=1;
	}

	if (document.yacht["nationality"].value=='')
	{
	  ErrMessage=ErrMessage+" Nationality\n";
  	  ErrorFlag=1;
	}
	if (document.yacht["daytravel"].value=='')
	{
	  ErrMessage=ErrMessage+" Day of travel\n";
  	  ErrorFlag=1;
	}
	if (document.yacht["monthtravel"].value=='')
	{
	  ErrMessage=ErrMessage+" Month of travel\n";
  	  ErrorFlag=1;
	}
	if (document.yacht["yeartravel"].value=='')
	{
	  ErrMessage=ErrMessage+" Year of Travel\n";
  	  ErrorFlag=1;
	}

email = document.yacht.email.value;
AtPos = email.indexOf("@");
StopPos = email.lastIndexOf(".");
longitud='';
vuelta='';
extension='';

longitud = email.length;

for (count=longitud; count >= 0; count--)

  vuelta+=email.substring(count,count-1);

extension = vuelta.indexOf(".");

if ((longitud == (StopPos+1)) || (extension < 2 || extension >5))
{
     Message = "The email address is not valid. Please check it.";
     alert (Message);
     return false;
}

if (AtPos == -1 || StopPos <= AtPos)
{
     Message = "The email address is not valid. Please check it.";
     alert (Message);
     return false;
}

if (ErrorFlag > 0)
{
    alert (ErrMessage);
}
else
{
    document.yacht.action="process_form.php?ReservationID=" + ResID;
    document.yacht.submit();
}
}


function change()
{

   if (document.yacht.member.value=='Yes')
   {
      document.yacht.clientnumber.disabled=false;
   }
   else
   {
      document.yacht.clientnumber.disabled=true;
   }
}



