/*
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 openWndPicture( _sFile ) {
	
	var _oImage = new Image() ;
	var _sParameter = '%26width=500' ;
	
	_oImage.src = _sFile ;
	
	var _iNewHeight = Math.floor( 500 / ( _oImage.width / _oImage.height ) ) ;
	var _iNewWidth  = Math.floor( 500 / ( _oImage.height / _oImage.width ) ) ;

	var left = ( screen.availWidth / 2 ) - ( 500 / 2 ) ;
	var top  = ( screen.availHeight / 2 ) - ( _iNewHeight / 2 ) ;


	_wndPicture = window.open( 'index.php?file=fast_gallery&show=img.resize.php%3Fpath=' + _sFile + _sParameter + '&clean=yes', 'openPicture', 'scrollbars=0, toolbar=0, statusbar=0, status=0, resizable=no, location=no, width=500, height=' + _iNewHeight + ', left=' + left + ', top=' + top ) ;
	_wndPicture.focus() ;
	
}

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;
}

function changePicture( _sFile, _sCaption, _Id ) {

	if ( document.getElementById( 'picture' + _Id ) ) {
		var _oImage = new Image() ;
		var _sParameter = '' ;
		
//		_oImage.src = _sFile ;
//
//		var _iNewHeight = 180 / ( _oImage.width / _oImage.height ) ;
//		var _iNewWidth  = 120 / ( _oImage.height / _oImage.width ) ;
//		 	
//		if ( _oImage.width > 180 || _oImage.height > 120 ) {
//			if ( _oImage.width > _oImage.height && _iNewHeight < 120 ) {
				_sParameter = '&width=180' ;
//			}
//			else {
//				_sParameter = '&height=120' ;
//			}  
//		}
	
		document.getElementById( 'picture' + _Id ).innerHTML = '<a href="javascript:openWndPicture(\'' + _sFile + '\') ;"><img alt="" border="0" name="image' + _Id + '" src="img.resize.php?path=' + _sFile + _sParameter + '" title="" /></a>' ;
		document.getElementById( 'pictureZoom' + _Id ).href = 'javascript:openWndPicture(\'' + _sFile + '\') ;' ;
	}
	
	if ( document.getElementById( 'caption' + _Id ) ) {
		document.getElementById( 'caption' + _Id ).innerHTML = _sCaption.length == 0 ? '&nbsp;<br/>' : _sCaption ;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* webcam - funktionen */


  self.name = "mxHome10__1__18__120";
	var hostname;
	var url_regexpr= /(\w+):\/\/([^\/]+)\/(\S*)/;
	var result = document.URL.match(url_regexpr);
	if (result != null)
		hostname = result[2];
	else
		hostname = "";
	document.write('<TITLE>' + hostname + '  <\/TITLE>');


	var filesystem__version="M10-V2.0.3.9";
	var homepage__language="de";
	var windowname_home="mxHome10__1__18__120";
	var windowname_ext ="mxExtern10__1__18__120";
	var windowname_help="mxHelp10__1__18__120";
	var windowname_info="mxInfo10__1__18__120";
	function openExtNoDeko(path,winname) {
		if ( path.search(/^!/) >= 0 ) {
			path=path.replace(/^!/,"");
			path=path+"?cachedummy="+Math.floor(Math.random()*1000000);
		}
		return window.open(path,winname,"scrollbars=yes,resizable=yes,width=722");
	}

	function goUserlevel()
	{
		if (self.name == windowname_ext)
		{
			if (window.opener==null || window.opener.closed)
			// Kein Opener oder bereits geschlossen
		  	window.open("http://195.98.209.50/control/userimage.html",windowname_home);
			else
				window.opener.focus();
	   	self.window.close();
			return;
		}
		location.href="http://195.98.209.50/control/userimage.html";
	}
	function getTextFensterX(breite) {
		var wString=",width="+breite;
		if (window.screenLeft)
			wString+=",left="+parseInt(screenLeft+document.body.offsetWidth/2-breite/2);
		else if (window.screenX)
			wString+=",screenX="+parseInt(screenX+outerWidth/2-breite/2);
		return wString;
	}
	function getTextFensterY(hoehe) {
		var wString=",height="+hoehe;
		if (window.screenTop)
			wString+=",top="+parseInt(screenTop+document.body.offsetHeight/2-hoehe/2);
		else if (window.screenY)
			wString+=",screenY="+parseInt(screenY+innerHeight/2-hoehe/2);
		return wString;
	}

	function open_camerainfo(prefix,evt) {
		var text="";
		if ( evt
				&& ( evt.shiftKey || evt.altKey || evt.CtrlKey ) ) {
			text="&text";
		}
		if (typeof prefix == "undefined")
			var prefix="";
		var wdh=window.open(prefix+"http://195.98.209.50/control/camerainfo?rand="+Math.random()+text, windowname_info,
			"width=370,height=320,scrollbars=yes,resizable=yes");
		if (wdh) wdh.focus();
	}
function debugmsg(k) {};

/* ENDE webcam - funktionen */
