//commonFuctions.....................
function isIntegerValue(theParam) {
	var theNumArray = new Array(0,1,2,3,4,5,6,7,8,9);
	var index = 0, j;
	if(theParam.charAt(0) == "+" || theParam.charAt(0) == "-")
		index = 1;
	for( ; index < theParam.length; index++) {
		var isValidFlag = false;
		for(j = 0; j < theNumArray.length; j++) {
			if(theParam.charAt(index) == theNumArray[j]) {
				isValidFlag = true;
				break;
				}
			}
		if(!isValidFlag)	
			return false;
		}	

		if (theParam < 0)
			{
		return false;
			}
  		var ValidChars = "1234567890.";
  		var Char;
  		var Text=theParam.value;
  		for (i = 0; i < theParam.length; i++) 
  		{ 
  		  Char = theParam.charAt(i); 
  		  if (ValidChars.indexOf(Char) == -1) 
  		  {
       
  		   return(false);
  		  }
  		}		
    return true;
	}
	
	
function isEmptyString(strValue) {
	if(((strValue == "") || (strValue.length == 0)))
		return true;
	return false;
	}

function trimString(strValue) {
	var chrSpace = " ";
	/*This section is for LEFT trimming of any string*/
	for(var i = 0; i < strValue.length; i++) {
		if(strValue.charAt(i) != chrSpace)
			break;
		}
	if(i != 0)
		strValue = strValue.substring(i,strValue.length);
	/*This section is for RIGHT trimming of any string*/
	for(i = (strValue.length-1); i >= 0; i--) {
		if(strValue.charAt(i) != chrSpace)
			break;
		}
	if(i != (strValue.length-1))
		strValue = strValue.substring(0,(i+1));
	return strValue;
	}	
	
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}
/********************************************************************************************************/	


//funnction for checking zip code
function checkZip(countrycode,zipval)
{
	if(countrycode	==	'US')
	{
		if(zipval.length!=5 && zipval.length!=10 )
		{
			alert ('Please enter valid zip value.\nCorrect format and length is like XXXXX or XXXXX-XXXX ie. 11111 or 22222-3333');
			return false;
		}
		
		var str
		str=""
		for(i=0;i<5;i++)
		{
		str=str+zipval.charAt(i)
		}
		if (!isIntegerValue(str))
		{	
			alert ('Please enter valid zip value.\nCorrect format and length is like XXXXX or XXXXX-XXXX ie. 11111 or 22222-3333');
			return false;
		}
		
		if (zipval.length==10)
		{
		
			var str1
			str1=""
			for(i=6;i<10;i++)
			{
				str1=str1+zipval.charAt(i)
			}
			var str2
			str2=""
			str2 = zipval.charAt(5)
			if (str2!='-' || !isIntegerValue(str1))
			{
				alert ('Please enter valid zip value.\nCorrect format and length is like XXXXX or XXXXX-XXXX ie. 11111 or 22222-3333');
				return false;
			}
		}
		
	}
	return true;
}




function showhidediv()
{
	
	document.orderform.bill_name.value		=	'';
	document.orderform.bill_lastName.value	=	'';
	document.orderform.address.value		=	'';
	document.orderform.countryCode.options[1].selected = true;	
	ShowState(document.orderform.countryCode.options[1].value,'billstate');
	document.orderform.city.value			=	'';
	document.orderform.zip.value			=	'';
	
	
	document.orderform.ShippingFirstName.value	=	'';
	document.orderform.ShippingLastName.value	=	'';
	document.orderform.shippingAddress.value	=	'';
	document.orderform.Copy_billing_Add[1].checked 	=	true;
	
	for (var i=0;i<=document.orderform.shippingCountryCode.options.length-1; i++ )
	{				
		if (document.orderform.shippingCountryCode.options[i].value==document.orderform.countryCode.value)
		{
			document.orderform.shippingCountryCode.options[i].selected=true;
			document.orderform.shippcountryCode.value	=	document.orderform.countryCode.value;			
			ShowState(document.orderform.shippingCountryCode.options[i].value,'shipstate');
		}				
	}	
	
	
	if(document.getElementById('reg_dlg').style.display=='none')
	{
		document.getElementById('reg_dlg').style.display = 'block';
	}
	else
	{
		document.getElementById('reg_dlg').style.display = 'none';
	}
	
}


