// JScript source code
	if (!window.captureEvents) {
		window.attachEvent('onload',onPageLoad);
	} else {
		if (window.addEventListener){
			window.addEventListener("load", onPageLoad, false);
		}
	}
	
	function onPageLoad(){
		var fo = new FlashObject("http://media.reliancenetwork.com/media/companyset/RemaxIN/charities_small.swf?url=default.asp?p=pagecontent.asp&target=_self&pid=59", "charities", "90", "65", 6, "#ffffff");
		fo.addParam("wmode", "transparent");
	}

	function showMenu(pstrShowMenu, pstrHideMenus){
		var menu = document.getElementById(pstrShowMenu);
		var hideArr = pstrHideMenus.split(';');
		for (var i=0;i<hideArr.length;i++){
			document.getElementById(hideArr[i]).style.display = 'none';
		}
		menu.style.marginLeft = '-6px';
		menu.style.marginTop = '-70px';
		menu.style.display = 'block';
	}

	function hideMenu(pstrMenu){
		document.getElementById(pstrMenu).style.display = 'none';
	}

	function mouseOverAdvancedSearch (pObj, pMode){
	    var offset = reliance.domUtilities.getOffset(pObj)
	    switch (pMode){
	        case "show":
	            document.getElementById("rolloverMapDiv").style.left = offset.x-200 + 'px';
	            document.getElementById("rolloverMapDiv").style.top = offset.y-260 + 'px';
	            document.getElementById("rolloverMapDiv").style.display = "block";
	            break;
	        case "hide":
	            document.getElementById("rolloverMapDiv").style.display = "none";
	            break;
	        default:
	            document.getElementById("rolloverMapDiv").style.display = "none";
	            break;
	    }
	}
	
	function findPos(obj) {
	    var curleft = curtop = 0;
	    if (obj.offsetParent) {
		    curleft = obj.offsetLeft
		    curtop = obj.offsetTop
		    while (obj = obj.offsetParent) {
			    curleft += obj.offsetLeft
			    curtop += obj.offsetTop
		    }
	    }
	    return [curleft,curtop];
    }

/* Home page Address, City or Zip code search*/
function validateSearchInputs(pSearchtype){
	var cityZip, sellingAddr;
	var isValidInput = false;
	var validAddress = true;
	var validCity = false;		
	
	if (pSearchtype == "selling"){				
		sellingAddr = document.getElementById('address').value;
		validAddress = isValidAddress(sellingAddr);
	    
	    if(validAddress){
	        validCity = isValidCityName(document.getElementById('citystatezip'));	
	    }
	    	    
		if ((validAddress) && (validCity)){ 
		    document.getElementById('formSellingSearch').submit();	
		}else {
		    if(!validAddress){
			    alert('Please enter Street Address.');
			    document.getElementById('address').focus();
			    document.getElementById('address').style.color = "#000000";
			    return false;
		    }		
		    else if(!validCity){
			    alert('Please enter the full City Name or a 5-digit Zip Code.');
			    document.getElementById('citystatezip').focus();
			    document.getElementById('citystatezip').style.color = "#000000";
			    return false;
		    }							
		}			
	}else if (pSearchtype == "buying"){		
		validCity = isValidCityName(document.getElementById('qsCityZip'));	
		
		if(!validCity){
			alert('Please enter the full City Name or a 5-digit Zip Code.');
			document.getElementById('qsCityZip').focus();
			document.getElementById('qsCityZip').style.color = "#000000"
			return false;	
		}else {		
			document.getElementById('formBuyingSearch').submit();							
		}
	}	
	
}

function isValidAddress(pAddress){
	var validChars = /\w{2,}/;

	if (pAddress != 'Enter Street Address'){	
		if (pAddress.search(validChars) != -1){		
			return true;
		}else{
		    document.getElementById('address').value = "";		   		         
	        document.getElementById('address').focus();
		    return false;	
		 }		    	
	}
	
	document.getElementById('address').value = "";					
	return false;
}

function isValidCityName(pCity){	
	var validChars = /\w{2,}/;	
	var cityValue = pCity.value;
	
	if (cityValue != 'Enter City or Zip'){		
		if (cityValue.search(validChars) != -1){					
			return true;
		}else{
		    pCity.value = "";
		    pCity.style.color = '#000000';
		    return false;
		}		
	}else{		
		pCity.value = "";
		pCity.style.color = '#000000';
		return false;
	}
}

function checkClearText(pObj){
	if ((pObj.value=='Enter City or Zip') || (pObj.value=='Enter Street Address')){
		pObj.value='';
		pObj.style.color = '#000000';
	}
}
