//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj() 
{ 

var str='<object width="50" height="200" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="cariflash">';
str += '<param name="allowScriptAccess" value="sameDomain" />';
str += '<param name="movie" value="logo_zg.swf" />';
str += '<param name="quality" value="best" />';
str += '<param name="bgcolor" value="#FFFFFF" />';
str += '<param name="menu" value="false" />';
str += '<param name="wmode" value="transparent" />';
str += '<param name="scale" value="noscale" />';
str += '<embed id="eqtv_zeitgeist_swf" src="logo_zg.swf" allowScriptAccess="sameDomain" wmode="transparent" scale="noscale" quality="high" bgcolor="#FFFFFF" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" name="cariflash" />';
str += '</object>';

  document.write(str);
}

function AC_FL_RunContent(){
  AC_Generateobj();
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj();
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
/*
 * Thickbox 2.1 - jQuery plugin for displaying content in a box above the page
 * 
 * Copyright (c) 2006, 2007 Cody Lindley (http://www.codylindley.com)
 *
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// on page load call TB_init
jQuery(document).ready(TB_init);

var hackHeight = 0;
var doHackHeight = false;

// add thickbox to href elements that have a class of .thickbox
function TB_init(){
	jQuery("a.thickbox").click(function(event){
		// stop default behaviour
		event.preventDefault();
		// remove click border
		this.blur();
	
		// get caption: either title or name attribute
		var caption = this.title || this.name || "";
		
		// get rel attribute for image groups
		var group = this.rel || false;
		
		// display the box for the elements href
		TB_show(caption, this.href, group);
	});
}

// called when the user clicks on a thickbox link
function TB_show(caption, url, rel) {

	// create iframe, overlay and box if non-existent
	if ( !jQuery("#TB_HideSelect").length ) {
		jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		jQuery("#TB_overlay").click(TB_remove);
	}
	// TODO replace or check if event is already assigned
	jQuery(window).scroll(TB_position);
	
	// TODO replace
	TB_overlaySize();
	
	// TODO create loader only once, hide and show on demand
	jQuery("body").append("<div id='TB_load'><img src='lib/contrib/thickbox/loadingAnimation.gif' /></div>");
	TB_load_position();
	
	// check if a query string is involved
	var baseURL = url.match(/(.+)?/)[1] || url;

	// regex to check if a href refers to an image
	var imageURL = /\.(jpe?g|png|gif|bmp)/gi;

	// check for images
	if ( baseURL.match(imageURL) ) {
		var dummy = { caption: "", url: "", html: "" };
		
		var prev = dummy,
			next = dummy,
			imageCount = "";
			
		// if an image group is given
		if ( rel ) {
			function getInfo(image, id, label) {
				return {
					caption: image.title,
					url: image.href,
					html: "<span id='TB_" + id + "'>&nbsp;&nbsp;<a href='#'>" + label + "</a></span>"
				}
			}
		
			// find the anchors that point to the group
			var imageGroup = jQuery("a[@rel="+rel+"]").get();
			var foundSelf = false;
			
			// loop through the anchors, looking for ourself, saving information about previous and next image
			for (var i = 0; i < imageGroup.length; i++) {
				var image = imageGroup[i];
				var urlTypeTemp = image.href.match(imageURL);
				
				// look for ourself
				if ( image.href == url ) {
					foundSelf = true;
					imageCount = "Image " + (i + 1) + " of "+ (imageGroup.length);
				} else {
					// when we found ourself, the current is the next image
					if ( foundSelf ) {
						next = getInfo(image, "next", "Next &gt;");
						// stop searching
						break;
					} else {
						// didn't find ourself yet, so this may be the one before ourself
						prev = getInfo(image, "prev", "&lt; Prev");
					}
				}
			}
		}
		
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			imgPreloader.onload = null;

			// Resizing large images
			var pagesize = TB_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			// TODO don't use globals
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			
			// TODO empty window content instead
			jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='schliessen'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>schliessen</a></div>");
			
			jQuery("#TB_closeWindowButton").click(TB_remove);
			
			function buildClickHandler(image) {
				return function() {
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					TB_show(image.caption, image.url, rel);
					return false;
				};
			}
			var goPrev = buildClickHandler(prev);
			var goNext = buildClickHandler(next);
			if ( prev.html ) {
				jQuery("#TB_prev").click(goPrev);
			}
			
			if ( next.html ) {		
				jQuery("#TB_next").click(goNext);
			}
			
			// TODO use jQuery, maybe with event fix plugin, or just get the necessary parts of it
			document.onkeydown = function(e) {
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				switch(keycode) {
				case 27:
					TB_remove();
					break;
				case 190:
					if( next.html ) {
						document.onkeydown = null;
						goNext();
					}
					break;
				case 188:
					if( prev.html ) {
						document.onkeydown = null;
						goPrev();
					}
					break;
				}
			}
			
			// TODO don't remove loader etc., just hide and show later
			TB_position();
			jQuery("#TB_load").remove();
			jQuery("#TB_ImageOff").click(TB_remove);
			
			// for safari using css instead of show
			// TODO is that necessary? can't test safari
			jQuery("#TB_window").css({display:"block"});
		}
		imgPreloader.src = url;
		
	} else { //code to show html pages
		
		var queryString = url.match(/\?(.+)/)[1];
		var params = TB_parseQuery( queryString );
		
		TB_WIDTH = (params['width']*1) + 30;
		TB_HEIGHT = (params['height']*1) + 40;

		var ajaxContentW = TB_WIDTH - 30,
			ajaxContentH = TB_HEIGHT - 45;
		
		if(url.indexOf('TB_iframe') != -1){				
			urlNoQuery = url.split('TB_');		
			jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='schliessen'>schliessen</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showIframe()'> </iframe>");
		} else {
			jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>schliessen</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
		}
				
		jQuery("#TB_closeWindowButton").click(TB_remove);
		
			if(url.indexOf('TB_inline') != -1){	
				jQuery("#TB_ajaxContent").html(jQuery('#' + params['inlineId']).html());
				doHackHeight = true;
				
				if(params['inlineId']=='confirm_download') {					
					hackHeight = 40;
					TB_HEIGHT = 122;
					TB_WIDTH = 344;					
				}				
				TB_position();
				hackHeight = 0;
				doHackHeight = false;
				jQuery("#TB_load").remove();
				jQuery("#TB_window").css({display:"block"}); 
			}else if(url.indexOf('TB_iframe') != -1){
				TB_position();
				if(frames['TB_iframeContent'] == undefined){//be nice to safari
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"});
					jQuery(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
				}
			}else{
				jQuery("#TB_ajaxContent").load(url, function(){
					TB_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"}); 
				});
			}
		
	}
	
	jQuery(window).resize(TB_position);
	
	document.onkeyup = function(e){ 	
		if (e == null) { // ie
			keycode = event.keyCode;
		} else { // mozilla
			keycode = e.which;
		}
		if(keycode == 27){ // close
			TB_remove();
		}	
	}
		
}

//helper functions below

function TB_showIframe(){
	jQuery("#TB_load").remove();
	jQuery("#TB_window").css({display:"block"});
}

function TB_remove() {
 	jQuery("#TB_imageOff").unbind("click");
	jQuery("#TB_overlay").unbind("click");
	jQuery("#TB_closeWindowButton").unbind("click");
	jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
	jQuery("#TB_load").remove();
	return false;
}

function TB_position() {
	var pagesize = TB_getPageSize();	
	var arrayPageScroll = TB_getPageScrollTop();
	var style = {width: TB_WIDTH, left: (arrayPageScroll[0] + (pagesize[0] - TB_WIDTH)/2), top: (arrayPageScroll[1] + (pagesize[1]-(doHackHeight ? (TB_HEIGHT+hackHeight) : TB_HEIGHT))/2)};
	

	jQuery("#TB_window").css(style);
}

function TB_overlaySize(){
	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {	
		yScroll = window.innerHeight + window.scrollMaxY;
		xScroll = window.innerWidth + window.scrollMaxX;
		var deff = document.documentElement;
		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		xScroll -= (window.innerWidth - wff);
		yScroll -= (window.innerHeight - hff);
	} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
		xScroll = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
		xScroll = document.body.offsetWidth;
  	}
	jQuery("#TB_overlay").css({"height": yScroll, "width": xScroll});
	jQuery("#TB_HideSelect").css({"height": yScroll,"width": xScroll});
}

function TB_load_position() {
	var pagesize = TB_getPageSize();
	var arrayPageScroll = TB_getPageScrollTop();
	jQuery("#TB_load")
		.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2), top: (arrayPageScroll[1] + ((pagesize[1]-100)/2)) })
		.css({display:"block"});
}

function TB_parseQuery ( query ) {
	// return empty object
	if( !query )
		return {};
	var params = {};
	
	// parse query
	var pairs = query.split(/[;&]/);
	for ( var i = 0; i < pairs.length; i++ ) {
		var pair = pairs[i].split('=');
		if ( !pair || pair.length != 2 )
			continue;
		// unescape both key and value, replace "+" with spaces in value
		params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
   }
   return params;
}

function TB_getPageScrollTop(){
	var yScrolltop;
	var xScrollleft;
	if (self.pageYOffset || self.pageXOffset) {
		yScrolltop = self.pageYOffset;
		xScrollleft = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
		xScrollleft = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
		xScrollleft = document.body.scrollLeft;
	}
	arrayPageScroll = new Array(xScrollleft,yScrolltop) 
	return arrayPageScroll;
}

function TB_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}
/*  
 *--------------------------------------------------------------------------
 *	Prototype JavaScript framework
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
/*--------------------------------------------------------------------------*/

//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).

var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}

