function onChangeLang(lang_id) {
	if(parent.frames.head && parent.frames.content) {
		document.location.href='?action=AesChangeLang&ReloadContent=1&frames=head&lang_id='+lang_id;
		//parent.frames.content.document.location.href='?action=AesChangeLang&frames=content&lang_id='+lang_id;
		//parent.frames.content.document.location.reload();
	}
	else{
		document.location.href='?action=AesChangeLang&lang_id='+lang_id;		
	}
}
function onChangeStyle(style_a,style_b,element) {
	if(element) {
		if(current_menu!=element.id) {
			if(element.className==style_a) {
				element.className=style_b;
			}
			else if (element.className==style_b) {
				element.className=style_a;
			}
		}
	}
}
var current_menu='';
var last_mover='';
function setCurrent(obj,field) {
	id=eval(field);
	if(id.length!=0 && (current_menu!=id || field=='current_menu')) {
		el=document.getElementById(id).className='aes_table_v_menu_td';
	}
	if(obj) {
		id=obj.id;
		if(field=='current_menu') {
			current_menu=id;
		}
		else {
			last_mover=id;
		}
	}
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

//Funktionen fuer Registrierung
function onChangeEmail(u_extern,member_secure) {	
	//alert(onCheckEmail()+'|'+u_extern+'|'+member_secure);
	if(onCheckEmail == false) {
		return false;
	}
	else {
		if((onCheckEmail() != -1) || (u_extern && member_secure)) {
			
			if(document.all) {
				if (u_extern == false) { 
				document.getElementById('abt_table').style.display='block';			
				}
				document.getElementById('pwd_table').style.display='block';
				document.getElementById('show_pwd_table').value=1;
			}
			else {
				if (u_extern == false) {
				document.getElementById('abt_table').style.display='';
				}
				document.getElementById('pwd_table').style.display='';
				document.getElementById('show_pwd_table').value=1;
			}
		
			//onChangeLocation();
		}
		else {			
			document.getElementById('abt_table').style.display='none';		
			document.getElementById('pwd_table').style.display='none';		
			//onChangeLocation();
		}
		return true;
	}
}
function onChangeCellStyle(id,style) {
	row=document.getElementById(id);
	for(i=0;i < row.cells.length;i++) {
		row.cells[i].className=style;
	}
}
var isIE=false;
function getIsIE() {
	if(navigator.userAgent.indexOf("MSIE")>=0) {
		isIE=true;
	}
}
getIsIE();
function resizeContent_a(element,offset) {
	isIE = true;
	//kein resize auf TBODY, da IE da nur Muell produziert
	if(isIE==false || document.getElementById(element).nodeName!='TBODY') {
		if(isIE) {
			if (document.documentElement&&document.documentElement.clientHeight) {
					maxheight=document.documentElement.clientHeight;
				} 
			else {
				if (document.body&&document.body.clientHeight) {
					maxheight=document.body.clientHeight;
				}
				else {
					maxheight=window.document.body.offsetHeight
				}
			}
			maxheight=maxheight-offset;
		}
		else {
			maxheight=window.innerHeight-offset;
		}
		//alert(maxheight);
		if(maxheight>0) {
			document.getElementById(element).style.height=maxheight+'px';
		}
	}
}

function resizeContent(element,offsetHeight,offsetWidth) {
	isIE = true;
	if(isIE) {	
		if (document.documentElement&&document.documentElement.clientHeight) {
				maxheight=document.documentElement.clientHeight;
				maxwidth=document.documentElement.clientWidth;
			} 
		else {
			if (document.body&&document.body.clientHeight) {
				maxheight=document.body.clientHeight;
				maxwidth=document.body.clientWidth;
			}
			else {
				maxheight=window.document.body.offsetHeight;
				maxwidth=window.document.body.offsetWidth;
			}
		}
		maxheight=maxheight-offsetHeight;
		maxwidth=maxwidth-offsetWidth;
	}
	else {
		maxheight=window.innerHeight-offsetHeight;
		maxwidth=window.innerWidth-offsetWidth;
	}
	if(maxheight>0) {
		document.getElementById(element).style.height=maxheight+'px';
	}
	if(maxwidth>0) {
		document.getElementById(element).style.width=maxwidth+'px';
	}
	//alert(maxwidth+'='+document.getElementById(element).style.width);
}

function openTCContentSort(root,obj_type,obj_id) {
	url=root+'/admin/?action=AesTCContentSortForm&obj_type='+obj_type+'&obj_id='+obj_id;
	win=createEditWindow(url);
}

function OnOpenCustomPopupWindow(void1, t, x, y, w, h, u, void2, bP, bT, bC, bS){
	var wndCustomPopupWindow = window.open('', 'wndCustomPopupWindow', 'left='+x+',top='+y+',pos-x='+x+',pos-y='+y+',width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=1,menubar=1');
	wndCustomPopupWindow.document.write('<html><title>'+t+'</title><body>Please wait...</body></html>');
	wndCustomPopupWindow.location.href=u+'&bPrint='+bP+'&bTop='+bT+'&bClose='+bC+'&bScroll='+bS+'&width='+w+'&height='+h+'&title='+escape(t);
	wndCustomPopupWindow.focus();
}

function aesAdoptElement(id) {
	top.frmList.addId(id);
}
function goSummary(target,event_id,alternate_control,root) {
	tFrame=eval(target);
	if(tFrame) {
		url=root+'/admin/?action=AkadSaveEventDoc&doc_id='+tFrame.document.edit_form.doc_id.value+'&event_id='+event_id+'&alternate_control='+alternate_control;
		tFrame.location.href=url;
	}
}
function akadSelectDocument(obj_type,obj_id,form_element,sel_type,sel_method,sel_id,root) {
	sel_id = document.forms['edit_form'].elements[form_element].value;
	url=root+'/admin/?action=AkadSelectPopup&obj_type='+obj_type+'&obj_id='+obj_id+'&form_element='+form_element+'&sel_type='+sel_type+'&sel_method='+sel_method+'&sel_id='+sel_id;
	selectwin=createSelectWindow(url);
}
function openLanguageSelect(obj_type,obj_id,form_element,sel_type,sel_method,sel_id,root) {
	url=root+'/admin/?action=AkadLangSelectPopup&obj_type='+obj_type+'&obj_id='+obj_id+'&form_element='+form_element+'&sel_type='+sel_type+'&sel_method='+sel_method+'&sel_id='+sel_id;
	selectwin=createSelectWindow(url);
}
function createSelectWindow(url) {
	selectwin=window.open(url,'tecracerselectpopup','width=1000,height=620,resizable=yes');
	x=(screen.width-1000)/2;
	y=(screen.height-620)/2
	if(x>0 && y>0) {
		win.moveTo(Math.round(x),Math.round(y));
	}
	selectwin.focus();
	return selectwin;
}


