//////////////////////////////////////////////
// fireworks generic pre-load images script //
//////////////////////////////////////////////
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 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_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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

////////////////////////////////////////
// pre-load images (default.asp page) //
////////////////////////////////////////
function newImage(arg)
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages()
{
	if (document.images && (preloadFlag == true))
	{
		for (var i=0; i<changeImages.arguments.length; i+=2)
		{
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadImages()
{
	if (document.images)
	{
		MBMMBM_03_over = newImage("images/MBMMBM_03_over.gif");
		MBMMBM_03_over006 = newImage("images/MBMMBM_03_over-06.gif");
		MBMMBM_03_over008 = newImage("images/MBMMBM_03_over-08.gif");
		MBMMBM_06_over = newImage("images/MBMMBM_06_over.gif");

		preloadFlag = true;
	}
}

///////////////////////////////////////////
// pre-load images (productNavStart.asp) //
///////////////////////////////////////////
function loadProductNavStartImages()
{
	MM_preloadImages('../images/product_nav/bibs2.gif','../images/product_nav/mats2.gif','../images/product_nav/new2.gif','../images/product_nav/smocks2.gif','../images/product_nav/formum2.gif','../images/product_nav/specials2.gif','../images/product_nav/aboutus2.gif','../images/product_nav/contact2.gif');
}

/////////////////////
// open new window //
/////////////////////
function NewWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}

///////////////////////////
// validate contact form //
///////////////////////////
function validateContactForm()
{
	var strname = document.contactForm.name.value;
	var straddress = document.contactForm.address.value;
	var stremail = document.contactForm.email.value;
	var strCaptcha = document.contactForm.strCAPTCHA.value;

	if (strname == "")
	{
		alert("Please enter your Name.")
		document.contactForm.name.focus();
		return false;
	}
	if (straddress == "")
	{
		alert("Please enter your Address.")
		document.contactForm.address.focus();
		return false;
	}
	if (stremail == "")
	{
		alert("Please enter your Email.")
		document.contactForm.email.focus();
		return false;
	}
	if (strCaptcha == "")
	{
		alert("Please make sure you have enter the correct security characters.")
		document.contactForm.strCAPTCHA.focus();
		return false;
	}
	else
	{
		return true;
	}
}

/////////////////////////////////
// validate tell a friend form //
/////////////////////////////////
function validateTellAFriend()
{
	var stryourname = document.tellafriend.yourname.value;
	var stryouremail = document.tellafriend.youremail.value;
	var strfriendsemail = document.tellafriend.friendsemail.value;
	var stryourmessage = document.tellafriend.yourmessage.value;
	var strCaptcha = document.tellafriend.captcha.value;

	if (stryourname == "")
	{
		alert("Please enter your Name.")
		document.tellafriend.yourname.focus();
		return false;
	}
	if (stryouremail == "")
	{
		alert("Please enter your Email.")
		document.tellafriend.youremail.focus();
		return false;
	}
	if (strfriendsemail == "")
	{
		alert("Please enter your friend's Email.")
		document.tellafriend.friendsemail.focus();
		return false;
	}
	if (stryourmessage == "")
	{
		alert("Please enter your Message.")
		document.tellafriend.yourmessage.focus();
		return false;
	}
	if (strCaptcha != "nappy")
	{
		alert("Please make sure you have enter the word nappy.")
		document.tellafriend.captcha.focus();
		return false;
	}
	else
	{
		return true;
	}
}

////////////////////////
// validate club form //
////////////////////////
function invalid()
{
	if (document.clubForm.T1.value.length < 2)
	{
		alert("Please enter your Full Name.");
		document.clubForm.T1.focus();
		return false;
	}
	if (document.clubForm.T2.value.length < 6)
	{
		alert("Please enter your Email.");
		document.clubForm.T2.focus();
		return false;
	}
	if (document.clubForm.T3.value.length < 2)
	{
		alert("Please enter your Country.");
		document.clubForm.T3.focus();
		return false;
	}
	
	return true;
}