/*
	2007.01.18	gricke
				<footerLogoClick> Make fed sig corporate image in footer clickable
				
	2007.01.03	gricke
				Update logo link
	2006.07.10	gricke
				Copy from o2elgin/JavaScriptShell
				Hard code link to dealer locator
*/

window.onload = initialize; 

function initialize(){
	dealerLoctor();
	loginAdmin();
	//searchUnderSideNav();
	logoClick();
	//flashDetect();
	footerLogoClick();
}
function footerLogoClick(){
	if (document.getElementById('FooterImage_1')){
		var fedSigCorpLink = document.getElementById('FooterImage_1');
		document.getElementById('FooterImage_1').onclick = function(){
			window.location="http://www.federalsignal.com";
		}
		document.getElementById('FooterImage_1').onmouseover = function(){
			document.getElementById('FooterImage_1').title="Visit Federal Signal";
		}
	}	
}
function logoClick(){
	var HTMLDisp = '';
	if (document.getElementById('logo')){
		var logoClickThrough = document.getElementById('logo');
		HTMLDisp = HTMLDisp + '<a href=\"http://www.vactor.com/\"><img src=\"/images/trans.gif\" width=\"188\" height=\"61\" border=\"0\" alt=\"Home\" /></a>';
		logoClickThrough.innerHTML = HTMLDisp;
	}
	
	if (document.getElementById('Edit_ExcelDataEditor')){
		//document.getElementById('Edit_ExcelDataEditor').style.top = '-300px';
	}
	
}

