function initFAQ(){

	$$(".moduleCinemaFAQDropdown").each(function(e){
        e.stopObserving("click");
		e.observe("click", function(){

            if (this.hasClassName("bgArrowRight")){
                this.removeClassName("bgArrowRight")
                this.addClassName("bgArrowDown")
            }else{
                this.removeClassName("bgArrowDown")
                this.addClassName("bgArrowRight")
            }
		
			Effect.toggle(this.down(".FAQDropdown"),'slide');

		});

	});
}//toggleFilter
function toggleFilter(){
	ul = document.getElementById('abc');
	on = ul.style.display;
	if(on != 'block'){
		ul.style.display = 'block';
		return false;
	}
	else {
		ul.style.display = 'none';
		return true;
	}
}
function select(value){
	input = document.getElementById('filter');
	input.value = value;
}

//togggleSort
function toggleSort(){
	ul = document.getElementById('def');
	on = ul.style.display;
	if(on != 'block'){
		ul.style.display = 'block';
		return false;
	}
	else {
		ul.style.display = 'none';
		return true;
	}
}
function select(value){
	input = document.getElementById('sort');
	input.value = value;
}



function camaoCookie(){
    var ccookie = {};

    this.init = function(){
        ccookie.backButton = $("zurucklink");
        ccookie.backButton.observe("click", this.backEvent.bind(this) );

      //  ccookie.last_page = this.getCookie("last_page");
        ccookie.last_url = this.getCookie("last_url");
        ccookie.last_page = unescape(this.getCookie("last_page"));

        //this.setCookie("last_page", page_title);
        this.setCookie("last_url", window.location.href);
        this.setCookie("last_page", p_title);

    
        ccookie.last_page = ccookie.last_page.replace("&amp;","&");

        if (ccookie.last_page){
            $("zurucklink").show();
            $("zurucklink").select("span")[0].update("Zurück zu " + ccookie.last_page);
        }else{
            $("zurucklink").hide();
        }
    }

    this.setCookie = function(cname, cvalue){ 
        var exp = new Date();     //set new date object
        exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead 
        document.cookie = cname + "=" + escape(cvalue) + "; path=/; expires=" + exp.toGMTString();
    }

    this.getCookie = function(cname){
        found = false;
        splittedCookies = document.cookie.split(";");
        splittedCookies.each(function(ccookie){
            tails = ccookie.split("=");
            if ( (tails[0].replace(/^\s+|\s+$/g, '') == cname) && (tails[1].replace(/^\s+|\s+$/g, '')) ){
                found = tails[1];
            }
        }.bind(this));
        return found;
    }

    this.backEvent = function(){
        if (ccookie.last_url) window.setTimeout("window.location = '" + unescape(ccookie.last_url) + "';",0);
    }

}

var camaoCookieObj = new camaoCookie();



//AB HIER IST ALTER CODE!! Weg damit ?!


var lasturl;
//Wird beim laden der seite aufegerufen
function lastpage_laden(){
		text = $('zurucklink').down("span").innerHTML.split('zu ')[1];
		//alert('loaded ' + text);
		
		if (text!=undefined){
			var exp = new Date();     //set new date object
			exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead 
	
			setCookie('last_page',text, exp);
		}else{
            var exp = new Date();     //set new date object
            exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead 
    
            setCookie('last_page',page_title, exp);
        }
		cookie = Get_Cookie('last_page');
        lasturl = Get_Cookie('last_url');

		if (cookie !=null){
			$('zurucklink').down("span").innerHTML='Zur&uuml;ck zu '+ Get_Cookie('last_page');
			$('zurucklink').down("span").setAttribute("style","");
		}
}

function setCookie(name, value, expires) {
		document.cookie = name + "=" + escape(value);
} 			

// this fixes an issue with the old method, ambiguous values 
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	
		// first we'll split this cookie up into name/value pairs
		// note: document.cookie only returns name=value, not the other components
		
		var a_all_cookies = document.cookie.split( ';' );
		var a_temp_cookie = '';
		var cookie_name = '';
		var cookie_value = '';
		var b_cookie_found = false; // set boolean t/f default f
		
		for ( i = 0; i < a_all_cookies.length; i++ ){
			// now we'll split apart each name=value pair
			a_temp_cookie = a_all_cookies[i].split( '=' );
			
			
			// and trim left/right whitespace while we're at it
			cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
			// if the extracted name matches passed check_name
			if ( cookie_name == check_name ){
				b_cookie_found = true;
				// we need to handle case where cookie has no value but exists (no = sign, that is):
				if ( a_temp_cookie.length > 1 )
				{
					cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
				}
				// note that in cases where cookie is initialized but no value, null is returned

//                console.log("GET " + check_name + " = " + cookie_value);
				return cookie_value;
				break;
			}
			a_temp_cookie = null;
			cookie_name = '';
		}
		if ( !b_cookie_found ){
			return null;
		}
}
//wird beim zurueck klicken aufgerufen
function saveCookie(){
	text = $('zurucklink').down("span").innerHTML.split('zu ')[1];
	
	//alert('clicked'+text)
	
	if (text!=undefined){
		var exp = new Date();     //set new date object
		exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead 

		
        setCookie('last_page',text, exp);
        setCookie('last_url',window.location.pathname, exp);
	}
        if(lasturl){
//            window.location = "http://" + window.location.host  + page_title;
        }
//	history.back();
}





















