// JavaScript Document
var timer;
var match_rule;
var enableSiteRule;
var fix_x;
var fix_y;

function setPPos(state)
{
	loc  = new Array();
	fix_x = 102;
	fix_y = -262;
	
	// OPTIONS:
	// this variables manage the reversed (starting from right-bottom) 
	// relative positions
	if(document.all){
		// for the early microsoft internet explorer 4 versions (Bildgröße:400/290)
		theight = 70;
		twidth  = 80;
	}else if(document.layers){
		// for the good old netscape 4 family
		theight = 95;
		twidth  = 90;
	}else if(document.getElementById){
		// and finally for modern browsers that include
		// the newer dom (Netscape6, mozilla, ie)
		theight = 10;
		twidth  = 80;
	}

	// define wether the layer hast to disappear at a specific resolution
	// true = enable, false = do not enable
	enableSiteRule = true;

	// define here at which (inner) non-reversed resolution (top-left) the layer has to disappear
	// only if you have enabled thw site rule
	rule_width  = 750;
	rule_height = 300;

	// this array contains the sites where the resolution rules above will be affected
	// you can simply add a file where the rule has to be affected (no url, just the filename!)
	// if you want to define rules, uncomment this block out
	
	loc[0]   = "first_file.html";
	loc[1]   = "second_file.html";
	loc[2]   = "third_file.html";
	loc[3]   = "just_one_more_file_to_go.html";
	loc[4]   = "really_the_very_last_file_in_this_array.html";
	

	/* ---------------------------------------------------------------------------
	  OPTIONS END
	  
	  don't change anything from here if you don't know, what you do!
	  
	  remember: the layer that is used in the html-code must have the id 'Layer1'
	            until you don't change the layer name in code itself.
	--------------------------------------------------------------------------- */
	  
	// get the (crossbrowser)heights ...
	if(document.all){
		inner_height = (document.body.clientHeight-document.body.clientHeight) + fix_x;
		inner_width  = (document.body.clientWidth/2) + fix_y;
	}else if(document.layers || document.getElementById){
		inner_height = (window.innerHeight-window.innerHeight) + fix_x;
		inner_width  = (window.innerWidth/2) + fix_y;
	}
	
	// rules for sites which contain e.g. flash-movies, inputs etc.
	if(enableSiteRule){
		locl = loc.length;
		for(i=0;i<locl;i++){
			if(document.location.href.indexOf(loc[i])!=-1){
				if(inner_width < rule_width || inner_height < rule_height){
					match_rule = true;
				}else{
					match_rule = false;
				}
			}
		}
	}else{
		match_rule = false;
	}
	
	// crossbrowser starts here ...
	if(document.all){
		if(state=='onload'){
			Layer1.style.pixelTop   = inner_height;
			Layer1.style.pixelLeft  = inner_width;
		}
		if(match_rule==true){
			Layer1.style.visibility = "hidden";
		}else{
			Layer1.style.visibility = "visible";
		}
	}else if(document.layers){
		if(state=='onload'){
			document.Layer1.pageY = inner_height;
			document.Layer1.pageX = inner_width;
		}
		if(match_rule==true){
			document.Layer1.visibility = "hide";
		}else{
			document.Layer1.visibility = "show";
		}
	}else if(document.getElementById){
		if(state=='onload'){
			//alert(document.getElementById('Layer1'));
			document.getElementById('Layer1').style.top  = inner_height;
			document.getElementById('Layer1').style.left = inner_width;
		}
		if(match_rule==true){
			document.getElementById('Layer1').style.visibility = "hidden";
		}else{
			document.getElementById('Layer1').style.visibility = "visible";
		}
	}

	// return the heights of inner window
	positions = inner_width+"#"+inner_height;
	return positions;
}

function scrollPPos(){
	// get return value of setPPos where the window heights are defined
	positions      = setPPos("xxx");
	positionsArray = positions.split("#");
	inner_width    = positionsArray[0];
	inner_height   = positionsArray[1];
	
	// crossbrowser starts here ... discovering new ways of mathmatics
	if(document.all){
		Layer1.style.pixelTop  = document.body.scrollTop  + inner_height * 0.999;
		Layer1.style.pixelLeft = document.body.scrollLeft + inner_width  * 0.999;
	}else if(document.layers){
		document.Layer1.pageY = pageYOffset + inner_height * 0.997;
		document.Layer1.pageX = pageXOffset + inner_width  * 0.997;
	}else if(document.getElementById){
		document.getElementById('Layer1').style.top  = pageYOffset + inner_height * 0.997;
		document.getElementById('Layer1').style.left = pageXOffset + inner_width  * 0.997;
	}
	
	timer = setTimeout("scrollPPos();",1);
}



//-->