var ns = document.layers ? true : false;
var ie = document.all && !window.opera ? true : false;;    // IEs
var dom = document.getElementById && !ie ? true : false;  // DOM-Browser

//Loadmodule
var loadingsequenz = "<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center' valign='middle'><img src='images/loading.gif' /><br /></td></tr></table>";
var lastmodule = "";
var lastspalte = "";
var lastrichtung = "";
var lastoffset = "";
var lasid = "";
var activeflash = false;


  ////////////////////////////
 // GLOBALE CMS FUNKTIONEN //
////////////////////////////

function gbsizes(){
	alert($('gray_box_content').width + "\n" + $('gray_box_content').style.height);	
}

function loadModule(id) {
	$('maincontent').innerHTML = loadingsequenz; 
	
	
	new Ajax.Request('main.php'+id, {
		method: 'get',	
		onSuccess: function(t) {
			$('maincontent').update(t.responseText);
		},
		onFailure: function(t) {
			$('maincontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function includeModule(module) {
	lastmodule = module;
	
	if(includeModule.arguments.length > 1) add = includeModule.arguments[1];
	else add = "";
	
	$('modulecontent').innerHTML = loadingsequenz;	
	
	new Ajax.Request('module/'+module+'.php'+add, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function includeModuleHidden(module) {
	lastmodule = module;
	
	if(includeModuleHidden.arguments.length > 1) add = includeModuleHidden.arguments[1];
	else add = "";
	
	// alert("lastmodule");
	$('loading_ani').show();
	//$('modulecontent').innerHTML = loadingsequenz;	
	//alert("ajax start..." + 'module/'+module+'.php?spalte='+lastspalte+'&richtung='+lastrichtung+'&suche='+$('searchmodule').value+'&offset='+lastoffset);
	new Ajax.Request(add+'module/'+module+'.php', {
		method: 'get',	
		onSuccess: function(t) {
			//alert("ajax ok");
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function sortModule(module,spalte,richtung) {
	//$('modulecontent').innerHTML = loadingsequenz;
	$('loading_ani').show();
	
	new Ajax.Request('module/'+module+'.php?spalte='+spalte+'&richtung='+richtung+'&suche='+$('searchmodule').value, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function changePage(module,spalte,richtung,offset) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	$('loading_ani').show();
	
	new Ajax.Request('module/'+module+'.php?spalte='+spalte+'&richtung='+richtung+'&suche='+$('searchmodule').value+'&offset='+offset, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function sizeToSession(breite,hoehe) {
	new Ajax.Request('ajax/sizeToSession.php?breite='+breite+'&hoehe='+hoehe, {
		method: 'get',	
		onSuccess: function(t) {
			//$('modulecontent').update(t.responseText);
		},
		onFailure: function(t) {
			//$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
}

function deleteObject(module,id) {
	//$('modulecontent').innerHTML = loadingsequenz; 
	
	if(window.confirm("Soll der Eintrag wirklich entfernt werden?")) {
		
		$('loading_ani').show();
		
		new Ajax.Request('module/'+module+'.php?action=delete&id='+id+'&spalte='+lastspalte+'&richtung='+lastrichtung+'&suche='+$('searchmodule').value+'&offset='+lastoffset, {
			method: 'get',	
			onSuccess: function(t) {
				$('modulecontent').update(t.responseText);
				$('loading_ani').hide();
			},
			onFailure: function(t) {
				$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);
	}
	
}

function checkLogin() {
	$('login_loading').show(); 
	
	new Ajax.Request('ajax/checklogin.php', {
		method: 'post',	
		postBody: $('login_form').serialize(),
		onSuccess: function(t) {
			$('login_response').update(t.responseText);
			$('login_loading').hide();
		},
		onFailure: function(t) {
			$('loginResponse').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
}

function changePasswort() {
	$('cpw_loading').show(); 
	
	new Ajax.Request('ajax/changepasswort.php', {
		method: 'post',	
		postBody: $('cpw_form').serialize(),
		onSuccess: function(t) {
			$('cpw_response').update(t.responseText);
			$('cpw_loading').hide();
		},
		onFailure: function(t) {
			$('cpw_response').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
}


  ////////////////////////////
 // SPEZIFISCHE FUNKTIONEN //
////////////////////////////
function sortInhalt(module,id,i_id,richtung) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	$('loading_ani').show();
	new Ajax.Request('module/'+module+'.php?action=subsort&id='+id+'&i_id='+i_id+'&srichtung='+richtung, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function sortStruktur(module,id,richtung) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	$('loading_ani').show();
	new Ajax.Request('module/'+module+'.php?action=sort&id='+id+'&srichtung='+richtung, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}
function sortProdukt(module,pid,id,richtung) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	$('loading_ani').show();
	new Ajax.Request('module/'+module+'.php?action=sort&id='+id+'&pid='+pid+'&srichtung='+richtung, {
		method: 'get',	
		onSuccess: function(t) {
			$('modulecontent').update(t.responseText);
			$('loading_ani').hide();
		},
		onFailure: function(t) {
			$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	
}

function deleteInhalt(module,id,i_id) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	if(window.confirm("Soll der Eintrag wirklich entfernt werden?")) {
		$('loading_ani').show();
		new Ajax.Request('module/'+module+'.php?action=subdelete&id='+id+'&i_id='+i_id, {
			method: 'get',	
			onSuccess: function(t) {
				$('modulecontent').update(t.responseText);
				$('loading_ani').hide();
			},
			onFailure: function(t) {
				$('modulecontent').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);
	}
	
}

function deleteProductAttribute(id){
	if(window.confirm("Soll die Eigenschaft wirklick entfernt werden?")) {
		new Ajax.Request('../ajax/deleteProductAttribute.php?id='+id, {
			method: 'get',	
			onSuccess: function(t) {
				$('EigAction').update(t.responseText);
			},
			onFailure: function(t) {
				$('EigAction').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);	
	}
}

var openEigChooser=false;

function changeProductAttribute(id){
	var eigFld=$('eig_bez_'+id);
	//alert(openEigChooser);
	takeProductAttribute(openEigChooser);
	openEigChooser=id;
	if(eigFld){
		new Ajax.Request('../ajax/changeProductAttribute.php?id='+id, {
			method: 'get',	
			onSuccess: function(t) {
				$('EigAction').update(t.responseText);
			},
			onFailure: function(t) {
				$('EigAction').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);	
	}
	else alert("Eigenschaft kann nicht geändert werden.");
/*	
	*/
}
function takeProductAttribute(id){
	
	if($('eigChooser_'+id) && $('eig_bez_'+id)){
		//$('eig_bez_'+id).update(AttributeById($('eigChooser_'+id).value));
		new Ajax.Request('../ajax/changeProductAttribute.php?set='+$('eigChooser_'+id).value+'&id='+id, {
			method: 'get',	
			onSuccess: function(t) {
				$('EigAction').update(t.responseText);
				updateAttributeValue(id,$('eig_wert_'+id).value);
			},
			onFailure: function(t) {
				$('EigAction').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);	
		
	}
	else{
		//alert(id+"\n"+$('eigChooser_'+id)+"\n"+$('eig_bez_'+id));
	}
}

function AttributeById(fld,id){
	new Ajax.Request('../ajax/AttributeById.php?id='+id, {
		method: 'get',	
		onSuccess: function(t) {
			fld.update(t.responseText);
		},
		onFailure: function(t) {
			fld.update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);	
}	

function updateAttributeValue(id,value){
	
	new Ajax.Request('../ajax/updateAttributeValue.php?id='+id+'&value='+value, {
		method: 'get',	
		onSuccess: function(t) {
			$('eig_format_wert_'+id).update(t.responseText);
		},
		onFailure: function(t) {
			$('eig_format_wert_'+id).update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);	
}

function deleteProductPicture(id) {
	//$('modulecontent').innerHTML = loadingsequenz; 	
	if(window.confirm("Soll das Bild wirklich entfernt werden?")) {
		new Ajax.Request('../ajax/deleteProductPicture.php?id='+id, {
			method: 'get',	
			onSuccess: function(t) {
				$('bildAction').update(t.responseText);
			},
			onFailure: function(t) {
				$('bildAction').update('Error ' + t.status + ' -- ' + t.statusText);
			},
			evalScript: true,
			asynchronous: true
			}
		);
	}	
}


function pBildUploadUpdate(id) {
	new Ajax.Request('../ajax/pBildUploadUpdate.php?pid='+id, {
		method: 'get',	
		onSuccess: function(t) {
			parent.$('bildInput').update(t.responseText);
		},
		onFailure: function(t) {
			parent.$('bildInput').update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
}

var isLeftSideOpen = true;

function toggleNavbar() {
	if(isLeftSideOpen) {
		Effect.SlideUp('navbar',{duration:1.0, scaleX: true, scaleY: false, scaleContent: false});
		$('navBarSlider_left').toggle();
		$('navBarSlider_right').toggle();
		isLeftSideOpen = false;
	} else {
		Effect.SlideDown('navbar',{duration:1.0, scaleX: true, scaleY: false,scaleFrom:0,scaleTo:100, scaleContent: false});
		isLeftSideOpen = true;
		$('navBarSlider_left').toggle();
		$('navBarSlider_right').toggle();
	}
}

var menuStatus = new Array();
function swapMenu(menuID) {
	if(menuStatus[menuID] == "" || menuStatus[menuID] == undefined) {
		menuStatus[menuID] = "open";
	}
	
	if(document.getElementById(menuID+'Menu').style.display == "block") {
		document.getElementById(menuID+'Menu').style.display = "none";
		menuStatus[menuID] = "close";
		document.getElementById(menuID+'Header').className='naviCloseHeaderMover';
	} else {
		document.getElementById(menuID+'Menu').style.display = "block";
		menuStatus[menuID] = "open";
		document.getElementById(menuID+'Header').className='naviHeaderMover';
	}
	
}

function menuHover(menuID, direct) {
	if(menuStatus[menuID] == "" || menuStatus[menuID] == undefined) {
		menuStatus[menuID] = "open";
	}
	
	if(direct == "in") {
		if(menuStatus[menuID] == "open") {
			document.getElementById(menuID+'Header').className='naviHeaderMover';
		}else{
			document.getElementById(menuID+'Header').className='naviCloseHeaderMover';
		}
	}else{
		if(menuStatus[menuID] == "open") {
			document.getElementById(menuID+'Header').className='naviHeader';
		}else{
			document.getElementById(menuID+'Header').className='naviCloseHeader';
		}
	}
}

function setStatus(menuID, status) {
	menuStatus[menuID] = status;
}


  /////////////////////////
 // Graybox Stuff Start //
/////////////////////////
function showGrayBox() {
	$('gray_box_content').innerHTML = '<img src="images/loading.gif" />';
	center('gray_box');
	$('gray_overlay').show(); 
	hideSelect();
}
function hideGrayBox2(){
    $('gray_box').hide();
    $('gray_overlay').hide();
	$('gray_overlay').style.width = '1px';
	$('gray_overlay').style.height = '1px';
	showSelect();
}
function hideGrayBox(){
    if(activeflash != false) {
		addEdit('flashdarstellung.php?id='+activeflash,'Flashdarstellung');
		activeflash = false;
	} else {
		$('gray_box').hide();
		$('gray_overlay').hide();
		$('gray_overlay').style.width = '1px';
		$('gray_overlay').style.height = '1px';
		showSelect();
		/*
		if(hideGrayBox.arguments.length > 0 && !ie) {
			includeModuleHidden(lastmodule,'../');
		} else {
			includeModuleHidden(lastmodule);
		}*/
	}
}

function center(element){
    try{
        element = $(element);
    }catch(e){
        return;
    }
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
		
	if(ie) breite = arrayPageSize[0]+"px";
	else breite = "100%";
	
	$('gray_overlay').style.width = breite;
	$('gray_overlay').style.height = (arrayPageSize[1])+"px";
	
	//alert(window.document.body.offsetHeight + " - " + document.body.clientHeight + " - " + document.documentElement.clientHeight + " - " + window.innerHeight + " - " + document.documentElement.scrollTop);
    
	element.style.position = 'absolute';
    element.style.zIndex   = 99;

    var elementDimensions = Element.getDimensions(element);

	//alert(elementDimensions.width + " " + element +" " + elementDimensions.height);
	/*
	element.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - elementDimensions.height) / 2) + 'px');
	element.style.left = (((arrayPageSize[0] - 20 - elementDimensions.width) / 2) + 'px');

    
	
	//alert(arrayPageSize[0] + " - " + arrayPageSize[1] + " - " + arrayPageSize[2] + " - " + arrayPageSize[3]);
	//alert(arrayPageScroll[0] + " - " + arrayPageScroll[1]);
	*/
	element.style.display  = 'block';
}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}


function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
/*
\\\\\\\\\\\\\\\\\\\\\\\\
 \\ Graybox Stuff ENDE \\
  \\\\\\\\\\\\\\\\\\\\\\\\
*/

function deleteGalerieBild(id,img) {
	if(window.confirm("Soll das Bild wirklich entfernt werden?")) {
		loc = 'galerie.php?action=delete&id='+id+"&img="+img;
		setTimeout("location.href=loc;", 10);
	}
}

function deleteFlashBild(id,img) {
	if(window.confirm("Soll das Bild wirklich entfernt werden?")) {
		loc = 'flashdarstellung.php?action=delete&id='+id+"&img="+img;
		setTimeout("location.href=loc;", 10);
	}
}

function deleteDownloads(id,aid) {
	if(window.confirm("Soll der Download wirklich entfernt werden?")) {
		loc = 'downloads.php?action=delete&id='+id+"&aid="+aid;
		setTimeout("location.href=loc;", 10);
	}
}

function hideSelect() {
	selects = parent.document.getElementsByTagName( 'select' );
   	for ( i = 0; i != selects.length; i++ )
	{
		selects[i].style.visibility = 'hidden';
    }
}

function showSelect() {
	selects = parent.document.getElementsByTagName( 'select' );
    for ( i = 0; i != selects.length; i++ )
	{
		selects[i].style.visibility = 'visible';
	}
}

function addEdit(file,title) {
	showGrayBox();
	new Ajax.Request('iframe.php?'+file,
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
		   	$('gray_box_headline').innerHTML = title;
			$('gray_box_content').update(t.responseText);
		  // 	center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
	
	//alert($('gray_box').style.left);
	window.setTimeout("gbPosX()",50);
	

	//alert($('offsetTable'));
}
function gbPosX(){
	if(ie) var iw=document.body.clientWidth;
	else var iw=window.innerWidth;
	var tw=1000; //$('offsetTable').width;
	
//	$('statuspos1').innerHTML="L:"+$('gray_box').style.left+"<br>T:"+$('gray_box').style.top;
	$('gray_box').style.position="absolute";
	$('gray_box').style.left=(iw-tw)/2+"px";
	$('gray_box').style.top="90px";
	//$('statuspos1').innerHTML=$('statuspos1').innerHTML + "<br><br>"+"L:"+$('gray_box').style.left+"<br>T:"+$('gray_box').style.top;
}
function tblPosXload(){
	$('testlink').onclick=tblPosX;	
}
//window.onload=tblPosXload;

function editMessestand(halle,title) {
	showGrayBox();
	new Ajax.Request('module_gb/messestand.php?id='+halle,
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
		   	$('gray_box_headline').innerHTML = title;
			$('gray_box_content').update(t.responseText);
		   	center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

function randomPassword(res) {
	new Ajax.Request('../ajax/randompassword.php',
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
			$(res).value = t.responseText;
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

function loadingAni(e){
	if(!e) e = window.event;
	
	x = e.clientX+document.documentElement.scrollLeft;
    y = e.clientY+document.documentElement.scrollTop;
	
	if($('loading_ani')) {
		$('loading_ani').style.left = (x+12)+'px';
		$('loading_ani').style.top = (y+10)+'px';
	}
	
	if($('hover')) {
		$('hover').style.left=(x+10)+'px';
		$('hover').style.top=(y+10)+'px';
	}
}

document.onmousemove=loadingAni;

function zoomImg(img,tag){
	showGrayBox();
	$('gray_box_content').innerHTML="<img src='"+img+"' "+unescape(tag)+">";
	center('gray_box');	
}

var interval;
var inc_interval = 1;
var int_counter = 0;

function startIncrease(feld) {
	clearInterval(interval);
	increase(feld);
	interval = setInterval("increase('"+feld+"')", 200);
}

function startDecrease(feld) {
	clearInterval(interval);
	decrease(feld);
	interval = setInterval("decrease('"+feld+"')", 200);
}

function stopInterv() {
	clearInterval(interval);
	int_counter = 0;
}

function increase(feld) {
	int_counter++;
	
	if(int_counter == 50) {
		clearInterval(interval);
		interval = setInterval("increase('"+feld+"')", 25);
	}	
	if(int_counter == 30) {
		clearInterval(interval);
		interval = setInterval("increase('"+feld+"')", 50);
	}
	if(int_counter == 20) {
		clearInterval(interval);
		interval = setInterval("increase('"+feld+"')", 100);
	}
	if(int_counter == 10) {
		clearInterval(interval);
		interval = setInterval("increase('"+feld+"')", 150);
	}
	
	val = $(feld).value;	
	val = val * 10;	
	val = val + inc_interval;	
	val = val / 10;	
	
	$(feld).value = val;
}

function decrease(feld) {
	int_counter++;
	
	if(int_counter == 50) {
		clearInterval(interval);
		interval = setInterval("decrease('"+feld+"')", 25);
	}	
	if(int_counter == 30) {
		clearInterval(interval);
		interval = setInterval("decrease('"+feld+"')", 50);
	}
	if(int_counter == 20) {
		clearInterval(interval);
		interval = setInterval("decrease('"+feld+"')", 100);
	}
	if(int_counter == 10) {
		clearInterval(interval);
		interval = setInterval("decrease('"+feld+"')", 150);
	}
	
	val = $(feld).value;
	val = val * 10;
	val = val - inc_interval;
	val = val / 10
	
	if(val >= 0.0) $(feld).value = val;
}

function typAuswahl(id,title) {
	showGrayBox();
	new Ajax.Request('module_gb/typauswahl.php?id='+id,
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
		   	$('gray_box_headline').innerHTML = title;
			$('gray_box_content').update(t.responseText);
		   	center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

	
	function popup(hovertxt){
		//alert(unescape(hovertxt));
		
		if(hovertxt != '') {
				var content="<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>"+
				"<tr><td align=left class='popup'>" + hovertxt + "</td></tr>"+
				"</table>";
				document.getElementById("hover").innerHTML=content;
				$('hover').show();
			}
	}
	
	function popupImg(hovertxt){
		//alert(hovertxt);
		
		if(hovertxt != '') {
				var content="<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>"+
				"<tr><td align=left class='popup'>"+
				"<img src='" + hovertxt + "' />"+
				"</td></tr>"+
				"</table>";
				document.getElementById("hover").innerHTML=content;
				$('hover').show();
			}
	}
	
	function kill(){
		$('hover').hide();			
	}
	
function activeFlashdarstellung(id,gid,titel) {
	activeflash = id;
	
	if(ie) url = 'iframe.php?galerie.php?id='+gid;
	else url = '../iframe.php?galerie.php?id='+gid;
	
	new Ajax.Request(url,
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
		   	$('gray_box_headline').innerHTML = titel;
			$('gray_box_content').update(t.responseText);
		   	//center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}