
function nover(nid) {
	nid = nid.toString();
	
	var tmp = nid.split(":");
	tmp = tmp[1].split("(");
	tmp = tmp[1].substring(0,1);
	
	$('number_'+numbers[tmp]).show();
	$('number_h-'+numbers[tmp]).hide();
}

function nout(nid) {
	nid = nid.toString();
	
	var tmp = nid.split(":");
	tmp = tmp[1].split("(");
	tmp = tmp[1].substring(0,1);
	$('number_'+numbers[tmp]).hide();
	$('number_h-'+numbers[tmp]).show();
}

function moreColumns() {
	$('columntext').show();
	$('contentoverflashbg').style.width = '920px';
	$('openlink').hide();
	$('closelink').show();
}

function closeColumns() {
	$('columntext').hide();
	$('contentoverflashbg').style.width = '278px';
	$('openlink').show();
	$('closelink').hide();
}

var numbers = new Array();
var int;
function changeImage(number, type) {
	$('innerflash').show();
	$('moviecontainer').hide();
	$('moviecontainer').innerHTML ='<div id="movieflash"></div>';
	$('closeContent').show();
	if (type===undefined) {
		type = 0;
	}
	
	$('content-flash-ersatz').style.opacity ="0.0";
	$('content-flash-ersatz').style.filter ="Alpha(opacity=0, finishopacity=0, style=1)";
	$('content-flash-ersatz').show();
	if ($('content-flash-ersatz')) {
		$('content-flash-ersatz').src = images[number].src;
		$('content-flash-ersatz').alt = altText[number];
		$('content-flash-ersatz').title = altText[number];
	}
	setTimeout("new Effect.Opacity('content-flash-ersatz', { from: 0, to: 1 ,duration: 0.3 })",500);
	
	for ( var i = 0; i < images.length; i++) {
		$('impimg'+i).src = 'clear.gif';
	}
	
	if ((number+1)<images.length) {
		$("forwardlinkimp").show();
		$("forwardlinkimp").href ="javascript:changeImageBtn("+(number+1)+");";
	}else {
		$("forwardlinkimp").hide();
	}
	if ((number-1)>=0) {
		$("backlinkimp").show();
		$("backlinkimp").href ="javascript:changeImageBtn("+(number-1)+");";
	}else {
		$("backlinkimp").hide();
	}
	
	if (type==1) {
		$('impimg'+number).src = 'fileadmin/images/picact2.gif';
		hideprevImgs();
	}else {
		$('impimg'+number).src = 'fileadmin/images/picact.gif';
	}
}

function changeImageBtn(number){
	
	$('content-flash-ersatz').style.opacity ="0.0";
	$('content-flash-ersatz').style.filter ="Alpha(opacity=0, finishopacity=0, style=1)";
	$('content-flash-ersatz').show();
	if (!images[number].src) {
		showMovie(images[number].substr(6),number);
		return;
	}
	
	if ($('content-flash-ersatz')) {
		$('content-flash-ersatz').src = images[number].src;
		$('content-flash-ersatz').alt = altText[number];
		$('content-flash-ersatz').title = altText[number];
	}
	setTimeout("new Effect.Opacity('content-flash-ersatz', { from: 0, to: 1 ,duration: 0.3 })",500);
	
	for ( var i = 0; i < images.length; i++) {
		$('impimg'+i).src = 'clear.gif';
	}
	
	if ((number+1)<images.length) {
		$("forwardlinkimp").show();
		$("forwardlinkimp").href ="javascript:changeImageBtn("+(number+1)+");";
	}else {
		$("forwardlinkimp").hide();
	}
	if ((number-1)>=0) {
		$("backlinkimp").show();
		$("backlinkimp").href ="javascript:changeImageBtn("+(number-1)+");";
	}else {
		$("backlinkimp").hide();
	}
	
	$('impimg'+number).src = 'fileadmin/images/picact.gif';

	
}


function switchPage(page) {
	
	for (int = 0; int < numbers.length; int++) {
		$('number_'+numbers[int]).hide();
		$('number_h-'+numbers[int]).show();
		
		$('impressions'+(int+1)).hide();
		var tmpnid = numbers[int];
		
		$('numberlink-'+numbers[int]).onmouseover =  function (){nover(this);};
		$('numberlink-'+numbers[int]).onmouseout = function (){nout(this);};
	}
	
	$('impressions'+(page+1)).show();
	$('number_h-'+numbers[page]).hide();
	$('number_'+numbers[page]).show();
	$('numberlink-'+numbers[page]).onmouseover = function (){return true;};
	$('numberlink-'+numbers[page]).onmouseout = function (){return true;};
}

