if(parent.pdGlobal){
	var obj = parent.document.getElementById('PageHead');
	var contents = obj.innerHTML;
	document.write(contents);
}

function openURL(url){
	window.location.href=url;
	parent.window.scrollTo(0,0);
}

//Submit Form from Select statment		
function jump(f) {
	f.submit();
}

/*Search Functions */
function submitSearch(){
	parent.__pdSiteSearch('', document.getElementById("search").value);
}
function SubmitOnEnter(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	if(charCode == "13" || charCode == "26"){
		submitSearch();
		return false;
	}
}

//Check for added variable to podium url
function CheckForID(VarType) {
	var beginValue,mylocation,MyID,FoundAnd
	mylocation = new String(parent.window.location);
	beginValue = mylocation.search(VarType);
	if(beginValue > 0){
		MyID = mylocation.substring(beginValue+VarType.length+1,mylocation.length);
		FoundAnd = MyID.search("&");
		if(FoundAnd > 0){
			MyID = MyID.substring(0,FoundAnd);
		}
	}
	if(MyID == null){
		return 0;
	}
	else{
		return MyID;
	}
	
}

//
function ReSizeIFRAME() {
	var aIF = window.parent.document.getElementsByTagName('IFRAME')
	var objIF
	for (x=0; x < aIF.length;x++) {
		if(aIF[x].id.substring(0,2) == 'if') objIF = aIF[x]
	}
	//if(objBody = document.getElementById('__pdIFRAMEarea') && objIF){
		objBody = document.getElementById('__pdIFRAMEarea')
		objIF.style.height = objBody.offsetHeight;
	//}
}

function sendEmail(address, linkto) {
   	var aryAddress = new Array
   	var mailTo = new String;
   	address = address.replace(/x/g, ',64');address = address.replace(/y/g, ',46');address = address.replace(/z/g, ',');
   	aryAddress = address.split(',') 
   	for (q=1; q<aryAddress.length;q++) {  
		mailTo = mailTo + String.fromCharCode(aryAddress[q]);   
	}
	linkto.href = 'mailto:'+mailTo;
} 

function __pdL(taskid, taskname, tasktypeid, taskargs, path, clearhistory, subtaskid, subtaskname) {
	parent.window.location = "/podium/default.aspx?t=" + taskid;
}


function GetPageTitles(DisplayL2,L2Target,DisplayL3,L3Target){
	if(parent.pdGlobal.currentPages[1]){
		tempL2s = ""
		tempL3s = ""
		if(parent.pdGlobal.currentPages[1]) {
			tempL2s = parent.pdGlobal.currentPages[1].title;
		}
		if(parent.pdGlobal.currentPages[2]) {
			tempL3s = parent.pdGlobal.currentPages[2].title;
		}
		//alert(tempL2s +" - "+ tempL3s );
		if(tempL2s.length > 0 && DisplayL2){
			$(L2Target).innerHTML = tempL2s;
		}else{
			$(L2Target).style.display = "none";
		}
		if(tempL3s.length > 0 && DisplayL3){
			$(L3Target).innerHTML = tempL3s;
		}else{
			$(L3Target).style.display = "none";
		}
	}
}
