	/* common client side js */
	
	/* loads all external links in a new window [eg. makes the inline use of target="_blank" obsolete] */
/*
	function setTarget()
	{
		var strDomain = document.domain + '/sale';
		var arrLinks = document.links

		for (var i=0; i < arrLinks.length; i++) 
		{		
			if(arrLinks[i].href.match("javascript")== null)
			{
				if (arrLinks[i].href.match(strDomain)== null)
				{
					arrLinks[i].target = "_blank";
				}
			}
		}
	}
	
	window.onload = function()
	{
		setTarget();
	}
*/
	function orderSaveAndPrint(objForm,orderStatus)
	{
		// create a blank window to submit to
		pop = window.open('about:blank', "mail", "width=515,height=570,toolbar=0,status=1,resizable=1,scrollbars=1,left=10,top=10,screenY=10,screenX=10");

		if(orderStatus == 2)
		{
			objForm.OrderStatus.value = 2 // in progress
			objForm.f.value = "print2"
		}
		if(orderStatus == 3)
		{
			objForm.OrderStatus.value = 3 // charged
			objForm.f.value = "print3"
		}
		if(orderStatus == 4 )
		{
			objForm.OrderStatus.value = 4 // shipped
			objForm.f.value = "print4"
		}

		objForm.target = "mail"
		objForm.submit();
		
		pop.focus();
		
		document.location.reload()
	}
	
	

	/* pops a general window and sets focus. requires a valid url (may be relative)*/
	function openPopup(url)
	{
		pop = window.open(url, "pop", "width=450,height=550,toolbar=1,status=1,resizable=0,scrollbars=1,left=10,top=10,screenY=10,screenX=10");
		pop.focus();
	}

	/* enlarge image by obj ref */
	function ImageViewer(obj)
	{
		// the ref obj is scaled down, so we need to assign it to new js imgage object in order to get the real sizes
		var objImage = new Image()
			objImage.src = obj.src


//		var win = window.open('',"ImageViewer", "width=" + objImage.width +",height=" + objImage.height + ",toolbar=0,status=0,resizable=yes,scrollbars=0,left=10,top=10,screenY=10,screenX=10");
		var win = window.open('',"ImageViewer", "width=10,height=10,toolbar=0,status=0,resizable=yes,scrollbars=0,left=10,top=10,screenY=10,screenX=10");
			win.document.write("<html>\n<head>\n<title>DeMask</title>\n<meta http-equiv='imagetoolbar' content='no'>\n");
			win.document.write("<script language='JavaScript'>function resize()\n{\n"
						+"	var winHeight = document.body.clientHeight;\n"
						+"	var winWidth = document.body.clientWidth;\n"
//						+"	window.resizeBy(document.pic.width - winWidth, document.pic.height - winHeight);\n"
						+"	window.resizeBy(document.pic.width, document.pic.height);\n"
						+"	window.focus(); return false;\n"
						+"}\n</script>");
			win.document.write("<link href='/sale/css/default.css' rel='stylesheet' type='text/css' />\n</head>\n");
			win.document.write("<body onload='resize()' >\n<img onMouseOver='resize()' name='pic' src=" + obj.src +" onClick='self.close()' name='viewer' style='cursor:pointer' alt='close'>\n</body>\n</html>");
			win.document.write("\n<!-- \npowered by www.iosis.nl. \n\nImages owned by DeMask contact info@demask.com if you like to use any images from this site \n-->");
			
			win.document.close();
			win.focus();
	}

	function ImageViewer2(name)
	{
		pop = window.open("?run=image&popup=1&name=" + name, "pop", "width=200,height=200,resizable=0,status=no,scrollbars=no,left=10,top=10,screenY=10,screenX=10");
		pop.focus();
	}
	/* sets defails statusline */
	window.status = "DeMask Sale Shop"
