// common.js

///////////// phone number validation //////////

	var digits = "0123456789";

	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 10;

	function isInteger(s)
	{   
	 	var i;
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		// All characters are numbers.
		return true;
	}

	function trim(s)
	{
	   	var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not a whitespace, append to returnString.
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if (c != " ") returnString += c;
		}
		return returnString;
	}
	function stripCharsInBag(s, bag)
	{
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function checkInternationalPhone(strPhone){

		var bracket=3
		strPhone=trim(strPhone)
		if(strPhone.indexOf("+")>1) return false
		if(strPhone.indexOf("-")!=-1)bracket=bracket+1
		if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
		var brchr=strPhone.indexOf("(")
		if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
		if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
		s=stripCharsInBag(strPhone,validWorldPhoneChars);
		return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);

	}

	
///////// email validation  /////////

function validate(form_id,email) {

	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = email;  
	   if(reg.test(address) == false) {
	      return false;
	   }else {
	      return true;
	}
		
}


// function : CheckFormLogInNewCall()
// Called   : From logeninnewcall.php
// desc     : validate form


function CheckFormLogInNewCall()
{

	var weight_new = document.getElementsByName('weight[]');
	var zipPostal_new = document.getElementsByName('zipPostal[]');
	var isEmpty = true;
	var isEmptyZipPostal  = true;
	var zipNotValid = false;
	
	var now = new Date();
	document.getElementById('submitDateTimeLogIn').value = now.toLocaleString();


	var rdbtn = document.getElementsByName('newCallUserType');
	isChecked = false;

	for(var j=0;j < rdbtn.length; j++){
		if(rdbtn[j].checked == true)
		{
			var rdV = rdbtn[j].value;
			isChecked = true;		
		}
	}

	if(isChecked == false){
		alert('please select Shipper/Consignee/Neither');
		return false;
	}

	if(document.logedinnewcallForm.elements.newCallUserType.value == ""){
		alert('Please select who you are');	
		return false;
	}

	var weight_new = document.getElementsByName('weight[]');
	var zipPostal_new = document.getElementsByName('zipPostal[]');


	if(document.logedinnewcallForm.ContactName.value.length<1)
	{
		alert("Contact Name required");
		document.logedinnewcallForm.ContactName.focus();
		return false;
	}
	
	if(document.logedinnewcallForm.ContactEmail.value.length > 0)
	{

		if(validate('newCallFrm',document.logedinnewcallForm.ContactEmail.value) == false)
		{
			alert("Contact email is not valid");
			document.logedinnewcallForm.ContactEmail.focus();
			return false;
		}

	}

	if(document.logedinnewcallForm.ContactPhone.value.length<1)
	{
		alert("Contact Phone number required");
		document.logedinnewcallForm.ContactPhone.focus();
		return false;
	}
	if (checkInternationalPhone(document.logedinnewcallForm.ContactPhone.value)==false){
		alert("Please Enter a Valid Phone Number");
		document.logedinnewcallForm.ContactPhone.value="";
		document.logedinnewcallForm.ContactPhone.focus();
		return false;
	}	

	if(document.logedinnewcallForm.ShipperName.value.length<1)
	{
		alert("Shipper Name required");
		document.logedinnewcallForm.ShipperName.focus();
		return false;
	}
	if(document.logedinnewcallForm.ShipperName.value.length > 1){
		
		if(!isSpecial(document.logedinnewcallForm.ShipperName.value)){
			alert("Invalid Shipper Name.");
			document.logedinnewcallForm.ShipperName.focus();
			return false;
		}
	}

	if(document.logedinnewcallForm.ShipperContactName.value.length<1)
	{
		alert("Shipper contact name required");
		document.logedinnewcallForm.ShipperContactName.focus();
		return false;
	}

	if(document.logedinnewcallForm.ShipperAddress.value.length<1)
	{
		alert("Shipper address required");
		document.logedinnewcallForm.ShipperAddress.focus();
		return false;
	}
	if(document.logedinnewcallForm.ShipperCity.value.length<1)
	{
		alert("Shipper city required");
		document.logedinnewcallForm.ShipperCity.focus();
		return false;
	}
	if(rdV == "consignee" || rdV == "neither")
	{
		if(document.getElementById('stSelBx').value == "")
		{
			alert("Shipper state required");
			document.getElementById('stSelBx').focus();
			return false;
		}
	}

	if(rdV == "shipper")
	{
		if(document.getElementById('stInpBx').value == "")
		{
			alert("Shipper state required");
			document.getElementById('stInpBx').focus();
			return false;
		}
	}

	if(document.logedinnewcallForm.ShipperZip.value.length<1)
	{
		alert("Shipper zip code required");
		document.logedinnewcallForm.ShipperZip.focus();
		return false;
	}

	if(document.logedinnewcallForm.ShipperZip.value.length > 1){

		if(!isZip(document.logedinnewcallForm.ShipperZip.value)){
			alert("Zip/Postal code for pick up info is not valid (e.g ##### or @#@#@# or @#@ #@#).\n# = Number.\n@ = Any Alphanumeric character.)");
			document.logedinnewcallForm.ShipperZip.focus();
			return false;
		}	
	}
	
	if(document.logedinnewcallForm.ShipperTotalShipements.value.length<1)
	{
		
		alert("Shipper total shipments required");
		document.logedinnewcallForm.ShipperTotalShipements.focus();
		return false;
	}
	
	for (var i=0;i < zipPostal_new.length;i++){

			if (zipPostal_new[i].value != ""){
				isEmptyZipPostal = false;
				break;
			}

	}
	if (isEmptyZipPostal){
		alert("Please enter at least one Zip/Postal for delivery info.");
		zipPostal_new[0].focus();
		return false;
	}
	if(!isEmptyZipPostal){

		for (var i=0;i < zipPostal_new.length;i++){

			if(!isZip(zipPostal_new[i].value)){
				zipNotValid = true;	
			}	
		}		
	}
	if(zipNotValid == true){

		alert("Zip/Postal code for delivery info is not valid (e.g ##### or @#@#@# or @#@ #@#).\n# = Number.\n@ = Any Alphanumeric character.)");
		return false;
	}
	for (var i=0;i<weight_new.length;i++){

		if (weight_new[i].value != ""){
			isEmpty = false;
			break;
		}
	}
	if (isEmpty){
		alert("Please enter at least one weight for delivery info.");
		weight_new[0].focus();
		return false;
	}

	if(document.logedinnewcallForm.PickUpDate.value == "" && document.getElementById('PickUpDate01').value == "")	
	{
		alert("PickUpDate required");
		document.logedinnewcallForm.PickUpDate.focus();
		return false;
	}

	if(document.logedinnewcallForm.ReadyTime1.value == "" && document.getElementById('ReadyTime').value == "")	
	{
		alert("Ready time required");
		document.logedinnewcallForm.ReadyTime1.focus();
		return false;
	}

	if(document.logedinnewcallForm.DockClosingTime1.value == "")
	{
		alert("Dock closing time required");
		document.logedinnewcallForm.DockClosingTime1.focus();
		return false;
	}
	
}

