function lowernavOn(idName) {
	if (document.getElementById("lowernav_"+idName)) {
		document.getElementById("lowernav_"+idName).style.display="block";
	}
}

function lowernavOff(idName) {
	if (document.getElementById("lowernav_"+idName)) {
		document.getElementById("lowernav_"+idName).style.display="none";
	}
}

function navOn(idName) {
	document.getElementById(idName).className="over";
	lowernavOn(idName);
}

function navOff(idName,hubName) {
	for (n = 0; n < navArray.length; n++) {
		if (navArray[n]!=hubName) {
			document.getElementById(navArray[n]).className="";
			lowernavOff(idName);
		}
	}
}

function showPic(picID,hubID,secID,ck) {
	if ((document.getElementById("thePic")) && (document.getElementById("pic"+picID)) && (document.getElementById("curPic"))) {
//		picSize = picSize.replace("^","'");
//		picSize = picSize.replace('$','"');
		var curPic = document.getElementById("curPic").value;
		document.getElementById("thePic").src="graphics/products/"+picID+".jpg?a="+ck;
// 		document.getElementById("theSize").innerHTML=picSize;
		document.getElementById("idStyle").style.width=document.getElementById("thePic").width;
		document.getElementById("theStyle").innerHTML="<b>Style:</b> "+picID;
		document.getElementById("theMagnify").href="javascript:magnifyMe('"+hubID+"','"+secID+"','"+picID+"')";
		document.getElementById("theMagnify2").href="javascript:magnifyMe('"+hubID+"','"+secID+"','"+picID+"')";
		document.getElementById("pic"+curPic).className="miniBox";
		document.getElementById("pic"+picID).className="miniBox noBox";
		document.getElementById("curPic").value=picID;
	}
}

function magnifyMe(hubID,secID,picID) {
 pop = 	window.open("magnify.asp?hubID="+hubID+"&sectionID="+secID+"&picID="+picID,'magnify','width=500,height=500,top=100,left=250,toolbar=no,scrollbars=no,resizable=no,location=no,menubar=no,directories=no,status=no,copyhistory=no');
}


	function validateEmail(email) {
		invalidChars = " /:,;";
		if (email == "") {
			return false;
		}
		// checks for bad characters
		for (i = 0; i < invalidChars.length; i++) {
			badChar = invalidChars.charAt(i);
			if (email.indexOf(badChar,0) != -1) {
				return false;
			}
		}
		//finds position of @ symbol
		atPos = email.indexOf("@",1);
		if (atPos == -1) {
			return false;
		}
		if (email.indexOf("@",atPos + 1) != -1) {
			return false;
		}
		//finds position of . in email
		periodPos = email.indexOf(".",atPos);
		if (periodPos == -1) {
			return false;
		}
		if (periodPos+3 > email.length) {
			return false;
		}
		atSplit = email.split("@");
		beforeAt = atSplit[0];
		afterAt = atSplit[1];
		if (atSplit[0].length == 1) { 
			return false;
		}
		periodSplit = atSplit[1].split(".");
		beforePeriod = periodSplit[0];
		if (beforePeriod.length <=1) {
			return false;
		}
		return true;
	}
	
	function checkSubscribe() {
		if (!validateEmail(document.getElementById("email").value)) {
			alert("Please enter a proper email address");
			document.getElementById("email").value="";
			document.getElementById("email").focus();
			return false;
		} else {
			return true;
		}
	}
	function Popup(myUrl,popType) {
		switch (popType) {
			case 0:   // special offer
		  	pop = window.open(myUrl,'winName','width=400,height=275,top=200,left=300,toolbar=no,scrollbars=no,resizable=no,location=no,menubar=no,directories=no,status=no,copyhistory=no');
			break
			case 1:   // e-coupon
		  	pop = window.open(myUrl,'winName','width=650,height=350,top=200,left=500,toolbar=no,scrollbars=no,resizable=no,location=no,menubar=no,directories=no,status=no,copyhistory=no');
			break
			case 2:   // admin view
		  	pop = window.open(myUrl,'winName','width=500,height=500,top=200,left=500,toolbar=no,scrollbars=no,resizable=no,location=no,menubar=no,directories=no,status=no,copyhistory=no');
			break
			case 3:   // admin view
		  	pop = window.open(myUrl,'winName','width=500,height=500,top=200,left=500,toolbar=no,scrollbars=no,resizable=no,location=no,menubar=yes,directories=no,status=no,copyhistory=no');
			break
		}
		pop.focus();
	}	