/**************************************************************
Map component uses this method to pass the location code to navigate to the state or county
***************************************************************/
function CallJavaScript(locationData) {
	var locationCode=getMloc(locationData);
	window.location="For_Businesses.aspx?gloc="+locationData.replace('@','-')+"&mloc="+locationCode;	
}

/**************************************************************
Helper method to get the code and location from the text obtained 
from the Map component
**************************************************************/
function getMloc(location) {
	var mlocsplit= location.split("*");
	if(mlocsplit[0].indexOf('[')>0){
		return mlocsplit[0].substring(mlocsplit[0].indexOf('[')+1,mlocsplit[0].indexOf('[')+3) + '$' + mlocsplit[1].substring(mlocsplit[1].indexOf(':')+3,mlocsplit[0].indexOf('[')+5);
	}
	else{
		return mlocsplit[1];
	}     
}

/**************************************************************
Opens the project details page based on the project Id and the 
location Id that is passed to the method
**************************************************************/
function openProjectDetails(projectId, locationId, locationValue,localRef) {
	var navigationURI = "ProjectDetail.aspx?ProjectId="+projectId+localRef;
	var newWindow = window.open(navigationURI, "", "scrollbars,resizable,height=" + (screen.height - 50) + ",width=" + (screen.width - 230) + ",top=" + screen.top + ",left=" + screen.left);
        alert(newWindow.setLocationDetail);
        return false
}

/**************************************************************
Called by the flash component to load the selected state or county
**************************************************************/
function getLoc(state) {
	var queryStr = window.location.search.substring(1);
	var params = queryStr.split("&");
	for (i = 0; i < params.length; i++) {
		value = params[i].split("=");
		if (value[0] == "mloc") {
			return value[1];
		}
	}
}