function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  LvlWin=window.open(theURL,winName,features);
  //LvlWin=window.open(theURL,winName);
 LvlWin.focus()
  }
function MM_findObj(n, d) { //v4.01 used in validateForm and in Admin MenuScript
  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_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_ConfirmAlert(sURL,Info)
	{
	if (confirm(Info) == true) 
		{
		window.location.href = sURL;
		}
	}
function MM_addNewDoc(sURL,sUrlNew,Info)
	{
	if (confirm(Info) == true) 
		{
		window.location.href = sURL;
		}else
		{
		window.location.href = sUrlNew;
		}
	}
var gObj,gHex,timer;
function NN_tr_start(obj,hex,type){
	var isMoz = parseInt(navigator.appVersion) >= 5 && navigator.appName == 'Netscape' ? true : false;
	if (type == 'fade' && !isMoz){gHex=hex;gObj=obj;NN_tr_fadeIn();
	} else { obj.style.backgroundColor=hex;}
	obj.style.cursor='hand';
}

function NN_tr_fadeIn(){
	var cntr=0,pObj=gObj.style.backgroundColor;
	var r = parseInt(gHex.substring(1,3),16),g = parseInt(gHex.substring(3,5),16), b = parseInt(gHex.substring(5,7),16);
	var rr = parseInt(pObj.substring(1,3),16),gg = parseInt(pObj.substring(3,5),16),bb = parseInt(pObj.substring(5,7),16);
		if (r!=rr){if(rr<r){rr++;}else{rr--;}}else{cntr++;}
		if (g!=gg){if(gg<g){gg++;}else{gg--;}}else{cntr++;}
		if (b!=bb){if(bb<b){bb++;}else{bb--;}}else{cntr++;}
	rr=rr.toString(16);gg=gg.toString(16);bb=bb.toString(16);
	rr=rr.length==1?'0'+rr:rr;gg=gg.length==1?'0'+gg:gg;bb=bb.length==1?'0'+bb:bb;
	gObj.style.backgroundColor='#'+rr.toUpperCase()+gg.toUpperCase()+bb.toUpperCase();
	if (cntr!=3){timer=setTimeout('NN_tr_fadeIn()',1);}
}

function NN_tr_reset(obj,hex){
	obj.style.backgroundColor=hex;clearTimeout(timer);
}
function winUpdate() {
  window.opener.location.href = window.opener.location.href;
  window.close();
}

function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.form1.file.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=355px; dialogHeight:120px; center:yes;";
      window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
    }
    else
    {
      window.open('<% = barref %>&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//  When the value in a textfield is changed, notice the onchange="RecUpdate('<%= varRecID %>')"
//  on each of the textfields,  the value of the Record ID associated with that field
//  is passed to the RecUpdate function. First the value is surounded with 2 asterisks e.g. *6*
//  This is so that *1* can be distinguished from *10*, *11* etc.
function RecUpdate(RecID){
var ThisID = "*" + (RecID) + "*";
if (document.forms["formcartupd"].elements["hidRecIDs"].value === ""){	// If the hidden field is empty
document.forms["formcartupd"].elements["hidRecIDs"].value = (ThisID);	// Store the value in the hidden field (hidRecIDs) as it is.
}
if (document.forms["formcartupd"].elements["hidRecIDs"].value != ""){
// If the hidden field isn't empty
var str = document.forms["formcartupd"].elements["hidRecIDs"].value;	// Store the contents of the hidden field in the variable str
var pos = str.indexOf(ThisID);				// Search str to see if this RecID is allready in it.
if (pos == -1) {							// If the position returned is -1 it isn't allredy in there,  
document.forms["formcartupd"].elements["hidRecIDs"].value = document.forms["formcartupd"].elements["hidRecIDs"].value + ", " + (ThisID);  
} 											// so add ", " and this ID to what is already in hidRecIDs 
}											// to create a list like this *2*, *5*, *8* etc.	
}
function ShopLinkUpd(shoppingCartCount,shoppingCartDel){
	if (shoppingCartCount+1-shoppingCartDel){
		var shoptoplink = document.getElementById("shoptopdiv");
		shoptoplink.style.visibility= 'visible'
		}
}

