<!--
	function launchWin(url,w,h,scroll)
	{
		window.open(url,'openWin',"toolbar=no,width=" + w + ",height=" + h + ",left=100,top=100,status=no,menubar=no,location=no,scrollbars=" + scroll + ",resize=no");
	}

	function toggleVisible( whichLayer )
	{
		var elem, vis;
		
		if( document.getElementById ) // this is the way the standards work
			elem = document.getElementById( whichLayer );
		else if( document.all ) // this is the way old msie versions work
			elem = document.all[whichLayer];
		else if( document.layers ) // this is the way nn4 works
			elem = document.layers[whichLayer];
		
		vis = elem.style;
		// if the style.display value is blank we try to figure it out here
		if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
			vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		
		vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	}	

	function confirmDel(item)
	{
		if (confirm("Are you sure you want to delete this " + item + "?"))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function imgToggle(imgName,imgFile)
	{
		if (document.images)
		{
			document[imgName].src = imgFile;
		}
	}

	//verify that combo index is not '0'
	function checkIndex(form)
	{
		if (form.variations.departmentID.selectedIndex == 0)
		{
			alert('Please choose a department.');
			return false;
		}
	}

	//verify correct quantity in input field
	function checkQty(field)
	{
		var valid = "0123456789";
		var ok = "yes";
		var temp;
		for (var i=0; i<field.value.length; i++)
		{
			temp=""+field.value.substring(i,i+1);
			if(valid.indexOf(temp)=="-1")ok="no";
		}
		if(ok=="no")
		{
			alert("Please enter a valid number in the quantity box.");
			field.focus();
			return false;
		}
	}

	//verify if search field blank when focus is taken off
	function checkSearch(field,searchterm)
	{
		if (field.value == "")
		{
			field.value = searchterm;
		}
	}
	
	function retrieveDetails()
	{
		var form = document.customerform;	
		var valid = true;		
		
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)))
		{
			valid = false;
			alert ('Please ensure you have entered a valid email address.');
		}
		else if (form.password.value == "")
		{
			valid = false;
			alert ('Please ensure you have entered a password.');
		}
		
		if (valid)
		{
			showCustomerDetails(form.email.value, form.password.value);
		}
	}
	
	var xmlHttp;
	
	function showCustomerDetails(email, pwd)
	{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request");
			return;
		} 
		var url="get_customerdetails.asp";
		url=url+"?email=" + email;
		url=url+"&password=" + pwd;
		url=url+"&sid=" + Math.random();
		xmlHttp.onreadystatechange = stateChangedCustomerDetails;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);		
	}
		
	function stateChangedCustomerDetails() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			var outputText = xmlHttp.responseText; 
			var arrText = outputText.split("[SEPARATOR]");
			var form = document.customerform;			

			form.action.value = arrText[0];
			document.getElementById("div_message").innerHTML = arrText[1];
			form.customerID.value = arrText[2];
			form.companyname.value = arrText[3]; 
			form.position.value = arrText[4]; 
			form.d_firstname.value = arrText[5]; 
			form.d_surname.value = arrText[6]; 
			form.d_address.value = arrText[7]; 
			form.d_suburb.value = arrText[8]; 
			form.d_state.value = arrText[9]; 
			form.d_postcode.value = arrText[10]; 
			form.d_country.value = arrText[11]; 
			form.d_phone.value = arrText[12]; 
		}
	}	

	function GetXmlHttpObject()
	{ 
		var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp	
	}	
//-->
