
// Browser Sniffer
// sniffer_version = "1.0"
var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

// *** BROWSER VERSION ************************************************************
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);

var iePos  = appVer.indexOf('msie');
if (iePos !=-1) {
   is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
   is_major = parseInt(is_minor);
}              

var is_getElementById   = (document.getElementById) ? "true" : "false";
var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false";
var is_documentElement = (document.documentElement) ? "true" : "false";

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

if ((navigator.vendor) && ((navigator.vendor=="Netscape6") || (navigator.vendor=="Netscape")) && (is_nav)) {
   is_major = parseInt(navigator.vendorSub);
   is_minor = parseFloat(navigator.vendorSub);
}

var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up 	= (is_nav && is_minor >= 4); 
var is_navonly	= (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
var is_nav6up 	= (is_nav && is_minor >= 6);
var is_nav5up 	= (is_nav && is_minor >= 5);
var is_nav7up 	= (is_nav && is_minor >= 7);
var is_ie   	= ((iePos!=-1));
var is_ie4   = (is_ie && is_major == 4);
var is_ie4up 	= (is_ie && is_minor >= 4);
var is_ie5up 	= (is_ie && is_minor >= 5);
var is_ie6up 	= (is_ie && is_minor >= 6);

// *** PLATFORM *******************************************************************	
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));  
var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1) || (agt.indexOf("windows 2000")!=-1));
var is_winxp = ((agt.indexOf("windows nt 5.1")!=-1) || (agt.indexOf("windows xp")!=-1));
var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
var is_win32 = (is_win95 || is_winnt || is_win98 || ((is_major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
var is_mac   = (agt.indexOf("mac")!=-1);

//Sets a JS variable for SSL pages for image paths etc.
var http_type;
http_type="http";

if(document.location.href.split(":")[0]=="https")
{
	http_type="https";
}


//Writes correct style sheet into page
//NOTE: legacy=1 is for ie4 and ns4 on a mac....all other browsers use style.css
var stylesheet="styles.asp";

if (is_mac)
{
	if (is_nav4)
	{
		stylesheet="styles.asp?legacy=1";
	}
	else if (is_ie4)
	{
		stylesheet="styles.asp?legacy=1";
	}
}

document.write('<link rel="stylesheet" type="text/css" media="screen" href="/template/includes/'+stylesheet+'" />');
document.write('<link rel="stylesheet" type="text/css" media="print" href="/template/includes/print_styles.asp" />');


//Image Rollover Function
function rollOver(img_name, img_src)
{
	if (document.images)
	{
		document [img_name].src = img_src;
	}
}

//General Purpose popUp Script
//usage: (#, #, 'name', 'url', 1/0, 1/0) where the last 2 parameters must be a 1 or 0.
function popUpWindow (window_width, window_height, window_name, window_url, _resizeable, _scrollbars )
{
	var options="resizable="+_resizeable+",scrollbars="+_scrollbars+",width="+window_width+",height="+window_height+"";
	popupWin=window.open(window_url, window_name, options);
	return false;
}

//General Read Cookie Function
function getCookie(name) 
{
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) 
	{
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} 
	else
	{
		begin += 2;
		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
		end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
	}
}

//directs the browser that opened the popup to the specified link
//usage: openerLink('URL STRING');
function openerLink(link_location)
{
	opener.location.href=link_location;
	return false;
}

function clearSearchBox()
{
	if(document.header_search_form.q.value=="Enter Your Search Here")
	{
		document.header_search_form.q.value="";
	}
}


//LQ Auto tabbing Functions
function isNumericLQ()
{
	if (is_nav)
	{
		return;
	}
	else
	{
		get=event.keyCode;
		if((get>47&&get<58)||(get==8)||(get==9)) 
		{
			return true;
		}
		else
		{
			event.returnValue=false;
		}
	}
}

function AutoTabLQ(hItem, maxLength, linkItem )
{	
	isNumericLQ();
	if (is_mac)
	{
		return;
	}
	else
	{
		var vKeyCode,oItem;
		oItem = eval(linkItem);	
		vKeyCode = window.event.keyCode
		if(vKeyCode==9 && window.event.shiftKey){ return; }
		switch(window.event.keyCode)
		{
			case 37 : return;
			case 39 : return;
			case 16 : return;
			case 46 : return;
		}
		if (window.event.keyCode != 9 )
		{
			if( typeof(oItem) == "object" )
			{					
				if(bAutotab && (String(oItem.value).length ==0) && (String(hItem.value).length == maxLength) && (window.event.keyCode != 8))
				{
					oItem.focus();
				}
			}
		}
	}
	bAutotab = true;
}

bAutotab = true;
function stopAutoTabLQ()
{
	bAutotab = false;
}


// Flash Player version sniffer
var flashTargetMajor = 7;
var flashTargetMinor = 0;	// The release number (example where 79 is the minor version: 6,0,79,0) - leave as 0 if uncertain

var hasFlash = false,
    hasActiveX = false,
    navPlugins = (navigator.plugins.length > 0),
    ieVer = parseFloat(navigator.appVersion.split("MSIE")[1]);

var fullVersion, majorVersion, minorVersion;

if(navPlugins || (is_ie && is_mac && ieVer >= 5)) {
	var plugin = navigator.plugins["Shockwave Flash"];
	var pluginDescription = plugin.description.split(" ");
	for(var i=0; i<pluginDescription.length; i++) {
		if(!isNaN(parseInt(pluginDescription[i]))) {
			majorVersion = parseInt(pluginDescription[i]);
			minorVersion = parseInt(plugin.description.split("r")[1]);
			break;
		}
	}
	if(majorVersion >= flashTargetMajor && minorVersion >= flashTargetMinor) hasFlash = true;
}
else if(is_win && is_ie) {
	document.write('<script language="VBScript"\>\n');
	document.write('function isHere(chk)\n');
	document.write('  isHere = false\n');
	document.write('  on error resume next\n');
	document.write('  if ScriptEngineMajorVersion > 1 then\n');
	document.write('    isHere = IsObject(CreateObject(chk))\n');
	document.write('  end if\n');
	document.write('end function\n');
	document.write('</script\>');

	//try {
		hasActiveX = isHere("msxml");
		if (!hasActiveX) {
			hasActiveX = isHere("Microsoft.ActiveXPlugin.1");
		}
	//} catch(e) {
	//	hasActiveX = false;
	//}
	
	if(hasActiveX) {
		for(var i=2; i<=flashTargetMajor; i++) {
			if(isHere("ShockwaveFlash.ShockwaveFlash."+i)) majorVersion = i;
		}
	}
	minorVersion = 0;
	if(majorVersion >= flashTargetMajor) hasFlash = true;
}
fullVersion = majorVersion+",0,"+minorVersion+",0";