// breite bilduntertitel anpassen
// darf wegen opera nicht in onDomContentReady stehen (zu schnell!??)
$(window).load(function () {
    $("div.figure img").each(function () {
        var iwidth;
        iwidth = $(this).width();
        if (iwidth) {
            $(this).parents("div.figure:first").css("width", iwidth);
        }
    });
});

// sIFR
/* v2 code
if (typeof sIFR === "function") {
    //sIFR.replaceElement(named({sSelector:"body h1", sFlashSrc:"media/flash/eurostile.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:20, nPaddingBottom:20, sFlashVars:"textalign=center&offsetTop=6"}));
    sIFR.replaceElement(named({sSelector: "body h1.kategorie", sFlashSrc: "/media/flash/eurostile.swf", sColor: "#009ada"}));
}
*/

/*
$(window).bind("unload", function () {
    $("h1.sIFR-replaced").css("display", "none");
});
*/

$(function () {
// input-vorbelegung
    $("input.vorbelegt").each(function () {
        var defaultVal = $(this).attr("title");
        if (!this.value) {
            this.value = defaultVal;
        }
        $(this).bind("focus", function () {
            if (this.value === defaultVal) {
                this.value = '';
            }
        });
        $(this).bind("blur", function () {
            if (!this.value) {
                this.value = defaultVal;
            }
        });
    });
    $("form:has(input.vorbelegt)").bind("submit", function () {
        $(this).find("input.vorbelegt").each(function () {
            if (this.value === $(this).attr("title")) {
                this.value = '';
            }
        });
    });


    $("#linkTheaterTv").click(function () {
        var newwin = window.open(this.href, "mediaPlayer", "width=750,height=380");
        newwin.focus();
        return false;
    });
});