function showhidedivforGuest()
{
	if(document.getElementById('reg_dlg').style.display=='none')
	{
		document.orderform.bill_name.value		=	'';
		document.orderform.bill_lastName.value	=	'';
		document.orderform.address.value		=	'';
		document.orderform.countryCode.options[0].selected = true;
		ShowState(document.orderform.countryCode.options[0].value,'billstate');
		document.orderform.city.value			=	'';
		document.orderform.zip.value			=	'';
		
		
		document.orderform.ShippingFirstName.value	=	'';
		document.orderform.ShippingLastName.value	=	'';
		document.orderform.shippingAddress.value	=	'';
		document.orderform.Copy_billing_Add[1].checked 	=	true;
		document.orderform.shippingCountryCode.options[0].selected = true;
		ShowState(document.orderform.shippingCountryCode.options[0].value,'shipstate');
		document.getElementById('reg_dlg').style.display = 'block';
	}
	//else
	//{
		//document.getElementById('reg_dlg').style.display = 'block';
	//}
	
}

/********************************************************************************************************/	
//checkthe Billing Info.....
function checkbilling()
{
	if(isEmptyString(trimString(document.orderform.bill_name.value)))
	{
		alert("Please Enter the Billing Name ");
		document.orderform.bill_name.select();
		document.orderform.bill_name.focus();
		return false;
	}
	if(isEmptyString(trimString(document.orderform.bill_lastName.value)))
	{
		alert("Please Enter the Billing LastName ");
		document.orderform.bill_lastName.select();
		document.orderform.bill_lastName.focus();
		return false;
	}
	if(isEmptyString(trimString(document.orderform.phone.value)))
	{
		alert("Please Enter the Phone ");
		document.orderform.phone.select();
		document.orderform.phone.focus();
		return false;
	}
	
	if(!guestemail())
	{
		return false;
	}
	
if(isEmptyString(trimString(document.orderform.phone.value)))
	{
		alert("Please Enter the Phone ");
		document.orderform.phone.select();
		document.orderform.phone.focus();
		return false;
	}
if(isEmptyString(trimString(document.orderform.address.value)))
	{
		alert("Please Enter the address");
		document.orderform.address.select();
		document.orderform.address.focus();
		return false;
	}

if(isEmptyString(trimString(document.orderform.countryCode.value)))
	{
		alert("Please Select Country");
		document.orderform.countryCode.focus();
		return false;
	}


if(isEmptyString(trimString(document.orderform.stateCode.value)))
	{
		alert("Please Select the State");
		document.orderform.stateCode.focus();
		return false;
	}
	
if(isEmptyString(trimString(document.orderform.city.value)))
	{
		alert("Please Enter The City");
		document.orderform.city.select();
		document.orderform.city.focus();
		 return false;
	}
	

if(isEmptyString(trimString(document.orderform.zip.value)))
	{
		alert("Please Enter The zip");
		document.orderform.zip.select();
		document.orderform.zip.focus();
		return false;
	}
	if(!checkZip(document.orderform.countryCode.value,document.orderform.zip.value))
	{
		document.orderform.zip.select();
		document.orderform.zip.focus();
		return false;
	}
	
	return true;
	
	
}

/********************************************************************************************************/	

//function for check sgipping
function checkshipping()
{
	
	if(isEmptyString(trimString(document.orderform.ShippingFirstName.value)))
	{
		alert("Please Enter the Shipping Name ");
		document.orderform.ShippingFirstName.select();
		document.orderform.ShippingFirstName.focus();
		return false;
	}
	if(isEmptyString(trimString(document.orderform.ShippingLastName.value)))
	{
		alert("Please Enter the shipping LastName ");
		document.orderform.ShippingLastName.select();
		document.orderform.ShippingLastName.focus();
		return false;
	}
	
if(isEmptyString(trimString(document.orderform.shippingAddress.value)))
	{
		alert("Please Enter the Shipping address");
		document.orderform.shippingAddress.select();
		document.orderform.shippingAddress.focus();
		return false;
	}

if(document.orderform.Copy_billing_Add[1].checked)
{
	if(isEmptyString(trimString(document.orderform.shippingCountryCode.value)))
		{
			alert("Please Select Shipping Country");
			document.orderform.shippingCountryCode.focus();
			return false;
		}

		if(isEmptyString(trimString(document.orderform.shippingStateCode.value)))
		{
			alert("Please Select the Shipping State");
			document.orderform.shippingStateCode.focus();
			return false;
		}
		
		if(isEmptyString(trimString(document.orderform.shippingCity.value)))
			{
				alert("Please Enter The Shipping City");
				document.orderform.shippingCity.select();
				document.orderform.shippingCity.focus();
				 return false;
			}
			
			if(isEmptyString(trimString(document.orderform.shippingZip.value)))
			{
				alert("Please Enter The Shipping zip");
				document.orderform.shippingZip.select();
				document.orderform.shippingZip.focus();
				return false;
			}
		
		if(!checkZip(document.orderform.shippingCountryCode.value,document.orderform.shippingZip.value))
		{
			document.orderform.shippingZip.select();
			document.orderform.shippingZip.focus();
		 	return false;
		}
		
}
	
	
if(isEmptyString(trimString(document.orderform.shippingCity.value)))
	{
		alert("Please Enter The shipping City");
		document.orderform.shippingCity.select();
		document.orderform.shippingCity.focus();
		 return false;
	}

if(isEmptyString(trimString(document.orderform.shippingZip.value)))
	{
		alert("Please Enter The Shipping zip");
		document.orderform.shippingZip.select();
		document.orderform.shippingZip.focus();
		return false;
	}
	if(!checkZip(document.orderform.shippingCountryCode.value,document.orderform.shippingZip.value))
	{
		document.orderform.shippingZip.select();
		document.orderform.shippingZip.focus();
		return false;
	}
	
	
	return true;
	
}





