/**********************************************************************/
/* Funktion laed Images vor          																  */	
/**********************************************************************/
function preload_images() 
{ 
  var d=document; 
	if(d.images)
	{ 
		if(!d.MM_p) d.MM_p=new Array();
   	var i,j=d.MM_p.length,a=preload_images.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];
			}
		}
	}
}		
/**********************************************************************/
/* Funktion erzeugt einen Mailto-Link 							             			*/	
/**********************************************************************/
function create_email_link(email,domain,linkname)
{
	document.writeln("<a onMouseMove=\"javascript:status='"+linkname+"';\" onMouseOut=\"javascript:status='';\" href=\"mailto:"+email+"@"+domain+"\">"+linkname+"</a>");
}
/**********************************************************************/
/* Funktion oeffnet ein	Pop-Up-Fenster							             			*/	
/**********************************************************************/
function open_window(url, w, h, winname, scroll, resize)  
{
	var winleft = (screen.width - w) / 2; 
	var wintop = (screen.height - h) / 2;
	var winprops = "height="+h+",width="+w+",top="+wintop+",left="+winleft+",scrollbars="+scroll+",resizable="+resize;
	//var windowname = "-"+(Math.random()*99999999);
	var win = window.open(url, winname, winprops);
	if(window.focus) 
	{
		win.focus();
	}
}
/**********************************************************************/
/* Funktion zaehlt die Zeichen in einem Textarea                      */
/**********************************************************************/
function display_count_chars(id_name,string,max_chars)
{
	if(max_chars-string.length<0)
	{
		document.getElementById(id_name).innerHTML=0;
	}else{
		document.getElementById(id_name).innerHTML=max_chars-string.length;
	}
}
/**********************************************************************/
/* Funktion integriert Flash                                          */
/**********************************************************************/
function embed_flash(file,color) {
  window.onload = checkSizes;
  window.onresize = checkSizes;
  var bLoaded = false;
  function checkSizes() {
    var height = window.innerHeight ? window.innerHeight : 
                 (document.documentElement.clientHeight);
    var width  = window.innerWidth ? window.innerWidth :
                 (document.documentElement.clientWidth);
    var fc = document.getElementById("content");

    fc.style.height = fc.style.height = Math.max(600,height)+'px';
    fc.style.width = fc.style.width = Math.max(800,width-450)+'px';

    if(bLoaded == false) {
      bLoaded = true;
      window.setTimeout(function() {
        var so = new SWFObject("flash/"+file, "flash", "100%", "100%", "8", "#282828");
        so.addParam("allowScriptAccess", "sameDomain");
        so.addParam("scale", "noscale");
        so.addParam("menu", "false");
        so.addParam("quality", "MEDIUM");
        so.addParam("align", "top");
        so.addParam("bgcolor", color);
        //so.setAttribute("redirectUrl","noflash.php");
        so.write("content");
      }, 500);
    }
  }
}

/**********************************************************************/
/* Funktion integriert Flash-Player fuer FLV-Videos                    */
/**********************************************************************/
function flv_player(_file,_x_size,_y_size)
{
document.write('<object data="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=true&'+Math.random()+'" type="application/x-shockwave-flash" width="'+_x_size+'" height="'+_y_size+'">');
document.write('<param name="movie" value="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=true&'+Math.random()+'" />');
document.write('<param name="allowfullscreen" value="true" />');
document.write('<param name="quality" value="high" />');
document.write('</object>');
}


/*
function check_resize(page_id,page_type)
{
	document.getElementById("inner_content").style.maxHeight=(innerHeight-200)+"px";
}
*/

function flash_content(page_id,page_type)
{
	var show_flash = true;
	
	if(!FlashDetect.installed)
	{
		document.getElementById("center_scroll").style.visibility="visible";
	}else{
		if(show_flash==true) 
		{
			document.getElementById("content_folge").style.backgroundImage="none";
			document.getElementById("center_scroll").style.visibility="hidden";
			document.getElementsByName('info_button')[0].style.visibility='hidden';
		}
	}
	if(show_flash==true) embed_flash("projekte.swf?id="+page_id+"&page_type="+page_type+"&"+Math.random(),"#282828");
}

function hide_infos()
{
	document.getElementById('infos').style.position='absolute';
	document.getElementById('infos').style.height='0px';
	document.getElementById('infos').style.visibility='hidden';
	document.getElementsByName('info_button')[0].style.visibility='visible';
}


function show_infos()
{
	document.getElementById('infos').style.width='500px';
	document.getElementById('infos').style.visibility='visible';
	document.getElementsByName('info_button')[0].style.visibility='hidden';
}

function next_pic()
{
	akt_bild++;
	if(akt_bild>(anzahl_bilder-1)) akt_bild=0;
	document.getElementById("content_folge").style.backgroundImage="url(uploads/"+bilder[akt_bild]+")";
	document.getElementById("number_start").innerHTML=(akt_bild+1);
}

function prev_pic()
{
	akt_bild--;
	if(akt_bild<0) akt_bild=(anzahl_bilder-1);
	document.getElementById("content_folge").style.backgroundImage="url(uploads/"+bilder[akt_bild]+")";
	document.getElementById("number_start").innerHTML=(akt_bild+1);
}