

function prepareUserRegUpdate(form)
{

		form.submit();
	
}	

function validateInputFields(form)
{
	return true;
}

function validateAddressFields(form)
{
	return true;
}


function prepareAddressBookSubmit(form)
{		
		var formNotSubmitted = monitor();
		if(formNotSubmitted){
		form.submit(); 
		}
	
}	

function popup()
{
	var passwordStatus = window.document.profile_info.confirmPwd.value;
	if(passwordStatus == 1){
 		var msg = "You have successfully changed \n       your password.";
 		 	 alert(msg); 
 	}
}


function monitor() {
counter++;
if(counter > 1) { return false; }
return true;
}


function forgotPassword(){
	ajaxEngine.sendRequest('SYForgotPasswordAjax', 'logonId=' + $F('logonIdF'));	
}

function changePassword(){
	ajaxEngine.sendRequest('SYChangePasswordAjax', 'logonPassword='+ $F('logonPasswordNew'),
												   'logonPasswordOld='+ $F('logonPasswordOld'),
												   'logonPasswordVerify='+ $F('logonPasswordVerify'));	
}
 
function openPasswordDiv(divDec,storeId){
	if(divDec == 'forgot_password'){
		
		document.getElementById("showSuccess").innerHTML= "";
		popOpen("showSuccess");
		ajaxEngine.sendRequest('SYForgotPasswordAjax', 'divDecision=' + divDec, 'storeId='+storeId);			
	}
	if(divDec == 'cancel'){
		cancelPop("showSuccess");
		return false;
	}

}

function login(){

popOpen("showChangePasswordResult");
ajaxEngine.sendRequest('SYLogonExtAjax',			
			'URL=' + $F('URL'),
			'storeId=' + $F('storeId'),
			'catalogId=' + $F('catalogId'),
			'logonId=' + $F('logonId'),
			'logonPassword=' + $F('logonPassword'),
			'reLogonURL=' + $F('reLogonURL'),		
			'langId=' + $F('langId'),
			'userLogonResponseView=' + $F('userLogonResponseView'),
			'userLogonErrorResponseView=' + $F('userLogonErrorResponseView')
			
			);
}

function closeChangePasswordDiv(){
		popClose("showChangePasswordResult");
}

function closeCPPop(){

}

function editAddress(addressId){
	ajaxEngine.sendRequest('SYAddressUpdateAjax',			
							'action=' + 'edit',
							'validateAddress=' + 'no',
							'addressId=' + addressId,
							'URL='+'SYAddressUpdateAjaxView',
							'errorViewName='+'SYAddressUpdateErrorAjaxView'
	);			

	popOpen("showAddressBookEditPop");		
}


function addNewAddressBook(){

		/*document.getElementById("addressIdAdd").value = "";			
		document.getElementById("primaryAdd").checked = false;
		document.getElementById("personTitleAdd").value = "";
		document.getElementById("firstNameAdd").value = "";
		document.getElementById("lastNameAdd").value = "";
		document.getElementById("address1Add").value = "";
		document.getElementById("address2Add").value = "";
		document.getElementById("cityAdd").value = "";
		document.getElementById("stateAdd").value = "";																																																																																								
		document.getElementById("zipCodePrimaryAdd").value = "";																																																																																								
		document.getElementById("zipCodeExtensionAdd").value = "";																																																																																								
		document.getElementById("phoneAreaCodeAdd").value = "";																																																																																								
		document.getElementById("phoneFirstAdd").value = "";																																																																																								
		document.getElementById("phoneSecondAdd").value = "";																																																																																								
		document.getElementById("email1Add").value = "";	*/
		
		document.getElementById("addressBookPop").innerHTML= "";
		popOpen("addressBookPop", 200);
		ajaxEngine.sendRequest('SYAddressUpdateAjax', 'divDecision=addressBook');			

		
}

function deleteAddress(addressId){
	addressIdG = addressId;
	popOpen("remove_confirm");

}

function confirmedAndDelete(){
	popClose("remove_confirm");
	ajaxEngine.sendRequest('SYAddressUpdateAjax',			
							'action=' + 'delete',
							'validateAddress=' + 'no',										
							'addressId=' + addressIdG,
							'URL='+'SYAddressBookSuccessView',
							'errorViewName='+'SYAddressUpdateErrorAjaxView'
	);	
	return false;
}




