﻿
/*
 Title: Unicef PFC
 Author: MHDY.com
 Last Update: 04/03/2005
*/

/* VARIABLES
---------------------------------------- */
var D = document;

/* FUNCTIONS
---------------------------------------- */

function getElementbyClass(classname)
{
 var inc=0;
 var alltags=document.all? document.all : document.getElementsByTagName("*");
 for (i=0; i<alltags.length; i++)
 {
  if (alltags[i].className == classname)
  {
   classActionPop(alltags[i]);
  }
 }
}
// Attact Pop Up functions
function classActionPop(x)
{
 var options = 'scrollbars=yes,menubar=no,resizable=yes,toolbar=no,location=no,status=no';
 var size = 'width=200,height=150';
 x.onclick = function(){window.open(this.href,'new', size + ',' + options); return false;}
 x.title = 'Pop Up: ' + x.title;
}

// Pop-up definition
var newWin = null;
function popUp(strURL, strType, strWidth, strHeight) {  
 if (newWin != null && !newWin.closed)    
  newWin.close();  
 var strOptions="";  
 
if (strType=="fixednooptions")    
  strOptions="height="+strHeight+",width="+strWidth; 
 
 if (strType=="resizablenooptions")    
  strOptions="resizable,height="+strHeight+",width="+strWidth;
  
if (strType=="fixedscroll")    
  strOptions="scrollbars,"+"height="+strHeight+",width="+strWidth;  
if (strType=="fixedmenuscroll")    
  strOptions="menubar,scrollbars,"+"height="+strHeight+",width="+strWidth;  
 if (strType=="resizablemenuscroll")    
  strOptions="menubar,scrollbars,"+"resizable,height="+strHeight+",width="+strWidth;
 
 if (strType=="fixedtoolsmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"height="+strHeight+",width="+strWidth;  
 if (strType=="resizabletoolsmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,height="+strHeight+",width="+strWidth;
  
 if (strType=="fixedtoolslocationmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"location,height="+strHeight+",width="+strWidth;  
 if (strType=="resizabletoolslocationmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
  
 if (strType=="resizablelocationmenuscroll")    
  strOptions="menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
 
/*The option below is being used for printer friendly pop ups*/
 if (strType=="printerfriendlypage")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;

 newWin = window.open(strURL, 'newWin', strOptions);  
 newWin.focus();
}
 // Rollovers/Mouseovers
function fNavRollOver(TIER)
{
 if (!D.getElementById(TIER)){return false}
 var ALINKS = D.getElementById(TIER).getElementsByTagName('a');
 var LNK0   = '0.gif';  
 var LNK1   = '1.gif';
 var REG0  =/0\.gif/i;
 var REG1  =/1\.gif/i;
 
 var objTmp = new Array;
 
 for (var i=0; i < ALINKS.length; i++)
 {
   // Preload
  if (ALINKS[i].firstChild.nodeName.toLowerCase() != 'img'){continue;}
  objTmp[i] = new Image;
  objTmp[i].src = ALINKS[i].firstChild.src.replace(REG0, LNK1);
  ALINKS[i].onmouseover =function()
  {
    // Note: this.parentNode.getAttribute('class') does not return a CLASS reference in IE 6 PC when one exists.
    // if (this.parentNode.getAttribute('class') != null) {return false} // Fails in IE 6 PC   
    // if (this.parentNode.attributes['class'].value == 'urhere') {return false} // Fails in Moz PC
   if (this.parentNode.attributes['class']) {if (this.parentNode.attributes['class'].value == 'urhere') {return false}} // IE
   if (this.parentNode.getAttribute('class')){if (this.parentNode.getAttribute('class') != null) {return false}} // Moz
   this.firstChild.src = this.firstChild.src.replace(REG0, LNK1);
   this.onmouseout =function()
   {
    this.firstChild.src =this.firstChild.src.replace(REG1, LNK0);
   }
  }
 }
}
function fGetObjHeight(ID)
{
 obj= D.getElementById(ID);
 var H= (obj.clientHeight)? obj.clientHeight: obj.offsetHeight;
 return H;
}
function fSetObjHeight(ID, NUM)
{
 D.getElementById(ID).style.height = NUM+"px"; 
}
function fLevelColumn(CONTAINER, TIER1)
{
 COL1= fGetObjHeight(CONTAINER);
 COL2= fGetObjHeight(TIER1);
 MAX = Math.max(COL1,COL2);
 if(COL1!= MAX) fSetObjHeight(CONTAINER, MAX);
}

  // Onload Function
function loaded()
{
 fNavRollOver('tier1');
 fLevelColumn('content', 'tier1');
 getElementbyClass('pop');
}

/* ACTIONS
---------------------------------------- */
if (D.getElementById)
{
 window.onload =loaded;
}

