$(document).ready(function(){
	initMenu("nav","down",MenuArray,pdGlobal.currentPages[0].id);
	//$('#benchQuote').cycle();
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==52392){$("#L_c4i0").css("display","none");}
	}
	$("a.sitelcolt:contains('PRINT THIS PAGE')").css("visibility","hidden");//CSP sdb 041610 hide the Print This Page
});

/*Search Functions */
function submitSearch(){ __pdSiteSearch('University Lake School Search', document.getElementById("search").value); }
function SubmitOnEnter(evt){ var charCode = (evt.which) ? evt.which : event.keyCode; if(charCode == "13" || charCode == "26"){ submitSearch(); return false; } }

function fSplitJavascript(strIn, intCharacters){
	var	strDummy=strIn, strOut="",
		strArray=new Array();
	
	strArray = strDummy.split(" ");
	
	if(strIn.length>intCharacters) {
		for(i=0; i<strArray.length; i++) {
			if((strOut.length + strArray[i].length + 1) < intCharacters) {
				if(i==0){ strOut = strArray[0]; }
				else{ strOut = strOut + " " + strArray[i]; }
			}
			else { strOut = strOut + "..."; i=999; }
		}
	} else { strOut = strIn; }
	return strOut;
}

/* Added willow call plus function to grab data from a link group for self managed buttons, March 2010 */
willow.ready(function($) {
	willow.smButtons($("#omniNav"),15231);
});
/* function to get data from a link group for self managed buttons, write out LIs for each button, and prepend inside a UL in HTML*/
willow.smButtons = function($obj,id){
	willow.getLinks(id,function(data){
		var links = data.link;
		if(links.length === 0){return;}
		var lstring = "";
		for(var i = 0; i < links.length; i++){
			var buttonLink = links[i].url
			if(buttonLink.slice(0,4)!=="http"){buttonLink = "http://"+buttonLink}
			lstring += "<li><a href='"+buttonLink+"'" + ((links[i].target) ? "" : "") + ">"+
			((typeof links[i].image !== "undefined") ? "<img src='"+links[i].image.path+"' border='0'/>" : links[i].title)+"</a></li>";
		}
		$obj.prepend(lstring);
	});
}

//Curriculum Showcase popup window
function LScurriculum(){window.open ("/curriculum/lower.asp","LScurriculum","location=0,status=0,scrollbars=1,width=800,height=575");}
function UScurriculum(){window.open ("/curriculum/upper.asp","UScurriculum","location=0,status=0,scrollbars=1,width=800,height=575");}
