<!--

document.write('<LINK REL=stylesheet HREF="/css/styles-hidden.css">');

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


 
function customScripts() {

MM_preloadImages('/images/interface/bn-home-o.gif','/images/interface/bn-charters-o.gif','/images/interface/bn-clubhouse-o.gif','/images/interface/bn-corporate-o.gif','/images/interface/bn-fleet-o.gif','/images/interface/bn-instruction-o.gif','/images/interface/bn-membership-o.gif','/images/interface/bn-news-o.gif','/images/interface/bn-racing-o.gif');

}

//this function checks user login privileges and displays the appropriate clubhouse menu

function clubhouseMenuRevised(userAccess) {
	if (userAccess == 3) { //placeholder test for login dectection - viewing privileges for Members
	document.write('<a href="/clubhouse/overview.asp"><img class="qm-is qm-ia" src="/images/interface/bn-clubhouse.gif" alt="clubhouse" width="81" height="27" border="0" /></a><div class="qmc_sub5"><a href="/clubhouse/login.asp">Login</a><a href="/clubhouse/findsailingpartners.asp">Find Sailing Partners</a><a href="/clubhouse/onlineforums.asp">Online Forums</a><a href="/clubhouse/crewlists.asp">Crew Lists</a><a href="/clubhouse/members-overview.asp">Members</a><div><a href="/clubhouse/members-myprofile.asp">My Profile</a><a href="/clubhouse/members-reference.asp">Reference</a><a href="/clubhouse/members-cruiseitinerary.asp">Cruise Itinerary</a></div><a href="/clubhouse/students-overview.asp">Students</a><div><a href="/clubhouse/students-lts.asp">Learn To Sail</a><a href="/clubhouse/students-adv.asp">Advanced</a><a href="/clubhouse/students-cruising.asp">Cruising Course</a></div><a href="/clubhouse/links.asp">Links</a><a href="/cruisingguide/index.html">Cruising Guide</a><a href="/clubhouse/photocontest.asp">Photo Contest</a><a href="/clubhouse/todaysconditions.asp">Todays Conditions</a></div>');	
	}
	else if (userAccess == 1) { //placeholder test for login dectection - viewing privileges for Students
	document.write('<a href="/clubhouse/overview.asp"><img class="qm-is qm-ia" src="/images/interface/bn-clubhouse.gif" alt="clubhouse" width="81" height="27" border="0" /></a><div class="qmc_sub5"><a href="/clubhouse/login.asp">Login</a><a href="/clubhouse/findsailingpartners.asp">Find Sailing Partners</a><a href="/clubhouse/onlineforums.asp">Online Forums</a><a href="/clubhouse/crewlists.asp">Crew Lists</a><a href="/clubhouse/members-overview.asp">Members</a><a href="/clubhouse/students-overview.asp">Students</a><div><a href="/clubhouse/students-myprofile.asp">My Profile</a><a href="/clubhouse/students-lts.asp">Learn To Sail</a><a href="/clubhouse/students-adv.asp">Advanced</a><a href="/clubhouse/students-cruising.asp">Cruising Course</a></div><a href="/clubhouse/links.asp">Links</a><a href="/cruisingguide/index.html">Cruising Guide</a><a href="/clubhouse/photocontest.asp">Photo Contest</a><a href="/clubhouse/todaysconditions.asp">Todays Conditions</a></div>');		
	}
	else if (userAccess == 2) { //placeholder test for login dectection - viewing privileges for Student Members
	document.write('<a href="/clubhouse/overview.asp"><img class="qm-is qm-ia" src="/images/interface/bn-clubhouse.gif" alt="clubhouse" width="81" height="27" border="0" /></a><div class="qmc_sub5"><a href="/clubhouse/login.asp">Login</a><a href="/clubhouse/findsailingpartners.asp">Find Sailing Partners</a><a href="/clubhouse/onlineforums.asp">Online Forums</a><a href="/clubhouse/crewlists.asp">Crew Lists</a><a href="/clubhouse/members-overview.asp">Members</a><a href="/clubhouse/students-overview.asp">Students</a><div><a href="/clubhouse/students-myprofile.asp">My Profile</a><a href="/clubhouse/students-lts.asp">Learn To Sail</a><a href="/clubhouse/students-adv.asp">Advanced</a><a href="/clubhouse/students-cruising.asp">Cruising Course</a></div><a href="/clubhouse/links.asp">Links</a><a href="/cruisingguide/index.html">Cruising Guide</a><a href="/clubhouse/photocontest.asp">Photo Contest</a><a href="/clubhouse/todaysconditions.asp">Todays Conditions</a></div>');			
	}
	else { //no login detected or ecommerce login
	document.write('<a href="/clubhouse/overview.asp"><img class="qm-is qm-ia" src="/images/interface/bn-clubhouse.gif" alt="clubhouse" width="81" height="27" border="0" /></a><div class="qmc_sub5"><a href="/clubhouse/login.asp">Login</a><a href="/clubhouse/findsailingpartners.asp">Find Sailing Partners</a><a href="/clubhouse/onlineforums.asp">Online Forums</a><a href="/clubhouse/crewlists.asp">Crew Lists</a><a href="/clubhouse/members-overview.asp">Members</a><a href="/clubhouse/students-overview.asp">Students</a><a href="/clubhouse/links.asp">Links</a><a href="/cruisingguide/index.html">Cruising Guide</a><a href="/clubhouse/photocontest.asp">Photo Contest</a><a href="/clubhouse/todaysconditions.asp">Todays Conditions</a></div>');	
	}


}