function Set_Cookie( name, value, expires, path, domain, secure ){
        // set time, it's in milliseconds
        var today = new Date();
        today.setTime( today.getTime() );
    
        /*
        if the expires variable is set, make the correct 
        expires time, the current script below will set 
        it for x number of days, to make it for hours, 
        delete * 24, for minutes, delete * 60 * 24
        */

        if ( expires ){
            expires = expires * 1000 * 60 * 60 * 24;
        }

        var expires_date = new Date( today.getTime() + (expires) );
        
        document.cookie = name + "=" +escape( value ) +
                    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
                    ( ( path ) ? ";path=" + path : "" ) + 
                    ( ( domain ) ? ";domain=" + domain : "" ) +
                    ( ( secure ) ? ";secure" : "" );
}/*
 * 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(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !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 elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = 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){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[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;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
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;
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;
var kontextualesWerbeelementKategorien;

function Advertisement(){
	this.request = function(){
	//	return '<?xml version="1.0" encoding="UTF-8" ?><xml><werbung bild_url="http://dev.kinopolis.kunden.camao.de/kinopolis/WerbungFolder/Werbung-1/raw" link="/kinopolis/angebote_und_events/kindergeburtstag_im_kino/kindergeburtstag_anmeldung/" priority="0"/></xml>';
    //    if (kontextualesWerbeelementKategorien){
		    count = $$("div.advertisementContextElement").length;
			if (window.location.search.indexOf("film_run") != -1){
				filmrunvalue_part = window.location.search.split("=");
				filmrunvalue = filmrunvalue_part[1];
				ajaxurl = "./WerbungFolder/view.html?count=" + count + "&page=" + window.location.pathname + "_" + filmrunvalue + "&category=" + kontextualesWerbeelementKategorien;
			}else{
				ajaxurl = "./WerbungFolder/view.html?count=" + count + "&page=" + window.location.pathname + "&category=" + kontextualesWerbeelementKategorien;
			}
		    new Ajax.Request(ajaxurl, {
			    method: 'get',
			    onSuccess: function(transport) {
    
    
				    try //Firefox, Mozilla, Opera, etc.
				    {
                        parser=new DOMParser();
                        r_root=parser.parseFromString(transport.responseText,"text/xml");
                    
                        
				    }
				    catch(e)
				    {
					    try //Internet Explorer
					    {
                            r_root=new ActiveXObject("Microsoft.XMLDOM");
                            r_root.async="false";
                            r_root.loadXML(transport.responseText);
					    }
					    catch(e) {alert(e.message)}
				    }
    
    
				    try{
    
					    var werbung = r_root.getElementsByTagName('werbung');
					    elements = $$("div.advertisementContextElement");
					    for (i=0; i < werbung.length; i++){
						    url = werbung[i].getAttribute("bild_url");
						    link = werbung[i].getAttribute("link");
		    
						    var a = new Element('a', { href: link });
						    var img = new Element('img', { src: url });
						    a.appendChild(img);
						    elements[i].appendChild(a);
					    }
				    }catch(e){
				    }
                    
var active_kid = camaoCookieObj.getCookie("kid");
if (active_kid){
    active_kid = active_kid.replace('"', '');
    active_kid = active_kid.replace('"', '');
    active_kid = '"' + active_kid + '"';
}

if (active_kid != false){
    createCinemaRedirects(kidObj[active_kid]);
}
                    
	    
			    }
		    });
        }
	//}
}function Bildgalerie(){
  var infos = {
    activeClass : 'thumbOver',
    target : $("galleryImgBig"),
    activePos : 0,
    activeChild : false
  };

  this.init = function(){
    infos.childs = $("movieGalleryThumbs").select("li");

    //first element is by default active
    infos.activeChild = infos.childs[0];
    infos.activeChild.down("div").addClassName(infos.activeClass);

    this.createEvents();
  }

  
  this.createEvents = function(){
    infos.childs.each(function(child, index){
      //set clicked thumb as big image
      child.observe("click", this.setImage.bind(this, index));

      //set mouseover and mouseout events for thumbs
      child.observe("mouseover", function(child){ 
        child.down("div").addClassName(infos.activeClass); 
      }.bind(this, child));

      child.observe("mouseout", function(child){ 
        if (child != infos.activeChild){
          child.down("div").removeClassName(infos.activeClass); 
        }
      }.bind(this, child));

    }.bind(this));

    $("movieGalleryBack").observe("click", this.showPrevious.bind(this));
    $("movieGalleryNext").observe("click", this.showNext.bind(this));
  }

  this.setImage = function(index){
    infos.activeChild.down("div").removeClassName(infos.activeClass);
    infos.activePos = index;
    infos.activeChild = infos.childs[infos.activePos];
    infos.activeChild.down("div").addClassName(infos.activeClass);

    infos.target.src = infos.activeChild.down("img").src;
  }

  this.showNext = function(){
      infos.activeChild.down("div").removeClassName(infos.activeClass);
      if (infos.activePos == infos.childs.length - 1){
          infos.activePos = 0;
      }else{
          infos.activePos++;
      }
      infos.activeChild = infos.childs[infos.activePos];
      infos.activeChild.down("div").addClassName(infos.activeClass);
      this.setImage(infos.activePos);
  }

  this.showPrevious = function(){
      infos.activeChild.down("div").removeClassName(infos.activeClass);

      if (infos.activePos == 0){
          infos.activePos = infos.childs.length - 1;
      }else{
          infos.activePos--;
      }
      infos.activeChild = infos.childs[infos.activePos];
      infos.activeChild.down("div").addClassName(infos.activeClass);
      this.setImage(infos.activePos);
  }

}function spielzeitenHandler(){
	
	var containerArray
	var saalIdNow
	
	this.init = function(whichPage){
		containerArray = new Array();
		saalIdNow = -1;
		$$(".spielzeit.active").each(function(e){
			if ( (whichPage == "wochenansicht") || (whichPage == "event") ) {
				if (e.up("TR")){
					if (containerArray.indexOf(e.up("TR")) == -1) {
						containerArray.push(e.up("TR"));
					}
				}
			} else if (whichPage == "vorverkauf" || (whichPage == "tagesansicht") || (whichPage == "event_detail")){
				if (e.up("P")){
					if (containerArray.indexOf(e.up("P")) == -1) {
						containerArray.push(e.up("P"));
					}
				}				
			} else if (whichPage == "film_detail") {
				if (e.up("div")){
					if (containerArray.indexOf(e.up("div")) == -1) {
						containerArray.push(e.up("div"));
					}
				}				
			} else if (whichPage == "filmreihen_detail"){
				if (e.up("div").up("div")){
					if (containerArray.indexOf(e.up("div").up("div")) == -1) {
						containerArray.push(e.up("div").up("div"));
					}
				}
			}

		});
	}

	this.setWeekAnsichten = function(){
		if ($("weekbutton_1")){
			$("weekbutton_1").observe("click", function(){
				$('week_1').show();
				$('week_2').hide();
				$('weekbutton_1').addClassName('active');
				$('weekbutton_2').removeClassName('active');
			});
		}

		if ($("weekbutton_2")){
			$("weekbutton_2").observe("click", function(){
				$('week_1').hide();
				$('week_2').show();
				$('weekbutton_1').removeClassName('active');
				$('weekbutton_2').addClassName('active');
			});
		}
	}
	
	this.setEvents = function(){
		//console.log(containerArray);
		containerArray.each(function(e){
			$(e).observe('mousemove', function(event){
				overElement = Event.element(event);
				
				x = Event.pointerX(event);
				y = Event.pointerY(event);

				if (overElement.hasClassName("active")){
					if (overElement.hasClassName("spielzeit")){
						tempClassArray = overElement.classNames().toArray();
						saalId = tempClassArray[(tempClassArray.length)-1].sub("saal_id_", "");
						spielzeitenHandlerObj.repositionLayer(x, y, saalId);
					}
				}else{
					$("globalShowcase").hide();
				}
			
			});


			$(e).observe('mouseout', function(event){
				$("globalShowcase").hide();
			});

		});

	}
	
	this.repositionLayer = function(x,y,saalId){
		if (saalIdNow != saalId) {
			saalIdNow = saalId;
			$("showcaseSpielzeitSaal").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['saal_name'];
			$("showcaseSpielzeitSaalSitzplaetze").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['sitze'];
			$("showcaseSpielzeitSaalLeinwandHoehe").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['bildwandhoehe'];
			$("showcaseSpielzeitSaalLeinwandBreite").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['bildwandbreite'];
			//$("showcaseSpielzeitSaal").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['bildwandgroesse'];
			//$("showcaseSpielzeitSaal").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['soundkanal'];
			$("showcaseSpielzeitSaalSoundsystem").innerHTML = kinoSaalInfoArray[choosen_centeroid][saalId]['soundsystem'];
		}
		$("globalShowcase").show();
		$("globalShowcase").style.position = "absolute";
		$("globalShowcase").style.top = y + 12 + "px";
		$("globalShowcase").style.left = x + 12 + "px";
	}
	
}



//spielzeitenHandlerObj = new spielzeitenHandler();
//spielzeitenHandlerObj.init();
//spielzeitenHandlerObj.setEvents();
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

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":
      case "id":
        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 "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;
}
function FormPrizeDraw(){
    var prizedraw;
    this.init = function(target){
        prizedraw = {
            container : target,
            checkbox : target.select(".inputCheckbox")[0],
            slider : target.select(".newsletterAboForm")[0]
        };

        this.resetBrowserSelection();
        this.createEvents();

    }

    this.resetBrowserSelection = function(){
        prizedraw.checkbox.checked = false;
    }

    this.createEvents = function(){
        prizedraw.checkbox.observe("click", this.toggleLayer.bind(this));

    }

    this.toggleLayer = function(){
        $(prizedraw.slider).toggle('show','hide');
    }

    this.send = function(){
        if (prizedraw.checkbox.checked){
            if($("form.email")){
                if ($("form.email").value == ""){
                    $("errors").select(".noemail")[0].show();
                    return false;
                }else{
                    $("errors").select(".noemail")[0].hide();
                    return true;
                }
            }else{
                    return true;
            }
        }else{
                    return true;
        }

    }

}


function Newsletter(){
    var newsletter;

    this.init = function(target){
        newsletter = {
            container : target,
            checkbox : target.select(".inputCheckbox")[0],
            slider : target.select(".newsletterAboForm")[0]
        };



        this.resetBrowserSelection();
        //this.clearForm();
        this.createEvents();
        
        
        
        $("form.firstname").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.firstname").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        $("form.name").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.name").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
        $("form.email").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.email").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }

        newsletter.container.down("form").onsubmit = function(){ 
            if (!$("newsletterAboForm").visible()){
                if($("form.name")){
                    if ($("form.name").up(".newsletterAboForm")) {
                        if ($("form.name").value == "") 
                            $("form.name").value = "Nachname";
                    }
                }

                if($("form.firstname")){
                    if ($("form.firstname").up(".newsletterAboForm")) {
                        if ($("form.firstname").value == "") 
                            $("form.firstname").value = "Vorname";
                    }
                }

                if($("form.email")){
                    if ($("form.email").up(".newsletterAboForm")){
                        if ($("form.email").value == "") $("form.email").value = "ihre-adresse@beispiel.de";
                    }
                }
            }
        };
        
        if (nw_fields_open){
          newsletter.checkbox.checked = true;
          this.toggleLayer();
        }
    }

    this.sendForm = function(){
        return false;
    }

    this.clearForm = function(){
        $("form.firstname").value = "";
        $("form.email").value = "";
        $("form.name").value = "";
        
        
        
        $("form.firstname").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.firstname").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        $("form.name").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.name").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
        $("form.email").onfocus = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
        
            $("form.email").onblur = function(){
                if (this.value == ""){
                    this.value = "";
                }
            }
    } 
    
    this.resetForm = function(){
        
        
        
        
    }
    
    
    
    
    
    

    this.resetBrowserSelection = function(){
        newsletter.checkbox.checked = false;
    }

    this.createEvents = function(){
        newsletter.checkbox.observe("click", this.toggleLayer.bind(this));

        if($("form.email_from")){
            $("form.email_from").observe("blur", function(){
                $("form.email").value = this.value;
            });
            $("form.email_from").observe("keyup", function(){
                $("form.email").value = this.value;
            });
            
        }

        if($("form.email_pre")){
            $("form.email_pre").observe("blur", function(){
                $("form.email").value = this.value;
            });
            $("form.email_pre").observe("keyup", function(){
                $("form.email").value = this.value;
            });
        }
    
        $("form.day").onfocus = function(){
            if (this.value == "TT"){
                this.value = "";
            }
        }
    
        $("form.day").onblur = function(){
            if (this.value == ""){
                this.value = "TT";
            }
        }
    
        $("form.month").onfocus = function(){
            if (this.value == "MM"){
                this.value = "";
            }
        }
    
        $("form.month").onblur = function(){
            if (this.value == ""){
                this.value = "MM";
            }
        }
    
        $("form.year").onfocus = function(){
            if (this.value == "JJJJ"){
                this.value = "";
            }
        }
    
        $("form.year").onblur = function(){
            if (this.value == ""){
                this.value = "JJJJ";
            }
        }
    }

    this.toggleLayer = function(){
    	if ($(newsletter.slider).visible()){
    		this.resetForm();
    	}else{
    		//this.clearForm();
            if ($("form.email_from")){
                $("form.email").value = $("form.email_from").value;
            }
    	}
        $(newsletter.slider).toggle('show','hide');
    }
}function slide_back_show(){
	if (document.getElementById('slideshowLink1').className == 'active') {
		$('contentModuleSlideshowImage1').hide(); 
		$('contentModuleSlideshowImage2').hide(); 
		$('contentModuleSlideshowImage3').show(); 
		$('slideshowLink3').addClassName('active'); 
		$('slideshowLink1').removeClassName('active'); 
		$('slideshowLink2').removeClassName('active'); 
		$('slideshowText1').hide(); 
		$('slideshowText2').hide(); 
		$('slideshowText3').show();
	}
	else if (document.getElementById('slideshowLink2').className == 'active') {
		$('contentModuleSlideshowImage1').show(); 
		$('contentModuleSlideshowImage2').hide(); 
		$('contentModuleSlideshowImage3').hide(); 
		$('slideshowLink1').addClassName('active'); 
		$('slideshowLink2').removeClassName('active'); 
		$('slideshowLink3').removeClassName('active'); 
		$('slideshowText1').show(); 
		$('slideshowText2').hide(); 
		$('slideshowText3').hide();
	} 
	else if (document.getElementById('slideshowLink3').className == 'active') {
		$('contentModuleSlideshowImage1').hide(); 
		$('contentModuleSlideshowImage2').show(); 
		$('contentModuleSlideshowImage3').hide(); 
		$('slideshowLink2').addClassName('active'); 
		$('slideshowLink1').removeClassName('active'); 
		$('slideshowLink3').removeClassName('active'); 
		$('slideshowText1').hide(); 
		$('slideshowText2').show(); 
		$('slideshowText3').hide();
	} 
}

function slide_forw_show(){
	if (document.getElementById('slideshowLink2').className == 'active') {
		$('contentModuleSlideshowImage1').hide(); 
		$('contentModuleSlideshowImage2').hide(); 
		$('contentModuleSlideshowImage3').show(); 
		$('slideshowLink3').addClassName('active'); 
		$('slideshowLink1').removeClassName('active'); 
		$('slideshowLink2').removeClassName('active'); 
		$('slideshowText1').hide(); 
		$('slideshowText2').hide(); 
		$('slideshowText3').show();
	}
	else if (document.getElementById('slideshowLink3').className == 'active') {
		$('contentModuleSlideshowImage1').show(); 
		$('contentModuleSlideshowImage2').hide(); 
		$('contentModuleSlideshowImage3').hide(); 
		$('slideshowLink1').addClassName('active'); 
		$('slideshowLink2').removeClassName('active'); 
		$('slideshowLink3').removeClassName('active'); 
		$('slideshowText1').show(); 
		$('slideshowText2').hide(); 
		$('slideshowText3').hide();
	} 
	else if (document.getElementById('slideshowLink1').className == 'active') {
		$('contentModuleSlideshowImage1').hide(); 
		$('contentModuleSlideshowImage2').show(); 
		$('contentModuleSlideshowImage3').hide(); 
		$('slideshowLink2').addClassName('active'); 
		$('slideshowLink1').removeClassName('active'); 
		$('slideshowLink3').removeClassName('active'); 
		$('slideshowText1').hide(); 
		$('slideshowText2').show(); 
		$('slideshowText3').hide();
	} 
}var isTrailerAlreadyOpen = false;

function trailerHandler(){
	var partPos = 0;
	var partCount = 0;
	var posPx = 0;

	this.resetSelection = function(){
		$$(".trailer_navi_link").each(function(e){
			$(e).removeClassName("selected");
		});
	}

	this.setNaviSelection = function(number){
		this.resetSelection();
		if ($("trailer_navi_" + (number + 1))){
			$("trailer_navi_" + (number + 1)).addClassName("selected");
		}
	}

	this.init = function(){

		partCount = $$(".trailerGalleryBlock").length;
		i = 1;
		if (partCount >= 2){
			$$(".trailerGalleryBlock").each(function(){
	
				newA = document.createElement("A");
				newA.innerHTML = i;
				newA.id = "trailer_navi_" + i;
				newA.className = "trailer_navi_link";
				newA.href = "javascript: void(0)"; //added by ce
				newA.onclick = function(){
					trailerHandlerObj.switchTo(this.innerHTML);
				}
				$("trailer_navi").appendChild(newA);
				i++;
			});
		}
		this.setNaviSelection(0);
	}

	this.switchTo = function(toNumber){
		toNumber = toNumber - 1;
		if (partPos == toNumber){
			//Wir sind schon an der Position
		}else if (toNumber > partPos){
			max = toNumber - partPos;
			for (var i = 0; i < max; i++){
				trailerHandlerObj.rightClickEvent();
			}
			partPos = toNumber;
			this.setNaviSelection(partPos);
			//Wir müssen weiter sliden
		}else if (toNumber < partPos){
			//Wir müssen zurück sliden
			max = partPos - toNumber;
			for (var i = 0; i < max; i++){
				trailerHandlerObj.leftClickEvent();
			}
			partPos = toNumber;
			this.setNaviSelection(partPos);
		}
	}

	this.showTrailer = function(trailerID){
		movieTrailerID = $("movieTrailer");
		Effect.SlideDown(
			$('movieTrailer'),
			{
				afterFinish: function(effect) {
					ajax_request(trailerID);
				}
			}
		);
	}

	this.rightClickEvent = function(){
		elementToMove = $$(".trailerGalleryBlock")[0].up();
		//console.log(elementToMove);
		if (partPos < partCount - 1){
			posPx = posPx - 650;
			new Effect.Move(elementToMove, { x: posPx, y: 0, mode: 'absolute' });
			partPos++;
			trailerHandlerObj.setNaviSelection(partPos);
		}
	}

	this.leftClickEvent = function(){
		//console.log("left");
		elementToMove = $$(".trailerGalleryBlock")[0].up();
		if (partPos > 0){
			posPx = posPx + 650;
			new Effect.Move(elementToMove, { x: posPx, y: 0, mode: 'absolute' });
			partPos--;
			trailerHandlerObj.setNaviSelection(partPos);
		}

	}

	this.setPlayButton = function(){
		$$(".trailerItemButton").each(function(e){
			e.href = "javascript:void(0);";
			e.onclick = function(){
				trailerID = this.up("div").up("div").className.replace("trailerGalleryItem trailer_","");
				if (isTrailerAlreadyOpen == false) {
					trailerHandlerObj.showTrailer(trailerID);
					isTrailerAlreadyOpen = true;							
				} else {
					ajax_request(trailerID);
				}
				
				trailertitel = this.up().down("div").down("h3").down("a").innerHTML;
//				$$("h1.subPortalHeadline")[0].innerHTML = "TRAILER " + trailertitel;

				flashHeadline.addParam('flashvars', 'headlineContent=TRAILER%20' + trailertitel + '&headlineBackgroundColor=blue&headlineFontSize=small');
				flashHeadline.write('flashHeadlineContainer');
                window.scrollTo(0,0);
			}
		});

	}

	this.setClickEvents = function(){
		$$(".trailerItemButton").each(function(e){
			trailerID = e.up("div").up("div").className.replace("trailerGalleryItem trailer_","");
			filmID = e.up("div").className.replace("trailerGalleryItemContent film_id_","");
			
			e.up("div").down("a").href = "../../film_details?id_f=" + filmID;
			e.up("div").down("a",1).href = "../../film_details?id_f=" + filmID;
		});

	}


}function preLoad(images){ 
    for (var loop = 0; loop < images.length; loop++)
    { 
        var buffer = new Image(); 
        buffer.src = images[loop]; 
    } 
}

imagesToPreload = new Array();
//imagesToPreload.push("./img/slide_bar_middle.png");


preLoad(imagesToPreload); //get Cookie
var flashVolume = Get_Cookie("flashVolume");
var trailerID_intern = -1;
if (flashVolume == null) {
	//default volume
	flashVolume = 80;
}

function kinopolis_flash_video_player_set_volume(volume) {
	/*ToDoBackend:Set volume to cookie*/
	if (isNaN(volume)) {
	//do nothing
	}
	else {
		Set_Cookie("flashVolume", volume, 40 * 7, "/");
	}
}

