﻿$(document).ready(function() {
    $("a[href$='.mp3']").click(function() {
	    var flashvars = {
            file: this.href
            , title:$(this).html()
            , type: "sound"
            , allowscriptaccess:"always"
        };
        tb_show($(this).html(),"#TB_inline?height=400&width=500&inlineId=onPageHiddenContent", null);
        $('#TB_ajaxContent').html("<div id='flv1234'></div>");
        swfobject.embedSWF("Portaldata/1/resources/_internal/flashplayer/player.swf", "flv1234", "500", "375", "9.0.0", "Portaldata/2/resources/_intern/flashplayer/swfobject/expressInstall.swf", flashvars, {allowfullscreen:"true",bgcolor:"#ffffff"});
		return false;
	});
	
    $("a[href$='.flv']").click(function() {
		var altText = $(this).children("img:first").attr("alt");
		var flashTitle = "";
		if (altText != undefined && $.trim(altText) != "")	flashTitle = altText; else 	flashTitle = getTextRecursive(this.firstChild);
		
		var flashvars = {
            file: this.href
            , title: flashTitle
            , type: "video"
            , allowscriptaccess:"always"
        };
        tb_show(flashTitle,"#TB_inline?height=400&width=500&inlineId=onPageHiddenContent", null);
        $('#TB_ajaxContent').html("<div id='flv1234'></div>");
        swfobject.embedSWF("Portaldata/1/resources/_internal/flashplayer/player.swf", "flv1234", "500", "375", "9.0.0", "Portaldata/2/resources/_intern/flashplayer/swfobject/expressInstall.swf", flashvars, {allowfullscreen:"true",bgcolor:"#ffffff"});
		return false;
	});

/*
    $("a[href$='.swf']").click(function() {
        var altText = $(this).children("img:first").attr("alt");
        var flashTitle = "";
        if (altText != undefined && $.trim(altText) != "") flashTitle = altText; else  flashTitle = getTextRecursive(this.firstChild);
  
        var flashvars = { 
            title: flashTitle
            , type: "video"
            , allowscriptaccess:"always"
        };
       
        tb_show(flashTitle,"#TB_inline?height=700&width=900&inlineId=onPageHiddenContent", null);
        $('#TB_ajaxContent').html("<div id='flv1234'></div>");
        swfobject.embedSWF(this.href, "flv1234", "900", "675", "9.0.0", "Portaldata/1/resources/_internal/flashplayer/swfobject/expressInstall.swf", flashvars, { allowfullscreen: "true", bgcolor: "#ffffff" });
        return false;
    });
*/


	$("a[rel^='prettyPhoto']").prettyPhoto({
				animationSpeed: 'normal', /* fast/slow/normal */
				padding: 40, /* padding for each side of the picture */
				opacity: 0.35, /* Value betwee 0 and 1 */
				showTitle: false, /* true/false */
				allowresize: true, /* true/false */
				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
				hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
				modal: false, /* If set to true, only the close button will close the window */
				changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
				callback: function(){} /* Called when prettyPhoto is closed */
			});
    
});

 
function getTextRecursive(node)
{
	var titleText = '';
	while (node != null)
	{
		if (node.nodeType == 3){titleText += node.nodeValue + " ";}
		if (node.hasChildNodes())
		{
			titleText += getTextRecursive(node.firstChild);
		}
		node = node.nextSibling;
	}
	return titleText;
}

