function handleParent(parentId) {
	myParent = document.getElementById("menu" + parentId);
	myImg = document.getElementById("img" + parentId);
	
	if (myParent.style.display=="none") {
		myParent.style.display="block";
//		myImg.src = "/MHS/ICORE/images/univ/minus.gif";
	} else {
		myParent.style.display="none";
//		myImg.src = "/MHS/ICORE/images/univ/plus.gif";
	}
}

leftmenu = 0;
submenu = 0;

function context() {
	if (tester['leftmenu']){
		//eval("img" + tester['leftmenu']).src = "/MHS/ICORE/images/univ/minus.gif";
		//MM_findObj("img" + tester['leftmenu']).src = "/MHS/ICORE/images/univ/minus.gif";
		//eval("topic" + tester['leftmenu']).className='LeftExp';
		MM_findObj("topic" + tester['leftmenu']).className='LeftExp';
//		eval(tester['leftname']).className='LeftExp';
		
		//if (tester['sub'] != 'none') eval(tester['sub']).style.fontWeight='bold';
		if (tester['sub'] != 'none') MM_findObj(tester['sub']).style.fontWeight='bold';
		//if (eval("top.menu" + tester['leftmenu'])) eval("menu" + tester['leftmenu']).style.display='';
		if (MM_findObj("menu" + tester['leftmenu'])){ 
			MM_findObj("menu" + tester['leftmenu']).style.display='';
		}
	}
}


function contextOld() {
//	alert("Wokka WOKKA!");
	if (tester['leftname']){
	//	alert(tester['leftname']);
//		eval("img" + tester['leftmenu']).style.display="block";
		eval("img" + tester['leftmenu']).src = "/MHS/ICORE/images/univ/minus.gif";
//		eval(tester['leftname']).style.color='yellow';
		eval(tester['leftname']).className='LeftExp';
		
		if (tester['sub'] != 'none') eval(tester['sub']).style.fontWeight='bold';
		eval("menu" + tester['leftmenu']).style.display='';
	}
}

function getArgs() {
	var args = new Object();
	var query = location.search.substring(1);
//	alert(query)
	var pairs = query.split("&");
//	alert(pairs[2]);

	for (var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var name = pairs[i].substring(0, pos);
//		alert(name);
		var value = pairs[i].substring(pos+1);
		if (typeof(args[name]) == "undefined") {
			args[name] = unescape(value);
		} else {
			args[name] += ':';
			args[name] += unescape(value);
		}
	}
	return args;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
		obj.visibility=v; }
}

function P7_autoLayers() { //v1.4 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;a=parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(var u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.visibility="hidden";}}for(k=1;k<args.length;k++){
 if((g=MM_findObj(args[k]))!=null){b=(document.layers)?g:g.style;b.visibility="visible";f=false;
 for(var j=0;j<p7c[a].length;j++){if(args[k]==p7c[a][j]) {f=true;}}
 if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}

function P7_Snap() { //v2.63 by PVII
 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
	ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
	w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
	x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
	dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
	break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
	xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}

function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
}

function hideLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"none";
}
}


function change(id, newClass) {

identity=document.getElementById(id);

identity.className=newClass;

}

/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

var contractsymbol='- ' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='+ ' //HTML for expand symbol.


if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate
inc++
}
revivestatus()
}


function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit) 
ccollect[inc].style.display="none"
inc++
}
}

function opencontent(show){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id==show) 
ccollect[inc].style.display="block"
inc++
}
}

function closecontent(thisone){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id==thisone) 
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

/* in order to NOT collapse previous content, for second-level expanding divs */

function expandcontent2(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
	var show
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (show === undefined && enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
if (show != undefined) {
opencontent(show) }
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

function changeClass(nama) { 
if(nama.id=='tdn0') { nama.style.backgroundColor = '#ff0000'} 
else if (nama.id=='tdn1') { nama.style.backgroundColor = '#0000ff'} 
return true; 
} 
function returnClass(nama) { 
nama.style.backgroundColor = '#ffffff'; 
return true; 
} 

function createNewWindow(url)
{
NewWindow1 = window.open(url, "help",
'toolbar=0,menubar=0,scrollbars=yes,location=0,status=0,resizable=yes,width=400,height=300,left=0,top=100')
}

function createNewWindow2(url)
{
//alert("This page will appear in a new window. Please close it to return to the main site.");
NewWindow2 = window.open(url, "window");
}

function createNewWindow3(url)
{
NewWindow3 = window.open(url, "tour",
'toolbar=0,menubar=0,scrollbars=no,location=0,status=0,resizable=yes,width=790,height=558,left=0,top=0')
}


function closeNewWindow(url)
 {
NewWindow=window.close(url, "help")
}

function message() {
		if (confirm("Are you sure you want to leave this page? You will lose all your information, as it has not been saved.")==false) {
				location.href="trf5_2.htm";
		}
}


/* added by Adrienne, November 2005 */

function suckerfish(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
			type(sfEls);
		});
	}
}

sfHover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

sfTarget = function(sfEls) {
	var aEls = document.getElementsByTagName("A");
	document.lastTarget = null;
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i].id) {
			if (location.hash==("#" + sfEls[i].id)) {
				sfEls[i].className+=" sftarget";
				document.lastTarget=sfEls[i];
			}
			for (var j=0; j<aEls.length; j++) {
				if (aEls[j].hash==("#" + sfEls[i].id)) aEls[j].targetEl = sfEls[i];
				aEls[j].onclick = function() {
					if (document.lastTarget) document.lastTarget.className = document.lastTarget.className.replace(new RegExp(" sftarget\\b"), "");
					if (this.targetEl) this.targetEl.className+=" sftarget";
					document.lastTarget=this.targetEl;
					return true;
				}
			}
		}
	}
}

// script for show/hide using JQuery 
$(document).ready(function() {
$(".togglebox").hide();
$(".show").show();
            $(".toggle").toggle(function() {
            var rl = this.getAttribute("rel");
            var rv = this.getAttribute("rev");
                        $(".togglebox").each(function(i) {
                        if (this.getAttribute('id') == rl)
                        $(this).show();
                        if (this.getAttribute('id') == rv)
                        $(this).hide();
                        });

            }, function()  {
            var rl = this.getAttribute("rel");
            var rv = this.getAttribute("rev");
                        $(".togglebox").each(function(i) {
                        if (this.getAttribute('id') == rl)
                        $(this).hide();
                        if (this.getAttribute('id') == rv)
                        $(this).show();
                        });
            });

            $(".expand").click(function() {
            var rl = this.getAttribute("rel");
                        $(".togglebox").each(function(i) {
                        if (this.getAttribute('id') == rl)
                        $(this).show();
                        });
            });
            $(".contract").click(function() {
            var rl = this.getAttribute("rel");
                        $(".togglebox").each(function(i) {
                        if (this.getAttribute('id') == rl)
                        $(this).hide();
                        });
            });
});

