var ie = false;
var safari = false;

if(navigator.userAgent.toLowerCase().indexOf("msie") > 0){
	ie = true;
}
else if(navigator.userAgent.toLowerCase().indexOf("safari") != -1){
	safari = true;
}

function globalOnload(){
	//Nifty("div#templateNav a","transparent");
	//Nifty("a#applyNow","transparent");
	//Nifty("div#formControlBar a","transparent");
	//Nifty("div#demo a","transparent");
	if(safari){ safariMenu(); }
}

function safariMenu(){
	document.getElementById("templateNav").id = "templateNavSafari";
}

window.onload = globalOnload;

function applyNow(pid){
	var blocker = document.createElement('div');
	blocker.id = "moduleBlocker";
	document.body.appendChild(blocker);
	var bg = document.createElement('div');
	bg.id = "moduleBg";
	document.body.appendChild(bg);
	bg.style.left = ((document.body.scrollWidth - bg.offsetWidth) / 2) + "px";
	var startIframe = "iframe";
	if(ie){
		startIframe = "<IFRAME SRC=\"assets/images/clear.gif\">";
	}
	var close = document.createElement('a');
	close.id = "moduleClose";
	bg.appendChild(close);
	close.innerHTML = "Close";
	close.href = "javascript:closeModule()";
	Nifty("div#moduleClose","transparent");
	var iframeElement = document.createElement(startIframe);
	iframeElement.setAttribute("id","moduleIframe");
	iframeElement.setAttribute("allowTransparency","true");
	iframeElement.setAttribute("scrolling","no");
	iframeElement.setAttribute("frameBorder","0");
	iframeElement.setAttribute("name","moduleIframe");
	bg.appendChild(iframeElement);
	iframeElement.src = "http://jobs.wingateweb.com/launch.php?pid="+ pid;
}
function closeModule(){
	document.body.removeChild(document.getElementById('moduleBg'));
	document.body.removeChild(document.getElementById('moduleBlocker'));
}

function linkedImageClick(id){
	var t = document.getElementById(id).getAttribute('target');
	var d = document.getElementById(id).getAttribute('href');
	if (t == "_blank"){
		window.open(d);
	}else{
		document.location = d;
	}
}

function searchSubmit(type){
	document.getElementById("siteSearchForm").submit();
}