function do_onload()
{ 
DZCP.resizeImages();
initLightbox();
}
function normalpopup(name, what, x, y) {
  var pop_url = what;
  popupWin = window.open(pop_url, name, 'width='+x+',height='+y+',scrollbars');
  setTimeout("checkWindow(popupWin)", 50);
  if ( popupWin ) popupWin.focus();
}

function uploadpopup(what, x, y) {
  var pop_url = 'http://tera-gaming.de/upload/index.php?action='+what;
  popupWin = window.open(pop_url, 'uploadpopup', 'width='+x+',height='+y+',scrollbars');
  setTimeout("checkWindow(popupWin)", 50);
  if ( popupWin ) popupWin.focus();
}

function clandbpopup(x, y) {
  var pop_url = 'http://tera-gaming.de/clandb/';
  popupWin = window.open(pop_url, 'clandbpopup', 'width='+x+',height='+y+',scrollbars=yes,resizable=no');
  setTimeout("checkWindow(popupWin)", 50);
  if ( popupWin ) popupWin.focus();
}
function mapdbpopup(x, y) {
  var pop_url = 'http://tera-gaming.de/mapdb/';
  popupWin = window.open(pop_url, 'mapdbpopup', 'width='+x+',height='+y+',scrollbars=yes,resizable=no');
  setTimeout("checkWindow(popupWin)", 50);
  if ( popupWin ) popupWin.focus();
}
// GLOBAL VARS
  var doc = document, ie4 = document.all, opera = window.opera;
  var innerLayer, layer, x, y, doWheel = false, offsetX = 15, offsetY = 5;
  var tickerc = 0, mTimer = new Array(), tickerTo = new Array(), tickerSpeed = new Array();
  var shoutInterval = 15000; // refresh interval of the shoutbox in ms
  var teamspeakInterval = 15000; // refresh interval of the teamspeak viewer in ms

