$(document).ready(function(){
	//for bg images so the site looks better
	//$("#lInTbl").wrap("<div id='intbl-wrap'></div>");
	//$("#lInTbl").wrap("<div id='intbl-wrap2'></div>");
	
	
	
	var MenuArray = new Array(
		{pageid : 116608},
	    {pageid : 116609},
	    {pageid : 116610},
	    {pageid : 116611},
	    {pageid : 116612}
	);
	
	var options = {
	    css_path:"/css/menu.css",
	    xml_path:"/xml/default.asp",
	    sid:423,
	    hOffset:-12,
		vOffset:0,
	    direction:"horizontal",
	    settings:MenuArray,
	    currentL1:pdGlobal.currentPages[0].id
	};
	$('#nav').menu(options);
	
	if(typeof pdGlobal != "undefined"){
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel - 1].type != "content"){
			$(".sitelcol").css("display","block");
		}
	}
	
	//load photos
	$photo = $("#lInTbl");
	switch(pdGlobal.currentPages[0].id){
 	 	case 116608:GetPhotos(27736,$photo); break;
 	 	case 116609:GetPhotos(27743,$photo); break;
 	 	case 116610:GetPhotos(27744,$photo); break;
 	 	case 116611:GetPhotos(27745,$photo); break;
 	 	case 116612:GetPhotos(27746,$photo); break;
 	 	default:GetPhotos(27747,$photo); break;
 	 } 	
//changing search results page text
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==52392){
	$(".maintext").css("color","#ffffff");
	$("a.link").css("color","#ffffff");
	}
});


/*Search Functions */
function submitSearch(){
	__pdSiteSearch('United World College-USA 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 GetPhotos(pID,$container){	
	$.ajax({
		type: "GET",
		url: "/xml/default.asp?sid=423&type=photo&id="+pID,
		dataType: "xml",
		success: function(xml) {
			$(xml).find('image:first').each(function(){
			   	$container.css("background"," url("+$(this).find("path").text()+") no-repeat");
			});
		},
		error: function(request,tStatus,eThrown){
			//alert("Cant Get Photos");
		}
	});		
}