//if (document.layers) {
//	document.write("<style>b {font-size: 12px; font-weight: bold;}</style>");
//}

var re, docWidth, lastWidth, main;

function init() {
	re = new RolloverEngine();
	main = new Div("main");

	center();
}

function randomImage() {
	var index = Math.round(Math.random()*2), root = "images/home_", labels= new Array("left", "center", "right");
	
	for (var i=0; i < labels.length; i++) 
		re.setSrc(labels[i], root + "image" + index + "_" + labels[i] + ".jpg");
		
	re.setSrc("pattern" , root + "pattern" + index + ".gif");
	
	
}

function getWinWidth() {
	return (window.innerWidth) ? window.innerWidth : 
			(window.document.body.clientWidth)? window.document.body.clientWidth : 
			(document.width) ? document.width : -1;
}

function center() {
	docWidth = getWinWidth();
	mainWidth = 780;
	
	main.setLeft((docWidth != -1 && docWidth > mainWidth)? Math.round((docWidth / 2) - (mainWidth / 2)) : 0);
	main.setVisible(true);
}

function preCenter() {
	var x = (getWinWidth() / 2) - 380;
	document.write("<style>#main {position: absolute; left: " + ((x < 0)? 0 : x) + "px; }</style>")
}

lastWidth = docWidth;
window.onresize=handleResize;


function handleResize(){
	docWidth = getWinWidth();

	if (lastWidth != docWidth) {
		lastWidth = docWidth;
		(document.layers)? location.reload() : center();
	}
}




/* popup code */
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
/* end popup code */