///////////////////////////////////////////////////////////////////////
//                                                                   //
//     JavaScripts Global Function used on every Page			     //
//                                                                   //
///////////////////////////////////////////////////////////////////////

// Global Constants
	var bCompatile = true;		// Compatible with Javascript 1.1
	var imgDir = "/Images/Nav/";     // Location of images from current page
	var imgPrefix = "img";      // Image Prefix
	var imgSuffix = ".gif";     // Image suffix
	var imgActive = "Off";       // Image Active
	var imgInActive = "On";	// Image Inactive
	var bPreloadPage = false;	// Whether page preloaded or not
	var nChoice;

	var openTimer;
							
	// Check for browser compatibility.
		browserName = navigator.appName;
		browserVersion = parseFloat(navigator.appVersion); 
			
		if (browserName == "Netscape" && browserVersion < 2.0) bCompatile = false;
		 else if (browserName == "Netscape" && browserVersion == 2.0) bCompatile = false;
 		 else if (browserName == "Netscape" && browserVersion >= 3.0) bCompatile = true;
		 else if (browserName == "Microsoft Internet Explorer" && browserVersion <= 2.0) bCompatile = false;
		 else if (browserName == "Microsoft Internet Explorer" && browserVersion >= 3.0) bCompatile = true;
		 else bCompatile = false;

	
// Top banner array
	var arrBanner = new ImageLoader("home", "about", "business", "product", "careers", "contact")
					
function StatusMsg(msgStr) {
// To show the msgStr in the Status Bar
		
		status = msgStr;
		document.returnValue = true;
		//status = "Applying The Web To Your Business"
}

function SetFocus(frmName,fldName) {		
// To set the Cursor on the specified field Name
		document.forms(frmName).item(fldName).focus();
}


function PopUp(sURl, sName, sFeatures) {
// To open a new window

		var newBrowser;

		newBrowser = window.open(sURl, sName, sFeatures);
		newBrowser.focus();		
}

function ShowProdImage(sImageName, sProdName) {
	PopUp("image.asp?img=" + escape(sImageName) + "&prd=" + escape(sProdName), "ProdImages", "WIDTH=450,HEIGHT=300,screenX=400,left=400,screenY=250,top=200,ScrollBars=No,Resizable=yes");
}
// Preloads images from a list of button names.
function ImageLoader() {
	for (var i = 0; i < ImageLoader.arguments.length; i++) {	
		var imgName = ImageLoader.arguments[i];
		eval(imgName + imgInActive + ' = new Image();');
		eval(imgName + imgInActive + '.src = "' + imgDir + imgName + imgInActive + imgSuffix + '";');
		eval(imgName + imgActive + ' = new Image();');
		eval(imgName + imgActive + '.src = "' + imgDir + imgName + imgActive + imgSuffix + '";');
	}
}

// Image swap functions
function rollOver(imgName, overOut) {
	if (bCompatile && bPreloadPage) { 
		switchName = eval(imgName + overOut); 
		document [imgName].src = switchName.src; 
	}
}

function showLayer(layerName) {
	//hideLayers();
	document.all['dropdown_nav_' + layerName + '_div'].style.visibility = "visible";
}

function hideLayers() {
	var oDivs = document.all.tags("div")
	var sDiv;
	for ( iDiv = 0; iDiv < oDivs.length; iDiv++) {
		sDiv = new String(oDivs.item(iDiv).id);
		//if (sDiv != 'dropdown_nav_' + sExcept + '_div') {
		if (sChkLayer(hideLayers.arguments, sDiv)) {
			if (sDiv.substring(0,13) == "dropdown_nav_") 
				document.all[sDiv].style.visibility = "hidden";
		//}
		}
	}	
}

function hideLayersAll() {
	alert("comes here");
	var oDivs = document.all.tags("div")
	var sDiv;
	var iCount = 0;
	
	for (iDiv = 0; iDiv < oDivs.length; iDiv++) {
		sDiv = new String(oDivs.item(iDiv).id);
		if (sDiv != 'dropdown_nav_Products_div') {
			if (document.all[sDiv].style.visibility == 'visible')
				iCount++;
		}
	}
	if (iCount == 0 ) {
		for (iDiv = 0; iDiv < oDivs.length; iDiv++) {
			document.all[sDiv].style.visibility = "hidden";			
		}			
	}	
}

function sChkLayer(args, divtochk ) {
	for (var i = 0; i < args.length; i++) {
		if (divtochk == 'dropdown_nav_' + args[i] + '_div') {
			return false
		}
	}
	return true;
}
function switchOn(rowName) {
	document.all.item('dropdown_nav_' + rowName + '_row').style.backgroundColor = "#000000";
}

function switchOff(rowName) {
	document.all.item('dropdown_nav_' + rowName + '_row').style.backgroundColor = "#999999";
}
function printPage() {
	PopUp(location.pathname + "?print=1", "ProdImages", "WIDTH=600,HEIGHT=600,screenX=100,left=100,screenY=150,top=100,ScrollBars=yes,Resizable=yes");
}
