//******************************************************************************************//
//******************************************************************************************//
//            Main Window Event Handlers
//******************************************************************************************//
//******************************************************************************************//

setDefault("CDC_VIDEO_RESIZE_ARRAY", new Array());

//for IE 6 to retest the container size after all page element load.
function loaderFunction() {
	// Adjust the search box if necessary.
	resizeSearch();
}

// Associate the loaderFunction function to the window.onload event.
addLoadEvent(loaderFunction);

//******************************************************************************************//
// This function resizes the search text box if necessary when the window is resized.
//******************************************************************************************//
function resizeSearch() {
	// Check to see if the Search textbox needs to be resized.
	if (getWindowWidth() < 835) {
		GetElementById("searchBox").style.width = "120px";
		GetElementById("searchForm").style.width = "190px";
	}
	else {
		//default sets to original sizes
		GetElementById("searchBox").style.width = "230px";
		GetElementById("searchForm").style.width = "300px";
	}
}

//******************************************************************************************//
// The event handler for the window.onresize event.
//******************************************************************************************//
function resizeElements() {
	
	// Check to see if the Search textbox needs to be resized.
	resizeSearch();

	// Iterate through list list of CDC.Video objects that have been "registered" to be resized.
	for (var i = 0; i < CDC_VIDEO_RESIZE_ARRAY.length; i++) {
		var mov = CDC_VIDEO_RESIZE_ARRAY[i];
		mov.resize();
	}

}

// Associate the resizeElements function to the window.onresize event.
addResizeEvent(resizeElements);

//******************************************************************************************//
//******************************************************************************************//
//*									Page Options Functions                                 *//
//******************************************************************************************//
//******************************************************************************************//

//******************************************************************************************//
// Email/Print Script
//******************************************************************************************//
var WindowObjectReference; // global variable
function openRequestedPopup() {
    document.url = location.href;
    WindowObjectReference = window.open("http://www.cdc.gov/email.do?url=" + escape(location.href), "_blank",  "height=320,width=576,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes," + "resizable=yes");
}
