function Binq(type)
{
	//if(!loaded)
	//return;
	if(readCookie('classname') != 'tracker')
		createCookie('classname','tracker', 1);
	
	switch(type)
	  {

	  case 'BOL':
			document.QuikTrak.binq.value="Bill of Lading";
			break;
		case 'Pro':
			document.QuikTrak.binq.value="Pro Number";
			break;
		case 'PO':
			document.QuikTrak.binq.value="Purchase Order";
			break;
		case 'Pickup':
			document.QuikTrak.binq.value="Pickup Number";
			break;
		case 'Trans':
			document.QuikTrak.binq.value="InTranShipments";
			document.QuikTrak.submit();
			break;
		case 'Delv':
			document.QuikTrak.binq.value="DelvShipments";
			document.QuikTrak.submit();
			break;
		case 'PS':
			document.QuikTrak.binq.value="PickupSalesman";
			document.QuikTrak.submit();
			break;
		
		default:
			break;
	}//switch
	
	if(document.QuikTrak.Bill.value.length	> 0) document.QuikTrak.submit();
	else document.QuikTrak.Bill.focus();
}

function validateMultiTrakForm(){
	var docObj = document.MultiTrak;

	var val1 = docObj.bill1;
	var val2 = docObj.bill2;
	var val3 = docObj.bill3;
	var val4 = docObj.bill4;

	if(val1.value == "" && val2.value == "" && val3.value == "" && val4.value == ""){
		alert("Please enter atleast one pro-number.");
		return false;
	}else{
		if(checkForSpecialChars(val1.value)){

			alert("Spaces and following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |)");
			val1.focus();
			val1.select();
			return false;
		}
		if(checkForSpecialChars(val2.value)){
			alert("Spaces and following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |)");
			val2.focus();
			val2.select();
			return false;
		}
		if(checkForSpecialChars(val3.value)){

			alert("Spaces and following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |)");
			val3.focus();
			val3.select();
			return false;
		}
		if(checkForSpecialChars(val4.value)){

			alert("Spaces and following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |)");
			val4.focus();
			val4.select();
			return false;
		}
	}
	return true;
}

function checkForSpecialChars(val){

	var charsInBag = " ?'^:,}][{)+=\|";
	flag = 0;
	for(var i=0;i < val.length;i++){
		
		for(var j=0;j < charsInBag.length;j++){
			if(val.charAt(i) == charsInBag.charAt(j)){
				flag = 1;
			}
		}
	}
	if(flag == 1)
	{
		return true;
	}else{
		return false;
	}
}

function checkIsSpecial(val){

	var charsInBag = "?'^:,}][{)+=\|";
	flag = 0;
	for(var i=0;i < val.length;i++){
		
		for(var j=0;j < charsInBag.length;j++){
			if(val.charAt(i) == charsInBag.charAt(j)){
				flag = 1;
			}
		}
	}
	if(flag == 1)
	{
		return true;
	}else{
		return false;
	}
}

function changeText2(){
		
	var userInput = document.getElementById('binq').value;
	document.getElementById('tracker_opt').innerHTML = userInput;
	document.getElementById('tracktxt').focus();

}
function checkpro(){

		var val1 = document.getElementById('tracktxt');
		if(document.getElementById('tracktxt').value == '')
		{
			alert("Please enter value in text box");
			document.getElementById('tracktxt').focus();
			return false;
		}else{
			if(checkIsSpecial(val1.value)){
				alert("Following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |)");
				val1.focus();
				val1.select();
				return false;
			}
		}
		return true;
}
	
/* pod.php */

function PodForm_Validator(theForm)
{
	var msg = '';
	var name = theForm.name;
	var pronumber = theForm.pronumber;
	var coname = theForm.coname;
	var email = theForm.email;
	var splCharMsgErrMsg = "Spaces and following special characters are not allowed:\n( ? ^ : , } ] [ { ) ' + = \ |) for ";
	if(name.value.length < 1)
	{
			msg += "Name required!!!\n";
	}else{
		if(checkForSpecialChars(name.value)){
			msg += splCharMsgErrMsg;
			msg += "name.\n";
		}
	}

	if(pronumber.value.length < 1)
	{
			msg += "ProNumber required!!!\n";
	}else{
		if(checkForSpecialChars(pronumber.value)){
			msg += splCharMsgErrMsg;
			msg += "pro-number.\n";
		}
	}
	if(coname.value.length < 1)
	{
		msg += "Company Name required!!!\n";
	}

	if(email.value.length < 1)
	{
			msg += "Email Address required!!!\n";
	}else{
		if(checkForSpecialChars(email.value)){
			msg += splCharMsgErrMsg;
			msg += "Email Address.\n";
		}
	}

	if(theForm.fax.value.length < 1)
	{
			msg += "Fax Number required!!!\n";
	}

	if(msg != ""){
		alert("Errors:\n"+msg);
		return false;
	}else{
		return true;
	}
}