// JavaScript Document


/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Updated by: Mike Weiner :: http://www.wearebent.com 
Original author: Eric King (eric_andrew_king@hotmail.com)
Last Updated: May 2006

Changes: Added parameters for optional scrollbars, resizablility,
menubar, toolbar, addressbar, statusbar, fullscreen. Also tweaked the
implementation a bit - links will now give the user a popup window
even if JavaScript is disabled.

Notes: Some parameters are not cross-browser capable (e.g. fullscreen).
Browsers that do not support these abilities will ignore them.

Usage: The link is written as follows: 
onclick="newWindow(this.href, 'popup', 600, 500, 1, 1, 0, 0, 0, 1, 0);

Usage Description:
"this.href" refers to the URL given in the "a" tag; "'popup'" is the name of the popup window;
600 is the width of the popup window; 500 is the height of the popup window; the numbers that
follow designate whether a property is turned on ("1") or off ("0"), in this order:
scrollbars, resizable, menubar, toolbar, addressbar, statusbar, fullscreen
*/

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}

var arrayOfRolloverClasses = new Array();
var arrayOfClickClasses = new Array();
var activeRow = false;
var activeRowClickArray = new Array();

function highlightTableRow()
{
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

	if(this!=activeRow){
		this.setAttribute('origCl',this.className);
		this.origCl = this.className;
	}
	this.className = arrayOfRolloverClasses[tableObj.id];
	
	activeRow = this;
	
}

function clickOnTableRow()
{
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;		
	
	if(activeRowClickArray[tableObj.id] && this!=activeRowClickArray[tableObj.id]){
		activeRowClickArray[tableObj.id].className='';
	}
	this.className = arrayOfClickClasses[tableObj.id];
	
	activeRowClickArray[tableObj.id] = this;
			
}

function resetRowStyle()
{
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

	if(activeRowClickArray[tableObj.id] && this==activeRowClickArray[tableObj.id]){
		this.className = arrayOfClickClasses[tableObj.id];
		return;	
	}
	
	var origCl = this.getAttribute('origCl');
	if(!origCl)origCl = this.origCl;
	this.className=origCl;
	
}
	
function addTableRolloverEffect(tableId,whichClass,whichClassOnClick)
{
	arrayOfRolloverClasses[tableId] = whichClass;
	arrayOfClickClasses[tableId] = whichClassOnClick;
	
	var tableObj = document.getElementById(tableId);
	var tBody = tableObj.getElementsByTagName('TBODY');
	if(tBody){
		var rows = tBody[0].getElementsByTagName('TR');
	}else{
		var rows = tableObj.getElementsByTagName('TR');
	}
	for(var no=0;no<rows.length;no++){
		rows[no].onmouseover = highlightTableRow;
		rows[no].onmouseout = resetRowStyle;
		
		if(whichClassOnClick){
			rows[no].onclick = clickOnTableRow;	
		}
	}
	
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}

function GetXmlHttpObject(handler) {
	var objXMLHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		objXMLHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	return objXMLHttp;
}