// some documentation at http://www.howtocreate.co.uk/tutorials/javascript/browserwindow



// *******************************
// this is the default text for the javascript write statement
// you can just set it to an empty string: var newtext = "";
var newtext="";
// *******************************


// *******************************
// set some constants, change the values as required	
minheight = 710; // mininum height required else JS document.write of new style

// in case we can't get the window height we can guess by
// subtracting the "chrome" size from the total monitor height
chromeheight = 260; // difference between monitor height and max window height

// we want to find the actual window height, but first set a default value
height = 500; // use this height in case we can't find the actual window height 
// *******************************


// *******************************
// most browsers can report the monitor height
// so start with this arithmetic
if(screen.height){
	monitorheight = screen.height; // monitor height
	height = monitorheight - chromeheight; // cheat for browsers that don't report window height 
}
// *******************************


// *******************************
// modern non-IE browsers can give the window height
// this will overwrite the defaults calculated above
// unfortunately IE 6 and 7 will report the monitor height here
if (window.innerHeight) {
	height = window.innerHeight;
	}
else if (document.documentElement && document.documentElement.clientHeight) {
	height = document.documentElement.clientHeight;
	}
else if (document.body && document.body.clientHeight) {
	height = document.body.clientHeight;
	}
// *******************************


// *******************************
// SET "newtext" TO BE THE CORRECTED CSS if the window is too small
// "newtext" will be written into the <BODY> of the page (see below)
// could be: newtext="<style> pagediv{ padding:0; float:right } text { font-size:3 } </style>";
// don't use any line breaks or carriage returns in the newtext, IE will choke on them.
if (height < minheight){
	newtext =  "<style>\n";
	newtext += "#main_content { min-height: 490px; height: auto !important; height: 490px; }\n";
	newtext += "#main_content #pageback { min-height: 410px; height: auto !important; height: 410px;  }\n";
	newtext += "#productimage_div { height: 410px; width: 410px; }\n";
	newtext += "#productimage { height: 410px; width: 410px; }\n";
	newtext += "#productgroup { height: 76px; }\n";
	newtext += "</style>\n";
//	newtext += "<p style='color:red'>height is " + height + "</p>\n";
	// setStylefix();
} else {
//	newtext = "<p>height is " + height + "</p>\n"
}
// *******************************

// *******************************
// you can comment this out
// alert("Window height is " + height);	
// *******************************
// *******************************


// *******************************
// Prototype setstyle

function setStylefix() {
	var main = $('main_content');
	main.style.height = 480;

}




// *******************************
// Prototype onresize observer

function setheight() {
	var dims=$(document.body).getDimensions(); 
	var pheight=$(document.body).getHeight(); 
	alert("Window height is " + pheight);
}

// Event.observe(document.onresize ? document : window, "resize", function() { setheight() }); 


