﻿function addItemToBasket(itemid, currentCount, obj)
{
if (!document.forms[0]) return;
var tmp = obj;
var count = null;
while (tmp.previousSibling)
{
tmp = tmp.previousSibling;
if (tmp.nodeName == "INPUT" && parseInt(tmp.value, 10) != NaN && tmp.value > 0)
{
count = parseInt(tmp.value);
break;
}
}
// if (count == null) { alert("Bitte geben Sie eine g\xFCltige Anzahl an."); return; }
obj.disabled = true;
var field = document.createElement("input");
field.type = "hidden";
field.id = "additem" + itemid;
field.name = "additem" + itemid;
field.value = count + currentCount;
document.forms[0].appendChild(field);
document.forms[0].submit();
}

/* FLV Player */
jQuery(document).ready(function() {
	//Hide (Collapse) the toggle containers on load
	jQuery(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click
	jQuery(".trigger").toggle(function(){
		jQuery(this).parent().addClass("active_expand");
		}, function () {
		jQuery(this).parent().removeClass("active_expand");
	});

	//Slide up and down on click
	jQuery(".trigger").click(function(){
		jQuery(this).next(".toggle_container").slideToggle("slow");
	});



	var imageArray = jQuery("a[href$='.flv']");
	var i=0;
	jQuery.each(imageArray, function() {
	    var href = jQuery(this).attr("href");
	    var title = jQuery(this).attr("title");
	    var image = "";
	    var  text= jQuery(this).text();

	    if(jQuery(this).text() == "" && jQuery("img", this).attr("src")!="undefined")
	    {
		image = "&image="+ jQuery("img", this).attr("src"); // bild
	    }
	    jQuery(this).attr("title", title);
	    jQuery(this).attr("href", "portaldata/1/Resources/_internal/js/flashplayer/player.swf?width=470&amp;height=320"+image+"&backcolor=#077f42&screencolor=#FFFFFF&frontcolor=#FFFFFF&lightcolor=#FFFFFF&autostart=true&file="+baseurl+href);
	    jQuery(this).attr("rel", "prettyPhoto"+i+"");
	    i++;
	});
	var imageArrayMp3 = jQuery("a[href$='.mp3']");
	i=0;
	jQuery.each(imageArrayMp3, function() {
	    var href = jQuery(this).attr("href");
	    var title = jQuery(this).attr("title");
	    var image = "";
	    var  text= jQuery(this).text();

	    if(jQuery(this).text() == "" && jQuery("img", this).attr("src")!="undefined")
	    {
		image = "&image="+ jQuery("img", this).attr("src"); // bild
	    }
	    jQuery(this).attr("title", title);
	    jQuery(this).attr("href", "portaldata/1/Resources/_internal/js/flashplayer/player.swf?width=470&amp;height=320"+image+"&backcolor=#077f42&screencolor=#FFFFFF&frontcolor=#FFFFFF&lightcolor=#FFFFFF&autostart=true&file="+baseurl+href);
	    jQuery(this).attr("rel", "prettyPhoto"+i+"");
	    i++;
	});
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({ theme: 'light_square' });

});


jQuery(function() {
        jQuery('.downloadlink').hover(
            function() {
		var downloadA = jQuery(this).children('a');
		var imgsrc = jQuery(downloadA).children('img').attr('src');
		jQuery(downloadA).children('img').attr(
			'src',
			imgsrc.replace( /\.gif$/, '_over.gif' )
		);
            },
            function() {
		var downloadA = jQuery(this).children('a');
		var imgsrc = jQuery(downloadA).children('img').attr('src');
		jQuery(downloadA).children('img').attr(
			'src',
			imgsrc.replace( /_over\.gif$/, '.gif' )
		);
            }
        );
    }); 
	
	jQuery(document).ready(function() {


var el = jQuery(".homepage-column").html();
if (el <= 0) {
var el2 = jQuery(".homepage-column").attr("id");
jQuery("#"+el2).attr({style:'display:none'});
return(false);
}
});

