/******************************************************************/
/* ARD Blankplayer Version 2                                      */
/******************************************************************/
/* � DMC 01 Consulting & Development GmbH - gerald.urbas@dmc01.at */
/******************************************************************/
/* www.jquery.com based scripts for ARD Videoportal               */
/******************************************************************/
/* inits major things                                             */
/* Player, Scrollbars, some global functions                      */
/******************************************************************/

if (typeof showplayer!="undefined") { // if showplayer is present generate the objects
	var imgpath = "img/videocontrol/";
	var player = false;
	var ec_current = false;
	var oldvote = 0;
}

$j(document).ready(function(){ // Page is ready
	// this initialises the player debugging if needed
	$j("#infopane").hide(); // make sure info layer is invisible (bottom infoplayer for help and infobutton)
	if (typeof pdebug!="undefined" && pdebug==false) {
		$j("#videodebugclear").hide(); // Hide debugging clearbutton layer
		$j("#videodebug").hide(); // Hide debugging layer
	}
	// this initialises the player object on the page. this generate some UI things and the player embed object code
	if (typeof showplayer!="undefined" && showplayer!=false) { // Show player is true - Home edition
		if (player.player_type=="extended") { // Show player is true - Extended edition			
			// startscreen settings... currently the Infopane is opened.
			player.start(); // after player preps start it.
			var tab = INITIALTAB;
			if (player.function_urls[tab]!=false && SHOWINITIALTAB==true) {
				var cobj = $j("#optionBoxContainer"); // tab content container 
				var obj = $j("#b_"+tab); // the infobutton
				var url = player.function_urls[tab]; // Some URL defined in the baseHTML code
				cobj.empty(); // forst empty the content container
				loading($j('#optionBoxContainer')); // loading animation
				//cobj.load(url+".html",null,setScrollPanes()); // load the url
				cobj.load(url+APPHTMLEXTENSION,function() {
					$j.getScript(url+APPJSEXTENSION); // Some Tabvs need some aditional JS code... but infopane doesnt!
				}); // load the url
				cobj.attr("url",url); // set an attr (used by button funcitons
				
				obj.addClass("optActive"); // Add correct klass to Button obj.
				ec_current = tab; // set current layer... later used to deativate Buttons--
			}
		}
	}
	//FIX IE6 FLICKER BUG!
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}	
});

function loading(jqtarget){ // loading animation	
	jqtarget.empty();
	jqtarget.show();
	var rand = Math.random()+"";
	rand = rand.substring(2, rand.length);
	jqtarget.append('<div id="loading'+rand+'" class="loading"></div>');
	flashvars 	= {};
	params = {wmode:"transparent",bgcolor:FLASHBGCOLOR};
	attributes 	= { style:";",'class':'loading'   };
	swfobject.embedSWF(FLASHLOADINGANIOMATION, "loading"+rand, FLASHLOADINGANIOMATION_W, FLASHLOADINGANIOMATION_H,"6", "", flashvars, params,attributes);
}

function UrlEncoding(input) {
	var encodedInputString=escape(input);
	encodedInputString=encodedInputString.replace("%3A", ":");
	return encodedInputString;
}

/*DASERSTE
Basically used 4 DasErste - used for compatibility 
*/

if (typeof closeHelpInfoObj != 'function') {
	function closeHelpInfoObj() {}
}
//if (typeof setScrollPanes != 'function') {
//	function setScrollPanes() {}
//}
/*DASERSTE*/