// DZCP JAVASCRIPT LIBARY
var DZCP = {
    resizeImages: function () {
        for (var i = 0; i < doc.images.length; i++) {
            var d = doc.images[i];
            if (d.className == 'content') {
                var a = d.width;
                var b = d.height;
                if (maxW != 0 && a > maxW) {
                    d.width = maxW;
                    d.height = Math.round(b * (maxW / a));
                    if (!DZCP.linkedImage(d)) {
                        var c = doc.createElement("span");
                        var e = doc.createElement("a");
                        d.setAttribute('class', 'sb-image');
                        c.setAttribute('class', 'resized f-r darkgrey');
                        c.appendChild(doc.createTextNode('auto resized to ' + d.width + 'x' + d.height + ' px (Original: '+ a +'x'+ b +')'));
                        e.setAttribute('href', d.src);
                        e.setAttribute('rel', 'shadowbox[current]');
                        e.appendChild(d.cloneNode(true));
                        d.parentNode.appendChild(c);
                        d.parentNode.replaceChild(e, d);
						Shadowbox.clearCache(); // <= clear Shadowbox's cache
						Shadowbox.setup(); // <= set up all Shadowbox links
                    }
                }
            }
        }
    },
	// ajax preview
    ajaxPreview: function(form) {
      var tag=doc.getElementsByTagName("textarea");
      for(var i=0;i<tag.length;i++)
      {
        var thisTag = tag[i].className;
        var thisID = tag[i].id;
        if(thisTag == "editorStyle" || thisTag == "editorStyleMini" || thisTag == "editorStyleWord" || thisTag == "editorStyleNewsletter")
        {
          var inst = tinyMCE.getInstanceById(thisID);
          $(thisID).value = inst.getBody().innerHTML;
        }
      }

      var url = prevURL;
      var addpars = (form == 'cwForm') ? '&s1='+$('screen1').value+'&s2='+$('screen2').value+'&s3='+$('screen3').value+'&s4='+$('screen4').value : '';
      var pars = Form.serialize(form) + addpars;

      $('previewDIV').innerHTML = '<div style="width:100%;text-align:center">'
                                + ' <img src="../inc/images/admin/loading.gif" alt="" />'
                                + '</div>';

      var myAjax = new Ajax.Updater('previewDIV', url, {method: 'post', postBody: pars});
    },
	
	// handle info layer
    showInfo: function(info) {
      if(typeof(layer) == 'object')
      {
        layer.innerHTML =
          '<div id="hDiv">' +
          '  <table class="hperc" cellspacing="0" style="height:100%">' +
          '    <tr>' +
          '      <td style="vertical-align:middle">' +
          '        <div id="infoInnerLayer">' +
          '          <table class="hperc" cellspacing="0">'+info+'</table>' +
          '        </div>' +
          '      </td>' +
          '    </tr>' +
          '  </table>' +
          '</div>';

      //IE Fix
        if(ie4 && !opera)
        {
          layer.innerHTML += '<iframe id="ieFix" frameborder="0" width="' + $('hDiv').offsetWidth + '" height="' + $('hDiv').offsetHeight + '"></iframe>'
          layer.style.display = 'block';
        } else layer.style.display = 'block';
      }
    },

    hideInfo: function() {
      if(typeof(layer) == 'object')
      {
        layer.innerHTML = '';
        layer.style.display = 'none';
      }
    },
	// submit shoutbox
    shoutSubmit: function() {
      var myAjax = new Ajax.Request('../shout/index.php?ajax', {method: 'post', postBody: Form.serialize('shoutForm'), onSuccess: function(s) {
        if(s.responseText) alert(s.responseText.replace(/  /g, ' '));
        var myAjax = new Ajax.Updater('navShout', '../inc/ajax.php?i=shoutbox', {method: 'get', onFailure: function() {
          var myAjax = new Ajax.Updater('navShout', '../inc/ajax.php?i=shoutbox', {method: 'get' });
        } });
        if(!s.responseText) $('shouteintrag').value = '';
      } });
      
      return false;
    },
	// init Gameserver via Ajax
    initGameServer: function(serverID) {
      var myAjax = new Ajax.Updater('navGameServer_' + serverID, '../inc/ajax.php?i=server&serverID=' + serverID, {method: 'get', onFailure: function() {
          DZCP.initGameServer(serverID);        
        }
      });
    },

  // init Teamspeakserver via Ajax
    initTeamspeakServer: function() {
      var myAjax = new Ajax.Updater('navTeamspeakServer', '../inc/ajax.php?i=teamspeak', {method: 'get', onFailure: function() { DZCP.initTeamspeakServer(); }});
    },
	// handle popups
    popup: function(url, x, y) {
      url = (url.indexOf('img=') == -1) ? url : '../popup.php?' + url;
      x = parseInt(x); y = parseInt(y) + 50;

      popup = window.open(url, 'Popup', "width=1,height=1,location=0,scrollbars=0,resizable=1,status=0");

      popup.resizeTo(x, y);
      popup.moveTo((screen.width - x) / 2, (screen.height-y) / 2);
      popup.focus();
    },
	// toggle object
    toggle: function(id) {
      if(id == 0) return;
      else {
        if($('more' + id).style.display == 'none')
        {
        	$('more' + id).style.display = '';
        	if($('img' + id)) $('img' + id).src = '../inc/images/collapse.gif';
        } else {
        	$('more' + id).style.display = 'none';
          if($('img' + id)) $('img' + id).src = '../inc/images/expand.gif';
        }
      }
    },
	  // switch userlist
    switchuser: function() {
      var url = doc.formChange.changeme.options[doc.formChange.changeme.selectedIndex].value;
      window.location.href = url
    },

  // Templateswitch
    tempswitch: function() {
      var url = doc.form.tempswitch.options[doc.form.tempswitch.selectedIndex].value;
      if(url != 'lazy') DZCP.goTo(url);
    },

  // go to defined url
    goTo: function(url, n) {
      if(n == 1) window.open(url);
      else window.location.href = url
    },

  // limit text lenthn
    maxlength: function(field, countfield, max) {
    	if(field.value.length > max) field.value = field.value.substring(0, max);
    	else                         countfield.value = max - field.value.length;
    },

    linkedImage: function (a) {
        do {
            a = a.parentNode;
            if (a.nodeName == 'A') return true
        } while (a.nodeName != 'TD' && a.nodeName != 'BODY');
        return false
    },
    calSwitch: function (m, y) {
        $('#navKalender').load('../inc/ajax.php?i=kalender&month=' + m + '&year=' + y)
    },
    teamSwitch: function (a) {
        clearTimeout(mTimer[1]);
        $('#navTeam').load('../inc/ajax.php?i=teams&tID=' + a, DZCP.initTicker('teams', 'h', 60))
    },
    ajaxVote: function (b) {
        DZCP.submitButton('contentSubmitVote');
        $.post('../votes/index.php?action=do&ajax=1&what=vote&id=' + b, $('#navAjaxVote').serialize(), function (a) {
            $('#navVote').html(a)
        });
        return false
    },
    ajaxFVote: function (b) {
        DZCP.submitButton('contentSubmitFVote');
        $.post('../votes/index.php?action=do&fajax=1&what=fvote&id=' + b, $('#navAjaxFVote').serialize(), function (a) {
            $('#navFVote').html(a)
        });
        return false
    },
    del: function (a) {
        a = a.replace(/\+/g, ' ');
        a = a.replace(/oe/g, 'ö');
        return confirm(a + '?')
    },
    hideForumFirst: function () {
        $('#allkat').attr('checked', false)
    },
    hideForumAll: function () {
        for (var i = 0; i < doc.forms['search'].elements.length; i++) {
            var a = doc.forms['search'].elements[i];
            if (a.id.match(/k_/g)) a.checked = false
        }
    },
    googleAPI: function (f) {
        map = new GMap2($("#memberMap")[0]);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());

        function initMember(a, b, c) {
            var d = new GIcon();
            if (c == 1) d.image = '../inc/images/mappin_team.png';
            else d.image = '../inc/images/mappin.png';
            d.iconSize = new GSize(20, 34);
            d.iconAnchor = new GPoint(10, 32);
            d.infoWindowAnchor = new GPoint(10, 2);
            var e = new GMarker(a, d);
            GEvent.addListener(e, "mouseover", function () {
                DZCP.showInfo(b)
            });
            GEvent.addListener(e, "mouseout", function () {
                DZCP.hideInfo()
            });
            GEvent.addListener(e, "click", function () {
                DZCP.hideInfo();
                map.showMapBlowup(e.getPoint(), 5)
            });
            map.addOverlay(e)
        }
        function handle(a) {
            var s = '';
            if (a < 0) s += "down";
            else s += "up";
            if (s == "down") map.zoomOut();
            if (s == "up") map.zoomIn()
        }
        var g = map.getMapTypes();
        for (var i = 0; i < g.length; i++) {
            g[i].getMinimumResolution = function () {
                return 4
            };
            g[i].getMaximumResolution = function () {
                return 17
            }
        }
        map.setCenter(new GLatLng(51.200000, 12.50000), 6);
        new GKeyboardHandler(map);
        map.addControl(new GMapTypeControl());
        eval(f)
    },
    submitButton: function (a) {
        submitID = (a) ? a : 'contentSubmit';
        $('#' + submitID).attr("disabled", true);
        $('#' + submitID).css('color', '#909090');
        $('#' + submitID).css('cursor', 'default');
        return true
    },
    initTicker: function (a, b, c) {
        tickerTo[tickerc] = (b == 'h' || b == 'v') ? b : 'v';
        tickerSpeed[tickerc] = (parseInt(c) <= 10) ? 10 : parseInt(c);
        var d = $('#' + a).html();
        var e = '  <div id="scrollDiv' + tickerc + '" class="scrollDiv" style="position:relative;left:0;z-index:1">';
        e += '    <table id="scrollTable' + tickerc + '" class="scrolltable"  cellpadding="0" cellspacing="0">';
        e += '      <tr>';
        e += '        <td onmouseover="clearTimeout(mTimer[' + tickerc + '])" onmouseout="DZCP.startTickerDiv(' + tickerc + ')">';
        for (var i = 0; i < 10; i++) e += d;
        e += '        </td>';
        e += '      </tr>';
        e += '    </table>';
        e += '  </div>';
        $('#' + a).html(e);
        window.setTimeout("DZCP.startTickerDiv(" + tickerc + ");", 1500);
        tickerc++
    },
    startTickerDiv: function (a) {
        tableObj = $('#scrollTable' + a)[0];
        obj = tableObj.parentNode;
        objWidth = (tickerTo[a] == 'h') ? tableObj.offsetWidth : tableObj.offsetHeight;
        newWidth = (Math.floor(objWidth / 2) * 2) + 2;
        obj.style.width = newWidth;
        mTimer[a] = setInterval("DZCP.moveDiv('" + obj.id + "', " + newWidth + ", " + a + ");", tickerSpeed[a])
    },
    moveDiv: function (a, b, c) {
        var d = $('#' + a)[0];
        if (tickerTo[c] == 'h') d.style.left = (parseInt(d.style.left) <= (0 - (b / 2) + 2)) ? 0 : parseInt(d.style.left) - 1 + 'px';
        else d.style.top = (d.style.top == '' || (parseInt(d.style.top) < (0 - (b / 2) + 6))) ? 0 : parseInt(d.style.top) - 1 + 'px'
    },
	
    addFlash: function () {
        var a = new Object();
        a.embedAttrs = new Object();
        a.params = new Object();
        a.objAttrs = new Object();
        var b = new Array('menu|false', 'quality|high', 'wmode|transparent', 'classid|clsid:d27cdb6e-ae6d-11cf-96b8-444553540000', 'type|application/x-shockwave-flash');
        for (var i = 0; i < arguments.length; i = i + 2) {
            a.objAttrs[arguments[i]] = arguments[i + 1];
            a.embedAttrs[arguments[i]] = a.params[arguments[i]] = arguments[i + 1];
            a.params[arguments[i]] = arguments[i + 1]
        }
        for (var i = 0; i < b.length; i++) {
            var s = b[i].split('|');
            if (!a.params[s[0]]) {
                a.objAttrs[s[0]] = s[1];
                a.embedAttrs[s[0]] = s[1];
                a.params[s[0]] = s[1]
            }
        }
        var c = '<object ';
        for (var i in a.objAttrs) c += i + '="' + a.objAttrs[i] + '" ';
        c += '>';
        for (var i in a.params) c += '<param name="' + i + '" value="' + a.params[i] + '" /> ';
        c += '<embed ';
        for (var i in a.embedAttrs) c += i + '="' + a.embedAttrs[i] + '" ';
        c += ' ></embed></object>';
        doc.write(c)
    }
}