/*
 *flash viedoe player needs this parameter 
 *don't return null
 */
function getUserAge() {
    userAge = Get_Cookie("userAge");
    if (userAge == null) {
        userAge = 0;
    }
    return userAge;
}

/*flash saves the user age into the cookie for trailer
 *it only should be valid as long as the browser is open
 */
function kinopolis_flash_video_player_age(age) {
    var exdate=new Date();
    exdate.setDate(exdate.getDate()-1);
    document.cookie="userAge"+"="+escape(age);
    //Set_Cookie("userAge", age, exdate.toGMTString(), "/");
}							
					
function kinopolis_flash_video_player_play() {
	new Ajax.Request("films_trailer_count?film_trailer_id=" + getClickedTrailerID(), {
		method: 'get',
		onSuccess: function(transport) {
		}
	});

}

function setClickedTrailerID (trailerID){
	trailerID_intern = trailerID;
}

function getClickedTrailerID (){
	return trailerID_intern;
}


function ajax_request(trailerID){	
    var active_kid = camaoCookieObj.getCookie("kid");
    if (active_kid){
        active_kid = active_kid.replace('"', '');
        active_kid = active_kid.replace('"', '');
    }

	new Ajax.Updater('movieTrailer', "film_trailer_tile", {
		parameters: { 
            trailer_id: trailerID,
            centerME : active_kid
        },
		evalScripts: true
	});
}