//function that called when form submitted
function validData(thisForm)
{
	if(isEmptyString(trimString(thisForm.name.value)))
	{
		alert("Please Enter the first name");
		thisForm.name.select();
		thisForm.name.focus();
		return false;
	}
	
if(isEmptyString(trimString(thisForm.lastName.value)))
	{
		alert("Please Enter the last name");
		thisForm.lastName.select();
		thisForm.lastName.focus();
		return false;
	}

if(isEmptyString(trimString(thisForm.phone.value)))
	{
		alert("Please Enter the phone");
		thisForm.phone.select();
		thisForm.phone.focus();
		return false;
	}
if(isEmptyString(trimString(thisForm.email.value)))
	{
		alert("Please Enter the email");
		thisForm.email.select();
		thisForm.email.focus();
		return false;
	}
//==========================
if (!isEmailAddr(thisForm.email.value))
  		{
    		alert("Please enter a valid email address in the form: yourname@yourdomain.com");
    		thisForm.email.focus();
    		return (false);
  		}
//==========================
if(trimString(document.getElementById('existsmail').innerHTML) !=="&nbsp;")
{
  	alert("Please enter another email address or retrieve your existing one");
    thisForm.email.select();
	thisForm.email.focus();
    return (false);
}
  if(isEmptyString(trimString(thisForm.password.value)))
	{
		alert("Please Enter the password");
		thisForm.password.select();
		thisForm.password.focus();
		return false;
	}

if(isEmptyString(trimString(thisForm.password2.value)))
	{
		alert("Please Enter Confirm Password");
		thisForm.password2.select();
		thisForm.password2.focus();
		return false;
	}
	
	if(thisForm.password.value !=thisForm.password2.value)
	{
		alert("Password does not match with Confirm Password");
		thisForm.password2.select();
		thisForm.password2.focus();
		return false;
		
	}
	
	//Check Billing Info
	if(!checkbilling())
	{
		return false;
	}
	if(!checkshipping())
	{
		return false;
	}
	
		
	document.orderform.billcountryCode.value	=	'';
	document.orderform.shippcountryCode.value	=	'';
	document.orderform.billstateCode.value		=	'';
	document.orderform.billstate.value			=	'';
	document.orderform.shippstateCode.value		=	'';
	document.orderform.shippstate.value			=	'';	
				
				if(document.orderform.Copy_billing_Add[1].checked)
				{
					
					document.orderform.billcountryCode.value	=	document.orderform.countryCode.value;
					document.orderform.shippcountryCode.value	=	document.orderform.shippingCountryCode.value;
				
					if(document.orderform.countryCode.value =='US')
					{
							var selObj =document.orderform.stateCode;
							var selIndex = selObj.selectedIndex;
					
							document.orderform.billstateCode.value		=	selObj.options[selIndex].value;
							document.orderform.billstate.value			=	selObj.options[selIndex].text;
					}
					else
					{
						//document.orderform.billstateCode.value		=	document.orderform.stateCode.value;
						document.orderform.billstateCode.value		=	'';						
						document.orderform.billstate.value			=	document.orderform.stateCode.value;						
					}
				
					if(document.orderform.shippingCountryCode.value =='US')
					{
						var selObj =document.orderform.shippingStateCode;
						var selIndex = selObj.selectedIndex;
					
						document.orderform.shippstateCode.value		=	selObj.options[selIndex].value;
						document.orderform.shippstate.value			=	selObj.options[selIndex].text;
					}
					else
					{
						//document.orderform.shippstateCode.value		=	document.orderform.shippingStateCode.value;
						document.orderform.shippstateCode.value		=	'';
						document.orderform.shippstate.value			=	document.orderform.shippingStateCode.value;
										
					}				
				}
				else{fillshipasbill();}
	
		return true;
		
	
	
			
	
}







