﻿

function InitPage()
{

    // set rollover-effect
 	var aList = document.getElementsByName("Rollover");
    var aPics = new Array();

	for (var i=0; i<aList.length; i++) 
	{
	    var sSrc = aList[i].src
	    var nLen = String(sSrc).length;
	    var sName = String(sSrc).substring(0, nLen - 6);
        var sExt = String(sSrc).substring(nLen, nLen - 6);

        // preload pics
        aPics[i] = new Object();
	    
        aPics[i]._0 = new Image();
     // aPics[i]._1 = new Image();
        aPics[i]._2 = new Image();
   
        aPics[i]._0.src = sName + '_0.gif';
     // aPics[i]._1.src = sName + '_1.gif';
        aPics[i]._2.src = sName + '_2.gif';
        
        
        // add effect
        aList[i].onmouseover = function () {RollOver(this,true);}
        aList[i].onmouseout =  function () {RollOver(this,false);}
            
	} 
	
	
	// init custom formelements
    // InitFormElements();      
}

function Popup(left, top, width, height, center, resizable, scrollbars, url, title)
{
    var popup = window.open(
        url,
        title,
          "center=" + center + ","
        + "height=" + height + ","
        + "left=" + left + ","
        + "resizable=" + resizable + ","
        + "scrollbars=" + scrollbars + ","
        + "top=" + top + ","
        + "width=" + width
    );
    popup.focus();
}
function PopupCenter(width, height, url, title)
{
    var left = (screen.availWidth - width + 10) / 2;
    var top = (screen.availHeight - height + 28) / 2;
	Popup(left, top, width, height, "yes", "no", "no", url, title);
}
function PopupMax(url, title)
{
	Popup(1, 1, screen.availWidth - 12, screen.availHeight - 38, "no", "no", "yes", url, title);
}
function PopupNormal(url, title)
{
    var popup = window.open(url, title);
    popup.focus();
}

function ToggleDisplay(ID)
{
    var obj = document.getElementById(ID)
    if(obj.style.display == 'none'){
       obj.style.display = 'block';
    }else{
       obj.style.display = 'none';
    }
}
function ToggleVisibility(ID)
{
    var obj = document.getElementById(ID)
    if(obj.style.visibility == 'hidden'){
       obj.style.visibility = 'visible';
    }else{
       obj.style.visibility = 'hidden';
    }
}

function RollOver(ctl,over) 
{ 
   var iLen = String(ctl.src).length;
   var s1 = String(ctl.src).substring(iLen, iLen - 6);
   var s2 = String(ctl.src).substring(0, iLen - 6);
   
   if (over){
       if (s1 == "_0.gif"){
         ctl.src = s2 + '_2.gif';
       }
   }
   else {
       if (s1 == "_2.gif"){
         ctl.src = s2 + '_0.gif';
       }
   }   
} 

function NavHeight()
{   
    if (document.documentElement && document.documentElement.clientWidth) 
        Height = document.documentElement.clientHeight; 
    else if (document.body && document.body.clientWidth) 
        Height = document.body.clientHeight; 
    else 
        Height = window.innerHeight;  
    
    return Height;
}

function NavWidth()
{   
    if (document.documentElement && document.documentElement.clientWidth) 
        Width = document.documentElement.clientWidth; 
    else if (document.body && document.body.clientWidth) 
        Width = document.body.clientWidth; 
    else 
        Width = window.innerHeight;  
    
    return Width;
}

function GetRect(o)
{
    var r = { top:0, left:0, width:0, height:0 };

    if(!o) return r;
    else if(typeof o == 'string' ) o = document.getElementById(o);

    if( typeof o != 'object' ) return r;

    if(typeof o.offsetTop != 'undefined')
    {
         r.height = o.offsetHeight;
         r.width = o.offsetWidth;
         r.left = r.top = 0;

         while (o && o.tagName != 'BODY')
         {
              r.top  += parseInt( o.offsetTop );
              r.left += parseInt( o.offsetLeft );
              o = o.offsetParent;
         }
    }
    return r;
}

function ScrollTop() {
    window.scrollTo(0, 0);
}