// function : CheckFormNewCall()
// Called   : From newcall.php
// desc     : validate form


function CheckFormNewCall()
{
	
	var weight_new = document.getElementsByName('weight[]');
	var zipPostal_new = document.getElementsByName('zipPostal[]');
	var isEmpty = true;
	var isEmptyZipPostal  = true;
	var zipNotValid = false;
	var now = new Date();
	document.getElementById('submitDateTime').value = now.toLocaleString();

	if(document.newCallForm.ContactName.value.length<1)
	{
		alert("Contact Name required");
		document.newCallForm.ContactName.focus();
		return false;
	}
	if(document.newCallForm.ContactName.value.length > 1){
		
		if(!isSpecial(document.newCallForm.ContactName.value)){
			alert("Invalid Name.");
			document.newCallForm.ContactName.focus();
			return false;
		}
	}
	
	if(document.newCallForm.ContactEmail.value.length > 0)
	{

		if(validate('newCallFrm',document.newCallForm.ContactEmail.value) == false)
		{
			alert("Contact email is not valid");
			document.newCallForm.ContactEmail.focus();
			return false;
		}

	}

	if(document.newCallForm.ContactPhone.value.length<1)
	{
		alert("Contact Phone number required");
		document.newCallForm.ContactPhone.focus();
		return false;
	}
	if (checkInternationalPhone(document.newCallForm.ContactPhone.value)==false){
		alert("Please Enter a Valid Phone Number");
		document.newCallForm.ContactPhone.value="";
		document.newCallForm.ContactPhone.focus();
		return false;
	}	

	if(document.newCallForm.ShipperName.value.length<1)
	{
		alert("Shipper Name required");
		document.newCallForm.ShipperName.focus();
		return false;
	}

	if(document.newCallForm.ShipperName.value.length > 1){
		
		if(!isSpecial(document.newCallForm.ShipperName.value)){
			alert("Invalid Shipper Name.");
			document.newCallForm.ShipperName.focus();
			return false;
		}
	}

	if(document.newCallForm.ShipperContactName.value.length<1)
	{
		alert("Shipper contact name required");
		document.newCallForm.ShipperContactName.focus();
		return false;
	}

	if(document.newCallForm.ShipperContactName.value.length > 1){
		
		if(!isSpecial(document.newCallForm.ShipperContactName.value)){
			alert("Invalid Shipper Contact Name.");
			document.newCallForm.ShipperContactName.focus();
			return false;
		}
	}
	if(document.newCallForm.ShipperAddress.value.length<1)
	{
		alert("Shipper address required");
		document.newCallForm.ShipperAddress.focus();
		return false;
	}
	if(document.newCallForm.ShipperCity.value.length<1)
	{
		alert("Shipper city required");
		document.newCallForm.ShipperCity.focus();
		return false;
	}
	if(document.newCallForm.ShipperState.value.length<1)
	{
		alert("Shipper state required");
		document.newCallForm.ShipperState.focus();
		return false;
	}
	
	
	if(document.newCallForm.ShipperZip.value.length<1)
	{
		alert("Shipper zip code required");
		document.newCallForm.ShipperZip.focus();
		return false;
	}
	
	if(document.newCallForm.ShipperZip.value.length > 1){
	
		if(!isZip(document.newCallForm.ShipperZip.value)){
			alert("Zip/Postal code for pick up info is not valid (e.g ##### or @#@#@# or @#@ #@#).\n# = Number.\n@ = Any Alphanumeric character.");
			document.newCallForm.ShipperZip.focus();
			return false;
		}	
	}
	
	if(document.newCallForm.ShipperTotalShipements.value.length<1)
	{
		
		alert("Shipper total shipments required");
		document.newCallForm.ShipperTotalShipements.focus();
		return false;
	}

	
	for (var i=0;i < zipPostal_new.length;i++){

			if (zipPostal_new[i].value != ""){
				isEmptyZipPostal = false;
				break;
			}

	}

	if (isEmptyZipPostal){
		alert("Please enter at least one Zip/Postal for delivery info.");
		zipPostal_new[0].focus();
		return false;
	}

	if(!isEmptyZipPostal){

		for (var i=0;i < zipPostal_new.length;i++){

			if(!isZip(zipPostal_new[i].value)){
				zipNotValid = true;	
			}	
		}		
	}
	if(zipNotValid == true){

		alert("Zip/Postal code for delivery info is not valid (e.g ##### or @#@#@# or @#@ #@#).\n# = Number.\n@ = Any Alphanumeric character.)");
		return false;
	}

	for (var i=0;i<weight_new.length;i++){

		if (weight_new[i].value != ""){
			isEmpty = false;
			break;
		}
	}
	if (isEmpty){
		alert("Please enter at least one weight for delivery info.");
		weight_new[0].focus();
		return false;
	}
	
	if(document.newCallForm.ContactEmail.value.length < 1)
	{
		alert("Email address required");
		document.newCallForm.ContactEmail.focus();
		return false;
	}
	if(document.getElementById('ReadyDate').value == "" && document.getElementById('PickUpDate01').value == "")
	{
		alert("Pickup Date required");
		document.getElementById('ReadyDate').focus();
		return false;
	}
	if(document.newCallForm.ReadyTime.value.length<1 && document.newCallForm.ReadyTime1.value == "")
	{
		alert("Ready Time required");
		document.newCallForm.ReadyTime.focus();
		return false;
	}
	if(document.newCallForm.DockClosingTime1.value == "")
	{
		alert("Dock closing time required");
		document.newCallForm.DockClosingTime1.focus();
		return false;
	}
	
}


