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, iID) {
	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;
		if (document.getElementById("theDescription")) {
			document.getElementById("theDescription").innerHTML=document.getElementById("descriptionText"+iID).innerHTML;
		}
		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();
	}	
	
// checks existence of ID in markup
function checkID(idName) {
	if (document.getElementById(idName)) {
		return true;
	} else {
		return false;
	}
}

// focuses on element
function focusMe(idName) {
	if (checkID(idName)){
		document.getElementById(idName).focus();
	}
}

function srcMe(idName,iSrc) {
	 if (checkID(idName)) {
	 	if (iSrc == "") {
			hideMe(idName);
		} else {
		 	document.getElementById(idName).src=iSrc;
		}
	}
}

// submit an element
function submitMe(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).submit();
	}
}

// submit an element
function resetMe(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).reset();
	}
}

// clears an element
function clearMe(t,val) {
	if (t.value==val) {
		t.value = '';
	}
}

// gives INNERHTML to an element
function htmlMe(idName,h) {
	if (checkID(idName)) {
		document.getElementById(idName).innerHTML = h;
	}
}

// gives INNERHTML to an element
function hrefMe(idName,h) {
	if (checkID(idName)) {
		document.getElementById(idName).href = h;
	}
}


// shows a html block
function getHTML(idName) {
	if (checkID(idName)) {
		return document.getElementById(idName).innerHTML;
	}
}

// shows a html block
function getValue(idName) {
	if (checkID(idName)) {
		return document.getElementById(idName).value;
	}
}

// shows a html block
function showMe(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).style.display="block";
	}
}

// shows a html block
function showMeFull(idName,displayWay) {
	if (checkID(idName)) {
		document.getElementById(idName).style.display=displayWay;
	}
}

// shows a html block
function showMe2(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).style.display="inline";
	}
}

// gives INNERHTML to an element
function htmlMe(idName,h) {
	if (checkID(idName)) {
		document.getElementById(idName).innerHTML = h;
	}
}

// shows a html block
function getValue(idName) {
	if (checkID(idName)) {
		return document.getElementById(idName).value;
	}
}


// shows a html block
function slipMe(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).style.display="inline";
	}
}

// hides a html block
function hideMe(idName) {
	if (checkID(idName)) {
		document.getElementById(idName).style.display="none";
	}
}

// changes a stylesheet class to a specified ID
function changeClass(idName,toClass) {
	if (checkID(idName)) {
		document.getElementById(idName).className=toClass;
	}
}

function goHere(u) {
	window.location.href=u;
}

var detectMacXFF;
var userAgent = navigator.userAgent.toLowerCase();
var dontCloseAlert = false;
var fProgress = "off";
if (userAgent.indexOf('firefox')!=-1) {
   detectMacXFF =  true; 
} else {
 detectMacXFF = false;
}

function showTableRow(idName)
{
 if (detectMacXFF) {
  displayWay = "table-row";
 } else {
  displayWay = "block";
 }

 showMeFull(idName,displayWay);
}

