function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
 if (selObj.options[selObj.selectedIndex].value!='') {
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
	}
}


function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}


function SearchSubmit (form) 
{
	
	MM_openBrWindow('search.php3?srcstr='+form.srcstr.value,'search','status=yes,scrollbars=yes,width=320,height=450');

}

function verifyEmail(form) {
checkEmail = form.email.value

if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) 
{alert("You have entered an invalid email address. Please try again.");

} 

else {
form.sendform.value="gosubleft";
form.action="";
form.submit();
}

}


function cancelemail()
{
    if (window.confirm('Cancelling this message will permanently discard its contents.\nAre you sure you want to do this?')) {
        self.close();    }
}

function checkemail(email2chk)
{
if ((email2chk.indexOf('@') < 0) || ((email2chk.charAt(email2chk.length-4) != '.') && (email2chk.charAt(email2chk.length-3) != '.'))) 
{
   return (false);
} 
else return (true);
}


function submitemail(form) {
form.sendform.value="go";
form.action="";
form.submit();
}


function verify2friend(form) {

if ( checkemail(form.toemail.value) && checkemail(form.fromemail.value) )
{
    submitemail(form)
;
}
else
{
  if (!checkemail(form.toemail.value))
  {
     alert ("Your friend's address is invalid. Please try again.");
     form.toemail.focus();
  }
  else
  {
  if (!checkemail(form.fromemail.value))
  {
     alert ("Your email address is invalid. Please try again.");
     form.fromemail.focus();}
  }
}


}

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.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 shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
			} else {
				filter(("img"+id),'imgout');	
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}

function cancel_order(url, ref) {
	
	var message = "This will cancel your order and delete all items from your shopping cart.\n\nDo you wish to proceed?";

	var return_value = confirm(message);

	if (return_value == true)
	{
		if (ref==1)
		{
		window.location.href=url+"?do=cancel";
		}
		else
		{
		MM_openBrWindow(url+'?do=cancel','EQMcart','status=yes,scrollbars=yes,width=450,height=400');
		}
	} else {

	}
}

function submit_order(url, ref) {
	
	var message = "You are about to submit your order.\n\n You will be asked for your address and payment preferences on the next page,\n as well as any special observations like T-shirt sizes or vinyl color where applicable.\n\nPress 'OK' to proceed or 'Cancel' to change your order before proceeding.";

	var return_value = confirm(message);

	if (return_value == true) {
		if (ref==1)
		{
		window.location.href=url;
		}
		else
		{
		MM_openBrWindow(url,'EQMcart','status=yes,scrollbars=yes,width=450,height=400');
		}
	} else {

	}
}

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
//var iframeids=["EQMscart"]
var iframeids=["EQMscart"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller


function refreshcartframe ()
{
if (!opener.document.getElementById('EQMscart'))
{
	window.opener.location.reload();	
}
else
{
	opener.document.getElementById('EQMscart').src='cartstat.php3';
}
}