Object.extend = function(destination, source) {
	for (property in source) destination[property] = source[property];
	return destination;
}

Function.prototype.bind = function(object) {
	var __method = this;
	return function() {
		return __method.apply(object, arguments);
	}
}

Function.prototype.bindAsEventListener = function(object) {
var __method = this;
	return function(event) {
		__method.call(object, event || window.event);
	}
}

function $() {
	if (arguments.length == 1) return get$(arguments[0]);
	var elements = [];
	$c(arguments).each(function(el){
		elements.push(get$(el));
	});
	return elements;

	function get$(el){
		if (typeof el == 'string') el = document.getElementById(el);
		return el;
	}
}

if (!window.Element) var Element = new Object();

Object.extend(Element, {
	remove: function(element) {
		element = $(element);
		element.parentNode.removeChild(element);
	},

	hasClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var hasClass = false;
		element.className.split(' ').each(function(cn){
			if (cn == className) hasClass = true;
		});
		return hasClass;
	},

	addClassName: function(element, className) {
		element = $(element);
		Element.removeClassName(element, className);
		element.className += ' ' + className;
	},
  
	removeClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var newClassName = '';
		element.className.split(' ').each(function(cn, i){
			if (cn != className){
				if (i > 0) newClassName += ' ';
				newClassName += cn;
			}
		});
		element.className = newClassName;
	},

	cleanWhitespace: function(element) {
		element = $(element);
		$c(element.childNodes).each(function(node){
			if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);
		});
	},

	find: function(element, what) {
		element = $(element)[what];
		while (element.nodeType != 1) element = element[what];
		return element;
	}
});

