function LoadPopup()
 {
		var prop='toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,locationbar=1,width=800,height=600';     
			if (unloadPopup) 
			{
				msg=window.open(indexAbandonPopupUrl,'exitdatingwindowert',prop);              
			}
		return true;
 }
 
 function WeAttractPopup()
{
	window.open(weattractpopup,null,'height=600,width=800,channelmode=0,directories=0,fullscreen=0,location=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0');
}

function IndexAbandonPopup()
 {
		var prop='toolbar=1,directories=1,menubar=1,scrollbars=1,resizable=1,locationbar=1,width=840,height=600';     
			if (unloadPopup) 
			{
				msg=window.open(indexAbandonPopupUrl,'exitdatingwindowert',prop);              
			}
		return true;
 }

function friendsIndexSwap(drop1,drop2)
{
	var friendsdrop = document.getElementById(drop1);
	var datingdrop = document.getElementById(drop2);
	
	
	friendsdrop.style.display = "block";
	datingdrop.style.display = "none";
		
}

function datingIndexSwap(drop1,drop2)
{
	var friendsdrop = document.getElementById(drop1);
	var datingdrop = document.getElementById(drop2);
	

	friendsdrop.style.display = "none";
	datingdrop.style.display = "block";
		
}

function resyncDivState()
{
	var searchByDating = document.getElementById(searchByDatingName);
	var searchByFriends = document.getElementById(searchByFriendsName);
	

	if (searchByDating != null)
	{
		if (searchByDating.checked)
		{
			datingIndexSwap('ds_friendsdrop','ds_datingdrop');
		}
		else
		{
			if (searchByFriends != null)
			{
				if (searchByFriends.checked)
				{
					friendsIndexSwap('ds_friendsdrop','ds_datingdrop');
				}
			}
		
		}
	}
}
function handleEnterKeyPress(newEvent)
{
	var isIE = (navigator.appVersion.toLowerCase().indexOf("msie") > -1) ? true : false;
	var isMac = (navigator.appVersion.toLowerCase().indexOf("mac") > -1) ? true : false;
	if(isIE)
	{
		if(event){newEvent = event;}
	}
	jsMatchPage.BlockEnterKey = false;
	if(newEvent != null)
	{
		if(parseInt(newEvent.keyCode) == 13)
		{
			if((isIE) && (!isMac))
			{
				document.getElementById(buttonToSubmit).click();
			}
			return false;
		}
	}
}

function enableEmailOnSaveSearches(savedChkbox, emailChkbox)
{
    var emailChk = document.getElementById(emailChkbox);
	if(document.getElementById(savedChkbox).checked)
	{
	   emailChk.disabled = false;
	   //span tag is wrapped around checkbox in generated html.
	   //Need to remove it, to enable
	   emailChk.parentElement.removeAttribute('disabled');
	  
	} else {
	   emailChk.checked = false;
	   emailChk.disabled = true;
	   emailChk.parentElement.setAttribute('disabled','true');
	}
    
	//alert("enableEmailOnSaveSearches:end");
		
}

function clearPostalCode(postalTxtbox)
{
   var postalTxt = document.getElementById(postalTxtbox);
   
   if((postalTxt.value == "city/zip/postal") ||
      (postalTxt.value == "city")||
      (postalTxt.value == "city or ZIP code"))
   {
       postalTxt.value = "";
  
   }
}
function alphaNumericCheck(){
  
	var regex=/[^0-9a-zA-Z]/;
	if(regex.test(document.formName.zip.value)){
		//alert("fail");
		alert("Please enter a valid ZIP code.");
		document.formName.action = "";
		document.formName.target = "";
		return false;
	} else {
		//alert("pass");
		document.formName.action = "http://local.msn.com/t3/default.asp";
		document.formName.target = "_new";
		document.formName.submit();
		return true;
	}
	return isNotAlpha;
}
