$.ajaxSetup ({  
    cache: false  
});



//alert(pageName);


function selectItem(){

	var sPath = window.location.pathname; 
	var sPage = sPath.substring(sPath.indexOf('/') + 1);
	var firstSlash = sPath.indexOf('/');
	var period = sPath.indexOf('.');
	var question = sPath.indexOf('?');
	if(period!=-1){
			pageName=sPath.substring(firstSlash+1,period);
	}
	else{
		tempPage =sPath.substring(firstSlash+1);
		pageName =tempPage.substring(0,tempPage.indexOf('/'));
	}
	
	switch (pageName){
	case "search":

	
		document.getElementById("directoryBar").setAttribute("class", "selectedBar");
		document.getElementById("directoryBar").setAttribute("className", "selectedBar");
		break;
	case "provider-detail":
		document.getElementById("directoryBar").setAttribute("class", "selectedBar");
		document.getElementById("directoryBar").setAttribute("className", "selectedBar");
	break;
	case "about-us":
		document.getElementById("aboutBar").setAttribute("class", "selectedBar");
		document.getElementById("aboutBar").setAttribute("className", "selectedBar");
	break;
	case "career-search":
		document.getElementById("jobBar").setAttribute("class", "selectedBar");
		document.getElementById("jobBar").setAttribute("className", "selectedBar");
		break;
	case "":
		document.getElementById("homeBar").setAttribute("class", "selectedBar");
		document.getElementById("homeBar").setAttribute("className", "selectedBar");
		break;
	default : //pageName="";
	}	
	
}

function submitSearch() {
	var searchtext = $('#searchtext').val();
	var location = $('#location').val();
	var searchType = $("input[name='searchType']:checked").val(); 

	if(searchType=="careers") {
		window.location="/career-search.xqy?searchtext="+searchtext+"&location="+location;
	} else {
		window.location="/search.xqy?searchTerm="+searchtext+"&geoTerm="+location;
	}
}

function submitIndexSearch() {
	var searchtext = document.indexSearch.searchTerm.val();
	var location = document.indexSearch.geoTerm.val();
	var searchType = $("input[name='searchType']:checked").val(); 

	if(searchType=="directory") {
		window.location="/search.xqy?searchTerm="+searchtext+"&geoTerm="+location;
	} else {
		window.location="/career-search.xqy?searchtext="+searchtext+"&location="+location;
	}
}
