// JavaScript Document

function windowHeight(){
  var myWidth = 0
  var 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;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
	return myHeight;
}

function resize(){ 
	if(document.all){
		//var frame = document.all("frame1"); 
		//var htmlheight = document.body.parentNode.scrollheight; 
	}else{
		var frame = document.getElementById("frame1"); 
		var htmlheight = document.body.parentNode.scrollheight; 
	}
	
	var windowheight = window.innerheight;
	
	/*
	if( htmlheight < windowheight ){
		frame.style.height = windowheight + "px";
	}else{
		frame.style.height = htmlheight + "px";
	}
	*/
	frame.style.height = windowheight + "px";
} 


var position = 0;
var color = "#ffffff";

function startPolling(){setInterval("poll()",250)}

function poll(){
	//if(navigator.appName == "Microsoft Internet Explorer"){var position = document.body.scrollTop;}
	if(document.all){
		//var position = document.body.scrollTop;
	}else{
		var position = window.pageYOffset;
	}

	if(position > 50  && position < 250){color = "#ff0000";}

	if(position > 250 && position < 450){color = "#00ff00";}

	if(position > 450 && position < 650){color = "#0000ff";}

	if(position > 650 && position < 850){color = "#ffff00";}

	if(position > 850 && position < 1050){color = "#c0c0c0";}

	if(position > 1050 || position < 50){color = "#ffffff"}

	document.bgColor = color;
	
	
	var noPx = document.childNodes ? 'px' : 0;
	//myReference.left = x + noPx;
	//myReference.top = y + noPx;
	
	if(document.getElementById('redbox') == "object"){
		document.getElementById('redbox').style.top = ((windowHeight() + position) - 150) + noPx;
	}
	//alertSize();
	
	//alert(position);
	
	return true;
}

startPolling();