var SupplyManagementCongressBackgroundImage = 1;

function openSite(URLStr) {
    var maxx = screen.width;
    var maxy = screen.height;
    windowprops = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=100,height=100,left=100,top=100";
    window.open(URLStr+"&maxx="+maxx+"&maxy="+maxy,"",windowprops);
}

function supersize(a_iBetween, a_iTransition) {
	scaleImages();
	setTimeout('backgroundfade(1, ' + a_iBetween + ', ' + a_iTransition + ')', a_iBetween - a_iTransition);
}

function scaleImages() {
	var iImage = 1;
	var oBackground = document.getElementById('background');
	var oFixed = document.getElementById('fixwindow');
	oBackground.style.height = jQuery(window).height();
	oBackground.style.width = jQuery(window).width();
	oFixed.style.height = jQuery(window).height();
	oFixed.style.width = jQuery(window).width();
	do {
		var oImg = document.getElementById('background-image' + iImage);
		if (oImg) {
			oImg.style.height = jQuery(window).height() + "px";
			oImg.style.width = 'auto';
			if (oImg.width < jQuery(window).width()) {
				oImg.style.width = jQuery(window).width() + "px";
				oImg.style.height = 'auto';
			}
		}
		iImage++;
	} while (oImg);	
}

function backgroundfade(a_iImage, a_iBetween, a_iTransition) {
	var iNextImage = a_iImage + 1;
	var oNextImage = document.getElementById('background-image' + iNextImage);
	if (!oNextImage) {
		if (a_iImage == 1) return;
		iNextImage = 1;
	}
	jQuery('#background-image' + a_iImage).fadeOut(a_iTransition, 'linear');
	jQuery('#background-image' + iNextImage).fadeIn(a_iTransition, 'linear');
	setTimeout('backgroundfade(' + iNextImage + ', ' + a_iBetween + ', ' + a_iTransition + ')', a_iBetween);	
}