var Position = {
	cumulativeOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop  || 0;
			valueL += element.offsetLeft || 0;
			element = element.offsetParent;
		} while (element);
		return [valueL, valueT];
	}
};

document.getElementsByClassName = function(className) {
	var children = document.getElementsByTagName('*') || document.all;
	var elements = [];
	$c(children).each(function(child){
		if (Element.hasClassName(child, className)) elements.push(child);
	});  
	return elements;
}

//useful array functions
Array.prototype.each = function(func){
	for(var i=0;ob=this[i];i++) func(ob, i);
}

function $c(array){
	var nArray = [];
	for (i=0;el=array[i];i++) nArray.push(el);
	return nArray;
}/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;// some variables to save
var currentPosition;
var currentVolume;
var currentItem;

// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm) { thisMovie("mpl").sendEvent(typ,prm); };

/*
function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "time") { currentPosition = pr1; }
	else if(typ == "volume") { currentVolume = pr1; }
	else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
	var id = document.getElementById(typ);
	id.innerHTML = typ+ ": "+Math.round(pr1);
	pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
	if(pid != "null") {
		document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
	}
};
*/

// These functions are caught by the feeder object of the player.
function loadFile(obj) { if(thisMovie("mpl")) thisMovie("mpl").loadFile(obj); };
function addItem(obj,idx) { if(thisMovie("mpl")) thisMovie("mpl").addItem(obj,idx); }
function removeItem(idx) { if(thisMovie("mpl")) thisMovie("mpl").removeItem(idx); }
function getItemData(idx) {
	var obj = thisMovie("mpl").itemData(idx);
	var nodes = "";
	for(var i in obj) { 
		nodes += "<li>"+i+": "+obj[i]+"</li>"; 
	}
	document.getElementById("data").innerHTML = nodes;
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};


var zgMovie = Class.create();

zgMovie.prototype = {
		initialize: function(id, filename) {
			this.id = id;
			this.filename = filename;

		}  		
};

var zgPlayer = Class.create();

zgPlayer.prototype = {
	initialize: function() {
		this.movies = Array();
	  	this.count = 0;
	  	this.current = -1;			
		this.start_at_movie = 0;
		this.start_at_specific = false;
		this.oneTimeInit = false;	  	
	}, 
	add: function(movie) {			
		this.movies[this.count] = movie;
		this.count++;
	},
	play: function() {
		//test_ start at specific point in playlist entry
		//first time only
		//when page is manually reloaded only...
		//oherwise call directly!
		if(this.start_at_specific && !this.oneTimeInit) {
			iCountMax = 0;
			iMax = this.movies.length;
			while(((aMovie = this.next()) || true) && iCountMax<iMax) {
				iCountMax++;
				//alert(aMovie.id);
				//alert(this.start_at_movie);
				if(aMovie.id==this.start_at_movie) {
					//alert("movie_id direct" + aMovie.id);
					this.oneTimeInit = true;
					this.start_at_specific = false;
					if(window.parent) {
						window.parent.movie_flash_play(aMovie.id, aMovie.filename);	
					} else {
						movie_flash_play(aMovie.id, aMovie.filename);
					}										
					break;
				}						
			}
			
			if(!this.oneTimeInit) {
				//alert("movie not found starting at the beginning of the playlist...");
				this.oneTimeInit = true;
				this.start_at_specific = false;
				this.current = -1;
				this.play();
			}
						
		} else {
			var aMovie = this.next();
			if(aMovie) {
				if(window.parent) {
					window.parent.movie_flash_play(aMovie.id, aMovie.filename);	
				} else {
					movie_flash_play(aMovie.id, aMovie.filename);
				}
			}			
		}

	},
	next: function() {
		if((this.current+1) < this.movies.length) {
			this.current++;				
		} else {
			this.current = 0;
		}
		if(this.current<this.movies.length) {
			return this.movies[this.current];	
		} else {
			return false;
		}			
	},
	current: function() {
		if(this.current<this.movies.length) {
			return this.movies[this.current];	
		} else {
			return false;
		}
	}		
};

function prepare_player() {
  s1.addParam('allowfullscreen','true');
  s1.addVariable("javascriptid","mpl"); 
  s1.addVariable('displayheight','288'); 
  s1.addVariable('frontcolor','0xFFFFFF');
  s1.addVariable('backcolor','0x86B003');
  s1.addVariable('lightcolor','0xFFFFFF');
  s1.addVariable('showicons','false');
  s1.addVariable('height','308'); 
  s1.addVariable('width','512'); 
  s1.addVariable('showdigits','false'); 
  s1.addVariable('autostart','false'); 
  s1.addVariable("enablejs","true");
  s1.write('player1');	
}
/*
content/view infos
*/

var activeContentFeed_name = "content_feed_";
var activeContentFeed_Image_name = "content_feed_img_";
var activeContentFeed_img_0 = "";
var activeContentFeed_img_1 = "";
var bForceEvent = false;
var startPlayer = false;


