var browsername=navigator.appName;
var gUrl = null;

function assignUrl(url) {
	gUrl = url;
}

function doSubmit() {	
    document.getElementById("form").action = "/RequestNewPassword.do?method=emailPassword&email="+document.getElementById("email").value;
    //alert(document.getElementById("form").action);
    document.getElementById("form").submit();
}

function registerProceed(){
	document.getElementById("processStar").style.display = "block";
}

function registerOver(){
	document.getElementById('register').className='registerMouseOver';
}

function registerOut(){
	document.getElementById('register').className='registerMouseOut';
}

function hereOver(){
	document.getElementById('here').className='hereMouseOver';
}

function hereOut(){
	document.getElementById('here').className='hereMouseOut';
}

function herepassOver(){
	document.getElementById('herepass').className='hereMouseOver';
}

function herepassOut(){
	document.getElementById('herepass').className='hereMouseOut';
}	

function hideState(ss_mailing_country,ss_mailing_country_canada){
	var lCountry=document.getElementById('country').options[document.getElementById('country').selectedIndex].value;
	if(lCountry==ss_mailing_country){
		document.getElementById('divState').style.display="block";
		//document.getElementById('divShippingState').style.display="block";
		document.getElementById('divProvince').style.display="none";
		document.getElementById('divZip').style.display="block";
		//document.getElementById('divShippingZip').style.display="block";
		document.getElementById('divPostal').style.display="none";
	}else if(lCountry==ss_mailing_country_canada){
		document.getElementById('divState').style.display="none";
		//document.getElementById('divShippingState').style.display="none";
		document.getElementById('divProvince').style.display="block";
		document.getElementById('divZip').style.display="none";
		//document.getElementById('divShippingZip').style.display="none";
		document.getElementById('divPostal').style.display="block";
	}else{
		document.getElementById('divState').style.display="none";
		//document.getElementById('divShippingState').style.display="none";
		document.getElementById('divProvince').style.display="none";
		document.getElementById('divZip').style.display="none";
		//document.getElementById('divShippingZip').style.display="none";
		document.getElementById('divPostal').style.display="block";
	}
}

function hideSummaryState(ss_mailing_country,ss_mailing_country_canada){
	var lCountry=document.getElementById('billingcountry').options[document.getElementById('billingcountry').selectedIndex].value;
	if(lCountry==ss_mailing_country){
		document.getElementById('divState').style.display="block";
		document.getElementById('divShippingState').style.display="block";
		document.getElementById('divProvince').style.display="none";
		document.getElementById('divZip').style.display="block";
		document.getElementById('divShippingZip').style.display="block";
		document.getElementById('divPostal').style.display="none";
	}else if(lCountry==ss_mailing_country_canada){
		document.getElementById('divState').style.display="none";
		document.getElementById('divShippingState').style.display="none";
		document.getElementById('divProvince').style.display="block";
		document.getElementById('divZip').style.display="none";
		document.getElementById('divShippingZip').style.display="none";
		document.getElementById('divPostal').style.display="block";
		document.getElementById('edit_shipping').style.display="none";
	}else{
		document.getElementById('divState').style.display="none";
		document.getElementById('divShippingState').style.display="none";
		document.getElementById('divProvince').style.display="none";
		document.getElementById('divZip').style.display="none";
		document.getElementById('divShippingZip').style.display="none";
		document.getElementById('divPostal').style.display="block";
		document.getElementById('edit_shipping').style.display="none";
	}
}

function showstar(pId){
	var id = pId;
	if(id=='freeshipping'){
	document.getElementById('freeshipping_star').style.display="block";
	document.getElementById('return_star').style.display="none";
	document.getElementById('assistance_star').style.display="none";
	}
	else if(id=='return'){
	document.getElementById('freeshipping_star').style.display="none";
	document.getElementById('return_star').style.display="block";
	document.getElementById('assistance_star').style.display="none";
	}
	else if(id=='assistance'){
	document.getElementById('freeshipping_star').style.display="none";
	document.getElementById('return_star').style.display="none";
	document.getElementById('assistance_star').style.display="block";
	}
}		

function privacyOver(){
	document.getElementById('privacy').className='privacyOver';
}

function privacyOut(){
	document.getElementById('privacy').className='privacyOut';
}

function mouseoverlink(id){
	document.getElementById(id).className='mouseover_text';
}

function mouseoutlink(id){
	document.getElementById(id).className='body_text';
}

function mouseoutsummarylink(id){
	document.getElementById(id).className='body_summary_text';
}

function showmenu1() {
   showMyAccountBox("edit_contact"); 
}
function showmenu2() {
   showMyAccountBox("edit_billing"); 
}
 function showmenu3() {
   showMyAccountBox("edit_shipping"); 
}

function showMyAccountBox(id){
	var div = document.getElementById(id);
	if (!div) return;	       
	if(div.style.display == 'block'){
		div.style.display = 'none';
	} else if(div.style.display == 'none'){
		div.style.display = 'block';
	}
	div.style.position = 'absolute';
	div.style.padding = '0';
}

function viewAllGrey(){
	document.getElementById('viewallorders').className='body_summary_text';
}
function viewAllBlack(){
	document.getElementById('viewallorders').className='black_text';
}
function hideGrey(){
	document.getElementById('hideorders').className='body_summary_text';
}
function hideBlack(){
	document.getElementById('hideorders').className='black_text';
}
function showErrorMessage(){
	document.getElementById('errormessage').style.display='block';
	document.getElementById('errormessageForReturns').style.display='none';
}
function showErrorMessageForReturns(){
    document.getElementById('errormessageForReturns').style.display='block';
    document.getElementById('errormessage').style.display='none';
}
function sendActionToNextPage(shippingType,url,orderId) {
	var lChooseRadio ;
/*	if (eval("document.getElementById('chooseShippingMethod1').checked") == true) {
	   lChooseRadio = "FEDEX";
	} else */
	
		if (eval("document.getElementById('chooseShippingMethod3').checked") == true) {
		   lChooseRadio = "UPS";
		}else 
		if (eval("document.getElementById('chooseShippingMethod2').checked") == true) {
		   lChooseRadio = "USPS";
		}
	       	 
/*	if (shippingType == 3 && lChooseRadio == "FEDEX") {
	  window.location=url+"/includes/FedExCustomerLetter.pdf"; 
	} else 
	if (shippingType != 3 && lChooseRadio == "FEDEX")  {
	  window.location=url+"/getPrintLabel.do?method=printLabel&orderid="+orderId;
	} else */
	
	if (lChooseRadio == "UPS")  {	  
	  window.location=url+"/getPrintLabel.do?method=printLabel&orderid="+orderId+"&isUPS=yes";
	}
	else	if (lChooseRadio == "USPS")  {
	  window.location=url+"/pages/myaccount/USPS_Return_Label.pdf";
	}
}

function handleWithEnterKey(evt,method){
    if ((evt.which && evt.which == 13) || (evt.keyCode && evt.keyCode == 13)){
        submitForm(method);
    }
}

function submitForm(method) {
	var theAction = "/checkout.do?method=" + method; 
	document.getElementById("EditUserInfoForm").action = theAction;
	document.getElementById("EditUserInfoForm").submit();
}	