function saveAddressBook(action){
	var prim = "0";
	if(action == 'add'){
		if(document.getElementById("primaryAdd").checked){
			prim = "1";
		}
		ajaxEngine.sendRequest('SYAddressUpdateAjax',			
			'addressType=' + document.getElementById("addressTypeAdd").value,
			'URL=SYAddressBookSuccessView',
			'action=' + action,	
			'errorViewName='+ document.getElementById("errorViewNameAdd").value,	
			'selfAddress=' + document.getElementById("selfAddressAdd").value,
			'addressId=' + document.getElementById("addressIdAdd").value,
			'addressField1='+ document.getElementById("county").value,	
			'catalogId=' + document.getElementById("catalogIdAdd").value,
			'country=' +document.getElementById("countryAdd").value,
			'primary=' + prim,
			'personTitle=' + document.getElementById("personTitleAdd").value,
			'firstName=' + document.getElementById("firstNameAdd").value,
			'lastName=' + document.getElementById("lastNameAdd").value,
			'address1=' + document.getElementById("address1Add").value,
			'address2=' + document.getElementById("address2Add").value,
			'city=' + document.getElementById("cityAdd").value,
			'state=' + document.getElementById("stateAdd").value,																																																																																								
			'zipCodePrimary=' + document.getElementById("zipCodePrimaryAdd").value,																																																																																								
			'zipCodeExtension=' + document.getElementById("zipCodeExtensionAdd").value,																																																																																											
			'phoneAreaCode=' + document.getElementById("phoneAreaCodeAdd").value,																																																																																								
			'phoneFirst=' + document.getElementById("phoneFirstAdd").value,										
		    'countyDelimited=' + document.getElementById("countyDelimitedAdd").value,										
			'phoneSecond=' + document.getElementById("phoneSecondAdd").value,																																																																																								
			'email1=' + document.getElementById("email1Add").value);	

	}else if(action == 'update'){
			trimEditAddress1();
			trimEditAddress2();
			if(document.getElementById("primary").checked){
				prim = "1";
			}

			ajaxEngine.sendRequest('SYAddressUpdateAjax',			
			'addressType=' + document.getElementById("addressType").value,
			'URL=SYAddressBookSuccessView',
			'action=' + action,	
			'addressField1='+document.getElementById("county").value,	
			'errorViewName='+ document.getElementById("errorViewName").value,	
			'selfAddress=' + document.getElementById("selfAddress").value,
			'addressId=' + document.getElementById("addressId").value,
			'catalogId=' + document.getElementById("catalogId").value,
			'country=' +document.getElementById("country").value,
			'primary=' + prim,
			'personTitle=' + document.getElementById("personTitle").value,
			'firstName=' + document.getElementById("firstName").value,
			'lastName=' + document.getElementById("lastName").value,
			'address1=' + document.getElementById("address1").value,
			'address2=' + document.getElementById("address2").value,
			'city=' + document.getElementById("city").value,
			'state=' + document.getElementById("state").value,																																																																																								
			'zipCodePrimary=' + document.getElementById("zipCodePrimary").value,																																																																																								
			'zipCodeExtension=' + document.getElementById("zipCodeExtension").value,																																																																																											
			'phoneAreaCode=' + document.getElementById("phoneAreaCode").value,																																																																																								
			'phoneFirst=' + document.getElementById("phoneFirst").value,																																																																																								
			'phoneSecond=' + document.getElementById("phoneSecond").value,		
		    'countyDelimited=' + document.getElementById("countyDelimited").value,																																																																																																			
			'email1=' + document.getElementById("email1").value);	
	
	}

}

function cancelPop(id){
	document.getElementById(id).style.display = "none";
}

function populateCounty(action){
	if(action == 'add'){
		if ( document.getElementById("addressField1Add") )
			document.getElementById("addressField1Add").value = document.getElementById("county").value;
	}else if(action == 'update'){
		if ( document.getElementById("addressField1") )
			document.getElementById("addressField1").value = document.getElementById("county").value;
	}

}

function sendAMailToFriendForm(){

	ajaxEngine.sendRequest('SYEmailAFriend',			
			'storeId=' + $F('storeId'),
			'action=form');
			popOpen("send_to_a_friend");			

}

function sendAMailToFriend(){
			popClose("send_to_a_friend");
		ajaxEngine.sendRequest('SYEmailAFriend',			
			'storeId=' + $F('storeId'),
			'catalogId='+$F('catalogId'),	
			'emailTo='+$F('emailTo'),
			'yourName='+$F('yourName'),
			'emailFrom='+$F('emailFrom'),
			'sendMeACopy='+$F('sendMeACopy'),
			'message='+$F('message')
			);	
			popOpen("send_to_a_friend");			
}
