window.oe = function (Fehler,Datei,Zeile)
{
	alert('Es ist der JS- Fehler: '+Fehler+', in der Datei: '+Datei+', in der Zeile: '+Zeile+'Aufgetreten.');
}
window.o2 = function ()
{
	return true;
}
window.onerror=window.o2;

window.$GLOBALS = {};

if(!Array.prototype.count)Array.prototype.count = function()
{
	return this.length;
}
if(!Function.prototype.apply)Function.prototype.apply = function(thisArg, argArray) {
    if (typeof this != "function") {
        throw new Error("apply called on incompatible " +
                    "object (not a function)");
    }
    if (argArray != null && !(argArray instanceof Array)
        && typeof argArray.callee != "function") {
        throw new Error("The 2nd argument to apply must " +
                    "be an array or arguments object");
    }

    thisArg = (thisArg == null) ? window : Object(thisArg);
    thisArg.__applyTemp__ = this;

    // youngpup's hack
    var parameters = [],
        length = (argArray || "").length >>> 0;
    for (var i = 0; i < length; i++) {
        parameters[i] = "argArray[" + i + "]";
    };
    var functionCall =
            "thisArg.__applyTemp__(" + parameters + ")";

    try {
        return eval(functionCall)
    } finally {
        try {
            delete thisArg.__applyTemp__
        } catch (e) {
            /* ignore */
        }
    }
}

if(!Function.prototype.call)Function.prototype.call = function(thisArg) {
    return this.apply(thisArg,
            Array.prototype.slice.apply(arguments, [1]));
}

if(!Array.prototype.push)Array.prototype.push = function()
{
	for(var i=0;i<arguments.length;i++){
		this[this.length]=arguments[i]
	};
	return this.length;
}
if(!Array.prototype.pop)Array.prototype.pop = function()
{
    lastElement = this[this.length-1];
	this.length = Math.max(this.length-1,0);
    return lastElement;
}
if(!Array.prototype.shift)Array.prototype.shift = function()
{
	var firstElement = this[0];
	this.reverse();
	this.length = Math.max(this.length-1,0);
	this.reverse();
	return firstElement;
}

if(!Array.prototype.unshift)Array.prototype.unshift = function()
{
	this.reverse();
	for(var i=arguments.length-1;i>=0;i--){
		this[this.length] = arguments[i];
	}		
	this.reverse();
	return this.length;
}
if(!Array.prototype.in_array)Array.prototype.in_array = function()
{
	for(var i=0;i<this.length;i++){
		if(this[i] == arguments[0])
		{
			return true;	
		}
	};
	return false;
}
if (!Array.prototype.foreach) Array.prototype.foreach = function (func)
{
	for(var i=0;i<this.length;i++){
		func(this[i], i);
	}
}	
var __continue = function (Index)
{
	if((Index == 'push')||(Index=='count')||(Index=='length')||(Index=='foreach')||(Index=='in_array'))return true;
	return false;
}
if(!Object.prototype.count)Object.prototype.count = function()
{
	var j = 0;
	for(var i in this){
		if(window['__continue'](i))continue;
		j++;
	};
	return j;
}

if(!Object.prototype.push)Object.prototype.push = function()
{
	for(var i=0;i<arguments.length;i++){
		for(var x in arguments[i]){
			this[x] = arguments[i][x];	
		}
	};
	return this.count();
}
if (!Object.prototype.foreach) Object.prototype.foreach = function(func){
	var z = 0;
	for(var i in this){
		if(window['__continue'](i))continue;
		func([this[i],i], z);
		z++;
	}
}
if(!Object.prototype.in_array)Object.prototype.in_array = function()
{
	for(var i in this){
		if(window['__continue'](i))continue;
		if(this[i] == arguments[0])
		{
			return true;	
		}
	};
	return false;
}
window.$ = function() {
	if (arguments.length == 1) return get$(arguments[0]);
	var elements = [];
	$A(arguments).foreach(function(el){
		elements.push(get$(el));
	});
	return elements;

	function get$(el){
		if (typeof el == 'string') el = document.getElementById(el);
		return el;
	}
}
window.$A = function(array){
	var nArray = [];
	for (var i=0;i<array.length;i++) nArray.push(array[i]);
	return nArray;
}
window.$T = function (tag_name, Parent)
{
	return tag_name != '*'  ? $A((Parent || document).getElementsByTagName(tag_name)) : ($A((Parent || document).all) || $A((Parent || document).getElementsByTagName('*'))); // Gibt alle Tags mit dem Namen in Variable tag_name als Array zurck; 
}
window.$C = function(className) {
	var children = document.all || document.getElementsByTagName('*');
	var elements = [];
	$A(children).foreach(function(child){
		if (Element.hasClassName(child, className)) elements.push(child);
	});  
	return elements;
}
window.isset = function(Var)
{
	return (typeof window[Var] !== 'undefined') ? true : false;
}
window.is_array = function(Var)
{
	return typeof window[Var] == ('object' || 'array')? true : false;
}
window.empty = function(Var)
{
	return (!window[Var]||(window[Var].length===0)) ? true : false;
}
window.hideFocus = function()
{
	var a = $T('a'); // Alle A-Tags als Array
	for(var i=0;i<a.length;i++){ // http://www.tomislav.net/gestrichelte-linie-um-link-verstecken.htm
		a[i].onmousedown	= function(){this.onfocus=function(){this.blur();}}
		a[i].onmouseup		= function(){this.onfocus=function(){}}
		a[i].onmouseout		= a[i].onmouseup;
	}
}
window.init = function()
{	
	hideFocus();
	if($('film')){
		$('film').onclick = function()
		{
			 window.open('movie/relax-nightclub-movie.html','moviewin','width=656,height=376,resizable=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no');
			 return false;
		}
	}
	else if($('en_film')){
		$('en_film').onclick = function()
		{
			 window.open('movie/en_relax-nightclub-movie.html','moviewin','width=656,height=376,resizable=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no');
			 return false;
		}
	}
}
window.win = null;
window.myOnClick = null;
window.wopen = function(URL,Name,Attributes,closer)
{
	window.win = window.open(URL,Name,Attributes);
	window.win.focus();
	if(closer != 1){
		window.win.onload = function(){
			window.win.onclick = function(){
				window.win.opener.focus();
				window.win.close();
			}
			
			window.myOnClick = this.onclick;
			
			var a = $A($T ('a', this.document));
			
			a.foreach(
				function(Value)
				{
					Value.onmousedown = function()
					{
						window.win.onclick = function(){}
					}
					Value.onmouseup = function()
					{
						window.win.setTimeout(function(){window.win.onclick = window.myOnClick}, 1000);
					}
				}
			);
		}
	}
	return false;
}
window.wsopen2 = function(URL)
{
	URL = URL.indexOf('http://') == -1 && URL.indexOf(window.location.host) == -1 ? 'http://' + window.location.host + URL : URL;
	return window.wopen(
		URL, 
		'Galerie', 
		'width=400,height=600'
	);
}
window.wsopen = function(URL, Name)
{
	Name = !Name ? 'Galerie' : '';
	URL = URL.indexOf('http://') == -1 && URL.indexOf(window.location.host) == -1 ? 'http://' + window.location.host + URL : URL;
	return window.wopen(URL, Name, "width=400,height=600");
}
window.onload=init;

