function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

startList = function() {
	if (document.all&&document.getElementById) {
		cssdropdownRoot = document.getElementById("navi");
		for (x=0; x<cssdropdownRoot.childNodes.length; x++) {
			node = cssdropdownRoot.childNodes[x];
			if (node.nodeName=="li") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

if (window.attachEvent){
	window.attachEvent("onload", startList)}
else {
	window.onload=startList;
}


/* Bildunterschirften */
function makeImgCaptions(){


		if($('img.pic_l').attr('rel')) {
			$('img.pic_r').wrap(function() {
                var caption="";
                if ($(this).attr('rel')) caption="<br>"+$(this).attr('rel');
				//if ($(this).attr('rel')) return '<span class="pic_r" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" /><br />'+ $(this).attr('rel') +'</span>';
				//else return '<span class="pic_r" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" /></span>';
				return '<span class="pic_r" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" />'+ caption +'</span>';
			}).remove();
		}

		if($('img.pic_l').attr('rel')) {
			$('img.pic_l').wrap(function() {
                var caption="";
                if ($(this).attr('rel')) caption="<br>"+$(this).attr('rel');
				//if ($(this).attr('rel')) return '<span class="pic_l" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" /><br />'+ $(this).attr('rel') +'</span>';
				//else return '<span class="pic_l" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" /></span>';
				return '<span class="pic_l" style="width:'+ $(this).width() +'px;font-weight:normal;"><img src="'+ $(this).attr('src') +'" border="0" alt="" />'+caption +'</span>';
			}).remove();
		}

}

function makeLightboxes()
{
    var c=0;
    $('#links a img').each(function(i,val) {
        //alert(val.src);
        /* Achtung, Breite max. 250 Px wg. Werbebanner*/
        if ((val.width>110)&&(val.height>100)&&(val.width<280)) {
            var src=val.src;
            if ( ( (src.indexOf("plakate/")<1)&&(src.indexOf("Live_Ticker.jpg")<1)&&(src.indexOf("partner/")<1)&&(src.indexOf("files/")<1)&&(src.indexOf("banner")<1)&&(src.indexOf("gif2010")<1) )&&((src.indexOf("jpg")>0) ||(src.indexOf("JPG")>0))) {
                var aTag=val.parentNode;
                var w=val.width;
                var h=val.height;
                val.border=0;
                val.src="/image.php?src="+src+"&w="+w+"&h="+h+"&qual=99";
                //aTag.href="/image.php?src="+src+"&w="+w+"&h="+h+"&qual=99";
                aTag.className="newLB";
                c++;
            }
        }
    });
    if (c>0) {
        $(".newLB").lightBox();
    }
}


var oldmenu2="";
function showMenu2(id)
{
        if (oldmenu2=="") oldmenu2=$("#subnavi").html();

        if (!$("#"+id)) return;
        var code=$("#"+id).html();
        if (!code) return;
        $("#subnavi").html(code);
}

function restoreMenu2()
{
        if (oldmenu2!="") $("#subnavi").html(oldmenu2);
        oldmenu2="";
}

$(document).ready(function(){

        var c=0;

        // bilder ohne left/right attr
        // 1. Bild ist grosses Bild, ignorieren!
        $('#links .white p img').each(function (i,val) {
          if (i>0) {
            if ((!val.className)&&(val.width<=255)&&(val.width>180)&&(val.height>100)) {

                if (i%2) val.className="pic_l";
                else val.className="pic_r";
            }
          }
        });
        $('img.rechts').removeClass("rechts").addClass("pic_r");
        $('img.links').removeClass("links").addClass("pic_l");

        makeImgCaptions();
        makeLightboxes();
});

function openVideo()
{
    window.scrollTo(0,0);
    var vw=640;
    var vh=360;
    var wh=$(window).height()-1;
    var ww=$(window).width()-1;
    $('<div id="fadeout" style="position:absolute;z-index:999;left:0px;top:0px;width:'+ww+'px;height:'+wh+'px;z-index:5;overflow:hidden;background-color:#000;opacity:0.0;filter: alpha(opacity = 0);"></div>').appendTo('body');
    $('#fadeout').animate({opacity:0.7},500);
    $('#closevideo').show();

    jwplayer("vplayer").setup({
        flashplayer: "/kickit/upload/video_startseite/mediaplayer/player.swf",
        file: "/kickit/upload/video_startseite/video.mp4",
        autostart: true,
        height: vh,
        width: vw
    });
    $('#videocontainer').css({
        "left":((ww/2)-(vw/2))+'px',
        "top":((wh/2)-(vh/2))+'px',
        "position":'absolute',
        "background-color":'#000',
        "border":'1px solid #fff',
        "z-index":'9999'
    });
    $('#videocontainer').show();

}

function closeVideo()
{
    $('#videocontainer').hide();
    $('#closevideo').hide();

    $('#fadeout').animate({opacity:0.0},200,function(){
        $('#fadeout').css({width:'1px',height:'1px'});
        $('#fadeout').remove();
    });

}