function isSpecial(s){

		return isCharsInBag(s, "[{!@#$%^&*()':;?");
}
function isCharsInBag (s, bag) {
	var i;
	// Search through string's characters one by one.
	// If character is in bag, append to returnString.
	for (i = 0; i < s.length; i++)
	{
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		for(var j=0;j< bag.length;j++){
			if(c == bag[j]){
				return false;
			}
		}
	}
	return true;
}
	
function fillPics(value){
	document.getElementById('pics').value = value;
}
function isZip(s)
{
	reZip = new RegExp(/(^\d{5}$)|(^[A-Za-z]{1}\d{1}[A-Za-z]{1} *\d{1}[A-Za-z]{1}\d{1}$)/);
	
	if (!reZip.test(s)) {
		return false;
	}else{
		return true;
	}

}

function insertHtml1(value)
{

		var j;
		divObj1 = document.getElementById('addDivs1');
		divObj1.style.display = 'block';
		divObj1.innerHTML = '';
		for(var i=0;i < value;i++)
		{
			//divObj1.innerHTML += "<div><input type='text' name=''></div>";
			if(i == '0'){
				j=0;
			}else if(i == '1'){
				j=4;
			}else if(i == '2'){
				j=9;
			}else if(i == '3'){
				j=14;
			}else if(i == '4'){
				j=19;
			}else if(i == '5'){
				j=24;
			}else if(i == '6'){
				j=29;
			}else if(i == '7'){
				j=34;
			}else if(i == '8'){
				j=39;
			}else if(i == '9'){
				j=44;
			}
			var tabInd;
			tabInd1 = 15+((j+0)+i);
			tabInd2 = 15+((j+1)+i);
			tabInd3 = 15+((j+2)+i);
			tabInd4 = 15+((j+3)+i);
			tabInd5 = 15+((j+4)+i);


			divObj1.innerHTML += '<div><div style="float:left;margin-top: 10px;"><label style="margin:10px 3px 0px 0px;">Consignee name:</label><br/><br/><input type="text" tabindex="'+tabInd1+'" size="15" name="consigneeName[]" id="consigneeName'+i+'" style="margin:0px 5px;border:1px solid #cccccc;height:20px;"></div></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:100px;margin:10px 3px 0px 0px;">Zip / Postal:<span style="color:red;font-weight:bold;">*</span></label><br/><br/><input type="text" tabindex="'+tabInd2+'" size="15" name="zipPostal[]" id="zipPostal'+i+'" style="margin:0px 5px;border:1px solid #cccccc;width:60px;height:20px;"></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:100px;margin:10px 3px 0px 0px;">Pcs:</label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="text" tabindex="'+tabInd3+'" size="15" name="pcs[]" id="pcs'+i+'" value="" style="margin:0px 5px;border:1px solid #cccccc;width:40px;height:20px;"></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:60px;margin:10px 3px 0px 0px;">Weight:<span style="color:red;font-weight:bold;">*</span></label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="text" tabindex="'+tabInd4+'" size="15" id="weight'+i+'" name="weight[]" style="margin:0px 5px;border:1px solid #cccccc;width:40px;height:20px;"></div><div style="float:left;margin-top: 10px;width:50px;"><label style="margin:10px 3px 0px 0px;">Hazardous:</label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="checkbox" tabindex="'+tabInd5+'" size="15" name="hazard[]" id="hazard'+i+'" style="margin:0px 5px;height:20px;"><br/></div><br/><br/><br/><br/><br/><br/>';
		}
}