//function that called when form submitted
function validDataforguest(thisForm)
{
	
	
	//Check Billing Info
	if(!checkbilling())
	{
		return false;
	}
	
	if(!checkshipping())
	{
		return false;
	}
	
	
	document.orderform.billcountryCode.value	=	'';
	document.orderform.shippcountryCode.value	=	'';
	document.orderform.billstateCode.value		=	'';
	document.orderform.billstate.value			=	'';
	document.orderform.shippstateCode.value		=	'';
	document.orderform.shippstate.value			=	'';
	
				if(document.orderform.Copy_billing_Add[1].checked)
				{
					
					document.orderform.billcountryCode.value	=	document.orderform.countryCode.value;
					document.orderform.shippcountryCode.value	=	document.orderform.shippingCountryCode.value;
				
					if(document.orderform.countryCode.value =='US')
					{
							var selObj =document.orderform.stateCode;
							var selIndex = selObj.selectedIndex;
					
							document.orderform.billstateCode.value		=	selObj.options[selIndex].value;
							document.orderform.billstate.value			=	selObj.options[selIndex].text;
					}
					else
					{
						//document.orderform.billstateCode.value		=	document.orderform.stateCode.value;
						document.orderform.billstateCode.value		=	'';						
						document.orderform.billstate.value			=	document.orderform.stateCode.value;						
					}
				
					if(document.orderform.shippingCountryCode.value =='US')
					{
						var selObj =document.orderform.shippingStateCode;
						var selIndex = selObj.selectedIndex;
					
						document.orderform.shippstateCode.value		=	selObj.options[selIndex].value;
						document.orderform.shippstate.value			=	selObj.options[selIndex].text;
					}
					else
					{
						//document.orderform.shippstateCode.value		=	document.orderform.shippingStateCode.value;
						document.orderform.shippstateCode.value		=	'';
						document.orderform.shippstate.value			=	document.orderform.shippingStateCode.value;
										
					}				
				}
				else{fillshipasbill();}
	
		return true;
		
	
	
			
	
}

/********************************************************************************************************/	
//function for displaying the state....
function ShowState(val,tdid)
{
document.getElementById(tdid).innerHTML="";
if(tdid=="billstate")
{
	//alert("Ashwani")
	inputname	="stateCode";		
	document.orderform.Copy_billing_Add[1].checked =true;	
	document.orderform.ShippingFirstName.readOnly=false;
	document.orderform.ShippingLastName.readOnly=false;
	document.orderform.shippingAddress.readOnly=false;
	document.orderform.shippingAddress2.readOnly=false;
	document.orderform.shippingCity.readOnly=false;
	document.orderform.shippingZip.readOnly=false;	
	
	if(document.orderform.shippingCountryCode.value='US')
	{				
		document.orderform.shippingCountryCode.disabled=false;
		document.orderform.shippingStateCode.disabled=false;			
	}
	else
	{				
		document.orderform.shippingCountryCode.disabled=false;
		document.orderform.shippingStateCode.readOnly=false;		
	}
}
else
{
	//alert("Dwivedi")
	inputname	="shippingStateCode";
}

if(val =="US")
	{
		var option;
		option="";
		strstates=document.orderform.strstates.value;
		strstateval=document.orderform.strstateval.value;
		arrstates=strstates.split(",");
		arrstateval=strstateval.split(",");
	
		for ( i = 0; i <=arrstateval.length-1; i++ )
		{
		
			if (option=="")
			{
				option="<option value=''>Select State</option><option value="+ arrstateval[0]+">"+arrstates[0]+"</option>";
			}
			else
			{
				option=option+"<option value='"+arrstateval[i]+"'>"+arrstates[i]+"</option>";
			}	
		}

			innertable="<select name='"+inputname+"' id='"+inputname+"' class='txtbox'>"+option+"</select>";
	}

	else
	{
		innertable="<input name='"+inputname+"' type='text' id='"+inputname+"' class='txtbox' maxlength='28'>";
	}
	document.getElementById(tdid).innerHTML=innertable;
	
	
}




