/**********************************************************************************/
// Common Javascript Functions
// Created by: Lynx Technical Solutions - Erica Lahoda
/**********************************************************************************/

// JavaScript Document
var browserName=navigator.appName; 

//DEFINE GRAPH VALUES [Item name, absolute value]
var graphimage="/images/poll.gif";
var graphx=new Array();
var graphy=new Array();
var graphz=new Array();

/**********************************************************************/
// m_sfcon: Email Function 
// Description: the email account name is passed in, then parsed onto 
//   the domain for this web site, then launched using the 'mailto' 
//   link. This is to help prevent bots from scouring a web page to 
//   find email addresses, since it is broken up into pieces in this 
//   function
/**********************************************************************/
function m_sfcon (u) {
pre = "mail";
url = pre + "to:" + u;
document.location.href = url + "@lynxts.com";
}



/**********************************************************************/
// change_css_style(selectionobject)
// Description: reloads the page with a different CSS Style option,
//   based on what was selected in the passed object (drop down, list)
/**********************************************************************/
function change_css_style(obj) {
	
	var stylenum = obj.value;
	var sPath = window.location.pathname;
	sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

	if (stylenum != '') {
		window.location = sPage + '?css=' + stylenum;
	}
}

//window.onload=showmenu;
function showmenu(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}


function runLynxSearch()
{
	var strText;
	
	strText = document.getElementById("txtSearchMe").value;
	strText = escape(strText);
	
	window.location = "/search.php?srch=" + strText;
	
}

function checkLynxSearch(e)
{
	
		var keyNum;

		if(window.event) // IE
		{
			keynum = e.keyCode;
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
			keynum = e.which;
		}      
		
		if (keynum == 13)
			{
			return runLynxSearch();
			}
	
}




//JavaScript Graph-it! (Absolute)- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use
function graphit(g,gwidth,usemax,valuedec){
	var total=0.00;
	var maxamount = 0.00;
	var curvalue = 0.00;
	
	for (i=0;i<g.length;i++) {
		total+=g[i][1];
		if (g[i][1] > maxamount)
			maxamount = g[i][1];
	}

	var divisor = 0.00;
	if (usemax == 1) {
		divisor = maxamount;
	} else {
		divisor = total;
	}
	
	output='<table class="tableClear">\n';
	for (i=0;i<g.length;i++){
		curvalue = g[i][1];		
		calpercentage=Math.round(g[i][1]*100/divisor);
		calwidth=Math.round(gwidth*(calpercentage/100));
		output+='<tr><td>'+g[i][0]+'&nbsp;</td><td><img src="'+graphimage+'" width="'+calwidth+'" height="12"></td><td align="right">&nbsp;&nbsp; '+curvalue.toFixed(valuedec)+'</td></tr>';
	}
	output+='</table>';
	output+='<br />Total: <b>'+total.toFixed(valuedec)+'</b>';
	document.write(output);
}