function popup (url, name, width, height)
{
  fenster = window.open(url, name, "width="+width+",height="+height+",resizable=yes,scrollbars=yes,left=10,top=0");
  /* fenster.focus(); */
  if (parseInt(navigator.appVersion) >= 4) { fenster.window.focus(); }
}

function fullscreen (url, name)
{
  fenster = popupWin = window.open(url, name, "fullscreen=yes");
  /* fenster.focus(); */
  if (parseInt(navigator.appVersion) >= 4) { fenster.window.focus(); }
}

function changeBorder (object, color, linepx)
{
  object.style.border = linepx +"px solid "+color;
}


var MicrosoftModel=0;
var xplus=10,yplus=10;
var runnerobject;

                          /* div-Sektion "runner" bewegen: */
function MouseAction(mausx,mausy)
{
  runnerobject.left=mausx+xplus+"px";
  runnerobject.top=mausy+yplus+"px";
}

                       /* das onMouseMove-event auswerten: */
function MouseMove(event)
{
  var mausx,mausy;
  if (typeof(event)!="object")              /* kein event? */
    return;
  if (MicrosoftModel)                     /* MSIE: ------- */
  {
    mausx=event.clientX;
    mausy=event.clientY;
    if (document.body.scrollLeft)
      mausx+=document.body.scrollLeft;
    if (document.body.scrollTop)
      mausy+=document.body.scrollTop;
  }
  else                                    /* Netscape: --- */
  {
    mausx=event.pageX;
    mausy=event.pageY;
  }
  MouseAction(mausx,mausy);
}

          /* Behandlung des Ereignisses und Objekt setzen: */
function MouseInit()
{
  if (document.all)         /* MSIE, Konqueror, Opera: --- */
  {
    MicrosoftModel=1;
    window.onmousemove=MouseMove;
    runnerobject=document.all.runner.style;
  }
  if (!(MicrosoftModel))                  /* Netscape: --- */
  {
    if (typeof(document.addEventListener)=="function")
                                         /* Netscape6: --- */
    {
      document.addEventListener("mousemove",MouseMove,true);
      runnerobject=document.getElementById("runner").style;
    }
    else
    if (document.runner)                 /* Netscape4: --- */
    {
      window.captureEvents(Event.MOUSEMOVE);
      window.onmousemove=MouseMove;
      runnerobject=document.runner;
    }
    else                              /* anderer Browser : */
      alert("Dein Browser kann das nicht!");
  }
}

function showDynText (text, bgcolor)
{
  document.getElementById("runner").innerHTML = text;
  document.getElementById("runner").style.backgroundColor = bgcolor;
  document.getElementById("runner").style.padding = 5+"px";
  document.getElementById("runner").style.display = 'block';
}

function showDynPic (src, width, height)
{
  document.getElementById("runner").innerHTML = "<img src=" + src+ " width=" + width+ " height="+height+" class=BlockImage>";
  document.getElementById("runner").style.padding = 0;
  document.getElementById("runner").style.display = 'block';
}

function hideDynText ()
{
  document.getElementById("runner").innerHTML = '';
  document.getElementById("runner").style.display = "none";
}


subject_id = '';
function handleHttpResponse()
{
  if (http.readyState == 4)
  {
    if (subject_id != '')
    {
      document.getElementById(subject_id).innerHTML = http.responseText;
    }
  }
}
function getHTTPObject()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      try
      {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (E)
      {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
  {
    try
    {
      xmlhttp = new XMLHttpRequest();
    }
    catch (e)
    {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object


function getScriptPage(div_id, content_id)
{
  subject_id = div_id;
  content = document.getElementById(content_id).value;
  http.open("GET", "ajax.php?content=" + escape(content), true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}

function sendVote(addvars)
{
  subject_id = 'voteBox';
  http.open("GET", "ajax.php" + addvars, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}

// for automatically closing pop-up video download
function winClose()
{
	window.close();
}
function startClose()
{
	setTimeout('winClose()', 15000);
}

// for base64 decode javascript
var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
function decode(encStr)
{ var bits; var decOut = ''; var i = 0;
 for(; i<encStr.length; i += 4)
 {
  bits = (base64s.indexOf(encStr.charAt(i))    & 0xff) <<18 |
         (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 |
         (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 |
          base64s.indexOf(encStr.charAt(i +3)) & 0xff;
  decOut += String.fromCharCode((bits & 0xff0000) >>16, (bits & 0xff00) >>8, bits & 0xff);
 }
 if(encStr.charCodeAt(i -2) == 61)
 {
  return(decOut.substring(0, decOut.length -2));
 }
 else if(encStr.charCodeAt(i -1) == 61)
 {
  return(decOut.substring(0, decOut.length -1));
 }
 else {return(decOut)};
}