function overwriteEvents(){
	//alert('choosen_centerappendix: '+choosen_centerappendix);
    if (choosen_centerappendix == "noCinema"){
    	$("dropdownButtonTagesansicht").onclick = function(){
    		$("chooseCinemaLayer").show();
    	}
    	$("dropdownButtonWoche").onclick = function(){
    		$("chooseCinemaLayer").show();
    	}
    }
}

function setContainerWidthAndHeight(){
	
	width = document.body.offsetWidth;
	height = $$(".portalFooter")[0].cumulativeOffset();
	
	
	if ($$("div.cinemaNotChosenLeft")[0]){
		$$("div.cinemaNotChosenLeft")[0].style.height = height[1] - 43 + "px";
		$$("div.cinemaNotChosenRight")[0].style.width = width - 190 + "px";
		$$("div.cinemaNotChosenRight")[0].style.height = height[1]  + "px";
	}					
}

function setContentHeight(){
	offsetsNavi = $("portalColumnOne").getDimensions();
	offsetsBody = $("portalColumnContent").getDimensions();

	if (offsetsNavi.height >= offsetsBody.height) {
		$("contentRegionInner").style.height = offsetsNavi.height + "px";
	}
}









var contentModuleSlideshowArray = new Array();
Event.observe(window, 'load', function() {
	allContentModuleSlideshowClasses = $$(".contentModuleSlideshow");
	for (i=0; i<allContentModuleSlideshowClasses.length; i++) {
		onlyDuration = allContentModuleSlideshowClasses[i].className.split("_");
		eval("contentModuleSlideshowArray[" + i + "] = new contentModuleSlideshow($(allContentModuleSlideshowClasses[i]));");
		eval(" contentModuleSlideshowArray[" + i + "].init(" + i + ", " + onlyDuration[1] + "); ");
	}
});


		
function contentModuleSlideshow(inputMutterContainer){
	var activeContainer = 0;
	var mutterContainer = inputMutterContainer;
	var imageContainer = $(mutterContainer).select(".contentModuleSlideshowImage");
	var containerCount = imageContainer.length;
	var textContainer = $(mutterContainer).select(".slideshowText");
	var naviNumbersContainer = $(mutterContainer).select(".slideshopNaviNumbers")[0];
	var naviBackContainer = $(mutterContainer).select(".slideshowNaviBackward")[0];
	var naviForwardContainer = $(mutterContainer).select(".slideshowNaviForward")[0];
	var selfObjectIndex;
	var selfObject;

	var slideShowtimer;

	this.init = function(arrayIndex, duration) {
		selfObjectIndex = arrayIndex;
		slideShowtimer = duration;
		selfObject = contentModuleSlideshowArray[selfObjectIndex];
		eval("Event.observe($(naviForwardContainer), 'click', function() { contentModuleSlideshowArray[" + selfObjectIndex + "].gotoNextContainer(); }  );");
		eval("Event.observe($(naviBackContainer), 'click', function() { contentModuleSlideshowArray[" + selfObjectIndex + "].gotoPreviousContainer(); }     );");
		
		for (i = 1; i <= containerCount; i++) {
			var tempSpan = new Element('span', {}).update(i);
            var tempA = new Element('a', {'href' : 'javascript:;'}).insert(tempSpan);
//            var tempA = new Element('a', {'href' : 'javascript:;','onClick' : "contentModuleSlideshowArray[" + selfObjectIndex + "].setActiveContainer(" + (i-1) + ");"}).insert(tempSpan);
tempA.observe("click", this.setActiveContainer.bind(this, (i-1)));
			if (i == 1) {
				tempA.addClassName('active');
			}
			naviNumbersContainer.insert(tempA);
		}
		this.startTimer();
	}

	this.setActiveContainer = function(number) {
        if (typeof imageContainer[activeContainer] == "undefined") return false;
		$(imageContainer[activeContainer]).hide();
		$(textContainer[activeContainer]).hide();
		
		tempAllLinks = naviNumbersContainer.select('a');
		tempAllLinks.each( function(e){
			e.removeClassName("active");
		});
		
		$(imageContainer[number]).show();
		$(textContainer[number]).show();
				
		tempAllLinks[number].addClassName("active");
		
		activeContainer = number;
	}
	

	this.gotoNextContainer = function() {
		if (activeContainer < containerCount-1) {
			this.setActiveContainer( activeContainer+1 );
		}else{
            this.setActiveContainer( 0 );
        }
		if (slideShowtimer){
			window.clearInterval(slideShowtimer);
		}
	}

	
	this.gotoPreviousContainer = function() {
		if (activeContainer > 0) {
			this.setActiveContainer( activeContainer-1 );
		}
		if (slideShowtimer){
			window.clearInterval(slideShowtimer);
		}
	}
	
	this.startTimer = function(){
		if (slideShowtimer > 0){
			if (slideShowtimer){
				window.clearInterval(slideShowtimer);
			}
			slideShowtimer = window.setInterval("contentModuleSlideshowArray[" + selfObjectIndex + "].showNextPicture()",slideShowtimer * 1000);
		}
	}
	
	this.showNextPicture = function(){
		if (activeContainer < containerCount-1) {
			this.setActiveContainer( activeContainer+1 );
		}else{
			this.setActiveContainer( 0);
		}
	}
	
}


