function PrintPage()
{
	if (window.print != null) 
	{ 
		window.print(); 
	} 
	else 
	{ 
		alert('Cannot print using this function.  Please select Print from the File menu.'); 
	}
}
    //function to limit form field size
function limitChars(myField,myLimit)
{
  if (myField.value.length>=myLimit)
  {
    alert("This field allows only " + myLimit + " characters.");
    myField.value=myField.value.substring(0,myLimit);
    myField.focus();
    return false;
  }
  else
    return true;

}

function ConfirmDelete(sText,param)
{
    if (confirm(sText))
    {
        window.location=param;
    }
    else
    {
        return;
    }
}
/*this function in generic util.js
function HideEmail(user,dnsname)
{
    document.write("<a href=" + "mail" + "to:" + user + "@" + dnsname + ">" + user + "@" + dnsname + "</a>");
}
*/
    //function to print the page
function PrintPage()
{
    if (window.print != null)
    {
        window.print();
    }
    else
    {
        alert('Cannot print using this function.  Please select Print from the File menu.');
    }
}

    //function to popup new window takes a page as a parameter
function popUp(pPage, wd, ht)
{
  newWin = window.open(pPage,'popWin','resizable=0,scrollbars=1,toolbar=0,width='+ wd +',height='+ ht +',screenX=30,screenY=40,top=30,left=40');
  newWin.focus();
}

    //function to swap images
/*this function in generic util.js
function Show(scene,imgname)
{
document.images[scene].src = eval(imgname + ".src");
}
*/
         //code below to do expand stuff
var agt=navigator.userAgent.toLowerCase();

var is_ie;

if((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1))
{
  is_ie = true;
}
else
{
  is_ie = false;
}

function initIt()
{
    if( is_ie == true ){
        tempColl = document.all.tags("DIV");
    }
    else{
        tempColl = document.getElementsByTagName('DIV');
    }

    for (i=0; i<tempColl.length; i++)
    {
        if (tempColl[i].className == "child")
        {
            tempColl[i].style.display = "none";
        }
    }
}

function expandIE(el,divID)
{
    if( is_ie )
        whichEl = eval(el + "Child");
    else
        whichEl = document.getElementById(el + 'Child');

    if (whichEl.style.display == "none"){
        whichEl.style.display = "block";
    }
    else{
        whichEl.style.display = "none";
    }

}

function expandIT()
{
    if( is_ie == true ){
        tempColl = document.all.tags("DIV");
    }
    else{
        tempColl = document.getElementsByTagName('DIV');
    }
    for (i=0; i<tempColl.length; i++)
    {
       if (tempColl[i].className == "child")
       {
   	    if (tempColl[i].style.display == "none"){
          	 tempColl[i].style.display = "block";
				 replaceButtonText('btnShow','Hide subject details')
          }
          else{
             tempColl[i].style.display = "none";
				 replaceButtonText('btnShow','Show subject details')
          }
        }
    }

}

function replaceButtonText(buttonId, text)
{
  if (document.getElementById)
  {
    var button=document.getElementById(buttonId);
    if (button)
    {
      if (button.childNodes[0])
      {
        button.childNodes[0].nodeValue=text;
      }
      else if (button.value)
      {
        button.value=text;
      }
      else //if (button.innerHTML)
      {
        button.innerHTML=text;
      }
    }
  }
}

function onLoadPage()
{
    initIt();
}

function getURLParameters() 
{
	var sURL = window.document.URL.toString();
	
	if (sURL.indexOf("#") > 0)
	{
		sURL = sURL.substring(0,sURL.indexOf("#"));
	}
	
	if (sURL.indexOf("?") > 0)
	{
		var arrParams = sURL.split("?");
			
		var arrURLParams = arrParams[1].split("&");
		
		var arrParamNames = new Array(arrURLParams.length);
		var arrParamValues = new Array(arrURLParams.length);
		
		var i = 0;
		for (i=0;i<arrURLParams.length;i++)
		{
			var sParam =  arrURLParams[i].split("=");
			arrParamNames[i] = sParam[0];
			
			if (sParam[1] != "")
				arrParamValues[i] = unescape(sParam[1]);
			else
				arrParamValues[i] = "No Value";
		}
		
		for (i=0;i<arrURLParams.length;i++)
		{
			highLight(arrParamValues[i],sParam[0]);
		}
	}
	else
	{
		return; //alert("No parameters.");
	}
}
function highLight(thisone,thisarea)
{
	m2 = thisarea; //'internat'; //'nav2xc';

	if (document.getElementById && document.createElement) 
	{ 
		m2 = document.getElementById(m2).getElementsByTagName('a');  
	}
	 
	curH1= thisone; //Trim(n2[0].innerHTML)
	var i;
	for (i = 0; i < m2.length; i++) 
	{
		pgMnuIem = m2[i].id;

		if (curH1.toLowerCase() == pgMnuIem.toLowerCase())
		{
			//alert('Match')
			m2[i].style.fontWeight = 'bold';
			m2[i].style.backgroundColor = '#ccc';
		}
	}
}