// JavaScript Document

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_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false){
		eval("obj."+theProp+"="+theValue);
	}
    else {
		eval("obj."+theProp+"='"+theValue+"'");
	}
  }
}

/////////Frontpage Code
	function FP_changeProp() {//v1.0
	 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
	 d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o"; 
	 ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) { 
	  s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
	 x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
	 if(s) eval(s+"=v"); }
	}
	
	function FP_getObjectByID(id,o) {//v1.0
	 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
	 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
	 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
	 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
	 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
	 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
	 return null;
	}
	
	function FP_changePropRestore() {//v1.0
	 var d=document,x; if(d.$cpe) { for(i=0; i<d.$cpe.length; i++) { x=d.$cpe[i];
	 if(x.v=="") x.v=""; eval("x."+x.n+"=x.v"); } d.$cpe=null; }
	}
/////////Frontpage Code End

///////////////////////////////////////////////////////////////////////////////////////////////////

function SD_AutoOffSetFirstLayer( axis, left, top ) // Parameter for var axis: 1 == only Width, 2 == only Height, 3 == both
{
            //var firstLayer = document.getElementsByTagName("div")[0].firstChild;
            var firstLayer = document.getElementsByTagName("div")[0];
            //alert( firstLayer.data);
           
            //var mainDivWidth = document.getElementById('mainLayer').offsetWidth;
            var mainDivWidth = firstLayer.offsetWidth;
            var mainDivHeight = firstLayer.offsetHeight;
 
            var bodyWidth, bodyHeight;
            if ( self.innerHeight ) // all except Explorer
            {
                        bodyWidth = self.innerWidth;
                        bodyHeight = self.innerHeight;
            }
            else if ( document.documentElement && document.documentElement.clientHeight )
                        // Explorer 6 Strict Mode
            {
                        bodyWidth = document.documentElement.clientWidth;
                        bodyHeight = document.documentElement.clientHeight;
            }
            else if ( document.body ) // other Explorers
            {
                        bodyWidth = document.body.clientWidth;
                        bodyHeight = document.body.clientHeight;
            }
            //alert( 'bodyWidth: ' +  bodyWidth + ', bodyHeight: ' + bodyHeight + ' // mainDivWidth: ' + mainDivWidth + ', mainDivHeight: ' + mainDivHeight );


            //if( document.body.offsetWidth < mainDivWidth  )
            if( ( axis == 1 ) || ( axis == 3 ) ) {
				if( bodyWidth < mainDivWidth  )
				{
							//alert('bodyWidth: ' +  bodyWidth);
							firstLayer.style.left = left + 'px';
							firstLayer.style.marginLeft = 0 + 'px';
				} 
				else
				{
							//alert(document.body.offsetWidth);
							firstLayer.style.left = '50%';
							firstLayer.style.marginLeft = - ( mainDivWidth / 2 ) + 'px';
				}
			}
			
			if( ( axis == 2 ) || ( axis == 3 ) ) {
				if( bodyHeight < mainDivHeight  )
				{
							//alert('bodyHeight: ' + bodyHeight);
							firstLayer.style.top = top + 'px';
							firstLayer.style.marginTop = 0 +'px';
				} 
				else
				{
							firstLayer.style.top = '50%';
							firstLayer.style.marginTop = - ( mainDivHeight / 2 ) + 'px';
				}
			}
}

function SD_Jump()
{
            //var firstLayer = document.getElementsByTagName("div")[0].firstChild;
            var firstLayer = document.getElementsByTagName("div")[0];
            //alert( firstLayer.data);
           
            //var mainDivWidth = document.getElementById('mainLayer').offsetWidth;
            var mainDivWidth = firstLayer.offsetWidth;
            var mainDivHeight = firstLayer.offsetHeight;
 
            var bodyWidth, bodyHeight;
            if ( self.innerHeight ) // all except Explorer
            {
                        bodyWidth = self.innerWidth;
                        bodyHeight = self.innerHeight;
            }
            else if ( document.documentElement && document.documentElement.clientHeight )
                        // Explorer 6 Strict Mode
            {
                        bodyWidth = document.documentElement.clientWidth;
                        bodyHeight = document.documentElement.clientHeight;
            }
            else if ( document.body ) // other Explorers
            {
                        bodyWidth = document.body.clientWidth;
                        bodyHeight = document.body.clientHeight;
            }
            //alert( 'bodyWidth: ' +  bodyWidth + ', bodyHeight: ' + bodyHeight + ' // mainDivWidth: ' + mainDivWidth + ', mainDivHeight: ' + mainDivHeight );


            //if( document.body.offsetWidth < mainDivWidth  )
            if( bodyWidth < mainDivWidth  )
            {
                        //alert('bodyWidth: ' +  bodyWidth);
                        firstLayer.style.left = 10 + 'px';
                        firstLayer.style.marginLeft = 0 + 'px';
            } 
            else
            {
                        //alert(document.body.offsetWidth);
                        firstLayer.style.left = '50%';
                        firstLayer.style.marginLeft = - ( mainDivWidth / 2 ) + 'px';
            }

 
            if( bodyHeight < mainDivHeight  )
            {
                        //alert('bodyHeight: ' + bodyHeight);
                        firstLayer.style.top = 10 + 'px';
                        firstLayer.style.marginTop = 0 +'px';
            } 
            else
            {
                        firstLayer.style.top = '50%';
                        firstLayer.style.marginTop = - ( mainDivHeight / 2 ) + 'px';
            }
}


function SD_TheOnLoad() {
	//SD_SetFooter( 'contentDiv', 'footerDiv', 20, 20 ); 
	SD_AutoOffSetFirstLayer( 3, 0, 0 ); 
	SD_GradientYes();
}

function SD_TheOnResize() {
	SD_AutoOffSetFirstLayer( 3, 0, 0 ); 
}

function SD_openBrWindow(theURL,winName,format) { // for portrait write SD_openBrWindow(theURL,winName,'portrait'), for landsape write SD_openBrWindow(theURL,winName,'portrait')
	//define here the correct height and width for portrait and landscape
	var portrait = 'width=288,height=375'; //the size is 25px bigger, so the pic will not be scaled
	var landscape = 'width=375,height=288';	//the size is 25px bigger, so the pic will not be scaled
	var def = 'width=350,height=350';	
	
	if( 'portrait' == format ){ 
		window.open(theURL,winName,portrait);
	}
	else { 
		if ( 'landscape' == format ){
			window.open(theURL,winName,landscape);
		}
		else {
			window.open(theURL,winName,def);			
		}
	}
}

function SD_GradientYes() {
	var lowerGradientLayer = document.getElementById('gradientDiv');
	var upperGradientLayer = document.getElementById('gradientDivTop');
	
	if( ( navigator.appName == 'Microsoft Internet Explorer')  &&  (navigator.appVersion.substring(22,23) <= '6' ) ) {
		upperGradientLayer.style.backgroundImage = 'Url(bilder/White.png)';
		upperGradientLayer.style.backgroundColor = '#ffffff';
		lowerGradientLayer.style.backgroundImage = 'Url(bilder/White.png)';
		lowerGradientLayer.style.backgroundColor = '#ffffff';
		//alert(navigator.appName + ' ' + navigator.appVersion.substring(22,23));		
	}

}