function loadOverlay1(colorHex){
    var div1 = new Element("div").update("&nbsp;");
    div1.style.backgroundColor = "#" + colorHex;
    div1.style.position = "absolute";
    div1.style.top = "0px";
    //div1.style.height = "27px";
    div1.style.height = "117px";
    div1.style.width =  $("portalGlobalNav").getDimensions().width + "px";
    div1.style.left = "221px";
    div1.style.zIndex = 1000;
    //div1.style.visibility = "hidden";
    //$("animierter_header").setColor(colorHex);
    $("overlayStorage").appendChild(div1);
}
function loadOverlay2(colorHex){
    var div2 = new Element("div").update("&nbsp;");
    div2.style.backgroundColor = "#" + colorHex;
    div2.style.position = "absolute";
    div2.style.top = "0px";
    div2.style.height = $("portalColumnContent").getDimensions().height + $$(".portalFooter")[0].getDimensions().height + $("portalTop").next().getDimensions().height + 13 + "px";

    temp = window.innerWidth || window.width;
    if (Prototype.Browser.Gecko){
        div2.style.width = temp - 949 - 17  + "px";
    }else{
        div2.style.width = temp - 949  + "px";
    }
    div2.style.left = "949px";
    
    $("overlayStorage").appendChild(div2);
}
function loadOverlay3(colorHex){
    var div3 = new Element("div").update("&nbsp;");
    div3.style.backgroundColor = "#" + colorHex;
    div3.style.position = "absolute";
    div3.style.top = "117px";
    div3.style.height = "33px";
    div3.style.width = "190px";
    div3.style.zIndex = "1";
    $("overlayStorage").appendChild(div3);
}
var overlayTimeout;
function setOverlay(colorHex){
    check = window.innerWidth || window.width;
    if (check) {
        if ($$(".portalFooter")[0]){
            if (overlayTimeout) 
                window.clearTimeout(overlayTimeout);
            loadOverlay1.delay(0.1,colorHex);
            loadOverlay2.delay(0.1,colorHex);
            //loadOverlay3.delay(0.1,colorHex);
        }else{
            overlayTimeout = window.setTimeout("setOverlay('"+colorHex+"')",500)
        }
    }else {
        overlayTimeout = window.setTimeout("setOverlay('"+colorHex+"')",500)
    }
    
}