// load global events
  $(document).ready(function() {
    DZCP.init();
    DZCP.resizeImages();
  });

function GetElementHeight (elm)
{
  if (!elm)
    return 0;

  if (document.layers)
  {
    if (!elm.height)
      elm.height = elm.clip.height;
    return elm.height;
  }
  else if (typeof(elm.style && elm.style.height) == 'number')
  {
    return elm.style.height;
  }
  else if (typeof(elm.style && elm.style.height) == 'string' && !isNaN(parseInt(elm.style.height)))
  {
    return parseInt(elm.style.height);
  }
  else if (elm.offsetHeight)
  {
    return elm.offsetHeight;
  }
  else if (typeof(elm.style && elm.style.pixelHeight) == 'number')
  {
    return elm.style.pixelHeight;
  }
  else if (elm.clientHeight)
  {
    return elm.clientHeight;
  }

  return 0;
}
function sameHeight() {
	var hoeheL = '';
	var hoeheR = '';
	//if(hoeheL > hoeheR) document.getElementById("rightColumn").style.offsetHeight = hoeheL;
	//else document.getElementById("contentbox").style.offsetHeight = hoeheR;
	//alert(GetElementHeight(document.getElementById('main')));
	//if(GetElementHeight(document.getElementById('main')) > 1600) document.getElementById("addwerbung").style.display = "block";
	if(GetElementHeight(document.getElementById('main')) > 2000)
	{
		document.getElementById("addwerbung").style.display = "block";
		//document.getElementById("addwerbung").getElementsByTagName("div")[0].innerHTML = '<script language="javascript" type="text/javascript">var proximic_widget_cl = { auid:"170",width:"160",height:"600",aid:"AQZNWNV" };/* widget_160x600 */</script><script language="javascript" type="text/javascript" src="http://widget.proximic.com/js/loader.js"></script>';
	}
	else 
	{
		document.getElementById("addwerbung").style.display = "none";
	}
}
//alert(GetElementHeight(document.getElementById('main')));

