function getWindowSize() {
	var thewidth = 0;
	//Non-IE
	if(typeof(window.innerWidth)=='number') {
		thewidth = window.innerWidth;
	} 
	//IE 6+ in 'standards compliant mode'
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		thewidth = document.documentElement.clientWidth;
	} 
	//IE 4 compatible
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		thewidth = document.body.clientWidth;
	}
	return thewidth;
}

function positionElements() {
	if (!document.getElementsByTagName) return false;
	if (!document.getElementById) return false;
	if (!document.getElementById("column02")) return false;
	var screenwidth = 0;
	var thediv = document.getElementById("column02");
	var maindiv = document.getElementById("container");
//	var inputdiv = document.getElementById("bannerContentForm");
//	var inputbox = document.getElementById("ctl00_FullRegion_Searchbox_txtSearchQuery");
    switchClass(thediv, "widthClassNone", "widthClass");
    setWidth(maindiv, "minWidth", "maxWidth");
//    setWidth(inputbox, "smallSize", "bigSize");
//    setWidth(inputdiv, "smallWidth", "bigWidth");
	window.onresize = function() {
		switchClass(thediv, "widthClassNone", "widthClass");
		setWidth(maindiv, "minWidth", "maxWidth");
//		setWidth(inputbox, "smallSize", "bigSize");
//		setWidth(inputdiv, "smallWidth", "bigWidth");
	}
}

function setWidth(element){
	screenwidth = getWindowSize();
	if (screenwidth > 880) {
		changeClass(element,"maxWidth");
	}
	else {
		changeClass(element,"minWidth");
	}
}

function setWidth(element, res880Class, resClass){
	screenwidth = getWindowSize();
	if (screenwidth > 880) {
		changeClass(element,resClass);
	}
	else {
		changeClass(element,res880Class);
	}
}

function switchClass(element) {
	screenwidth = getWindowSize();
	if (screenwidth > 880) {
		changeClass(element,"widthClass");
	}
	else {
		changeClass(element,"widthClassNone");
	}
}

function switchClass(element, res880Class, resClass) {
	screenwidth = getWindowSize();
	if (screenwidth > 880) {
		changeClass(element,resClass);
	}
	else {
		changeClass(element,res880Class);
	}
}

function changeClass(element,value) {
	if (value == "") {
		element.className = "";
	}
	else {
		if (!element.className) {
			element.className = value;
		} 
		else {
//			element.className+= " ";
			element.className= value;
		}
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} 
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function resizeFlashCarousel(){
	var width = getNewWidth();
	setStyleWidth("banner",width);
	setStyleWidth("flash_carousel_movie",width);
}

function getNewWidth (){
	return getWindowSize() > 880 ? 890 : 680;
}

function setStyleWidth ( id, v ) {
	var e = document.getElementById(id);
	if(!e) return;
	var s = e.style;
	if (document.layers){
		s.width = v;
	}else {
		s.width = v + "px";
	}
}

addLoadEvent(positionElements);