//this is the OLD function checks user login privileges and displays the appropriate clubhouse menu

function clubhouseMenu(userAccess) {
	if (userAccess == 3) { //placeholder test for login dectection - viewing privileges for Members
	document.write("<a href='/clubhouse/overview.asp'><img src='/images/interface/bn-clubhouse.gif' alt='clubhouse' width='81' height='27' border='0' name='menu9' id='menu9'  onmouseover='showMenu(event)' onMouseOut='hideMenu(event)' /></a>");	
	}
	else if (userAccess == 1) { //placeholder test for login dectection - viewing privileges for Students
	document.write("<a href='/clubhouse/overview.asp'><img src='/images/interface/bn-clubhouse.gif' alt='clubhouse' width='81' height='27' border='0' name='menu10' id='menu10'  onmouseover='showMenu(event)' onMouseOut='hideMenu(event)' /></a>");	
	}
	else if (userAccess == 2) { //placeholder test for login dectection - viewing privileges for Student Members
	document.write("<a href='/clubhouse/overview.asp'><img src='/images/interface/bn-clubhouse.gif' alt='clubhouse' width='81' height='27' border='0' name='menu11' id='menu11'  onmouseover='showMenu(event)' onMouseOut='hideMenu(event)' /></a>");	
	}
	else { //no login detected or ecommerce login
	document.write("<a href='/clubhouse/overview.asp'><img src='/images/interface/bn-clubhouse.gif' alt='clubhouse' width='81' height='27' border='0' name='menu6' id='menu6'  onmouseover='showMenu(event)' onMouseOut='hideMenu(event)' /></a>");	
	}


}