function showdiv( show , hide )
{
	if(document.getElementById(show).style.display == "block")
	{
		document.getElementById(show).style.display = "none"; 
		document.getElementById(hide).style.display = "block"; 
	} else {
	document.getElementById(show).style.display = "block"; 
	document.getElementById(hide).style.display = "none"; 
	}
}

function openumenu()
{
	if(navigator.appName=="Microsoft Internet Explorer") {
		document.location="../user/?action=login";
	} else {
		if(document.getElementById('userlogin-open').style.display == "block")
		{
			document.getElementById('userlogin-open').style.display = "none"; 
		} else {
		document.getElementById('userlogin-open').style.display = "block"; 
		}
	}
}

//Universaler onmouseover via background-position
function bg_change(element,pixel)
{
	if("navb-"+selected_navi != element) {
		window.clearTimeout(navi_timeout);
		document.getElementById(element).style.backgroundPosition="0px "+pixel+"px";
		if(pixel = -31) document.getElementById(element).style.marginTop="1px";
		else document.getElementById(element).style.marginTop="0px";
	}
}


/** 
 * flashembed 0.31. Adobe Flash embedding script
 * 
 * http://flowplayer.org/tools/flash-embed.html
 *
 * Copyright (c) 2008 Tero Piirainen (tipiirai@gmail.com)
 *
 * Released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * >> Basically you can do anything you want but leave this header as is <<
 *
 * version 0.01 - 03/11/2008 
 * version 0.31 - Tue Jul 22 2008 06:30:31 GMT+0200 (GMT+02:00)
 */