function setTime(id){
		var now = new Date();
		var hours = now.getHours();
		var minutes = now.getMinutes();
		var seconds = now.getSeconds();
		var timeValue = "" + ((hours >12) ? hours -12 :hours);
		if (timeValue == "0") timeValue = 12;
		timeValue += ((minutes < 10) ? ":0" : ":") + minutes;

		timeValue += (hours >= 12) ? " PM" : " AM";
		document.getElementById(id).value = timeValue;	
}


// function : insertHtml2()
// Called   : From logededincall.php
// Desc     : Insert html box

function insertHtml2(value)
{

		var j;
		divObj1 = document.getElementById('addDivs2');
		divObj1.style.display = 'block';
		divObj1.innerHTML = '';
		for(var i=0;i < value;i++)
		{

			if(i == '0'){
				j=0;
			}else if(i == '1'){
				j=4;
			}else if(i == '2'){
				j=9;
			}else if(i == '3'){
				j=14;
			}else if(i == '4'){
				j=19;
			}else if(i == '5'){
				j=24;
			}else if(i == '6'){
				j=29;
			}else if(i == '7'){
				j=34;
			}else if(i == '8'){
				j=39;
			}else if(i == '9'){
				j=44;
			}
			var tabInd;
			tabInd1 = 15+((j+0)+i);
			tabInd2 = 15+((j+1)+i);
			tabInd3 = 15+((j+2)+i);
			tabInd4 = 15+((j+3)+i);
			tabInd5 = 15+((j+4)+i);


			consigneeValue = "";
			zipPostalValue = "";
			if(i ==0)
			{
				consigneeValue = " value='"+document.getElementById('consigneeNamehidd').value+"'";
				zipPostalValue = " value='"+document.getElementById('zipPostalhidd').value+"'";
			}
			divObj1.innerHTML += '<div><div style="float:left;margin-top: 10px;"><label style="margin:10px 3px 0px 0px;">Consignee name:</label><br/><br/><input type="text" tabindex="'+tabInd1+'" size="15" name="consigneeName[]" '+consigneeValue+' id="consigneeName'+i+'" style="margin:0px 5px;border:1px solid #cccccc;height:20px;"></div></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:100px;margin:10px 3px 0px 0px;">Zip / Postal:<span style="color:red;font-weight:bold;">*</span></label><br/><br/><input type="text" tabindex="'+tabInd2+'" size="15" name="zipPostal[]" id="zipPostal'+i+'" '+zipPostalValue+' style="margin:0px 5px;border:1px solid #cccccc;width:60px;height:20px;"></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:100px;margin:10px 3px 0px 0px;">Pcs:</label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="text" tabindex="'+tabInd3+'" size="15" name="pcs[]" id="pcs'+i+'" value="" style="margin:0px 5px;border:1px solid #cccccc;width:40px;height:20px;"></div><div style="float:left;margin-top: 10px;width:100px;"><label style="width:60px;margin:10px 3px 0px 0px;">Weight:<span style="color:red;font-weight:bold;">*</span></label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="text" tabindex="'+tabInd4+'" size="15" id="weight'+i+'" name="weight[]" style="margin:0px 5px;border:1px solid #cccccc;width:40px;height:20px;"></div><div style="float:left;margin-top: 10px;width:50px;"><label style="margin:10px 3px 0px 0px;">Hazardous:</label>&nbsp;&nbsp;&nbsp;<br/><br/><input type="checkbox" tabindex="'+tabInd5+'" size="15" name="hazard[]" id="hazard'+i+'" style="margin:0px 5px;height:20px;"><br/></div><br/><br/><br/><br/><br/><br/>';
		}
}