function dealerLoctor(){
	if (document.getElementById('logo2')){
		var LoginBox = document.getElementById('logo2');
		var HTMLDisp = '';
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		HTMLDisp = HTMLDisp + '<a id=\"repLocatorLink\" href=\"FindaDealer_1246.asp\">';
		HTMLDisp = HTMLDisp + '<img src=\"images/trans.gif\" width=\"130\" height=\"30\" alt=\"Locate Dealer\" border=\"0\" />';
		HTMLDisp = HTMLDisp + '</a>';
		HTMLDisp = HTMLDisp + '';
   		LoginBox.innerHTML = HTMLDisp;
	}
}
/* ~~~~~~~~~~~~~~~~~~~~[ login functions ] ~~~~~~~~~~~~~~~ */
/*
	seeAlso
		css/header.css <Login>
		workfiles <logIn.psd>
*/
function loginAdmin(){
	if (document.getElementById('loginFoot') && isDotNet() != '.aspx'){
		var LoginBox = document.getElementById('loginFoot');
		var HTMLDisp = '';
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		var sSite = window.location;
		var tempHold = document.forms['searchform'].vars1.value;
		
		document.forms['searchform'].vars1.value = sSite;
		sSite = document.forms['searchform'].vars1.value;
		document.forms['searchform'].vars1.value = tempHold;
		sSite = sSite.substring(sSite.indexOf("/")+2);
		sSite = sSite.substring(0,sSite.indexOf("/"));
		sSite = sSite.substring(0,sSite.indexOf("."));

		var sUser = sSite + 'User';
		var sPass = sSite + 'Pass';		

		if(getCookie(sSite + 'AdminLoggedIn') == 'True'){
			HTMLDisp = HTMLDisp + '<a href="#" id=\"loginLink\" onClick="LogOut(\'' + sSite + '\');return false;" style=\"\text-decoration:none;font-size:8px;">Log Out</a>';
		}else{
			HTMLDisp = HTMLDisp + '<a href="#" id=\"loginLink\" onClick="DispLogin();return false;" style=\"\text-decoration:none;font-size:8px;">Log In</a>';
		}	
		HTMLDisp = HTMLDisp + '<div id=\"Login\">';
		HTMLDisp = HTMLDisp + '<form id=\"adminLoginForm\" method=\"post\" action=\"/Admin/Default.asp?OnTo=' + sPage + '" name=\"Security\" style=\"display:inline;\" >';
		HTMLDisp = HTMLDisp + '<input class=\"txtInput\" type=\"text\" name=\"txtUserID\">';
		HTMLDisp = HTMLDisp + '<input class=\"txtInput\" type=\"password\" name=\"txtPassword\">';
		HTMLDisp = HTMLDisp + '<input type=\"button\" value=\"log in\" name=\"Login2\" onClick=\"submitLogin();">';
		HTMLDisp = HTMLDisp + '<br /><span style=\"white-space:nowrap;\"><input type=\"checkbox\" name=\"savePass\" value =\"true\">Remember me</span><br />';
		HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"FormSubmitted\" value =\"true\">';
		HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"ByPassAdmin\" value =\"true\">';
		HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"siteUrlSec\" value =\"\">';
		HTMLDisp = HTMLDisp + '<a href="#" id=\"closeLink\" onClick="hideLogin();return false;">Cancel</a>';
		HTMLDisp = HTMLDisp + '</form>';
		HTMLDisp = HTMLDisp + '</div>';
		HTMLDisp = HTMLDisp + '';
   		LoginBox.innerHTML = HTMLDisp;
		
		if(getCookie(sUser) != null){
			document.forms['Security'].txtUserID.value = getCookie(sUser);
			document.forms['Security'].txtPassword.value = getCookie(sPass);
		}
	}
}
function submitLogin(){
	var sSite = window.location;
	document.forms['Security'].siteUrlSec.value = sSite;
	sSite = document.forms['Security'].siteUrlSec.value;
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));
	sSite = sSite.substring(0,sSite.indexOf("."));
	var sUser = sSite + 'User';
	var sPass = sSite + 'Pass';
	
	if(document.Security.savePass.checked == true){
		SetGetCookie(sUser,document.forms['Security'].txtUserID.value);
		SetGetCookie(sPass,document.forms['Security'].txtPassword.value);
		document.forms['Security'].submit();
	}else{
		document.forms['Security'].submit();
	}
}
function DispLogin(){
	var Login = document.getElementById('Login');
	Login.style.display = 'block';
	document.Security.txtUserID.focus();
}
function hideLogin(){
	var Login = document.getElementById('Login')
	Login.style.display = 'none';
}
function isDotNet(){
	var checkDotNet;
	if(document.getElementById('searchform') != null){
		checkDotNet = document.searchform.isDotNet.value.indexOf('aspx');
		if(checkDotNet != -1){
			return '.aspx';
		}else{
			return '.asp';
		}
	}else if(document.getElementById('searchPageform') != null){
		checkDotNet = document.searchPageform.isDotNet.value.indexOf('aspx');
		if(checkDotNet != -1){
			return '.aspx';
		}else{
			return '.asp';
		}	
	}else{
		return '.aspx';
	}
}
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="/javascriptO2/cookies.js">');
document.write('</' + 'script' + '>');
/* ~~~~~~~~~~~~~~~~~~~~[ login function ] ~~~~~~~~~~~~~~~ */
function searchUnderSideNav(){
	if (document.getElementById('subnavEnd')){
		var searchBox = document.getElementById('subnavEnd');
		var HTMLDisp = '';

		HTMLDisp = HTMLDisp + '<form id=\"searchformSideNav\" name=\"SerachForm\" method=\"post\" action=\"Search_10.asp\">';
		HTMLDisp = HTMLDisp + '<div id=\"searchHeader\">ENTER KEYWORD</div>';
		HTMLDisp = HTMLDisp + '<input type=\"text\" name=\"SearchText\" id=\"SearchInputSideNav\" value=\"\"/>';
		HTMLDisp = HTMLDisp + '<input type=\"submit\" id=\"searchsubmitSideNav\" name=\"submitButton\" value=\"Search\" />';
		HTMLDisp = HTMLDisp + '</form>';
		HTMLDisp = HTMLDisp + '';
   		searchBox.innerHTML = HTMLDisp;
	}
}

/* ~~~~~~~~~~~~~~~~~~~~[ Wibiya ] ~~~~~~~~~~~~~~~ */
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="http://cdn.wibiya.com/Toolbars/dir_0587/Toolbar_587729/Loader_587729.js">');
document.write('</' + 'script' + '>');





