// JavaScript Document

/* Popup Window Using a Link */
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}

	if(pos=="center")
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	} 
	else if((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=0;TopPosition=20
	}
	
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';win=window.open(mypage,myname,settings);
}

/* Use This For Mailing List Form Submit */
function submitFormPopup(myForm, windowName)
{
	if (! window.focus)return true;
	window.open('', windowName, 'height=400,width=500,scrollbars=yes');
	myForm.target=windowName;
	return true;
}

/** print page **/
function printpage() {
	window.print();  
}

/** toggle div **/
function toggleDisplay(targetId)
{
    if (document.getElementById) 
	{
        target = document.getElementById(targetId);
    	if (target.style.display == "none")
		{
    		target.style.display = "";
    	} else {
    		target.style.display = "none";
    	}
    }
}

// toggle visibility 
function toggleVisibility(targetId) 
{
    if (document.getElementById) 
	{
        target = document.getElementById(targetId);
    	if (target.style.visibility == "hidden")
		{
    		target.style.visibility = "visible";
    	} else {
    		target.style.visibility = "hidden";
    	}
    }
}

// Jump Select (Dropdown) Menu
function JumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popitup(url, w, h)
{
	newwindow=window.open(url,'name','height=h,width=w');
	if (window.focus) {newwindow.focus()}
	return false;
}

/** place focus on first input of form **/
function placeFocus() {
if (document.forms.length > 0) {
	var field = document.forms[0];
	for (i = 0; i < field.length; i++) {
		if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
			document.forms[0].elements[i].focus();
		break;
         }
      }
   }
}