/*
player handling
*/	
var init_movie_desc_loaded = false;
var prev_played_movie = 0;
var bIsPlaying = false;
var zgPlayer = null;
var zgCurrentlyViewing = null;

var result_num = '';

/*
search 
*/
var channel_reload_eval_str = "";

function resetSearch() {
	simple_search_enabled = false;
	ext_search_enabled = false;			
	//var eSimpleSearchText = $('simple_search_text');
	var eExtSearchText  = $('ext_search_text');	
	//if(eSimpleSearchText) {
	//	eSimpleSearchText.value="";
	//}
	if(eExtSearchText) {
		eExtSearchText.value="";
	}	
}

function hoveringEnabled(feed) {
	return (feed!=activeContentFeed || bForceEvent);
}

function channelReloaded() {
	eval(channel_reload_eval_str);
	channel_reload_eval_str = "";
}

function onChannelReload(str) {
	channel_reload_eval_str = channel_reload_eval_str + str;
}

function doSimpleSearch(search_text) {
	simple_search_enabled = true;
	ext_search_enabled = false;
	simple_search_text = search_text;
	onChannelReload("showExtendedSearch();");
	setActiveFeed(0);	
}

function doExtSearch() {
	ext_search_enabled = true;
	ext_search_text = $('ext_search_text').value;
	onChannelReload("adjustByExtendedSearch();");
	
	setActiveFeed(0);	
}

function showExtendedSearch() {			
	
	var eSimpleSearchText = $('simple_search_text');
	var eExtSearchText  = $('ext_search_text');
	
	eExtSearchText.value = eSimpleSearchText.value;
	
	var eExtSearch = $('ext_search');
	eExtSearch.style.display = 'block';
	adjustScrollBy(0,250);
}

function adjustByExtendedSearch() {
	var eExtSearchCategory = $('ext_search_category');
	if(eExtSearchCategory && eExtSearchCategory.value>0) {
		aContentFeed = document.getElementById(activeContentFeed_Image_name + eExtSearchCategory.value);
		if(aContentFeed) {
			bForceEvent = true;
			if(activeContentFeed>0) {
				oldContentFeed = aContentFeed = document.getElementById(activeContentFeed_Image_name + activeContentFeed);
				oldContentFeed.onmouseout();
			}					
			aContentFeed.onmouseover();
			activeContentFeed = eExtSearchCategory.value;
			bForceEvent = false;
		}
	}
}

function register_new_feed_player(area, player) {						
	if(activeContentFeed==area && !bIsPlaying) {
		zgPlayer = player;
		if(current_movie>0) {
			zgPlayer.start_at_specific = true;
			zgPlayer.start_at_movie = current_movie;
		}
		zgPlayer.play();
	} else {
		// save for non page reloads
		zgCurrentlyViewing = player;
	}
}

function setActiveFeed(new_feed) {
	var aContentFeed = document.getElementById(activeContentFeed_Image_name + new_feed);
	var oldContentFeed = document.getElementById(activeContentFeed_Image_name + activeContentFeed);
	
	bForceEvent = true;
	
	hideLightboxInfo();
	
	if(oldContentFeed) {
		oldContentFeed.onmouseout();	
	}
	
	if((!simple_search_enabled || !ext_search_enabled) && aContentFeed) {
		aContentFeed.onmouseover();	
	}			
	
	bForceEvent = false;
				
	eChannelFrame = document.getElementById('channelFrame');
	
	sNewSrc = page + '?pid=' + page_channel;
	sNewSrc = sNewSrc + '&m=' + mMovieViewMode;
	sNewSrc = sNewSrc + '&sa=' + new_feed;
	sNewSrc = sNewSrc + '&reload_movie=0';
				
	if(simple_search_enabled) {
		//alert("passing simple search");
		sNewSrc = sNewSrc + '&action=doSearch';
		sNewSrc = sNewSrc + '&search=' + simple_search_text;
	}	
	
	if(ext_search_enabled) {
		//alert("passing ext search");
		sNewSrc = sNewSrc + '&action=doSearch';
		sNewSrc = sNewSrc + '&extSearch=1';
		sNewSrc = sNewSrc + '&search=' + ext_search_text;
		sNewSrc = sNewSrc + '&search_category=' + $('ext_search_category').value;
		sNewSrc = sNewSrc + '&search_start_day=' + $('ext_search_startdate_day').value;
		sNewSrc = sNewSrc + '&search_start_month=' + $('ext_search_startdate_month').value;
		sNewSrc = sNewSrc + '&search_start_year=' + $('ext_search_startdate_year').value;
		sNewSrc = sNewSrc + '&search_end_day=' + $('ext_search_enddate_day').value;
		sNewSrc = sNewSrc + '&search_end_month=' + $('ext_search_enddate_month').value;
		sNewSrc = sNewSrc + '&search_end_year=' + $('ext_search_enddate_year').value;										
	}					
	
	if(current_movie!=0) {
		sNewSrc = sNewSrc + '&movie=' + current_movie;
	}
	
	eChannelFrame.src = sNewSrc;			
	activeContentFeed = new_feed;
}

function get_description_refresh(current_movie) {
	src = page + "?pid=" + page_player;
	src = src + "&movie=" + current_movie;
	src = src + "&sa=" + activeContentFeed;
	src = src + "&a=description_refresh";			
	eRefreshFrame = document.getElementById('refreshFrame');
	eRefreshFrame.src = src;
}

