$(document).ready(function(e){
	// Penny Pack Bild:
	$(".content .detail_col2 img.pp").hide();
    $(".content .detail_col2 img.pp").show('slow');
});

// Flash-Animationen > Suchergebnis (changed CSD: added flashsPath)
function swf_Suchergebnis(el, treffer, text, flashsPath){
	var flashvars = { version: "1.0", resulttext: text, treffertext: treffer };
	var params = false;
	var attributes = false;
	var movieUrl = flashsPath + "suchergebnis.swf";
	var expressUrl = flashsPath + "expressInstall.swf";
	swfobject.embedSWF(movieUrl, el, "253", "281", "9.0.0", expressUrl, flashvars, params, attributes);
}

// Flash-Animationen > Votings:
function swf_initVotingVideos(flvBig, flvThumb, htmlEle, playerUrl){
	
	for (var i = 0; i < flvBig.length; ++i){
		var flashvars = { version: "1.0", btnUrl: playerUrl+'?flv='+flvBig[i] };
		var params = false;
		var attributes = false;
		//alert(htmlEle[i]+' -> '+playerUrl+'?flv='+flvBig[i]);
		swfobject.embedSWF("swf/tvvote_thumb.swf", htmlEle[i], "94", "71", "9.0.0");
	}
}

// Angebot-Detailbilder:
function initDetailImages(){
	$(".content .detailThumbs a").click(function(){ 
		return switchDetailImage($(this).attr("id"));
    });
}

function switchDetailImage(id){
	thisSrc = $("#"+id+" img").attr("src");
	thisIndex = searchArray(detailThumbArray, thisSrc);
	switch(thisIndex) {
	  case 0:
		t1Index = 1;
		t2Index = 2;
		break;
	  case 1:
		t1Index = 2;
		t2Index = 0;
		break;
	  case 2:
		t1Index = 0;
		t2Index = 1;
		break;
	  default:
	  	thisIndex = 0;
		t1Index = 1;
		t2Index = 2;
		break;
	}
	//alert(thisSrc+" -> "+thisIndex+", "+t1Index+", "+t2Index);
	$(".content #detailImgBig").attr("src",detailImgArray[thisIndex]);
	$(".content .detailImgThumb1").attr("src",detailThumbArray[t1Index]);
	$(".content .detailImgThumb2").attr("src",detailThumbArray[t2Index]);
	return false;
}

function searchArray(arr,str){
	str=str.toUpperCase();
	arr[arr.length]=str;
	var i=0;
	while (arr[i].toUpperCase().indexOf(str)==-1) i++;
	if (i==arr.length-1) return -1; else return i;
}

// added by CSD 04.02.2009

// Flash-Animationen > Custom Script with Default Version 9.0.0
function swf_Embed(el, movieUrl, width, height){
	var flashvars = false;
	var params = false;
	var attributes = false;
	var defaultFlashVersion = "9.0.0";	
	swfobject.embedSWF(movieUrl, el, width, height, defaultFlashVersion);
}

// Flash-Animation > Elements with fixed default width
function swf_PennyElement(el, movieUrl, width, height, position)
{
    var defaultWidth = 170; //minimum width
    var defaultHeight = 117; //minimum height
    
    if (width==0||height==0)
    {   
        switch (position) 
        {    
            case "NaviLeft":
            //set dimensions for NaviLeft
                width=170;
                height=117;
                break;
            case "Sidebar":
            //set dimensions for sidebar
                width=186;
                height=133;
                break;
            default:
                //set dimensions if no position matched
                width=defaultWidth;
                height=defaultHeight;
                break;
         }
     }
	 swf_Embed(el, movieUrl, width, height);
}
