var cacheImages = [];
$(document).ready(function() {
	$("img, input[type=image]")
	.filter(
		function() { return this.src.match(/_on\..{3}/); })
	.hover(
		function() {
			ext = this.src.substr(this.src.lastIndexOf('.') + 1);
			this.src = this.src.replace(new RegExp('_on.' + ext + '$'), '_ov.' + ext);
			this.style.filter = this.style.filter.replace(new RegExp('on.png'), 'ov.png');
		},
		function() {
			ext = this.src.substr(this.src.lastIndexOf('.') + 1);
			this.src = this.src.replace(new RegExp('_ov.' + ext + '$'), '_on.' + ext);
			this.style.filter = this.style.filter.replace(new RegExp('ov.png'), 'on.png');
		}
	)
	.each(
		function() {
			var ext = this.src.substr(this.src.lastIndexOf('.') + 1);
			var image = document.createElement('img');
			image.src = this.src.replace(new RegExp('_on.' + ext + '$'), '_ov.' + ext);
			cacheImages.push(image);
		}
	);

	adjustContentPanel();
	$(".hide_exc_ie6").hide();
});

$(window).load(function() {
	adjustContentPanel();
});

function changeOpac(opacity, id) {
	var object = $("#" + id)[0].style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

var adjustContentPanel_resizeHandler;
function adjustContentPanel() {
	if ($("#content_panel").length > 0) {
		$(window).unbind("resize", adjustContentPanel_resizeHandler);
		$("#content_panel").css("min-height", "auto");
		$("#content_panel").css("height", "auto");
		
		var minHeight = $("#content_panel").height();
		$("#content_panel").css("min-height", minHeight);
		var heightOffset = $("#content_panel").offset().top + parseInt($("#content_panel").css("padding-top")) +
			parseInt($("#content_panel").css("padding-bottom")) + parseInt($("#content_area").css("padding-bottom"));
		$("#content_panel").height($(window).height() - heightOffset);
		
		adjustContentPanel_resizeHandler = function() {
			$("#content_panel").height($(window).height() - heightOffset);
			if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
				var newHeight = $(window).height() - heightOffset;
				$("#content_panel").height(newHeight < minHeight ? minHeight : newHeight);
			}
		}
		$(window).resize(adjustContentPanel_resizeHandler);
	}
}