// called upon movie clip addtion to lightbox
function got_lightbox_content_info_refresh(count, size) {
	var eLightboxCount = document.getElementById('lightbox_clips');
	var eLightboxSize = document.getElementById('lightbox_size');
	eLightboxCount.innerHTML = "CLIPS IN LIGHTBOX: " + count;
	eLightboxSize.innerHTML = "GR&Ouml;SSE: " + size + "&nbsp; MB";
}

function got_description_refresh(eDescription_new) {			
	eDescriptionDiv = document.getElementById('description_content');
	//eDescriptionDiv.innerHTML = frames[1].document.getElementById('description_content').innerHTML;
	eDescriptionDiv.innerHTML = frames[1].document.getElementById('description_content').innerHTML;
}

function movie_flash_next() {
	zgPlayer.play();
}

function movie_flash_play(id, src) {
	if(typeof s1 != 'undefined') {
		if(!bIsPlaying) {
			bLoadDescription = (!has_init_movie) || (has_init_movie && init_movie_desc_loaded) || (has_init_movie && !init_movie_desc_loaded && id!=init_movie);
			
			if(bLoadDescription) {
				get_description_refresh(id);	
			}
								
			init_movie_desc_loaded = true;
			//alert('0fjsadlkfjlkdsjlfkjl');
			var new_file =  site + 'media_features' + src;					
			loadFile({file: new_file});
			setTimeout('sendEvent(\'playpause\')', 500);	
					
			//alert(new_file);
/*			if(prev_played_movie!=0) {

			} else {
				loadFile({file: new_file});
				//sendEvent('stop');
				setTimeout('sendEvent(\'playpause\')', 500);
				//sendEvent('playpause');				
			}					
*/
			
			bIsPlaying = true;
			
			if(current_movie!=0) {
				
				prev_played_movie = current_movie;
				
				if(mMovieViewMode=='t') {														
					curr_movie_img = frames[0].document.getElementById('thumb_list_playing_'+current_movie);
					curr_movie_img.style.display = 'none';
					curr_movie_img = frames[0].document.getElementById('thumb_list_play_'+current_movie);
					curr_movie_img.style.display = 'inline';
					curr_movie_img = frames[0].document.getElementById('thumb_list_play2_'+current_movie);
					curr_movie_img.style.display = 'inline';														
					set_thumb_view_type(current_movie, 'inactive', 'active');
					
				} else if(mMovieViewMode=='l') {							
					curr_movie_img = frames[0].document.getElementById('movie_list_play_img_'+current_movie);						
					curr_movie_img.src = 'img/test/eq_tv_list_play.gif';
					set_list_view_type(current_movie, 'inactive', 'active');
				}						
			}
			
			if(mMovieViewMode=='t')  {
				curr_movie_img = frames[0].document.getElementById('thumb_list_playing_'+id);
				curr_movie_img.style.display = 'inline';
				curr_movie_img = frames[0].document.getElementById('thumb_list_play_'+id);
				curr_movie_img.style.display = 'none';
				curr_movie_img = frames[0].document.getElementById('thumb_list_play2_'+id);
				curr_movie_img.style.display = 'none';		
																												
				set_thumb_view_type(id, 'inactive', 'active');	
			}
			else if(mMovieViewMode=='l'){
				//alert("changing view.......");						
				curr_movie_img = frames[0].document.getElementById('movie_list_play_img_'+id);						
				curr_movie_img.src = 'img/test/eq_tv_list_playing.gif';
				set_list_view_type(id, 'inactive', 'active');
			}					
			current_movie = id;										
		}
	}			
}

function set_thumb_view_type(id, style_out, style_in) {			
	curr_movie_row = frames[0].document.getElementById('thumb_list_'+id);
	eCells = curr_movie_row.getElementsByTagName('span');
	for(i=0;i<eCells.length;i++) {
		jscss('swap', eCells[i], style_out, style_in);
	}			
	
}

function set_list_view_type(id, style_out, style_in) {
	curr_movie_row = frames[0].document.getElementById('movie_list_row_'+id);
	eCells = curr_movie_row.getElementsByTagName('td');
	for(i=0;i<eCells.length;i++) {
		jscss('swap', eCells[i], style_out, style_in);
		eSubCells = eCells[i].getElementsByTagName('b');
		for(j=0;j<eSubCells.length;j++) {
			jscss('swap', eSubCells[j], style_out, style_in);	
		}		
	}			
}

function change_view_type(new_type) {
	var view_list_link = document.getElementById("view_list_link");
	var view_thumb_link = document.getElementById("view_thumb_link");
	
	if(new_type=="thumb") {
		if(view_thumb_link.className.indexOf("_active")==-1) {
			mMovieViewMode = 't';			
		}
	} else {
		if(view_list_link.className.indexOf("_active")==-1) {							
			mMovieViewMode = 'l';
		}
	}
	onChannelReload("set_view_mode();");
	setActiveFeed(activeContentFeed);
	return false;
}					

