<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->


function browseCap() 
{
	this.browser = navigator.appName;
	this.platform = "other";
	this.version = null;
	this.bcVersion = 20030616;
	this.aol = false;
	this.seed = seedBrowseCap;
	this.seed();
}

function seedBrowseCap()
{
	//define our regular expressions
	var ua = navigator.userAgent;
	var Win = /win/i;
	var Mac = /mac/i;
	var IE = /(MSIE )([0-9]{1}\.[0-9]{0,2})/i;
	var zilla = /(zilla\/)([0-9]{1,2}\.[0-9]{0,2})/i;
	var Netscape = /(netscape[0-9]?\/)([0-9]?\.[0-9]{0,2})/i;
	var safari = /safari/i;
	var aol = /(aol )([0-9]?\.[0-9]{0,2})/i;
	
	//perform our base pattern matches
	if (Win.test(ua)) { this.platform = "Windows"; }
	if (Mac.test(ua)) { this.platform = "Mac"; }
	if (navigator.appName == 'Netscape') { this.browser = "Netscape"; }
	if (safari.test(ua)) { this.browser = "Safari"; this.version = 1; }
	if (IE.test(ua)) { this.browser = "IE"; }
	if (aol.test(ua)) { this.aol = true; }
	//get our version numbers
	if ( this.browser == "Netscape" )
	{
		answerArray = ua.match(zilla);
		this.version = answerArray[2];
		if (parseInt(this.version) == 5)
			{
			answerArray = ua.match(Netscape);
			if (!answerArray) return;
			if (answerArray.length > 2) { this.version = answerArray[2]; }
			}

	}
	if (this.browser == "IE" )
	{
		answerArray = ua.match(IE);
		this.version = answerArray[2];
	}
}
var bc = new browseCap();

function printMe()
{
	if (bc.platform == "Mac" && bc.browser == "IE")
	{
		var Msg = 'To print this page, please press the Apple + P keys on your keyboard.';
		alert(Msg);
	}
	else
	{
		window.print();
	}
}

/*
startList = function() {
	if (document.all&&document.getElementById) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
*/

function popup_image(url, w, h)
{
	var width= w + 60;
	if (h <= 600)
	{
		var height = h + 50;
		var scroll = 'no';
	}
	else 
	{
		var height= 550;
		var scroll = 'yes';
	}
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;
	window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,scroll=auto,menubar=no,scrollbars=' + scroll + ',resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top);
	return false;
}

function popUp(url, w, h, scroll)
{
	if (scroll == '') scroll = 'no';
	var width= w + 20;
	if (h <= 600) 
		var height = h + 40;
	else 
		var height = 650;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;
	window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,scroll=auto,menubar=no,scrollbars=' + scroll + ',resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top);
	return false;
}

/*Used in search field*/
function searchtext(state)
{
	var sb = document.getElementById('sp-q');
	if(state == 'on') {sb.value = '';}
	if(state == 'off') {}
}

function searchtext404(state)
{
	if(state == 'on') {document.search.elements['sp-q'].value = '';}
	if(state == 'off') {}
}

/*Test Systems - check/uncheck all*/ 
function checkedAllCheckboxes (id, checked)
{
	var el = document.getElementById(id);
	for (var i = 0; i < el.elements.length; i++)
	{
		el.elements[i].checked = checked;
	}
}
function verifyFormTestSystem(id)
{
	var el = document.getElementById(id);
	var err = 1;
	for (var i = 0; i < el.elements.length; i++)
	{
		if (el.elements[i].checked == true) err = 0;
	}
	if (err != 0)
	{
		window.alert("Please select at least one item of interest!");
		return false;
	}
}

/*****************************************************/
function findObj(n, d)
{ //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length)
	{
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHide()
{ //v6.0
	var i,p,v,obj,args=showHide.arguments;
	for (i=0; i<(args.length-2); i+=3)
	if ((obj=findObj(args[i]))!=null)
	{
		v=args[i+2];
		if (obj.style)
		{
			obj=obj.style; 
			v=(v=='show')?'':(v=='hide')?'none':v;
		}
		obj.display=v;
	}
}
/* Registration */
function displayProducts(obj, max)
{
	selectedID = obj.options[obj.selectedIndex].value;
	if (selectedID == 0)
	{
		document.getElementById('prod_table').style.display = 'none';	
	}
	else
	{
		document.getElementById('prod_table').style.display = 'block';	
		for (i=1; i <= max; i++ )
		{
			bodyID = 'prod_row'+i;
			if (i <= selectedID)
			{
				document.getElementById(bodyID).style.display = 'block';
			}
			else
			{
				document.getElementById(bodyID).style.display = 'none';
			}
		}
	}
}


/*****************************************************/

function swapHtml(id, string1, string2)
{
	if (document.getElementById(id).innerHTML == string1)
	{
		document.getElementById(id).innerHTML = string2;
	}
	else
	{
		document.getElementById(id).innerHTML = string1;
	}
}


function scrollSubnav(navId) 
{
	$('#scroll-left').toggle();
	$('#scroll-right').toggle();
	$(navId +' div').animate({'left': -235}, 'fast');
	return false;
}

function unscrollSubnav(navId) 
{
	$('#scroll-left').toggle();
	$('#scroll-right').toggle();
	$(navId + ' div').animate({'left': 0}, 'fast');
	return false;
}

/*
 * Cookies Functions
 */
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