/********************************************************************************************************/	


//check whether ship details is same as bill details........

function SameasBill(wht)
{
	document.orderform.separateShipping.value='';		
	if(wht=='yes')
	{
		document.orderform.separateShipping.value="-1";
		if (!isEmailAddr(document.orderform.email.value))
  		{
    		alert("Please enter a valid email address in the form: yourname@yourdomain.com");
    		document.orderform.email.focus();
    		document.orderform.Copy_billing_Add[1].checked =true;
  		}
		
		if(checkbilling())
		{
			ShowState(document.orderform.countryCode.value,'shipstate');
			fillshipasbill();
			//document.orderform.Copy_billing_Add[0].checked =true;			
			document.orderform.ShippingFirstName.readOnly=true;
			document.orderform.ShippingLastName.readOnly=true;
			document.orderform.shippingAddress.readOnly=true;
			document.orderform.shippingAddress2.readOnly=true;
			document.orderform.shippingCity.readOnly=true;
			document.orderform.shippingZip.readOnly=true;		
			
			var BillSelIndex = document.orderform.countryCode.selectedIndex
			if(document.orderform.countryCode.value='US')
			{				
				document.orderform.shippingCountryCode.disabled=true;
				document.orderform.shippingStateCode.disabled=true;						
				document.orderform.countryCode.selectedIndex=BillSelIndex				
			}
			else
			{				
				document.orderform.shippingStateCode.readOnly=true;
				document.orderform.countryCode.selectedIndex=BillSelIndex
			}
		}
		else
		{
			document.orderform.Copy_billing_Add[1].checked =true;
		}
			
	}
	else
	{			
			document.orderform.ShippingFirstName.value		=	'';
			document.orderform.ShippingLastName.value		=	'';
			document.orderform.shippingAddress.value		=	'';
			document.orderform.shippingAddress2.value		=	'';
			document.orderform.shippingCity.value			=	'';
			document.orderform.shippingZip.value			=	'';			
			document.orderform.shippingCountryCode.options[0].selected=true;
			
			document.orderform.ShippingFirstName.readOnly=false;
			document.orderform.ShippingLastName.readOnly=false;
			document.orderform.shippingAddress.readOnly=false;
			document.orderform.shippingAddress2.readOnly=false;
			document.orderform.shippingCity.readOnly=false;
			document.orderform.shippingZip.readOnly=false;		
			if(document.orderform.countryCode.value='US')
			{				
				document.orderform.shippingCountryCode.disabled=false;
				document.orderform.shippingStateCode.disabled=false;						
						
			}
			else
			{				
				document.orderform.shippingStateCode.readOnly=false;
				
			}
			
			
			ShowState('US','shipstate');
	}
				  
}


function SameasBillforGuest(wht)
{
	document.orderform.separateShipping.value='';
		
	if(wht=='yes')
	{
		document.orderform.separateShipping.value="-1";		
		if(checkbilling())
		{
			ShowState(document.orderform.countryCode.value,'shipstate');
			fillshipasbill();
			document.orderform.Copy_billing_Add[0].checked =true;
		}
		else
		{
			document.orderform.Copy_billing_Add[1].checked =true;

		}
			
	}
	else
	{			
			document.orderform.ShippingFirstName.value		=	'';
			document.orderform.ShippingLastName.value		=	'';
			document.orderform.shippingAddress.value		=	'';
			document.orderform.shippingAddress2.value		=	'';
			document.orderform.shippingCity.value			=	'';
			document.orderform.shippingZip.value			=	'';			
			
			ShowState('US','shipstate');
	}
				  
}