function flashembed(root,userParams,flashvars){function getHTML(){var html="";if(typeof flashvars=='function'){flashvars=flashvars();}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" ';if(params.id){extend(params,{name:params.id});}for(var key in params){if(params[key]!==null){html+=[key]+'="'+params[key]+'"\n\t';}}if(flashvars){html+='flashvars=\''+concatVars(flashvars)+'\'';}html+='/>';}else{html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+params.width+'" height="'+params.height+'"';if(!params.id&&document.all){params.id="_"+(""+Math.random()).substring(5);}if(params.id){html+=' id="'+params.id+'"';}html+='>';html+='\n\t<param name="movie" value="'+params.src+'" />';params.id=params.src=params.width=params.height=null;for(var k in params){if(params[k]!==null){html+='\n\t<param name="'+k+'" value="'+params[k]+'" />';}}if(flashvars){html+='\n\t<param name="flashvars" value=\''+concatVars(flashvars)+'\' />';}html+="</object>";if(debug){alert(html);}}return html;}function init(name){var timer=setInterval(function(){var doc=document;var el=doc.getElementById(name);if(el){flashembed(el,userParams,flashvars);clearInterval(timer);}else if(doc&&doc.getElementsByTagName&&doc.getElementById&&doc.body){clearInterval(timer);}},13);return true;}function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}}var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,bgcolor:'#ffffff',allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{return init(root);}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML();return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML();}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':return'"'+obj.replace(new RegExp('(["\\\\])','g'),'\\$1')+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}return root;}if(typeof jQuery=='function'){(function($){$.fn.extend({flashembed:function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});}});})(jQuery);}flashembed=flashembed||{};flashembed.getVersion=function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;};flashembed.isSupported=function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;};

var globlSlideElement;
function nextSlide() {
	slide(globlSlideElement,1);
}

// Hilfsfunktion für die Slideshow
function handleClick (Event) {
	for(var i=1; i < 6; i++)
	{
		if (document.getElementById("slide_"+i).style.display=="block") {	
			location.href=document.getElementById("slink_"+i).value;
		}
	}
}


var tick;
  function stop() {
  clearTimeout(tick);
  }
  function clock() {
  var ut=new Date();
  var h,m,s;
  var time="        ";
  h=ut.getHours();
  m=ut.getMinutes();
  s=ut.getSeconds();
  if(s<=9) s="0"+s;
  if(m<=9) m="0"+m;
  if(h<=9) h="0"+h;
  time+=h+":"+m+":"+s;
  document.getElementById('clock').innerHTML=time + " Uhr";
  tick=setTimeout("clock()",1000); 
  }

//noch eine Hilfsfunktion für die Slideshow
function initFeatureBox() {
	document.getElementById("highlights").addEventListener("click", handleClick, false);
}