function showprevImgs(){
	
	$('houseoverlaybg').show();
	$('houseoverlay').show();
	
	//new Effect.Parallel([
	new Effect.Move('houseoverlaybg', { x: -200, y: 0, mode: 'relative',transition: Effect.Transitions.sinoidal });
	//new Effect.Scale('houseoverlaybg', 100, {scaleFrom:0,scaleY:false,scaleContent:true});
	new Effect.Scale('houseoverlaybg', 100, {
		scaleMode: { originalHeight: $('houseoverlaybg').height, originalWidth: $('houseoverlaybg').width }, 
		sync: true, scaleFrom:  0, transition: Effect.Transitions.sinoidal, restoreAfterFinish: true});
	new Effect.Move('houseoverlay', { x: -200, y: 0, mode: 'relative',transition: Effect.Transitions.sinoidal });
	new Effect.Scale('houseoverlay', 100, {
		scaleMode: { originalHeight: $('houseoverlay').height, originalWidth: $('houseoverlay').width }, 
		sync: true, scaleFrom:  0, transition: Effect.Transitions.sinoidal, restoreAfterFinish: false});

	$('hopenlink').hide();
}

function hideprevImgs(){
	
	new Effect.Move('houseoverlaybg', { x: 200, y: 0, mode: 'relative',transition: Effect.Transitions.sinoidal });
	new Effect.Scale('houseoverlaybg', 0, {
		scaleMode: { originalHeight: $('houseoverlaybg').height, originalWidth: $('houseoverlaybg').width }, 
		sync: true, scaleFrom:  100, transition: Effect.Transitions.sinoidal, restoreAfterFinish: true});
	new Effect.Move('houseoverlay', { x: 200, y: 0, mode: 'relative',transition: Effect.Transitions.sinoidal });
	new Effect.Scale('houseoverlay', 0, {
		scaleMode: { originalHeight: $('houseoverlay').height, originalWidth: $('houseoverlay').width }, 
		sync: true, scaleFrom:  100, transition: Effect.Transitions.sinoidal, restoreAfterFinish: false});
	
	setTimeout('$("houseoverlaybg").hide();$("houseoverlay").hide();$("hopenlink").show();',1000);
}

function newCaptcha() {
	var zeit = new Date();
	$("captcha-img").src = "fileadmin/inc/class.captcha.php?" + zeit.getMilliseconds();
}

var locked = 0;
function showHeader(uid) {
	if (window.document.GRIFFNER) {
		window.document.GRIFFNER.changeImage(uid);
		locked = 1;
		return true;	
	}
}

function setcookie(name, value, days, path, domain, secure) { 
	var expires = -1; 
	if(typeof days == "number" && days >= 0) {
		var d = new Date(); d.setTime(d.getTime()+(days*24*60*60*1000)); expires = d.toGMTString(); 
	} 
	value = escape(value); 
	document.cookie = name + "=" + value + ";" + (expires != -1 ? " expires=" + expires + ";" : "") + (path ? "path=" + path : "") + (			domain ? "; domain=" + domain : "") + (secure ? "; secure" : ""); 
}

function delcookie(name) { setcookie(name, "-", 0); }
function getcookie(name) { 
	var idx = document.cookie.indexOf(name+'='); 
	if(idx == -1) { 
		return null; 
	} 
	value = document.cookie.substring(idx+name.length+1); 
	var end = value.indexOf(';'); 
	if(end == -1) { 
		end = value.length; 
	} 
	
	value = value.substring(0, end); 
	value = unescape(value); return value; 
}


function showHeaderL() {
	locked = 1;
}

function showStartHeader() {
	try{
		locked = 0;
		setTimeout("showStartHeader1()",200);
	}catch (e) {
		// TODO: handle exception
	}
}

function showStartHeader1() {
	try{
		if (locked==0) {
			if (window.document.GRIFFNER) {
				window.document.GRIFFNER.changeImage(1);
			}
		}
	}catch (e) {
		// TODO: handle exception
	}
	
	return true;	
}

var active = new Array();
function showSellerDetails(layerid) {
	if (active[layerid] != 1) {
		$("openseller"+layerid).hide();
		new Effect.SlideDown("sellerdetails"+layerid, {duration: 1});
		active[layerid] = 1;
		$("closeseller"+layerid).show();
	} else {
		active[layerid] = 0;
	}
}
	
function hideSellerDetails(layerid) {
	if (active[layerid] == 1) {
		$("closeseller"+layerid).hide();
		new Effect.SlideUp("sellerdetails"+layerid, {duration: 1});
		active[layerid] = 0;
		$("openseller"+layerid).show();
	}
}

function gotoURL(target,link) {
	eval(target+".location='"+link+"'");
}

function showLightbox(image) {
	var objTmp = document.getElementById('overlay');
	var tmpLink = document.createElement("a");
	tmpLink.setAttribute('rel','lightbox');
	tmpLink.setAttribute('href',image);
	objTmp.appendChild(tmpLink);
	myLightbox.start(tmpLink);
	
	return true;
	
}

function closeContent() {
	$('contentoverflashbg').hide();
	$('contentoverflash').hide();
	$('closeContent').hide();
	$('openContent').show();
}

function openContent(){
	$('contentoverflashbg').show();
	$('contentoverflash').show();
	$('openContent').hide();
	$('closeContent').show();
	
}

