
/*********************
KCSARC Javascript File
Created: 1/25/2008
Last Updated: 1/25/2008
***********************/
 
//Define window.onload event
/*window.onload=pageLoadChecks;*/

function pageLoadChecks(){  
  checkIsCookiesEnabled();  
}

function gotoPage(iUrlType, sTarget){	
	
	if (iUrlType == 1) {
		//Need to build full path to url
	    window.location.href = sTarget;		  
	} else {
		window.location.href = sTarget;
	}
}

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == '.') 
        strText = strText.substring(1, strText.length);   
    return strText;
} 

function setVisibility(objId,sStyleProperty)
{  
  var objRef = document.getElementById(objId);  
  objRef.style.display = sStyleProperty;
}

function display(id, v) {
	var obj = document.getElementById(id);
	if (obj && obj.style) obj.style.display = v;
}

function swapStyle(objId,sClassName){
  var objRef = document.getElementById(objId);   
  objRef.className = sClassName;	
}

function showArticle(currentArticle,nextArticle){
	var objCurrentArticle = document.getElementById(currentArticle); 
	var objNextArticle = document.getElementById(nextArticle);
	objCurrentArticle.style.display = "none";
	objNextArticle.style.display = "block";	
}

function swapImage(path,imgObj,state){
	imgObj.src = path + "nImages/Navigation/" + imgObj.id + state + ".gif";	
}

function buildLink(sUrl){
	window.location.href = sUrl;	
}
function submitSearch(){
	var objFormRef = document.getElementById('cse-search-box');
	
	//Trim the contents of the search string of leading or trailing spaces.
	objFormRef.q.value = trimString(objFormRef.q.value.toString());
	
	if (objFormRef.q.value != "") {				     
    	alert("Clear to submit request for search string of" + objFormRef.q.value);
		objFormRef.submit();
	} else {
		alert("Search string is blank");
	}
	 
 }