//filling the shiping value
function fillshipasbill()
{
		
		document.orderform.ShippingFirstName.value		=	'';
		document.orderform.ShippingLastName.value		=	'';
		document.orderform.shippingAddress.value		=	'';
		document.orderform.shippingCity.value			=	'';
		document.orderform.shippingZip.value			=	'';
		
		document.orderform.billcountryCode.value		=	'';
		document.orderform.billstateCode.value			=	'';
		document.orderform.billstate.value				=	'';
		
		document.orderform.ShippingFirstName.value		=	document.orderform.bill_name.value;
		document.orderform.ShippingLastName.value		=	document.orderform.bill_lastName.value;
		document.orderform.shippingAddress.value		=	document.orderform.address.value;
		document.orderform.shippingAddress2.value		=	document.orderform.address2.value;
		document.orderform.shippingCity.value			=	document.orderform.city.value;
		document.orderform.shippingZip.value		 	=	document.orderform.zip.value;
		
			
		//===================================================================================
		for (var i=0;i<=document.orderform.shippingCountryCode.options.length-1; i++ )
		{				
			if (document.orderform.shippingCountryCode.options[i].value==document.orderform.countryCode.value)
			{
				document.orderform.shippingCountryCode.options[i].selected=true;
				document.orderform.shippcountryCode.value	=	document.orderform.countryCode.value;					
			}				
		}
		if(document.orderform.countryCode.value	==	'US')
		{
			for (var i=0;i<=document.orderform.shippingStateCode.options.length-1; i++ )
			{
				if (document.orderform.shippingStateCode.options[i].value==document.orderform.stateCode.value)
				{
					document.orderform.shippingStateCode.options[i].selected=true;
					
					document.orderform.billstateCode.value		= document.orderform.shippingStateCode.options[i].value;
					document.orderform.shippstateCode.value		= document.orderform.shippingStateCode.options[i].value;
					document.orderform.billstate.value			= document.orderform.shippingStateCode.options[i].text;
					document.orderform.shippstate.value			= document.orderform.shippingStateCode.options[i].text;
					
				}
			}			
		}
		else
		{				
			//document.orderform.billstateCode.value		=	document.orderform.stateCode.value;
			document.orderform.shippingStateCode.value	= document.orderform.stateCode.value;
			
			document.orderform.billstateCode.value		=	'';
			document.orderform.shippstateCode.value		=	'';				
			document.orderform.shippstate.value			= document.orderform.stateCode.value;
			document.orderform.billstate.value			= document.orderform.stateCode.value;
		}	
		//===================================================================================
		document.orderform.billcountryCode.value	=	document.orderform.countryCode.value;
			
			
		
		
}

function EnableDisable(wht)
{				
		document.orderform.bill_name.readOnly=wht;
		document.orderform.bill_lastName.readOnly=wht;
		document.orderform.address.readOnly=wht;
		document.orderform.city.readOnly=wht;
		document.orderform.zip.readOnly=wht;		
			
			
		document.orderform.ShippingFirstName.readOnly=wht;
		document.orderform.ShippingLastName.readOnly=wht;
		document.orderform.shippingAddress.readOnly=wht;
		document.orderform.shippingCity.readOnly=wht;
		document.orderform.shippingZip.readOnly=wht;
		document.orderform.countryCode.disabled=wht;
		document.orderform.shippingCountryCode.disabled=wht;
		
		
		if(document.orderform.countryCode.value='US')
		{
			document.orderform.stateCode.disabled=wht;
			document.orderform.shippingStateCode.disabled=wht;
		}
		else
		{
			document.orderform.stateCode.readOnly=wht;
			document.orderform.shippingStateCode.readOnly=wht;
		}
		
		if(!wht)
		{
			document.orderform.ShippingFirstName.value		=	'';
			document.orderform.ShippingLastName.value		=	'';
			document.orderform.shippingAddress.value		=	'';
			document.orderform.shippingAddress2.value		=	'';
			document.orderform.shippingCity.value			=	'';
			document.orderform.shippingZip.value			=	'';
			
			//document.orderform.shippingCountryCode.options[0].selected=true;
			ShowState('','shipstate');
		
		}
		
		
		
	
}

/********************************************************************************************************/	
function guestemail()
	{
		if(isEmptyString(trimString(orderform.email.value)))
			{
				alert("Please Enter the email");
				orderform.email.select();
				orderform.email.focus();
				return false;
			}
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(orderform.email.value))
			{
				alert("Please Enter A Valid E-Mail Address");
				orderform.email.select();
				orderform.email.focus();
				return false;
			}		

		if(trimString(document.getElementById('existsmail').innerHTML) !=="&nbsp;")
			{
				alert("Please enter another email address or retrieve your existing one");
				orderform.email.select();
				orderform.email.focus();
				return (false);
			}
		return true;
	}

/********************************************************************************************************/	
// Checking existing email in database......
function CheckExisting()
	{
			parent.frames['frmemaillcheck'].document.iframe_form.email.value=document.orderform.email.value;
			parent.frames['frmemaillcheck'].document.forms[0].submit();
	}
/********************************************************************************************************/	