//functions.js
var win = null;
var $currentlyShown = null;

// open a new window
function  openwin(theURL,winName,features) { //v2.0
	if (win && win.open) win.close();
	win = window.open(theURL,winName,features);
}
// jump to a menu
function jumpmenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
//  if (restore) selObj.selectedIndex=0;
}
// redirect to the specified URL
function redirect(theURL) {
  window.location.replace = theURL;
}
function redirect2(URLStr) 
{ location = URLStr; 
}
// check options
function check()
{
var x=document.forms.myForm
 for (var i=0; i <= document.forms.myForm.elements.length-1;i++) {
   if(document.myForm.elements[i].value=="0") {
      x[i].checked=1
   }
   if(document.myForm.elements[i].value=="1") {
      x[i].checked=1
   }

 }
}
// uncheck options
function uncheck()
{
var x=document.forms.myForm
 for (var i=0; i <= document.forms.myForm.elements.length-1;i++) {
   if(document.myForm.elements[i].value=="1") {
      x[i].checked=0
   }
   if(document.myForm.elements[i].value=="0") {
      x[i].checked=0
   }
 }
}

function ECDiv(cDiv)
{
	var cCurrentDisplay;

	cCurrentDisplay = document.getElementById(cDiv).style.display;

	if (cCurrentDisplay == "block")
	{
		document.getElementById(cDiv).style.display = "none";
	}
	else
	{
		document.getElementById(cDiv).style.display = "block";
	}
	if (parent.adjustIFrameSize)
                parent.adjustIFrameSize(window);
}


function ExpandDiv(cDiv)
{
	var cCurrentDisplay;

	cCurrentDisplay = document.getElementById(cDiv).style.display;

	if (cCurrentDisplay == "none")
	{
		document.getElementById(cDiv).style.display = "block";
	}
	if (parent.adjustIFrameSize)
                parent.adjustIFrameSize(window);
}

function CloseDiv(cDiv)
{
	var cCurrentDisplay;

	cCurrentDisplay = document.getElementById(cDiv).style.display;

	if (cCurrentDisplay == "block")
	{
		document.getElementById(cDiv).style.display = "none";
	}

	if (parent.adjustIFrameSize)
                parent.adjustIFrameSize(window);
}


function showOptions($value)
{
 
    $currentlyShown = document.getElementById('form_' + $value);
 
    // Check for invalid selection or no available options.
    if($currentlyShown)
    {
        $currentlyShown.style.display = '';
    }
}
function hideOptions($value)
{
 
    $currentlyShown = document.getElementById('form_' + $value);
 
    // Check for invalid selection or no available options.
    if($currentlyShown)
    {
        $currentlyShown.style.display = 'none';
    }
}


function simpleECDiv($divname,$count,$target)
{

 
	for (var i = 1; i <= $count; i++) {						   

		$currentlyShown = document.getElementById($divname + i);
	    // Check for invalid selection or no available options.
	    if($currentlyShown)
	    {
			
			if( $target == i )
			{
    		    $currentlyShown.style.display = 'block';
				
			}
			else
	    	    $currentlyShown.style.display = 'none';
	    }
	}
 
}