function set_view_mode() {

	var view_list_link = document.getElementById("view_list_link");
	var view_thumb_link = document.getElementById("view_thumb_link");
	
	if(mMovieViewMode=="t") {
		if(view_thumb_link.className.indexOf("_active")==-1) {
			view_list_link.className = view_list_link.className.replace(/active/g, "");	
			view_thumb_link.className = view_thumb_link.className + 'active';					
			var eMovieChoose = document.getElementById('movie_thumb');
			eMovieChoose.style.paddingTop = '20px';
			var eChannelFrame = document.getElementById('channelFrame');
			eChannelFrame.style.overflowY = '';			
			var tbl = document.getElementById('tbl_movie_list_header');
			tbl.style.display = 'none';
			var movie_thumb = document.getElementById('movie_thumb');
			movie_thumb.style.height = '174px';			
		}
	} else {
		if(view_list_link.className.indexOf("_active")==-1) {
			view_thumb_link.className = view_thumb_link.className.replace(/active/g, "");	
			view_list_link.className = view_list_link.className + 'active';						
			var eMovieChoose = document.getElementById('movie_thumb');
			eMovieChoose.style.paddingTop = '0px';
			var eChannelFrame = document.getElementById('channelFrame');
			eChannelFrame.style.overflowY = 'scroll';						
			
			var tbl = document.getElementById('tbl_movie_list_header');
			tbl.style.display = 'block';
			var movie_thumb = document.getElementById('movie_thumb');
			movie_thumb.style.height = '204px';					
		}
	}	
}

function getUpdate(typ,pr1,pr2,pid) { 
	//alert(typ + "with the prl value of:" + prl);

	if (typ == "state" && pr1 == 3) {
	  bIsPlaying = false;
	  movie_flash_next();
	}
	/*
	if (typ == "state" && prl == 0) {
		sendEvent('playpause');
		alert("test");
	}
	*/
}
 
function jscss(a,o,c1,c2)
{
  switch (a){
    case 'swap':
      o.className=!jscss('check',o,c1)?o.className.replace(c2,c1) : o.className.replace(c1,c2);
    break;
    case 'add':
      if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className);
    break;
  }
}

function add_movie(movie, format) {
	add_movie_to_lightbox(movie, format);
}

function add_movie_to_lightbox(movie, format) {
	if(movie>0) {
		applyLightboxStyle(movie);
		src = page + "?pid=" + page_player;
		src = src + "&movie=" + current_movie;
		src = src + "&sa=" + activeContentFeed;
		src = src + "&a=l";
		src = src + "&f=" + format;
		src = src + "&seamless=1";
		eRefreshFrame = document.getElementById('refreshFrame');
		eRefreshFrame.src = src;		
		setActiveFeed(activeContentFeed);
	}
}

function submitRequest(e) {
	var characterCode 
	
	if(e && e.which){
		e = e;
		characterCode = e.which;
	}
	else{
		e = event;
		characterCode = e.keyCode;
	}
	return (characterCode == 13);
}

function saveLogin() {
	if(document.loginForm.movie.value!=current_movie) 
		document.loginForm.movie.value = current_movie;
}

function doLogin(e) {
	saveLogin();	
	submitRequest(e) ? document.loginForm.submit() : false;
}

function doExtenedSearch(e) {
	submitRequest(e) ? doExtSearch() : false;
}

function selectSimpleSearch() {
	var searchBox = document.getElementById('searchbox_simple_search');
	if(!jscss('check', searchBox, 'bgs_active')) {
		jscss('swap', searchBox, 'bgs_inactive', 'bgs_active');	
	}	
	
	/*
	var searchBox = document.getElementById('searchbtn_simple_search');
	if(!jscss('check', searchBox, 'bgs_active')) {
		jscss('swap', searchBox, 'bgs_inactive', 'bgs_active');	
	}
	*/	
	
	var searchBtn = document.getElementById('img_simple_search');
	searchBtn.src = 'img/test/suche/suche_button_aktiv.gif';
}

function deselectSimpleSearch() {
	var searchBox = document.getElementById('searchbox_simple_search');
	if(!jscss('check', searchBox, 'bgs_inactive')) {
		jscss('swap', searchBox, 'bgs_active', 'bgs_inactive');	
	}		
	var searchBtn = document.getElementById('img_simple_search');
	searchBtn.src = 'img/test/suche/suche_button.gif';	
}

function applyLightboxStyle(movie) {
	if(mMovieViewMode=='t') {		
		var movie_thumb = frames[0].document.getElementById("movie_thumb_"+movie);
		if(movie_thumb) {			
			movie_thumb.setAttribute('style','-moz-opacity: 0.65; opacity: 0.65; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=65);');
		}
	} else if(mMovieViewMode=='l') {
		var movie_list = frames[0].document.getElementById("movie_list_row_"+movie);
		if(movie_list) {						
			var movie_list_cells = movie_list.getElementsByTagName('td');
			for(i=0;i<movie_list_cells.length;i++) {
				var movie_list_cell = movie_list_cells[i];
				jscss('swap', movie_list_cell, 'movie_list_cell', 'movie_list_cell_lightboxed');
			}
		}		
	}
}

function removeLightboxStyle(movie) {
	if(mMovieViewMode=='t') {		
		var movie_thumb = frames[0].document.getElementById("movie_thumb_"+movie);
		if(movie_thumb) {			
			movie_thumb.setAttribute('style','');
		}
	} else if(mMovieViewMode=='l') {
		var movie_list = frames[0].document.getElementById("movie_list_row_"+movie);
		if(movie_list) {						
			var movie_list_cells = movie_list.getElementsByTagName('td');
			for(i=0;i<movie_list_cells.length;i++) {
				var movie_list_cell = movie_list_cells[i];
				jscss('swap', movie_list_cell, 'movie_list_cell_lightboxed', 'movie_list_cell');
			}
		}		
	}
}

