﻿
function MM_reloadPage(init) 
{
  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);  

window.onresize = doResize; 
 
var AGN_UserAgent = navigator.userAgent.toLowerCase();
var AGN_Opera = (AGN_UserAgent.indexOf('opera') != -1); // is opera
var AGN_Opera8 = ((AGN_UserAgent.indexOf('opera 8') != -1 || AGN_UserAgent.indexOf('opera/8') != -1) ? 1 : 0); // is opera8
var AGN_NS4 = (document.layers) ? true : false; // is netscape 4
var AGN_IE4 = (document.all && !document.getElementById) ? true : false; // is IE 4
var AGN_IE5 = (document.all && document.getElementById) ? true : false; // is IE 5+
var AGN_NS6 = (!document.all && document.getElementById) ? true : false; // is netscape 6
var AGN_FireFox = (AGN_UserAgent.indexOf("firefox/") != -1); // is firefox
var AGN_Transitions = (AGN_IE5 || AGN_IE4) ? true : false // do we support transitions
 
function AGN_FindControl(strControlName) 
{
    var objReturn = '';
        if (AGN_IE5 || AGN_NS6 || AGN_Opera || AGN_Opera8)
        {
            objReturn = document.getElementById(strControlName);
        }
        else if (AGN_IE4)
        {
            objReturn = document.all[strControlName];
        }
        else if (AGN_NS4)
        {
            objReturn = document.layers[strControlName];
        }
    return objReturn
}

function doResize() 
{
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    
    var divRechts = AGN_FindControl("tdRechts");
    var divRechtsReplace = AGN_FindControl("rechtsReplace");
    var divLatestNews = AGN_FindControl("latestNews");
    var divHands =  AGN_FindControl("hands");
     
    if ( myWidth < 985 ) //1125
    {
        if ( divRechtsReplace.innerHTML.length == 0 && divRechts.innerHTML.length > 500 ) 
        {
            divLatestNews.style.width="100%";
            divHands.style.width="100%";
            divRechtsReplace.innerHTML = divRechts.innerHTML;
            divRechts.innerHTML = "";
        }        
    }
    else 
    {   
        if ( divRechts.innerHTML.length == 0 && divRechtsReplace.innerHTML.length > 500 ) 
        {
            divRechts.innerHTML = divRechtsReplace.innerHTML;
            divRechtsReplace.innerHTML = "";
            
            divLatestNews = AGN_FindControl("latestNews");
            divLatestNews.style.width="160px";
            divHands.style.width="160px";
        }
    }
}

function DisableEnterSubmit( aEvent ) 
{
    var myEvent = aEvent ? aEvent : window.event;
    if ( myEvent.keyCode == 13 )
    {
        try 
        {
            myEvent.returnValue=false;
            myEvent.cancel = true;
            myEvent.preventDefault(); 
            return false;                 
        } 
        catch (exc) {}
    }
}

function returnModalDialogPage( sPage )
{
    var retValue = window.showModalDialog( sPage, '', 'resizable=no; scrollbars=no; status=no; center=yes; help=no;');
    
    if ( retValue != null )
    {
        location.href = retValue;
    }
}

function LoadToIframe( sLink, ahrefElement ) 
{
   if ( window.glob_iframeid )
   {
        ahrefElement.href = sLink;
        ahrefElement.target = "content_iframe";
   }
}


