//--------------------------------------------------------------
// file: javascript.js
// Gesammelt von: Sattler Wolfgang
//--------------------------------------------------------------



//-------------------------------------------------
// AJAX - lädt den Inhalt 
var issent=false, global_file, last_main, last_submain, reload_symbol=true;

function read_file(file) 
{
  global_file = file;
  document.getElementById('main').innerHTML = "<br><br><center><b>Seite wird geladen...</b><br><br><img src=\"pics/loading.gif\"><center>";

  var myAjax1   = new Ajax.Request(file, { onComplete: zeige_main });
} 
function zeige_main( originalRequest ) 
{
  document.getElementById('main').innerHTML = originalRequest.responseText;
  if (global_file == "home.php")  countdown();

  document.getElementById('page').height = document.body.offsetHeight;
}

function getSize(obj, win)
{
    if(!obj) return null;
    if(typeof obj == "string") obj = document.getElementById(obj);

    var size = {width:0, height:0};

    if(typeof document.layers != 'undefined')
    {
         size.width = obj.clip.width;
         size.height = obj.clip.height;
    }
    else if(obj.offsetWidth)
    {
         size.width = parseInt(obj.offsetWidth);
         size.height = parseInt(obj.offsetHeight);
    }


    return size;
}

//-------------------------------------------------
// AJAX - Formular Post
  
function ajax_post(file, form_id) 
{ 
  var myAjax = new Ajax.Request(file, { method: 'post', encoding: 'UTF-8', parameters: Form.serialize($(form_id)), onComplete: zeige_main }); 
  document.getElementById('main').innerHTML = "<br><br><center><b>Seite wird geladen...</b><br><br><img src=\"bilder/loading.gif\"><center>";
} 

function player_start()
{
  var so = new SWFObject("flashmp3player/flashmp3player.swf", "player", "290", "270", "9"); // Location of swf file. You can change player width and height here (using pixels or percents).
  so.addParam("quality", "high");
  so.addVariable("content_path","mp3"); // Location of a folder with mp3 files (relative to php script).
  so.addVariable("color_path","flashmp3player/default.xml"); // Location of xml file with color settings.
  so.addVariable("script_path","flashmp3player/flashmp3player.php"); // Location of php script.
  so.write("player");
}

function ch_vid(nr)
{
  if (nr == 1)
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=EinfachgernbeidirDavid.flv&plugins=viral-1d&autostart=true'/>";	
  else if (nr == 2)	
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=FestinDeinerHandMatthias.flv&plugins=viral-1d&autostart=true'/>";	
  else if (nr == 3)	
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=NewDayAmy.flv&plugins=viral-1d&autostart=true'/>";	
  else if (nr == 4)	
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=WaswirklichzahltGianni.flv&plugins=viral-1d&autostart=true'/>";	
  else if (nr == 5)	
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=DankeChor.flv&plugins=viral-1d&autostart=true'/>";	
  else if (nr == 6)	
    document.getElementById('flvplayer').innerHTML="<embed src='flvplayer/player.swf' height='300' width='400' allowscriptaccess='always' allowfullscreen='true' flashvars='file=DankeProduktion.flv&plugins=viral-1d&autostart=true'/>";	
}

function MM_preloadImages() 
{ 
  	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function bild(imgPath) 
{
	varPicDivImg = document.all.bild;
 	varPicDivImg.src = "pics/loading.gif";
	MM_preloadImages(imgPath);
 	varPicDivImg.src = imgPath;
}