function showLightboxInfo() {
	var eLightboxInfo = document.getElementById('lightbox_info');
	if(eLightboxInfo) {
		eLightboxInfo.style.display = 'block';	
	}
}

function hideLightboxInfo() {
	var eLightboxInfo = document.getElementById('lightbox_info');
	if(eLightboxInfo) {
		eLightboxInfo.style.display = 'none';	
	}
}

function displaySearchResultInfo(search_text, num_rows) {
	var eSearchResultInfo = document.getElementById('search_results_info');
	if(eSearchResultInfo) {
		eSearchResultInfo.style.display = 'block';
	}
	
	var eSearchText = document.getElementById('result_search_text');
	if(eSearchText) {
		eSearchText.innerHTML = search_text;
	}

	var eSearchNum = document.getElementById('result_num');
	if(eSearchText) {
		eSearchNum.innerHTML = num_rows;
	}	
}

function hideSearchResultInfo() {
	var eSearchResultInfo = document.getElementById('search_results_info');
	if(eSearchResultInfo) {
		eSearchResultInfo.style.display = 'none';
	}	
}

function feed_click(feed) {
	hideSearchResultInfo(); 
	deselectSimpleSearch(); 
	resetSearch();
	setActiveFeed(feed);	
}

function showLightbox(step) {
	get_lightbox_screen(step);
}

function get_lightbox_screen(step) {
	src = page + "?pid=" + page_player;
	src = src + "&a=v";			
	src = src + "&step="+step;
	src = src + "&seamless=1";
	eRefreshFrame = document.getElementById('refreshFrame');
	eRefreshFrame.src = src;
}

function got_lightbox_screen() {
	eDescriptionDiv = document.getElementById('content');
	eRefreshFrame = document.getElementById('refreshFrame');
	
	if(eRefreshFrame.contentDocument)	
		eDescriptionDiv.innerHTML = eRefreshFrame.contentDocument.getElementById('lightbox_outer').innerHTML;
	else 
		eDescriptionDiv.innerHTML = eRefreshFrame.contentWindow.document.getElementById('lightbox_outer').innerHTML;
}

function setDownload(checkbox, key) {
	/*
	var row = document.getElementById('lightbox_choice_row_' + key);
	if(row) {
		if(checkbox.checked) {
			adjustLightboxChoiceListEntry(row, 'choice_inactive', 'choice_active', 'choice_dl_inactive', 'choice_dl_active');
		} else {
			adjustLightboxChoiceListEntry(row, 'choice_active', 'choice_inactive', 'choice_dl_active', 'choice_dl_inactive');
		}
		storeDownloadInformation(key, checkbox.checked);
	}
	
	getLightboxChoicePrice();
	*/
	var row = document.getElementById('lightbox_choice_row_' + key);
	adjustLightboxChoiceListEntry(row, 'choice_inactive', 'choice_active', 'choice_dl_inactive', 'choice_dl_active');	
	storeDownloadInformation(key, true);
}

function storeDownloadInformation(key, doDownload) {
	src = page + "?pid=" + page_player;
	src = src + "&action=" + (doDownload ? 'add_dl' : 'remove_dl');			
	src = src + "&key="+key;
	src = src + "&seamless=1";
	eRefreshFrame = document.getElementById('refreshFrame');
	eRefreshFrame.src = src;	
}


function adjustLightboxChoiceListEntry(element, style_out, style_in, dl_style_out, dl_style_in) {
	eCells = element.getElementsByTagName('td');
	for(i=0;i<eCells.length-1;i++) {
		if(jscss('check', eCells[i], style_out)) {
			jscss('swap', eCells[i], style_out, style_in);
		}		
	}
	if(jscss('check', eCells[i], dl_style_out)) {
		jscss('swap', eCells[i], dl_style_out, dl_style_in);
	}
}

function removeFromLightbox(movie, key) {
	removeLightboxStyle(movie);
	
	src = page + "?pid=" + page_player;
	src = src + "&key="+key;
	src = src + "&removeFromLightbox=1";
	src = src + "&seamless=1";
	eRefreshFrame = document.getElementById('refreshFrame');
	eRefreshFrame.src = src;
	
	var row = document.getElementById('lightbox_choice_row_' + key);
	row.parentNode.removeChild(row);
	
	if(activeContentFeed==lightboxFeed) {
		if(mMovieViewMode=='t') {		
			var movie_thumb = frames[0].document.getElementById("movie_thumb_"+movie);
			movie_thumb.parentNode.removeChild(movie_thumb);
		} else if(mMovieViewMode=='l') {
			var movie_list = frames[0].document.getElementById("movie_list_row_"+movie);
			movie_list.parentNode.removeChild(movie_list);
		}
	}	
}

function getLightboxChoicePrice() {
	src = page + "?pid=" + page_player;
	src = src + "&lightboxChoicePriceRefresh=1";
	src = src + "&seamless=1";
	eRefreshFrame = document.getElementById('refreshFrame');
	eRefreshFrame.src = src;	
}

function gotLightboxChoicePrice(new_price) {
	var ePrice = document.getElementById('lightbox_choice_total_costs');
	if(ePrice) {
		ePrice.innerHTML = new_price;
	}
}