function Camao_Captcha(){
    var infos = { 'alreadyLoaded' :  false};
    this.init = function(target, url){
        infos.target = target;
        infos.url = url;
    
        this.createEvents();
        this.checkDelay.bind(this).delay(0.5);
    }
    
    this.checkDelay = function(){
        if (infos.alreadyLoaded == false){
            this.loadCaptcha();
        }
    }
    
    this.createEvents = function(){
        infos.target.observe("error", this.imageLoadErrorEvent.bind(this));
        infos.target.observe("load", this.imageLoadEvent.bind(this));
    }
    
    this.imageLoadEvent = function(){
        infos.alreadyLoaded = true;
    }
    this.loadCaptcha = function(){
        infos.target.src = infos.url + "&" + Math.round(Math.random() * 100000);
    }
    
    this.imageLoadErrorEvent = function(){
        this.loadCaptcha.bind(this).delay(0.1);
    }
}


function loadNewsletterAboFormEvent(){
    var NewsletterObj = new Newsletter();
    NewsletterObj.init($("newsletterAboForm").up(".contentSecondRow"));
/*
    if ($("form.captcha")){
        var captcha_handler = new Camao_Captcha();
        captcha_handler.init($("form.captcha").up().down("img"), $("form.captcha").up().down("img").src);
    }    
    */
}


