function resizeMe() {
	if (resizeMode == "overflow") {
		newheight = Math.max($(window).height() - 300, $("#col1").height() - 80, 300)
		$("#pagecontent").css("height", newheight + "px")

		if ($("#contentcolumn").height() > $("#pagecontent").height()) {
            $("#pagenav2").show()
		}
		else {
            $("#pagenav2").hide()
		}
	}
}

function autoFill(id, v){
	$(id).css({ color: "#b2adad" }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ color: "#333" });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ color: "#b2adad" }).val(v);
		}
	});
}

var resizeTimer = null;
var resizeMode = "overflow";

$(document).ready(function(){
    /* Ich hasse das Teil ... */
    if ($.browser.msie && $.browser.version == "6.0")
    {
        if (window.location.href.substring(7).split("/")[1] != "") {
            $("#pagecontent").css("overflow", "visible").css("height", "100%");
            resizeMode = "fullsize";
        }

        /*$("#pagecontent").css("position", "relative");
        $("#pagecontent").css("top", "-125px");*/
    }

	resizeMe();

	$(window).bind('resize', function() {
		if (resizeTimer)
			clearTimeout(resizeTimer);
		resizeTimer = setTimeout(resizeMe, 100);
	});

	$("#resizerow").click(function(event) {
		event.preventDefault();
		if (resizeMode == "overflow") {
			$("#pagecontent").css("overflow", "visible").css("height", "100%");
			resizeMode = "fullsize";
		}
		else {
			$("#pagecontent").css("overflow", "auto").css("height", "100%");
			resizeMode = "overflow";
			resizeMe();
		}
	});
	
	autoFill($("#q"), "Suchen ...");
});