// function : stateDropDown()
// Called   : From getCustAddressById.php
// desc     : Get State drop down listing


function stateDropDown(value,name,cls,tabindex){

		var str="";
		var states = {'AB':'Alabama','AK':'Alaska','AZ':'Arizona','AR':'Arkansas','CA':'California','CO':'Colorado','CT':'Connecticut','DE':'Delaware','DC':'D.C.','FL':'Florida','GA':'Georgia','HI':'Hawaii','ID':'Idaho','IL':'Illinois','IN':'Indiana','IA':'Iowa','KS':'Kansas','KY':'Kentucky','LA':'Louisiana','ME':'Maine','MD':'Maryland','MA':'Massachusetts','MI':'Michigan','MN':'Minnesota','MS':'Mississippi','MO':'Missouri','MT':'Montana','NE':'Nebraska','NV':'Nevada','NH':'New Hampshire','NJ':'New Jersey','NM':'New Mexico','NY':'New York','NC':'North Carolina','ND':'North Dakota','OH':'Ohio','OK':'Oklahoma','OR':'Oregon','PA':'Pennsylvania','RI':'Rhode Island','SC':'South Carolina','SD':'South Dakota','TN':'Tennessee','TX':'Texas','UT':'Utah','VT':'Vermont','VA':'Virginia','WA':'Washington','WV':'West Virginia','WI':'Wisconsin','WY':'Wyoming','AB':'Alberta','BC':'British Columbia','MB':'Manitoba','NB':'New Brunswick','NF':'Newfoundland','NS':'Nova Scotia','NT':'Northwest Territory','ON':'Ontario','PE':'Price Edward Island','PQ':'Quebec','SK':'Saskatchewan','YT':'Yukon'};
	
		str = '<select name="'+name+'" class="'+cls+'" id="'+name+'" tabindex="'+tabindex+'"><option value="">Select</option>';
			for(key in states){
				if(key == value){
					str += '<option value="'+key+'" selected>'+states[key]+'</option>';
				}else{
					str += '<option value="'+key+'">'+states[key]+'</option>';
				}
			}
		str += '</select>';
	return str;
}

