/**
 *
 *
 * @version $Id: ClientFunctions.js,v 1.5 2007/10/09 01:11:58 NOgbourne Exp $
 * @copyright 2007
	Code loads page selected, based on the id of the passed object.
	A file to be referenced in the load is optional
	@param object objPage The control passed
	@param strDocToLoad - a document to be loaded
	*/
/**
 *
 * @access public
 * @return void
 **/
function iframePrint(){
   if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')
   {
   document.contentIframe.focus();
   document.contentIframe.print();
   }
   else
   {
   window.frames['contentIframe'].focus();
   window.frames['contentIframe'].print();
   }
    return;
   }
function SwitchButtonImage(myid,strMouseAction)

/*
	function swaps an image based on the name of the src object
 */
 {
	var strSwitch = "idimg" + myid.substr(4);	// compile the id for the image
	var strsrc = new String (document.getElementById(strSwitch).src); // get its source
	var intpng = strsrc.indexOf(".png");
	if (strMouseAction == "over")
	{
		var strNewAction = strsrc.substr(0,intpng)+"OVR.png";
		document.getElementById(myid).style.color="Red";
	}
	if (strMouseAction == "out")
	{
		var strNewAction = strsrc.substr(0,intpng-3)+".png";
		document.getElementById(myid).style.color="Black";
	}
	document.getElementById(strSwitch).src = strNewAction;

 }

function ChangePageHeader(strHeader)
{
	// function saves document title in the page header frame
   // self.parent.frmBdy.
   //alert (self.parent.document.getElementById("tdHeader").innerHTML);
	self.parent.document.getElementById("spanheader").innerHTML= strHeader;
}

function LoadPage (objPage)
{
   	self.parent.frmBdy.location.href=objPage.id+".php";
}


/**
 * function chnages colour of expander character and the character itselfg
 * based on its class
 * @access public
 * @return void
 **/
function SwitchExpander(objExpander){
  if (objExpander.className=='expanderover') {
    objExpander.className='expander';
  }
  else
  {
    objExpander.className='expanderover';
  }
}
/**
 *
 * @access public
 * @return void
 **/
function ShowLinks(objExpander){

  // compile name of conbtaing div
  var strTextContent = objExpander.innerHTML;
  strDivExpID = "div"+objExpander.parentNode.id;
  // Get pointer to it
  var strDivExp = document.getElementById(strDivExpID);
  // If it is closed, open it
  // The undefined value is a fiox for and IEbug!
  switch(strTextContent){
    case '+':
      objExpander.innerHTML  = "-";
      strDivExp.style.display = "block";
      break;
    case '-':
      objExpander.innerHTML  = "+";
      strDivExp.style.display = "none";
      break;
    default:
      objExpander.innerHTML  = "-";
      strDivExp.style.display = "block";
      break;
  } // switch
  //alert (objExpander.textContent);
}
function LoadInFrameSet(strMasterFrame)
/*
Ref "Using JavaScript" McFredies P397
			"JavaScript & DHTML CookBook" Goodman p179
 */
{
		if (top == self)
		{
			// Store URL of calling page
			// and the url of this page
			var orphanurl = self.location.href;
			// build reframed url
			var reframeurl = strMasterFrame + "?" + orphanurl;
			// redirect to that address
			// use replace if possible
			var blnisVar4 = (navigator.appname == "Netscape" &&	parseInt(navigator.appVersion) == 4)
			if (parent == window)
			{
			// If this is an NN4 printing frame, don't do anything
			if (!blnisVar4 || (blnisVar4 && window.innerWidth !=0))
			{
				if (location.replace)
				{
					location.replace(reframeurl);
				}	// if (location.replace)
				else
				{
					location.href = reframeurl;
				}// if (location.replace)
			}	// (!blnisVar4 || (blnisVar4 && window.innerWidth !=0))
		}	// (parent == window)
	}	// if (top == self)
}