function get_page(id, src) {
	var bFollow = (id!=page_player);
	if(bFollow) {
		var img = document.getElementById("nav_" + page_current);
		
		bForceEvent = true;
		img.onmouseout();
		bForceEvent = false;
		
		img = document.getElementById("nav_" + id);
		img.onmouseover();
		
		page_current = id;		
		src = src + ((id==page_player) ?  "&sa=" + (activeContentFeed>0 ? activeContentFeed : defaultFeed) + (current_movie>0 ? "&movie="+current_movie:"") : "");		
		eRefreshFrame = document.getElementById('refreshFrame');
		eRefreshFrame.src = src;		
	}
	return !bFollow;
	return false;
}

function allow_out(id) {
	return id!=page_current;
}

function got_page(pid) {
	eDescriptionDiv = document.getElementById('content');
	eDescriptionDiv.innerHTML = frames[1].document.getElementById('page_content').innerHTML;
	/*if(pid==page_player) {
		s1 = frames[1].document.s1;
		movie_flash_next();
		//prepare_player();
		//zgPlayer.play();
	
	}	*/
}

function confirm_download(multiple, cost, movie_id, url, hidden) {
	sMultipleText = 'Sie sind im Begriff, Clips downzuloaden. ';
	sSingleText = 'Sie sind im Begriff, einen Clip downzuloaden. ';
	
	sMultipleText2 = 'Diese Downloads werden Ihnen für ';
	sSingleText2 = 'Dieser Download wird Ihnen für ';	
	
	var confirmation_download_mode = document.getElementById('confirm_download_mode');
	confirmation_download_mode.value = multiple ? 'm' : 's';
	
	var confirmation_download_movie = document.getElementById('confirm_download_movie');
	confirmation_download_movie.value = (!multiple) ? movie_id : 0;
	
	var confirmation_download_url = document.getElementById('confirm_download_url');
	confirmation_download_url.value = url + "&js_add=1";
	
	var confirmation_text_field = document.getElementById('confirmation_text');
	var confirmation_text_field2 = document.getElementById('confirmation_text2');
	
	if(multiple) {
		confirmation_text_field.innerHTML = sMultipleText;	
		confirmation_text_field2.innerHTML = sMultipleText2;	
	} else {
		confirmation_text_field.innerHTML = sSingleText;
		confirmation_text_field2.innerHTML = sSingleText2;
	}

	var confirmation_cost_field = document.getElementById('confirmation_cost');
	confirmation_cost_field.innerHTML = cost + "&nbsp;";
	
	if(!hidden) {
		TB_show('Download Bestätigung', '#TB_inline?height=140&width=360&inlineId=confirm_download&modal=true', false);
	} else {
		document.location = confirmation_download_url.value;
		window.setTimeout('showLightbox(1)', 1000);		
	}
}

function download_confirmed() {
	var confirmation_download_mode = document.getElementById('confirm_download_mode');	
	var confirmation_download_movie = document.getElementById('confirm_download_movie');
	var confirmation_download_url = document.getElementById('confirm_download_url');
	
	if(confirmation_download_mode.value=='s') {
		TB_remove();				
		setDownload(null, confirmation_download_movie.value);
		document.location = confirmation_download_url.value;
		var eDownloadFrame = document.getElementById("download_" + 0);
		eDownloadFrame.src = confirmation_download_url.value;
		window.setTimeout('showLightbox(1)', 1000);
	} else {
		TB_remove();
		start_all_downloads();
		window.setTimeout('showLightbox(1)', 1000);
	}
}

function download_aborted() {
	TB_remove();
}

function start_all_downloads() {
	var openDownloadsForm = document.getElementById('openDownloadsForm');
	var baseURL = "";
	
	baseURL = page + "?pid=" + page_download;
	baseURL = baseURL + "&download=file";
	baseURL = baseURL + "&js_add=1";

	if(openDownloadsForm) {
		var openDownloads = openDownloadsForm.getElementsByTagName('input');
		for(i=0;i<openDownloads.length;i++) {
			var entry = openDownloads[i].value.split("_");
			var download_url = baseURL;
			
			download_url = download_url + "&format="+entry[1];
			download_url = download_url + "&movie="+entry[0];
			
			var eDownloadFrame = document.getElementById("download_" + i);
			eDownloadFrame.src = download_url;
			
			//document.location = download_url;
		}
	}
}
function save_scroll_link(a) {
	a.href=a.href + "&yscroll=" + getYScroll() + "&xscroll=" + getXScroll();
}

function save_scroll_form(form)  {
	if (navigator.appName == "Microsoft Internet Explorer") {
		scroll_top = document.body.scrollTop;
	} else{
		scroll_top = window.pageYOffset;          
	}
	
	$(form.id + "_yscroll").value = getYScroll();
	$(form.id + "_xscroll").value = getXScroll();
}

function loadScroll(x, y) {
	window.scrollTo(x,y);
}		

function getYScroll() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		return document.body.scrollTop;
	} else{
		return window.pageYOffset;          
	}			
}

function getXScroll() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		return document.body.scrollLeft;
	} else{
		return window.pageXOffset;          
	}			
}

function adjustScrollBy(xAdjust, yAdjust) {
	var xScroll = getXScroll();
	var yScroll = getYScroll();
	if(xAdjust>0)
		xScroll += xAdjust;
	if(yAdjust>0)
		yScroll += yAdjust;
		
	window.scrollTo(xScroll,yScroll);
}