
// globale Variablen
var ns=false, ie=false;
var windowWidth, windowHeight;
var objRef, styleSwitch, pixSwitch, leftSwitch, topSwitch;
var gen5, elementID, diffX, diffY;
var lastScrollX = 0;
var lastScrollY = 0;
var layerXY = [0, 0, 0, 0];



var debug = 0;

checkBrowser();

function init() {
checkBrowser();
if ( debug == 0 ) { self.onError=null; }
getDimensions();
}



// Browsererkennung
function checkBrowser() {
if( (parseInt( navigator.appVersion )) >= 4 ) {
( navigator.appName.indexOf("etscape") != -1 ) ? ns = true : ns = false;
( navigator.appName.indexOf("xplorer") != -1 ) ? ie = true : ie = false;
gen5 = document.getElementById ? 1 : 0; // check if it is a 5th generation Browser
}
}

function getDimensions() {
if( ns ) {
windowWidth = innerWidth;
windowHeight = innerHeight;
}
else if( ie ) {
windowWidth = self.document.body.clientWidth;
windowHeight = self.document.body.clientHeight;
}
return windowHeight, windowWidth;
}

// CrossBrowser objRefekte erstellen
function makeObj( elementID ) {
if ( gen5 ) {
objRef = 'document.getElementById("' + elementID + '")';
styleSwitch = ".style";
}
if( ns ) {
// if ( !gen5 ) {objRef = 'document.all["' + elementID + '"]'};
if ( !gen5 ) {objRef = 'document.layers["' + elementID + '"]'};
if ( !gen5 ) {styleSwitch = ""};
leftSwitch = ".left";
topSwitch = ".top";
widthSwitch = ".clip.right";
heightSwitch = ".clip.bottom";
}
else if( ie ) {
if ( !gen5 ) {objRef = 'document.all["' + elementID + '"]'};
if ( !gen5 ) {styleSwitch = ".style"};
leftSwitch = ".pixelLeft";
topSwitch = ".pixelTop";
widthSwitch = ".width";
heightSwitch = ".height";
}

if ( eval( objRef ) ) {

this.obj = eval( objRef );
this.css = eval( objRef + styleSwitch );
this.css.left = eval( objRef + styleSwitch + leftSwitch );
this.css.top = eval( objRef + styleSwitch + topSwitch );
this.css.visibility = eval( objRef + styleSwitch + '.visibility' );
this.css.width = eval( objRef + styleSwitch + widthSwitch );
this.css.height = eval( objRef + styleSwitch + heightSwitch );

var Xleft = parseInt( this.css.left );
var Ytop = parseInt( this.css.top );
var Xright = parseInt( this.css.left ) + parseInt( this.css.width );
var Ybottom = parseInt( this.css.top ) + parseInt( this.css.height );

layerXY = [Xleft, Xright, Ytop, Ybottom];

}
if ( debug == 1 && !eval(objRef) ) {
alert('<div>-Layer mit der ID: "' + elementID + '" nicht gefunden !!')
}
}






// Funktionen um die Sichtbarkeit von Layern zu ?§ndern:
function showLayer( elementID ) {



if ( this.css && this.obj.id != elementID || !this.css) {
if ( debug == 1 ) { window.status = 'creating Object: ' + elementID; }
makeObj( elementID );





}

this.css.visibility = "visible";



}


function hideLayer( elementID ) {



if ( this.css && this.obj.id != elementID || !this.css) {
if ( debug == 1 ) { window.status = 'creating Object: ' + elementID; }
makeObj( elementID );


}
this.css.visibility = "hidden";


}



// Funktionen um Informationen ?ºber den Layer zu erhalten:




// Funktionen um Layer zu positionieren
function setLayerLeftPos( elementID, leftPos ) {
if ( this.css && this.obj.id != elementID || !this.css) {
if ( debug == 1 ) { window.status = 'creating Object: ' + elementID; }
makeObj( elementID );
}
this.css.left = leftPos;
}

function setLayerTopPos( elementID, topPos ) {
if ( this.css && this.obj.id != elementID || !this.css) {
if ( debug == 1 ) { window.status = 'creating Object: ' + elementID; }
makeObj( elementID );
}
this.css.top = topPos;
}

function setLayerPos( elementID, leftPos, topPos ) {
setLayerLeftPos( elementID, leftPos )
setLayerTopPos( elementID, topPos )
}


function centerMove4MI () {
    getDimensions();
    var leftPosFrame_DE = (windowWidth+400) / 2;
	var topPosFrame_DE = (windowHeight-100) / 2;

	

	 
	 if (windowWidth >= 0) {
        setLayerLeftPos("iframenews_DE",leftPosFrame_DE);
        setLayerTopPos("iframenews_DE",topPosFrame_DE);

		
		
    } else {
        setLayerLeftPos("iframenews_DE",-100);
        setLayerTopPos("iframenews_DE",0);
	
      
    }
}