// Slideshow auf der Startseite
function slide (element,clear,pause,unpause) {
	if(pause == 1) window.clearTimeout(slide_timeout);
	else if(unpause == 1) slide_timeout=window.setTimeout("slide("+globlSlideElement+")",10000);
	else {
		if(clear == 1) window.clearTimeout(slide_timeout);
		for(var i=1; i < 7; i++)
		{
			document.getElementById("slide_"+i).style.display="none";
			document.getElementById("slideil_"+i).style.display="none";
			document.getElementById("slided_"+i).style.display="none";
			document.getElementById("slidec_"+i).style.display="none";
			document.getElementById("slideb_"+i).className="naviButton";
		}
		document.getElementById("slide_"+element).style.display="block";
		document.getElementById("slideil_"+element).style.display="block";
		document.getElementById("slided_"+element).style.display="block";
		document.getElementById("slidec_"+element).style.display="block";
		document.getElementById("slideb_"+element).className="naviButton_hover";
	
		var nextslide = element+1;
		if(nextslide == 7) nextslide = 1;
		globlSlideElement = nextslide;
		slide_timeout=window.setTimeout("slide("+nextslide+")",10000);
	}
}

function newrate(file,rate)
{
  pars = '&tvfile='+file+'&rate='+rate;
  var myAjax = new Ajax.Updater('newrate', '../inc/global.php?i=newrate'+pars, {method: 'get'});
}
function ajaxcommentspage( news,page,entrys,maxcomments,blog ) {
//document.write("LBLABBLALB");
  ajaxcomments( news,page,maxcomments,blog );
  ajaxcommentspages( entrys,maxcomments,page,news,blog );
}
function ajaxcomments( news,page,maxcomments,blog ) {
//document.write("LBLABBLALB");
  pars = '&news='+news+'&page='+page+'&blog='+blog;
  var myAjax = new Ajax.Updater('ajaxcomments', '../inc/global.php?i=ajaxcomments'+pars, {method: 'get'});
}
function ajaxcommentspages( entrys,maxcomments,page,news,blog ) {
//document.write("LBLABBLALB");
  pars = '&entrys='+entrys+'&maxcomments='+maxcomments+'&page='+page+'&news='+news+'&blog='+blog;
  var myAjax = new Ajax.Updater('ajaxcommentspages', '../inc/global.php?i=ajaxcommentspages'+pars, {method: 'get'});
  var myAjax = new Ajax.Updater('ajaxcommentspages2', '../inc/global.php?i=ajaxcommentspages'+pars, {method: 'get'});
}
function switchToNewNewsRate( news,kat,rate ) {
  newnewsrate( news,kat,rate );
  setTimeout ( newsrate( news,kat ), 2000 );
}
function newsrate(news,kat)
{
  pars = '&news='+news+'&kat='+kat;
  var myAjax = new Ajax.Updater('newsrate'+news, '../inc/global.php?i=newsrate'+pars, {method: 'get'});
}
function newnewsrate(news,kat,rate)
{
  pars = '&news='+news+'&kat='+kat+'&rate='+rate;
  var myAjax = new Ajax.Updater('newsrate', '../inc/global.php?i=newnewsrate'+pars, {method: 'get'});
}
function movieinfo(file)
{
  pars = '&tvfile='+file;
  var myAjax = new Ajax.Updater('movieinfo', '../inc/global.php?i=movieinfo'+pars, {method: 'get'});
}
function toggletopnews(kat)
{
  pars = '&kat='+kat;
  var myAjax = new Ajax.Updater('topnews', '../inc/global.php?i=toggletopnews'+pars, {method: 'get'});
}
function togglenewsarchiv(kat)
{
  pars = '&kat='+kat;
  var myAjax = new Ajax.Updater('topnews', '../inc/global.php?i=togglenewsarchiv'+pars, {method: 'get'});
}
function insertcomment(file,autor,comment)
{
  pars = '&tvfile='+file+'&autor='+autor+'&comment='+comment;
  var myAjax = new Ajax.Updater('insertcomment', '../inc/global.php?i=insertcomment'+pars, {method: 'get'});
}
function switchToNewComments( file,autor,comment ) {
  insertcomment(file,autor,comment);
  unitoggle('showcomments','addcomment');
  showcomments(file);
}

function switchToNewRate( file,rate ) {
  newrate( file,rate );
  movieinfo( file );
}


/* MENU  */
//pokazuje dymek 
function showDym(nr) {
	$("dym" + nr).show();
}
//chowa dymek 
function hideDym(nr) {
	$("dym" + nr).hide();
}

/* /MENU  */
var formatedTime = "";
function setFormatedTime(time){
	formatedTime = time;
}