function intval( mixed_var, base ) {
 
    var tmp;
    var type = typeof( mixed_var );
 
    if(type == 'boolean'){
        if (mixed_var == true) {
            return 1;
        } else {
            return 0;
        }
    } else if(type == 'string'){
        tmp = parseInt(mixed_var * 1);
        if(isNaN(tmp) || !isFinite(tmp)){
            return 0;
        } else{
            return tmp.toString(base || 10);
        }
    } else if(type == 'number' && isFinite(mixed_var) ){
        return Math.floor(mixed_var);
    } else{
        return 0;
    }
}

function showMovie(flv,number){
	// Layer
	$('innerflash').hide();
	
	//margin-left:-360px; width:720px;
	$('forwardlinkimp').hide();
	$('closeContent').hide();
	for ( var i = 0; i < images.length; i++) {
		$('impimg'+i).src = 'clear.gif';
	}
	$('impimg'+number).src = 'fileadmin/images/picact.gif';
	
	
	//SWF
	var flashvars = {
	  src: flv,
	  width: 642,
	  height: 365
	};
	var params = {
	  wmode: "transparent",
	  allowScriptAccess: "sameDomain",
	  quality: "high",
	  allowfullscreen: true
	};
	var attributes = {
	  id: "flv_cinema",
	  name: "flv_cinema"
	};
	//alert("swf:"+new_width+"x"+new_height1);
	//alert("flv:"+new_width+"x"+new_height);
	swfobject.embedSWF("fileadmin/swf/videoplayer.swf?src=/"+flv, "movieflash", 642, 365, "9.0.0","fileadmin/swf/expressInstall.swf", flashvars, params, attributes);
	try {
		$("moviecontainer").show();
	} catch (e) {
		//TODO: handle exception
	}
	
}


// functions by CR -------------------------------------------------------------------------------------------------------------------

	function cr_init_headerpics(){
		if($("nf_1")){
			setTimeout("cr_rotate_headerpics()",6000);
		}
	}
	var cr_header_current = 0;
	var cr_hp_stopp = 0;
	
	function cr_rotate_headerpics(){
		if(cr_hp_stopp==0){
			$("nf_"+cr_header_current).style.display = "none";
			next = cr_header_current+1;
			if($("nf_"+ next)){
				cr_header_current++;
			}else{
				cr_header_current = 0;
			}
			// $("nf_"+cr_header_current).style.display = "";
			Effect.Appear("nf_"+cr_header_current, { duration: 1.0 });
	
			setTimeout("cr_rotate_headerpics()",6000);
		}
	}

	function cr_rotate_manual(){
		cr_hp_stopp = 1;
		$("nf_"+cr_header_current).style.display = "none";
		next = cr_header_current+1;
		if($("nf_"+ next)){
			cr_header_current++;
		}else{
			cr_header_current = 0;
		}
		// $("nf_"+cr_header_current).style.display = "";
		Effect.Appear("nf_"+cr_header_current, { duration: 1.0 });
	}
	
	function cr_stopp_rotation(){
		cr_hp_stopp = 1;
	}

	function cr_random(element,i){
		$(element+"xxx").style.display = "none";
		var rand = GetRandom(0,i-1);
		Effect.Appear(element+rand, { duration: 0.5 });
	}
	function GetRandom( min, max ) {
		if( min > max ) {
			return( -1 );
		}
		if( min == max ) {
			return( min );
		}
		return min + parseInt( Math.random() * ( max-min+1 ));
	}
    
var Cookie = {
  data: {},
  options: {expires: 1, domain: "", path: "", secure: false},

init: function(options, data) {
  Cookie.options = Object.extend(Cookie.options, options || {});

  var payload = Cookie.retrieve();
        if(payload) {
            Cookie.data = payload.evalJSON();
        }
        else {
            Cookie.data = data || {};
        }
        Cookie.store();
    },
    getData: function(key) {
        return Cookie.data[key];
    },
    setData: function(key, value) {
        Cookie.data[key] = value;
        Cookie.store();
    },
    removeData: function(key) {
        delete Cookie.data[key];
        Cookie.store();
    },
    retrieve: function() {
        var start = document.cookie.indexOf(Cookie.options.name + "=");

        if(start == -1) {
            return null;
        }
        if(Cookie.options.name != document.cookie.substr(start, Cookie.options.name.length)) {
            return null;
        }

        var len = start + Cookie.options.name.length + 1;   
        var end = document.cookie.indexOf(';', len);

        if(end == -1) {
            end = document.cookie.length;
        } 
        return unescape(document.cookie.substring(len, end));
    },
    store: function() {
        var expires = '';

        if (Cookie.options.expires) {
            var today = new Date();
            expires = Cookie.options.expires * 86400000;
            expires = ';expires=' + new Date(today.getTime() + expires);
        }

        document.cookie = Cookie.options.name + '=' + escape(Object.toJSON(Cookie.data)) + Cookie.getOptions() + expires;
    },
    erase: function() {
        document.cookie = Cookie.options.name + '=' + Cookie.getOptions() + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
    },
    getOptions: function() {
        return (Cookie.options.path ? ';path=' + Cookie.options.path : '') + (Cookie.options.domain ? ';domain=' + Cookie.options.domain : '') + (Cookie.options.secure ? ';secure' : '');      
    }
};
    
