
function checkNum(rawVal, per){
	var intI;
	var numList;
	var checkNumFlag = true;
	rawVal = rawVal.toLowerCase();

	if(per == 1){
		numList = "0123456789.";
	}else if(per == -1){
		numList = "0123456789";
	}	
	for(intI=0; intI<rawVal.length; intI++){
		if(numList.indexOf(rawVal.charAt(intI),0) == -1){
			checkNumFlag = false;
		}
	}
	return checkNumFlag;
}
function checkPercentage(varPer){
	if(varPer.indexOf('.',0) != -1){
		if((varPer.substring(varPer.indexOf('.',0)+1, varPer.length)).length > 2){
			return true;
		}
		if(varPer > 100.00 || checkNum(varPer, 1) == false){
			return true;
		}
	}else if(varPer.indexOf('.',0) == -1){
		if(varPer > 100.00 || varPer.length > 3 || checkNum(varPer, -1) == false){
			return true;
		}
	}
	return false;
}
function checkRealNum(varNum){
	if(isNaN(varNum) == true || varNum.indexOf('-', 0) == 0 || varNum.indexOf('+', 0) == 0){ 
		return true;
	}
}
function CheckEmpty(tString){
	var Counter;
	var tempFlag;
	tempFlag = true;
			    
	for (Counter=0;Counter<tString.length;Counter++){
	if (tString.charAt(Counter) != " "){
		tempFlag = false;
		break;
	}
	}
	 if (tempFlag==true){
	return "true"; 
	}
	if (tempFlag==false){
	    return "false";
	}
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function newwin(page,name,w,h,scroll)
{
	lpos = (screen.width) ? (screen.width - w)/2 : 0;
	tpos = (screen.height) ? (screen.height - h)/2 : 0;
	settingie ='height='+h+',width='+w+',top='+tpos+',left='+lpos+',scrollbars';
	settingns ='height='+h+',width='+w+',top='+tpos+',left='+lpos+',scrollbars'
	if (document.all)
	{
		var NW = window.open(page,name,settingie);
		NW.termscon = self;
	}
	else
	{
		var NW = window.open(page,name,settingns);
		NW.termscon = self;
	}
}

function acknowladge(){
if ('<%=Request.Querystring("status")%>' == 'error'){
	alert('Sorry, the e-mail address you have entered does not correspond to a registered user.');
	return false;
}
if ('<%=Request.Querystring("status")%>' == 'sucess'){
	alert('An e-mail has now been sent to you with your details.');
	return false;
}
if ('<%=Request.Querystring("loginstatus")%>' == 'error'){
	alert('Sorry, the e-mail address and/or password you have entered does not correspond to a registered user. Please try again.');
	return false;
}
}
function draft(){
	if(CheckEmpty(document.forms[0].jobname.value) == "true"){
		alert("You must enter a job name")	
		document.forms[0].jobname.focus();
		return false;
	}
	if (confirm("Your quote request will be saved as draft but not sent. You can retrieve it from your Quotes and Orders list to finish it later.") == true){
		//alert(document.forms[0].B2.value)
		document.forms[0].B5.value="";	
		document.forms[0].B2.value="Save as Draft";	
		return true;
	}else{
		return false;
	}
}
function clearform(){
	if (confirm("Please confirm that you want to erase all the details you have entered.")){
		return true;
	}else{
		return false;
	}
}
function deleteform()
{
if (confirm("This will erase all the details you have already entered for this product and delete it if you have previously saved it as a draft.")){
	
	document.forms[0].B4.value="Close & Delete Form";
	//alert(document.forms[0].B4.value)
	return true}
else{
return false;}
}






function ENV()
{
document.forms[0].ENV.value="Outer Envelope";
return true
}


function BRE()
{

	document.forms[0].BRE.value="BRE";
	return true
}


function LHD()
{

	document.forms[0].LHD.value="Letterhead";
	return true
}


function LFT()
{

	document.forms[0].LFT.value="Leaflet";
	return true
}

function BCE()
{

	document.forms[0].BCE.value="Brochure";
	return true
}

function SIT()
{

	document.forms[0].SIT.value="Special Item";
	return true
}

function DPG()
{

	document.forms[0].DPG.value="Data Processing";
	return true
}

function deleteform1()

{
if (confirm("This will erase any details you have already entered for this item.")){
	document.forms[0].A2.value="Delete This Item";	
	return true}
else{
	return false;}
}


function closeform1()
{
if (confirm("This will erase all the details you have already entered for this product and delete it if you have previously saved it as a draft.")){
	
	document.forms[0].A4.value="Close & Delete Form";
	return true}
else{
return false;}
}
