/*
Contentpapst wurde von der sandoba.de medien agentur (www.sandoba.de) aus Berlin entworfen und unterliegt dem Urheberrecht. Jedwede Änderung des Codes außerhalb der Lizenzrechte ist nicht erlaubt. Anfragen bitte an "contact@sandoba.de".

Website: www.sandoba.de
© sandoba.de medien agentur, 2002-2006
*/

function open_element(number) {
	post_number = "post"+number;
	get_number = "get"+number;
	post = document.getElementById(post_number).style;
	get = document.getElementById(get_number).style;

	if(get.display == "") {
		get.display = "none";
	} else {
		get.display = "";
	}
}

function clean_table(theLink,sql) {

	if (clean_text == '' || typeof(window.opera) != 'undefined') {
		return true;
	}

	var confirmed = confirm(clean_text + '\nSQL-Befehl: ' + sql);
	if (confirmed) {
		theLink.href += '&action=1';
	}

	return confirmed;

}

function drop_table(theLink,sql) {

	if (drop_text == '' || typeof(window.opera) != 'undefined') {
		return true;
	}

	var confirmed = confirm(drop_text + '\nSQL-Befehl: ' + sql);
	if (confirmed) {
		theLink.href += '&action=1';
	}

	return confirmed;

}

function message_check(theLink,text) {

	if (text == '' || typeof(window.opera) != 'undefined') {
		return true;
	}

	var confirmed = confirm(text);
	if (confirmed) {
		theLink.href += '&action=1';
	}

	return confirmed;

}

function select_tables(form,select,proove) {

	var selected = document.forms[form].elements[select];
	var selectCount = selected.length;

	for (var i = 0; i < selectCount; i++) {
		selected.options[i].selected = proove;
	}

	return true;

}

function change_bgcolor(sElementId, sNewColor, sPointer) {
	eval("document.getElementById('"+sElementId+"').style.backgroundColor='"+sNewColor+"';");
	if (sPointer=='') {
		eval("document.getElementById('"+sElementId+"').style.cursor='default';");
	} else {
		if (navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.substring(22,23)<="5") {
			eval("document.getElementById('"+sElementId+"').style.cursor='default';");
		} else {
			eval("document.getElementById('"+sElementId+"').style.cursor='"+sPointer+"';");
		}
	}
}

function admin_help_window() {

	var url = opener.window.location.href;

	if (url.match(/(admin.php\?file=help)/g)) {
		opener.window.history.back();
		window.focus();
	} else {
		opener.window.location.href = 'admin.php?file=help';
	}

}

function doWindowOpen(width, height, url, name) {
	var left = (screen.availWidth/2) - width/2;
	var top = (screen.availHeight/2) - height/2;
	
	var openWindow = window.open(url, name, 'menubar=1, scrollbars=1, toolbar=0, statusbar=1, width='+width+', height='+height+', left='+left+', top='+top);
}

function article_unlimited_from() {
	document.cform.date_start_day.options[0].selected=true;
	document.cform.date_start_month.options[0].selected=true;
	document.cform.date_start_year.options[0].selected=true;
	document.cform.date_start_hour.options[0].selected=true;
	document.cform.date_start_minute.options[0].selected=true;
}

function article_unlimited_to() {
	document.cform.date_stop_day.options[0].selected=true;
	document.cform.date_stop_month.options[0].selected=true;
	document.cform.date_stop_year.options[0].selected=true;
	document.cform.date_stop_hour.options[0].selected=true;
	document.cform.date_stop_minute.options[0].selected=true;
}

function module_unlimited_from(_sForm) {
	_sForm.date_start_day.options[0].selected=true;
	_sForm.date_start_month.options[0].selected=true;
	_sForm.date_start_year.options[0].selected=true;
	_sForm.date_start_hour.options[0].selected=true;
	_sForm.date_start_minute.options[0].selected=true;
}

function module_unlimited_to(_sForm) {
	_sForm.date_stop_day.options[0].selected=true;
	_sForm.date_stop_month.options[0].selected=true;
	_sForm.date_stop_year.options[0].selected=true;
	_sForm.date_stop_hour.options[0].selected=true;
	_sForm.date_stop_minute.options[0].selected=true;
}

