// JavaScript Document
// Initialize Page
window.onload = initPage;
/* Open Finance Calculator Window
-------------------------------------*/
function openFinanceWindow() {
	var winl = (screen.width - 570) / 2;
    var wint = (screen.height - 460) / 2;
	window.open('https://195.224.208.145/qq/qq_V0M.asp','_blank','width=570,height=460,top='+wint+',left='+winl+',resizable=no,toolbar=no,menubar=no,scrollbars=yes')
}
/* Open Tutorial Video Window
-------------------------------------*/
function openSTut(str) {
	var winl = (screen.width - 800) / 2;
    var wint = (screen.height - 570) / 2;
	window.open('common/stutPopup.asp?tutorial='+str,'_blank','width=800,height=570,top='+wint+',left='+winl+',scrollbars=no,location=no,toolbar=no,status=no,resizeable=no');
}
/* Open Product Larger View Window
-------------------------------------*/
function openProductImageWindow(imgName) {
	window.open('images/products/largeview.asp?i='+imgName,'_blank','width=400,height=400,resizable=no,toolbar=no,menubar=no,scrollbars=no,status=no')
}
/* Open Special Offer Window
-------------------------------------*/
function openSpecialOfferWindow(str) {
	var winl = (screen.width - 500) / 2;
    var wint = (screen.height - 360) / 2;
	window.open('common/specialOfferPopup.aspx?offer='+str,'_blank','width=500,height=360,top='+wint+',left='+winl+',scrollbars=no,location=no,toolbar=no,status=no,resizeable=no');
}

document.getElementById("QuickSearch1_btnQuickSearch").onclick = checkQuickSearch;

function checkQuickSearch() {
	if(document.getElementById("QuickSearch1_SearchQuick").value.length == 0) {
		alert("Please enter some Search Criteria.");
		return false;
	} else {
		return true;
		document.forms[0].submit();
	}
}
/* Set External Links to load in a new window
-------------------------------------*/
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
/* Product Solutions Tabs
-------------------------------------*/
function showSolution(layerName) {
 for (var i = 1; i < 7; i ++) {
	 document.getElementById('sol-' + i).style.display = "none";
	 document.getElementById('solLink' + i).className = "listItem";
 }
 document.getElementById('sol-' + layerName).style.display = "block";
 document.getElementById('solLink' + layerName).className = "currentPage";
}
/* Trim String
-------------------------------------*/
function Trim(s) {
	// Remove leading spaces and carriage returns
   	while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
   	 { s = s.substring(1,s.length); }
     
	// Remove trailing spaces and carriage returns
	while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
	{ s = s.substring(0,s.length-1); }
   	return s;
}
/* Initialize page on all loads
-------------------------------------*/
function initPage() {
	// External Links
	externalLinks();
	// Hide Solutions List
	if ( document.getElementById("solutionsListMenu") ) {
		toggleSolListVis("solutionsListMenu");
	}
}
/* Generic Hide/Show Elements
-------------------------------------*/
function toggleVis(elname) {
	div = document.getElementById(elname);
	if (div.style.display == 'none') {
		div.style.display = '';
	} else {
		div.style.display = 'none';
	}
}



/* Hide/Show Solution List
-------------------------------------*/
function toggleSolListVis(elname) {
	div = document.getElementById(elname);
	hdr = document.getElementById("solutionlisthdr");
	if (div.style.display == 'none') {
		div.style.display = '';
		hdr.className = 'close';		
	} else {
		div.style.display = 'none';
		hdr.className = 'open';
	}
}