function displayHeader() {
if (window.location.href.indexOf('instruction') != -1) {
	document.write("<img src='/images/interface/header_instruction.gif' alt='Instruction' width='610' height='95' />");
} else if (window.location.href.indexOf('membership') != -1) {
	document.write("<img src='/images/interface/header_membership.gif' alt='Membership' width='610' height='95' />");
} else if (window.location.href.indexOf('shoppingcart') != -1) {
	document.write("<img src='/images/interface/header_generic.jpg' alt='' width='610' height='95' />");
} else if (window.location.href.indexOf('about') != -1) {
	document.write("<img src='/images/interface/header_aboutus.gif' alt='About Us' width='610' height='95' />");
} else if (window.location.href.indexOf('charters') != -1) {
	document.write("<img src='/images/interface/header_charters.gif' alt='Charters' width='610' height='95' />");
} else if (window.location.href.indexOf('corporate') != -1) {
	document.write("<img src='/images/interface/header_corporate.gif' alt='Corporate Events' width='610' height='95' />");
} else if (window.location.href.indexOf('clubhouse') != -1) {
	document.write("<img src='/images/interface/header_clubhouse.gif' alt='Clubhouse' width='610' height='95' />");
} else if (window.location.href.indexOf('fleet') != -1) {
	document.write("<img src='/images/interface/header_thefleet.gif' alt='The Fleet' width='610' height='95' />");
} else if (window.location.href.indexOf('news') != -1) {
	document.write("<img src='/images/interface/header_news.gif' alt='News and Events' width='610' height='95' />");
} else if (window.location.href.indexOf('racing') != -1) {
	document.write("<img src='/images/interface/header_racing.gif' alt='Racing' width='610' height='95' />");
} else if (window.location.href.indexOf('giftcertificate') != -1) {
	document.write("<img src='/images/interface/header_gift.gif' alt='Give the Gift of Sailing' width='610' height='95' />");
} else {
	document.write("<img src='/images/interface/header_generic.jpg' alt='' width='610' height='95' />");
}
}


// the following builds the array for the homepage slideshow
    var imgArray = new Array();
            imgArray[1-1] = "/images/slideshow/homepic4.jpg";
            imgArray[2-1] = "/images/slideshow/homepic5.jpg";
            imgArray[3-1] = "/images/slideshow/homepic1.jpg";
            imgArray[4-1] = "/images/slideshow/bavaria.gif";
            imgArray[5-1] = "/images/slideshow/closereach.gif";
            imgArray[6-1] = "/images/slideshow/dbwdaniel.jpg";
            imgArray[7-1] = "/images/slideshow/francoisteach.jpg";
            imgArray[8-1] = "/images/slideshow/glissade.jpg";
            imgArray[9-1] = "/images/slideshow/ltspeter.jpg";
            imgArray[10-1] = "/images/slideshow/melissa.jpg";
            imgArray[11-1] = "/images/slideshow/racing.jpg";
            imgArray[12-1] = "/images/slideshow/raft.jpg";
            imgArray[13-1] = "/images/slideshow/riverboat.jpg";
            imgArray[14-1] = "/images/slideshow/sunset.jpg";
			imgArray[15-1] = "/images/slideshow/homepic2.jpg";
        var index = 0;
    function changeImg(what) {
        if (index >= imgArray.length) index=0;
        what.src = imgArray[index];
        index++;
    }


// the following generates a random photo to start the homepage slideshow
function showPhoto(){
var homePhoto = new Array() 

homePhoto[0] = '/images/slideshow/homepic4.jpg'
homePhoto[1] = '/images/slideshow/homepic5.jpg'
homePhoto[2] = '/images/slideshow/homepic1.jpg'
homePhoto[3] = '/images/slideshow/bavaria.gif'
homePhoto[4] = '/images/slideshow/closereach.gif'
homePhoto[5] = '/images/slideshow/dbwdaniel.jpg'
homePhoto[6] = '/images/slideshow/francoisteach.jpg'
homePhoto[7] = '/images/slideshow/glissade.jpg'
homePhoto[8] = '/images/slideshow/ltspeter.jpg'
homePhoto[9] = '/images/slideshow/melissa.jpg'
homePhoto[10] = '/images/slideshow/racing.jpg'
homePhoto[11] = '/images/slideshow/raft.jpg'
homePhoto[12] = '/images/slideshow/riverboat.jpg'
homePhoto[13] = '/images/slideshow/sunset.jpg'
homePhoto[14] = '/images/slideshow/homepic2.jpg'

var j = 0
var p = homePhoto.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = homePhoto[i]
}
var whichPhoto = Math.round(Math.random()*(p-1));