// function : setthis()
// Called   : From getCustAddressById.php
// desc     : Set the Customer address values to the BOL


function setthis(sname,address,city,state,zip,phone,bx,shipper_number){

	//if(bx == "shipper")
	switch(bx)
	{
		case 'shipper':
			window.opener.document.getElementById('shipper_name').value	= sname;
			window.opener.document.getElementById('shipper_address').value	= address;
			window.opener.document.getElementById('shipper_city').value	= city;
			window.opener.document.getElementById('stateSpan').innerHTML	= stateDropDown(state,"shipper_state","slct_new","");
			window.opener.document.getElementById('shipper_zip').value	= zip;
			window.opener.document.getElementById('shipper_phone').value	= phone;
			window.opener.document.getElementById('Shipper').checked	= true;
			window.opener.document.getElementById('Consignee').checked	= false;
			window.opener.document.getElementById('shipper_number').value	= shipper_number;
			window.opener.document.getElementById('saveShipper').style.display = 'none';
			break;
		case 'cons':
			window.opener.document.getElementById('cons_name').value	= sname;
			window.opener.document.getElementById('cons_address1').value	= address;
			window.opener.document.getElementById('cons_city').value	= city;
			window.opener.document.getElementById('conStateSpan').innerHTML	= stateDropDown(state,"cons_state","slct_new","");
			window.opener.document.getElementById('cons_zip').value	= zip;
			window.opener.document.getElementById('cons_phone').value	= phone;
 			window.opener.document.getElementById('Consignee').checked	= true;
 			window.opener.document.getElementById('Shipper').checked	= false;
			window.opener.document.getElementById('cons_number').value	= shipper_number;
			window.opener.document.getElementById('saveConsignee').style.display = 'none';
			break;
		default:	
			break;
	}
	
	window.close();
}