// 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 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( 1, 0, 0 ); 
}

function SD_TheOnResize() {
	SD_AutoOffSetFirstLayer( 1, 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));		
	}

}