var kidObj  = { 
    '"10000000014VEGOZTB"' : 'ro',
    '"19210000014PLXMQDD"' : 'ka',
    '"20000000014KGIVNZB"' : 'dacd',
    '"20000000014KYVFAJM"' : 'su',
    '"20000000014NGRSDLK"' : 'fr',
    '"20000000014SPADYMD"' : 'dacx',
    '"20000000014SXHKWMD"' : 'ab',
    '"20000000014TTMBFYG"' : 'mm',
    '"20000000014VEGOZTB"' : 'bn',
    '"30000000014AOPKLEM"' : 'mg',
    '"3FF10000014PLXMQDD"' : 'gi',
    '"40000000014MHWBOTF"' : 'lh',
    '"50000000014MHWBOTF"' : 'ko',
    '"60000000014TVDAFYG"' : 'vi',
    '"9F430000014PLXMQDD"' : 'we',
    '"BE830000014PLXMQDD"' : 'hu'
};//Dropdown Class
//v0.1 by Matthias Friedrich

function dropdown(){
	var selfName;
	var dropdownPrefix;
	var overClassName;

	this.init = function() {
		dropdowns = $$("select");
		this.transformDropdowns(dropdowns);

		//We add an global Event to control the dropdown hide and show 
		eval("$(document).observe('mousedown', " + selfName + ".eventGlobalMouseDown);");
	}

	//We set the Object name for event calls
	this.setSelfName = function(objName) {
		selfName = objName;
	}

	//we set the clone container prefix
	this.setClassPrefix = function(pre) {
		dropdownPrefix = pre;
	}
	
	//we set the dropdown entry over class
	this.setOverClass = function(oClassName) {
		overClassName = oClassName;
	}
	
	//we transform all exist dropdown to own dropdowns
	this.transformDropdowns = function(element) {
		for (var i = 0; i < element.length; i++) {
			this.createNewDropDown(element[i]);
		}
	}

	//read all entrys from the original dropdown element
	this.getDropDownEntrys = function(element) {
		return $(element).select("option");
	}

	//create a new dropdown
	this.createNewDropDown = function(element) {
		entrys = this.getDropDownEntrys(element);
		if (element.id == "form.subject_1"){
			entrys[1].setAttribute("selected","selected");
		}

		//we use the first container over the dropdown for output
		appendContainer = element.up();

		//we make a clone from the html dropdown
		appendElement = $$("." + dropdownPrefix + "container")[0].cloneNode(this);

		dropDownOutput = appendElement.select("." + dropdownPrefix + "output")[0];
		dropDownSelector = appendElement.select("." + dropdownPrefix + "selector")[0];
		dropDownEntry = appendElement.select("." + dropdownPrefix + "entry")[0];
		dropDownOutput = appendElement.select("." + dropdownPrefix + "output")[0];
		dropDownInputField = appendElement.select("input")[0];
		dropDownInputField.name = element.name;
		dropDownInputField.id = element.id;
		element.name = "";
		element.id = "";
		alreadySelected = false;

		//we read all entry from original dropdown and copy it to the new dropdown
		for (var i = 0; i < entrys.length; i++) {
			entryValue = entrys[i].innerHTML;
			newEntry = dropDownEntry.cloneNode(this);
			newEntry.innerHTML = entryValue;
			newEntry.id = dropDownInputField.name + "_" + entrys[i].value;

			if ($(entrys[i]).readAttribute("disabled") != "true") {
				if (entryValue.indexOf("Bitte") == -1){
					if (dropDownSelector.down("ul")) {
						dropDownSelector.down("ul").appendChild(newEntry);
					}
					else {
						dropDownSelector.appendChild(newEntry);
					}
				}
			}

			//we preselect the entry
			if (($(entrys[i]).readAttribute("selected") == "selected") || ($(entrys[i]).readAttribute("selected") == "true") || ($(entrys[i]).selected == true) ) {
				dropDownOutput.innerHTML = $(entrys[i]).innerHTML;
				dropDownInputField.value = $(entrys[i]).value;
				alreadySelected = true;
			}

			if ($$(".errortag")[0]){
			}else{
				if (entrys[i].value == choosen_centerappendix){
					//if (alreadySelected == false){
						dropDownOutput.innerHTML = $(entrys[i]).innerHTML;
						dropDownInputField.value = choosen_centerappendix;
					//}
	
				}
			}


		}

		//We create all Events
		eval("$(dropDownSelector).observe('mouseover', " + selfName + ".eventMouseOver);");
		eval("$(dropDownSelector).observe('mouseout', " + selfName + ".eventMouseOut);");
		
		eval("$(dropDownSelector).observe('click', " + selfName + ".eventSetEntry);");
		eval("$(dropDownOutput).up().observe('click', " + selfName + ".eventShowHideSelector);");

		//we remove the first line, this is the container entry dummy line
		dropDownEntry.remove();
		//we hide the selector
		dropDownSelector.hide();
		//we hide the original dropdown
		element.hide();
		//we show the new dropdown
		appendElement.show();

		appendContainer.appendChild(appendElement);
	}

	//Entry mouse over event
	this.eventMouseOver = function(event) {
		var element = Event.element(event);
		if (element.hasClassName(dropdownPrefix + 'entry')) {
			entry = element;
		}else{
			entry = element.down('.' + dropdownPrefix + 'entry');
		}
		entry.addClassName(overClassName);
	}

	//Global event for hide open dropdowns
	//we change the classname
	this.eventGlobalMouseDown = function(event) {
		var element = Event.element(event);
		ignoreDropDown = element.up('.' + dropdownPrefix + 'container');

		//we have clicked inside a dropdown
		if (ignoreDropDown) {
			dropdowns = $$('.' + dropdownPrefix + 'container');
			for (var i = 0 ; i < dropdowns.length; i++) {
				//we hide all dropdowns but not the clicked dropdown
				if (dropdowns[i] != ignoreDropDown) {
					dropdowns[i].down("." + dropdownPrefix + "selector").hide();
				}
			}
		}else{
			//we hide all dropdowns
			$$("." + dropdownPrefix + "selector").each(function(e) {
				e.hide();
			});
		}
	}

	//Entry mouse out event
	//we change the classname
	this.eventMouseOut = function(event) {
		var element = Event.element(event);
		if (element.hasClassName(dropdownPrefix + 'entry')) {
			entry = element;
		}else{
			entry = element.down('.' + dropdownPrefix + 'entry');
		}
		entry.removeClassName(overClassName);
	}

	//Entry click event
	//we save the clicked element
	this.eventSetEntry = function(event) {
		var element = Event.element(event);
		dropdownContainer = element.up('.' + dropdownPrefix + 'container');
		dropDownSelector = dropdownContainer.select("." + dropdownPrefix + "selector")[0];
		dropDownOutput = dropdownContainer.select("." + dropdownPrefix + "output")[0];
		dropDownInputField = dropdownContainer.select("input")[0];

		if (element.hasClassName(dropdownPrefix + 'entry')) {
			entry = element;
		}else{
			entry = element.down('.' + dropdownPrefix + 'entry');
		}


		dropDownOutput.innerHTML = entry.innerHTML;
		dropDownInputField.value = entry.id.replace(dropDownInputField.name + "_","");


		if (dropDownSelector.visible()) {
			dropDownSelector.hide();
		}else{
			dropDownSelector.show();
		}
	}

	//Output (all entrys) click event
	//we show / hide the selector
	this.eventShowHideSelector = function(event) {
		var element = Event.element(event);
		dropdownContainer = element.up('.' + dropdownPrefix + 'container');
		dropDownSelector = dropdownContainer.select("." + dropdownPrefix + "selector")[0];
		if (dropDownSelector.visible()) {
			dropDownSelector.hide();
		}else{
			dropDownSelector.show();
		}
	}
}
