// JavaScript Document

function tab_swap(listID, listID2)
{
	alert(listID);
	listID.style.display='none';
	listID2.style.display='';
}

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_changeProp(objName,x,theProp,theValue)
{ //v6.0
  	var obj = MM_findObj(objName);
  	if (obj && (theProp.indexOf("style.")==-1 || obj.style))
	{
		if (theValue == true || theValue == false) eval("obj."+theProp+"="+theValue);
	else 
		eval("obj."+theProp+"='"+theValue+"'");
  	}
}

function changeProp(objName,x,theProp,theValue,objName2,theValue2) 
{ //v6.0
  	var obj = MM_findObj(objName);
  	var obj2 = MM_findObj(objName2);
  	if (obj && (theProp.indexOf("style.")==-1 || obj.style))
	{
		if (theValue == true || theValue == false)
		{
			eval("obj."+theProp+"="+theValue);
			eval("obj2."+theProp+"="+theValue2);
		} 
		else 
		{
	  		eval("obj."+theProp+"='"+theValue+"'");
	  		eval("obj2."+theProp+"='"+theValue2+"'");
		}
  	}
}

function MM_goToURL()
{ //v3.0
	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Auto Tab for Phone Number
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) 
	{
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	function containsElement(arr, ele) 
	{
		var found = false, index = 0;
		while(!found && index < arr.length)
		if(arr[index] == ele)
			found = true;
		else 
			index++;
		return found;
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)
			index = i;
		else 
			i++;
		return index;
	}
	return true;
}

function action(url)
{  
   document.form1.action = url;
   document.form1.submit();
}

function checkUncheckAll(theElement)
{
	var theForm = theElement.form, z = 2;
    while (theForm[z].type == 'checkbox') {
    	theForm[z].checked = theElement.checked;
    	z++;
     }
}
