function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function jumpMenuNewWin(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.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];}
}




/* Newsletter Sign Up Javascript */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please enter a valid email address.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid email address.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid email address.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid email address.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid email address.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid email address.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a valid email address.")
		    return false
		 }

 		 return true					
	}


function ValidateForm(){
	var emailID=document.signup.email

	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter a valid email address.")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	window.open('/newsletter_signup.asp?fslid=23&closebutton=true&email=' + emailID.value,'NEWSLETTER_SIGNUP','width=760,height=500,resizeable=yes,scrollbars=yes')
 }



var navSecure_url = '';
var navDomain_url = '';
var navQuery_ids = '';

var SHOWROOM = new menu('SHOWROOM',150, 'hNavMenu', '','hNavMenuItem', 'hNavMenuItemOver', 'images/more_arrow.gif');
var SHOWROOM1 = new menuItem('bayliner advantage','why_bayliner.asp');
var SHOWROOM2 = new menuItem('media coverage','media_coverage.asp');
var SHOWROOM3 = new menuItem('contact a dealer','contact_a_dealer.asp');
var SHOWROOM4 = new menuItem('get a quote','request_a_quote.asp');
SHOWROOM.addItem(SHOWROOM1, SHOWROOM2,SHOWROOM3,SHOWROOM4);
SHOWROOM.Build(0);

var YOURBAYLINER = new menu('YOURBAYLINER',150, 'hNavMenu', '','hNavMenuItem', 'hNavMenuItemOver');
var YOURBAYLINER1 = new menuItem('articles','articles.asp');
var YOURBAYLINER2 = new menuItem('boating links','boating_links.asp');
var YOURBAYLINER3 = new menuItem('screen savers','screensavers.asp');
var YOURBAYLINER4 = new menuItem('wallpaper','wallpapers.asp');
var YOURBAYLINER5 = new menuItem('videos','video.asp');
var YOURBAYLINER6 = new menuItem('owners manuals','manuals.asp?type=owners');
var YOURBAYLINER7 = new menuItem('parts manuals','manuals.asp?type=parts');
var YOURBAYLINER8 = new menuItem('boating safety','safety.asp');
YOURBAYLINER.addItem(YOURBAYLINER1,YOURBAYLINER2,YOURBAYLINER3,YOURBAYLINER4,YOURBAYLINER5,YOURBAYLINER6,YOURBAYLINER7,YOURBAYLINER8);
YOURBAYLINER.Build(0);

var ONLINESTORE = new menu('ONLINESTORE',150, 'hNavMenu', '','hNavMenuItem', 'hNavMenuItemOver');
var ONLINESTORE1 = new menuItem('retail store','http://www.baylinerstore.com/store', '', '', '',true,'new', 'resizable=yes,scrollbars=yes,status=yes,menubar=yes,width=760,height=500');
var ONLINESTORE2 = new menuItem('dealers only','http://www.baylinerdealer.com', '', '', '',true,'new', 'resizable=yes,scrollbars=yes,status=yes,menubar=yes,width=760,height=500');
ONLINESTORE.addItem(ONLINESTORE1,ONLINESTORE2);
ONLINESTORE.Build(0);


/* PNG Fix */


function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);

