// 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()
{

var Titulos = new Array('CLC Reference Number',
                      'Name',
                      '',
                      'Date of Birth: Day',
                      'Date of Birth: Month',
                      'Date of Birth: Year',
                      'Passport number',
                      'Nationality',
                      'Date of travel: Day',
                      'Date of travel: Month',
                      'Date of travel: Year');

var ErrMessage='Please fill in the field: \n';
var ErrorFlag=0;
for (t=0;t<Titulos.length;t++)
{
    if (document.yacht[t].name=='email')
    {
        continue;
    }

    if (document.yacht[t].value=='')
    {
       ErrMessage=ErrMessage+Titulos[t]+"\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";
    document.yacht.submit();
}
}

function Check_Field()
{
var Titulos = new Array('Name',
                      'Address',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      '',
                      'Where:',
                      'Nš of Cabins Required');

var ErrMessage='Please fill in the field: \n';
var ErrorFlag=0;
for (t=0;t<Titulos.length;t++)
{
    if (document.yacht[t].name=='email')
    {
        continue;
    }

    if ((document.yacht[t].name=='whenday')  ||
       (document.yacht[t].name=='whenmonth')  ||
       (document.yacht[t].name=='whenyear')  ||
       (document.yacht[t].name=='whenday02') ||
       (document.yacht[t].name=='whenmonth02') ||
       (document.yacht[t].name=='whenyear02') ||
       (document.yacht[t].name=='whenday03') ||
       (document.yacht[t].name=='whenmonth03') ||
       (document.yacht[t].name=='whenyear03'))
    {
       continue;
    }

    if (document.yacht[t].name=='telephone')
    {

        if (document.yacht[t].value=='')
        {
           ErrMessage=ErrMessage+"Telephone \n";
           ErrorFlag=1;
           continue;
        }
    }

    if (document.yacht[t].value=='')
    {
       ErrMessage=ErrMessage+Titulos[t]+"\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 (document.yacht.tipo.value!='Holiday_Request_Form')
{
   if ((document.yacht.member.value=='Yes') && (document.yacht.clientnumber.value==''))
   {
     alert("Please insert the Member Number");
     return false;
   }
}

if ((longitud == (StopPos+1)) || (extension < 2 || extension >5))
{
     Message = "The email address is not valid. Please check it.";
     alert (Message);
     return false;
}

var Fecha=0;
var Fecha1=0;
var Err_fecha=0;

if ((document.yacht.whenday.value=='')  ||
    (document.yacht.whenmonth.value=='')  ||
    (document.yacht.whenyear.value==''))
{
  alert('The first choice of when is not valid. Please check it');
  return false;
}

if ((document.yacht.whenday02.value=='')  ||
    (document.yacht.whenmonth02.value=='')  ||
    (document.yacht.whenyear02.value==''))
{
  alert('The second choice of when is not valid. Please check it');
   return false;
}

if ((document.yacht.whenday03.value=='')  ||
    (document.yacht.whenmonth03.value=='')  ||
    (document.yacht.whenyear03.value==''))
{
   alert('The third choice of when is not valid. Please check it');
   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_form2.php";
    document.yacht.submit();
}
}

function change()
{

   if (document.yacht.member.value=='Yes')
   {
      document.yacht.clientnumber.disabled=false;
   }
   else
   {
      document.yacht.clientnumber.disabled=true;
   }
}

//-->