var active_timer = null;
var active_navigation = null;

function position_left(obj) {
 if (obj.offsetParent == null) {
  return obj.offsetLeft;
 } else {
  return obj.offsetLeft + position_left(obj.offsetParent);
 }
}

function position_top(obj) {
 if (obj.offsetParent == null) {
  return obj.offsetTop;
 } else {
  return obj.offsetTop + position_top(obj.offsetParent);
 }
}

function show_navigation(nav, menu) {
 hide_navigation_total();
 active_navigation = menu;
 menu.style.position = 'absolute' ;
 menu.style.top = String( position_top(nav) + 24 ) + "px" ;
 menu.style.left = String( position_left(nav) + 0 ) + "px" ;
 menu.style.visibility = 'visible';
}

function hide_navigation(nav) {
 active_navigation = nav;
 active_timer = window.setTimeout("hide_navigation_total()", 10);
}

function hide_navigation_total() {
 if (active_navigation != null) {
  active_navigation.style.visibility = "hidden";
 }
}

function keep_navigation(menu) {
 window.clearTimeout(active_timer);
 menu.style.visibility = "visible";
}

/*
function show_navigation(nav, menu) {
 hide_navigation_total();
 active_navigation = menu;
 menu.style.position = 'absolute' ;
 menu.style.top = String( position_top(nav) + 24 ) + "px" ;
 menu.style.left = String( position_left(nav) + 0 ) + "px" ;
 menu.style.visibility = 'visible';
}

function hide_navigation(nav) {
 active_navigation = nav;
 active_timer = window.setTimeout("hide_navigation_total()", 500);
}

function hide_navigation_total() {
 if (active_navigation != null) {
  active_navigation.style.visibility = "hidden";
 }
}

function keep_navigation(menu) {
 window.clearTimeout(active_timer);
 menu.style.visibility = "visible";
}
*/

var xhttp ;
    
function createXMLHttpRequest() { 
	if ( window.ActiveXObject ) {  
  	try {  
     // IE 6 and higher 
     xhttp = new ActiveXObject("MSXML2.XMLHTTP") ; 
    } 
    catch (e) { 
  		try { 
     		// IE 5 
      	xhttp = new ActiveXObject("Microsoft.XMLHTTP") ; 
    	} 
    	catch (e) { 
        xhttp = false ; 
      } 
    } 
  } 
  else if (window.XMLHttpRequest) { 
		try { 
    	// Mozilla, Opera, Safari ... 
      xhttp = new XMLHttpRequest() ; 
    } 
    catch (e) { 
    	xhttp = false ; 
		} 
	} 
}

function xhttpRequest_callback() {
	if ( xhttp.readyState == 4 ) {
		if ( xhttp.status != 200 ) {
			alert( "Fehler " + xhttp.status + ": " + xhttp.statusText ) ;
		}
		else {
			var sResponseText = xhttp.responseText ;
			document.getElementById('AJAX').innerHTML = sResponseText ;
		}
	}
}		

function setContent( _iId, _sModule ) {
	document.getElementById('AJAX_hidden').innerHTML = document.getElementById('AJAX').innerHTML ;
  document.getElementById('AJAX').innerHTML = 'Die Daten werden geladen...<br /><br /><a class="maps" href="#" onClick="document.getElementById(\'AJAX\').style.display = \'none\' ; return false">Fenster schlie&szlig;en</a>' ;
  document.getElementById('AJAX').style.display = 'inline' ;
  createXMLHttpRequest() ;
  xhttp.open( "GET", "webservices.php?file=" + _sModule + "&type=details&template=modules/" + _sModule + "/templates/details_main.html&ct=text/html&number=" + _iId, true ) ;
  xhttp.onreadystatechange = xhttpRequest_callback ;
  xhttp.send(null) ;
}

function getBack() {
	document.getElementById('AJAX').innerHTML = document.getElementById('AJAX_hidden').innerHTML ;
  document.getElementById('AJAX').style.display = 'inline' ;	
}


function startFlash() {
	document.getElementById('play_flash').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="526" height="290" id="interview" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="interview.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="interview.swf" quality="high" bgcolor="#ffffff" width="526" height="290" name="interview" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'
}