function MM_validateForm() { //v4.0
  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=MM_findObj(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') {
        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 (val<min || max<val) 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('\n'+errors);
  document.MM_returnValue = (errors == '');
}

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.01
  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_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

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_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);

function MM_showHideLayers() { //v3.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; }
}

function openBrWindow(theURL,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
features = 'width='+w+',height='+h+',top='+wint+',left='+winl+',scrollbars=yes'
win = window.open(theURL, '', features)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function submitMyForm() {
	window.document.newAccountForm.submit();
}

function setForm(varFormValue) {
	document.modifyBagForm.doAction.value=varFormValue;
	document.modifyBagForm.submit();
}	

function removeItem(intID) {
	document.modifyBagForm.doAction.value='remove'
	document.modifyBagForm.remove.value=''+intID+''
	document.modifyBagForm.submit();
}

function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}


function swapMovie(moviesource){
	//alert(myBrowser);
	if (myBrowser == 'NN') {
		//document.net_load_qts.visibility = "hide";
		document.net_load_qts.load(moviesource, 150);
		//document.net_load_qts.visibility = "show";
		// works if this alert is here, setTimeout will have the same effect
		setTimeout('pause;',1500000000);
	} else {
		parent.load_qts.location = moviesource;
	}
}	

function pause() {
	// function doesn't do anything, but is called from above by the setTimeout function
	return false;
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v4.0
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}

function openZoomWin(imgURL) {

	if (document.all) {
		var windowW = 480;
		var windowH = 600;
		var windowX = Math.ceil((window.screen.width  - windowW) / 2);
		var windowY = Math.ceil((window.screen.height - windowH) / 2);

		winZoomPic = window.open(imgURL, "", "toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no");
		winZoomPic.resizeTo(windowW, windowH);
		winZoomPic.moveTo(windowX, windowY);
	} else {
		winZoomPic = window.open(imgURL, "", "width=480,height=600,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no");
	}

}

function validateForm(formName) {
	var boolOK;
	var strError;
	var antal;
	boolOK = true;
	strError = '';
	if (formName.size.options[formName.size.selectedIndex].text==''){
		boolOK = false;
		strError = strError + '\nYou have to select a size.';
	}
	if (formName.color.options[formName.color.selectedIndex].text==''){
		boolOK = false;
		strError = strError + '\nYou have to select a color.';
	}
	antal=parseInt(formName.Qty.value)
	if (isNaN(antal)){
		boolOK = false;
		antal=1;
		strError = strError + '\nQuantity is not correct.';
	} else {
		if (antal < 1) {
			boolOK=false;
			antal = 1;
			strError = strError + '\nQuantity must be more than 0.';
		}
	}
	if (boolOK==false){
		alert(strError);
	}
	formName.Qty.value=antal;
	return boolOK;
}

function submitForm() {
	if (validateForm(window.document.addProducts2Bag)){
		window.document.addProducts2Bag.submit();
	}
}

function cancelOrder(orderID){
	var message = '\nYou are about to cancel your order.\n\nAre you sure you wish to continue?'
	if (confirm(message))
		document.location.replace('cancel_order.asp?bagID='+orderID+'');
}
