window.onerror = function(message, url, lineNumber) {
	// code to execute on an error
	// It is important to note that this needs to be commented out during development
	// This code is to prevent any javascript errors that occur because of calls to the partner server

	return true; // prevents browser error messages
};
var agt=navigator.userAgent.toLowerCase();
var is_ie=(agt.indexOf("msie")!=-1);
var is_ie5_5=(is_ie && agt.indexOf("5.5")!=-1);
var is_nav = (!is_ie && agt.indexOf('mozilla')!=-1);

/**********
* Javascript functions to pop up a window with customized features 
**************************/
function Popup(url,w,h,menu) 
{ 
	x = Math.floor((screen.width - w) / 2); 
	y = Math.floor((screen.height - h) / 2); 
	
	features = "screenx="+x+",screeny="+y+",left="+x+",top="+y+",width="+w+",height="+h+",location=no,resizable=yes"+",directories=no,status=no"; 
	if (menu != null)
	 { 
	 features += ",menubar=no,toolbar=no, scrollbars=yes"; 
	 } 
	else 
	{ 
	features += ",menubar=no,toolbar=no,scrollbars=no"; } 
	window.open(url,"newwin",features); 
}
/**********
 * Changes the css style and events for buttons
 **************************/
//button class name constants
var OUTER = "Outer";
var INNER = "Inner";
var PRIORITY = "Priority";
function btnOn(id){
	var linkRef = document.getElementById(id);
	if (linkRef){
		changeBtnClass(id,"On");
		linkRef.onfocus = function(){ changeBtnClass(id,"Over") } ;
		linkRef.onblur = function(){ changeBtnClass(id,"On") } ;
		linkRef.onmouseover = function(){ changeBtnClass(id,"Over") 

		} ;
		linkRef.onmousedown = function(){//need to also clear onfocus and blur on mousedown for mozilla/firefox conflicts
			if (!is_ie){
				document.getElementById(id).onfocus=null;
				document.getElementById(id).onblur=null;
			}
			changeBtnClass(id,"Down");
		} ;
		linkRef.onmouseup = function(){ 
			changeBtnClass(id,"On") 
		};
		linkRef.onmouseout = function(){ //need to also reset onfocus and blur on mousedown for mozilla/firefox conflicts
			changeBtnClass(id,"On");
			if (!is_ie){
				document.getElementById(id).onfocus = function(){changeBtnClass(id,"Over")};
				document.getElementById(id).onblur= function(){changeBtnClass(id,"On")};	
			}
		} ;
		linkRef.onclick = linkRef.inlineonclick; 
	}
 }
 
 function btnOff(id) {
	var linkRef = document.getElementById(id);
	if (linkRef){
		changeBtnClass(id,"Off");

		linkRef.onfocus = null;
		linkRef.onblur = null;
		linkRef.onclick = function(){return false;};
		linkRef.onmouseover = null;
		linkRef.onmousedown = null ;
		linkRef.onmouseup = null;
		linkRef.onmouseout = null;	
	}
 }
 
function changeBtnClass(id,state){
	var btn = document.getElementById(id + OUTER);
	if (btn){
		 var prty = document.getElementById(id+PRIORITY);
		 if (prty) prty.className = "priority"+state;
		 btn.className = "btn" + state;
		 var innerBtn = document.getElementById(id+INNER);
		 if (innerBtn) innerBtn.className = "btn" + state + INNER;
	}
}

function btnInit(id,priority,on,setwidth,mozmargin){
	var linkRef = document.getElementById(id); //get a tag link
	if (linkRef){
		var txt = linkRef.firstChild.nodeValue; //get text in link

		var oswidth = linkRef.offsetWidth; //buttons may need to be same width for design, if so, pass width size
		var padding =  12; //add extra width padding
		var width = (setwidth) ? setwidth : oswidth + padding; //get width of link, and add padding

		linkRef.firstChild.nodeValue = " "; //erase text link
		linkRef.className = "btnLink"; 
		linkRef.style.width = width; //reset link width
		if (mozmargin) {
			if (!is_ie) linkRef.style.marginRight = mozmargin + "px"; //mozilla firefox need extra margin due to floating left a
		} else {
			if (!is_ie) linkRef.style.marginRight = "6px"; //mozilla firefox need extra margin due to floating left a
		}
		
		//writing out this structure <a href="#"><div><div></div></div></a>
		//double divs for additional borders
		var outerDiv = document.createElement("div"); 
		outerDiv.id = id + OUTER;
		outerDiv.style.width = width + "px";
		
		var innerDiv = document.createElement("div");
		innerDiv.id = id + INNER;
		innerDiv.style.width = (width - 2) + "px";

		outerDiv.appendChild(innerDiv);
		innerDiv.appendChild(document.createTextNode(txt));
		
		//if button has priority, add another wrapper div
		if (priority){
			var priorityDiv = document.createElement("div");
			priorityDiv.id = id + PRIORITY;
			priorityDiv.className = "priorityOn";
			priorityDiv.style.width = (width + 2) + "px";
			priorityDiv.appendChild(outerDiv);
			linkRef.appendChild(priorityDiv);
		}
		else linkRef.appendChild(outerDiv);
		
		//hold on to inline onclick on the original link
		if (linkRef.inlineset!=true) {
			linkRef.inlineonclick = linkRef.onclick; 
			linkRef.inlineset = true;
		}
		on ? btnOn(id) : btnOff(id); //set button states
	}
}
//HIDE/SHOW LAYERS
function toggleLayer(whichLayer, action)
{
	if (document.getElementById)
	{
	// this is the way the standards work
	var style = document.getElementById(whichLayer).style;
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style = document.all[whichLayer].style;
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style = document.layers[whichLayer].style;
	}
	if (action=="show")
		style.display = "block";
	else if (action=="hide")
		style.display = "none";
}

function QueryString(k) {
	this.qstring = new Array;
	var current_qstring = window.location.search;
	var trimmed_qstring = current_qstring.substring(1)
	var args = trimmed_qstring.split('&');
	for (var i=0;i<args.length;i++){
		var pair = args[i].split('=');
		var key = decodeURIComponent(pair[0]);
		var val = decodeURIComponent(pair[1]);
		qstring[key] = val;
	}
	return qstring[k];
}

google_ad_client = "pub-6098480201087834";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003366";
google_color_text = "000000";
google_color_url = "38B63C";