document.write('<img border="0" width="243" height="287" alt="Click to cycle images" style="cursor:hand;" onClick="changeImg(this)"src="'+homePhoto[whichPhoto]+'">');
}

// the following hides/displays the gift recipient table on the billinginfo page

function showGift(x){ 

var theRegion=eval("document.getElementById(x)");
theRegion.style.display="block";		 
} 

function hideGift(x){ 

var theRegion=eval("document.getElementById(x)");
theRegion.style.display="none";			
 
} 



function openPassword () {
passwordWin  = window.open("change-password.asp","passwordWin","width=300,height=100");	
}


function validateBillingInfo()
{
    var error_string = "";
    // check the first name field
    if (window.document.form1.FirstName.value == "")
    {
        error_string += "You must enter your first name.\n";
    }

    // check the last name field
    if (window.document.form1.LastName.value == "")
    {
        error_string += "You must enter your last name.\n";
    }


// check the address field
    if (window.document.form1.Address1.value == "")
    {
        error_string += "You must enter your address.\n";
    }

// check the city field
    if (window.document.form1.City.value == "")
    {
        error_string += "You must enter your city.\n";
    }
	
// check the state field
    if (window.document.form1.State.value == "")
    {
        error_string += "You must enter your state.\n";
    }

// check the zip field
    if (window.document.form1.Zip.value == "")
    {
        error_string += "You must enter your zip code.\n";
    }


// check the phone field
    if (window.document.form1.HomePhone.value == "")
    {
        error_string += "You must enter your home phone number.\n";
    }

// check the email field
    if (window.document.form1.Email.value == "")
    {
        error_string += "You must enter a valid email address.\n";
    }
	
// check the name on card field
    if (window.document.form1.NameOnCard.value == "")
    {
        error_string += "You must enter the name on the credit card.\n";
    }

// check the card type field
    if (window.document.form1.CardType.value == "")
    {
        error_string += "You must enter a card type.\n";
    }
	
// check the card number field
    if (window.document.form1.CardNumber.value == "")
    {
        error_string += "You must enter a card number.\n";
    }	
	
// check the AVS number field
    if (window.document.form1.AVSNumber.value == "")
    {
        error_string += "You must enter an AVS number.\n";
    }	
	
// check the Exp date field
    if (window.document.form1.ExpDate.value == "")
    {
        error_string += "You must enter an expiration date.\n";
    }	
	
	
// check mailing info if it is a gift and should be sent to recipient
	if (window.document.form1.mailgifts[1].checked)
	{
	
// check recipient name field	
	if (window.document.form1.FirstNameGift.value == "")
    {
        error_string += "You must enter the gift recipient's first name.\n";
    }
    // check the last name field
    if (window.document.form1.LastNameGift.value == "")
    {
        error_string += "You must enter the gift recipient's last name.\n";
    }


// check the address field
    if (window.document.form1.Address1Gift.value == "")
    {
        error_string += "You must enter the gift recipient's address.\n";
    }

// check the city field
    if (window.document.form1.CityGift.value == "")
    {
        error_string += "You must enter the gift recipient's city.\n";
    }
	
// check the state field
    if (window.document.form1.StateGift.value == "")
    {
        error_string += "You must enter the gift recipient's state.\n";
    }

// check the zip field
    if (window.document.form1.ZipGift.value == "")
    {
        error_string += "You must enter the gift recipient's zip code.\n";
    }
	
	
	}
	
	

    if (error_string == "")
    {
	   document.form1.submit();
	   return true;
	   
    } else {
        error_string = "We found the following ommisions in your registration: \n\n" + error_string;
        alert(error_string);
        return false;
    } 
}



//-->