/*
*/

var rand	= Math.random();


ns_flag = ( document.layers )? true : false;
ie4_flag = ( document.all )? true : false;
ie5_flag = false;
ie_flag = false;

/*
 Falls die obige prüfung nicht hinhaut, kann auch diese genommen werden:
 
 var isMinNS4=(navigator.appName.indexOf("Netscape")>=0&&parseFloat(navigator.appVersion)>=4)?1:0;
 var isMinIE4=(document.all)?1:0;
 var isMinIE5=(isMinIE4&&navigator.appVersion.indexOf("5.")>=0)?1:0;
*/

if( ie4_flag ) ie5_flag = navigator.userAgent.indexOf( 'MSIE 5' ) > 0;

if ( navigator.userAgent.indexOf( 'MSIE' ) > 0 )
	{
		ie_flag = 1;
	}

function ChangeNavMenue(type, adm_func_id, obj_type_id) {
  	try {
		parent.frmSystem.location.href='backend_system.cfm?nav_adm_func_id=' + adm_func_id + '&nav_obj_type_id=' + obj_type_id + '&nav_type=' + type;
	}
	catch(e) {
		parent.parent.frmSystem.location.href='backend_system.cfm?nav_adm_func_id=' + adm_func_id + '&nav_obj_type_id=' + obj_type_id + '&nav_type=' + type;
	}
}




function openSitemap(){ 
	window.open('sitemap.cfm', 'tmfrmSitemap', 'width=300,height=450,resizable=yes,scrollbars=yes');
}

function onClickSitemap(newLocation){
	window.opener.location=newLocation;
}
	
	




	
function object_edit_switch_wysing(field_1, field_2) {
	
	field_1 = eval(field_1);
	field_2 = eval(field_2);
	
	v1 = field_1.style.getAttribute('display', 'false');

	if (v1=='none'){
		field_1.style.setAttribute('display', 'inline', 'false');
		field_2.style.setAttribute('display', 'none', 'false');
	} else {
		field_1.style.setAttribute('display', 'none', 'false');
		field_2.style.setAttribute('display', 'inline', 'false');
	}
}
	

function object_edit_switch_lang(field, id){
	
	object_edit_delete_lang(field);

	field_i = eval(field + '_' + id + '_div');
	field_i.style.setAttribute('display','inline','false');
}


function object_edit_delete_lang(field){
	// die ID's der Sprachen sind fest: 1,2,3,4
	

  	try {
		field_i = eval(field + '_1_div');
		field_i.style.setAttribute('display', 'none', 'false');
	}
	catch(e) {
	}

  	try {
		field_i = eval(field + '_2_div');
		field_i.style.setAttribute('display', 'none', 'false');
	}
	catch(e) {
	}

  	try {
		field_i = eval(field + '_3_div');
		field_i.style.setAttribute('display', 'none', 'false');
	}
	catch(e) {
	}

  	try {
		field_i = eval(field + '_4_div');
		field_i.style.setAttribute('display', 'none', 'false');
	}
	catch(e) {
	}
	

}

function object_edit_open_wysing (adm_func_id, form_name, field_name, initialValue){
	
	var Win_Width = 800;
	var Win_Height = 600;
	
	var Screen_Width = screen.availWidth;
	var Screen_Height = screen.availHeight;
	
	if(Win_Width > Screen_Width){
		Win_Width = (Screen_Width - 15);
		var new_x = 1;
	}
	else{
		var new_x = (Screen_Width / 2) - (Win_Width / 2);
	}
	
	if(Win_Height > Screen_Height){
		Win_Height = (Screen_Height - 50);
		var new_y = 1;
	}
	else{
		var new_y = (Screen_Height / 2) - (Win_Height / 2);
	}

	

	//pagePath = ROOT_PATH + '/' + ADMIN_DIR + '/DHTML_window.cfm?field_name=' + field_name + '&form_name=' + form_name + '&adm_func_id=' + adm_func_id + '&get_init_val_from_field=1&initialValue=' + escape(initialValue);
	pagePath = ROOT_PATH + '/' + ADMIN_DIR + '/DHTML_window.cfm?field_name=' + field_name + '&form_name=' + form_name + '&adm_func_id=' + adm_func_id + '&get_init_val_from_field=1&initialValue=';

	//return showModalDialog(pagePath, window, "dialogWidth:1000px;dialogHeight:800px;help:no;scroll:no;status:no");
	//var wnddoc = window.open( pagePath, 'tm_dhtml_win' ,'width=' + Win_Width + ',height=' + Win_Height + ',hotkeys=yes,locationbar=no,menubar=no,resizable=yes,screenX=' + new_x + ',screenY=' + new_y + ',status=yes,scrollbars=no');
	var wnddoc = window.open( pagePath, 'tm_dhtml_win' ,'width=' + Win_Width + ',height=' + Win_Height + ',hotkeys=yes,locationbar=no,menubar=no,resizable=yes,status=yes,scrollbars=no');
	
	wnddoc.moveTo(new_x,new_y)

}


	

	
	
function getFileTxt(form_name, form_name_file, form_name_txt) {
	frm = eval( 'document.' + form_name + '.' + form_name_file + '.value' );
	frm_txt = eval( 'document.' + form_name + '.' + form_name_txt );
	frm_txt.value = frm;
}

function onClickAccess( form_name, accid, objid, mi, vmax, objmid ) {
	frm = eval( 'document.' + form_name );
	fld = eval( 'document.' + form_name + '.data_' + accid );
	chg = eval( 'document.' + form_name + '.changed_' + accid );
	if( (!fld)  ||  (!chg) )  return;
	v = fld.value;
	if( v == '' ){
		v = 1;}
	else if( v < vmax ){
		v = parseInt(v) + 1;}
	else{
		v = 1;}
	fld.value = v;
	chg.value = 1;
	img = eval( 'document.' + form_name + '.img_' + accid );
	mand_img = eval( 'document.' + form_name + '.sign_' + v );
	img_text = eval( 'document.' + form_name + '.text_' + v );
	mand_text = eval( 'document.' + form_name + '.mand_text_' + objmid );
	obj_text = eval( 'document.' + form_name + '.obj_text_' + objid );
	if( (!mand_img)  ||  (!img)  ||  (!mand_text)  ||  (!obj_text)  ||  (!img_text) )  return;
	img.src = mand_img.value;
	img.alt = mand_text.value + "/" + obj_text.value + ": " + img_text.value;
	
}

function onClickCheckbox( form_name, chk, val, func ) { // Checkbox
	frm = eval( "document." + form_name );
	ctl = eval( "document." + form_name + '.' + chk );
	if( val  &&  ctl.length ) {
		for( i=0; i<ctl.length; i++ ) {
			if( ctl[i].value == val )
				 ctl[i].checked = ! ctl[i].checked;
		}
	} else
		{
			ctl.checked = ! ctl.checked;
		}
	if( func )
		{
			func( form_name, chk, val );
		}
	
}



function onClickRadio( form_name, chk, val ) {
	ctl = eval( "document." + form_name + '.' + chk );
	if( ctl ) {
		if( ctl.length ){
			for( i=0; i<ctl.length; i++ ) ctl[i].checked = ctl[i].value == val;}
		else{
			ctl.checked = ctl.value == val;}
	}
}






	
function onShowHide( div ) {
	if( document.all[div].style.display == 'none' ){
		document.all[div].style.setAttribute( 'display', 'inline', false );}
	else{
		document.all[div].style.setAttribute( 'display', 'none', false);}
}


function ShowHideStatus( div, form_name, field ) {
	frm = eval('document.' + form_name + "." + field);
	if( document.all[div].style.display == 'none' ){
		frm.value = "0";
	}
	else{
		frm.value = "1";
	}
}





function onEditObject(form_name, var_name, var_id, back_button) {
	frm = eval('document.' + form_name);
	frm.cmd.value = "edit";
	frm.obj_id.value = var_id;
	if ( back_button != null )	frm.close_mode.value = back_button;
	frm.submit();
}


function onSort( form_name, field_name, sort_id ) {
	frm = eval('document.' + form_name);
	frm.cmd.value = "sort";
	frm.obj_id.value = sort_id;
	frm.submit();
}



function onClickObject( form_name, field_name, new_id ) {
	cur_id = eval('document.' + form_name + '.' + field_name + '.value');
	if(eval('document.' + form_name + '.' + field_name + '_pic1')){ //fehler wenn nicht gefunden
  	   pic1 = eval('document.' + form_name + '.' + field_name + '_pic1.value'); // unsel
	}else{pic1 = '';}
	if(eval('document.' + form_name + '.' + field_name + '_pic2')){
	   pic2 = eval('document.' + form_name + '.' + field_name + '_pic2.value'); // unsel
	}else{pic2 = '';}
	if(eval('document.' + form_name + '.' + field_name + '_pic_path')){
	   pic_path = eval('document.' + form_name + '.' + field_name + '_pic_path.value'); // sel
	}else{pic_path='';}
	if( cur_id != '' ) { // Current: currentfolder <- folder
		img = eval('document.' + form_name + '.' + field_name + '_img_' + cur_id);
		if( img )  img.src = pic_path + pic1;
	}
	img = eval('document.' + form_name + '.' + field_name + '_img_' + new_id);
	if( img )  img.src = pic_path + pic2;
	eval('document.' + form_name + '.' + field_name).value = new_id;
}







	
function onClickPlusMinus( form_name, f_obj_type_id, f_obj_id, f_is_open, cmd) {
	fld = eval('document.' + form_name + '.' + 'f_obj_type_id');
	fld.value = f_obj_type_id;
	frm = eval('document.' + form_name);
	
	fld = eval('document.' + form_name + '.' + 'f_obj_id');
	fld.value = f_obj_id;
	frm = eval('document.' + form_name);
	
	fld = eval('document.' + form_name + '.' + 'f_is_open');
	fld.value = f_is_open;
	frm = eval('document.' + form_name);

	fld = eval('document.' + form_name + '.' + 'cmd');
	fld.value = cmd;
	frm = eval('document.' + form_name);

	fld = eval('document.' + form_name + '.' + 'cmd_tree');
	fld.value = 'PlusMinus';
	frm = eval('document.' + form_name);

	frm.submit();
}

	
	
function onClickTree( form_name, f_obj_type_id, f_obj_id) {

	fld = eval('document.' + form_name + '.' + 'f_obj_type_id');
	fld.value = f_obj_type_id;
	frm = eval('document.' + form_name);
	
	fld = eval('document.' + form_name + '.' + 'f_obj_id');
	fld.value = f_obj_id;
	frm = eval('document.' + form_name);
	

	frm.submit();
}
	

	
function tm_on_list_type_one(form_name, list_type){
	frm = eval( 'document.' + form_name );
	frm.tm_list_type_one.value = list_type;
	frm.submit();
}
	
		



function DisabledForm(form_name){
	if (document.forms[form_name]){
		var f = document.forms[form_name];
		var e = f.elements;
		for (i=0;i<e.length;i++){
			if (e[i].type=='button'||e[i].type=='submit'){
				fe = e[i];
				fe.disabled=true;
				fe.enabled=false;
				if (fe.style)fe.style.setAttribute('color','silver',false);
			}
		}
	}
}

	
function AskSaveData(form_name, cmd, fld){

	// Nachfragen, wenn Daten geaender wurden 
	try {
		fld_change = eval('document.' + form_name + '.tm_form_data_changed.value');
	
		if ( cmd != 'save' && fld_change == 1 && cmd != 'editcancel' && cmd != 'delete' && cmd != 'editnew' && cmd != 'save_sort'){
			if( confirm( 'Daten wurden geaendert. Wollen Sie die Aenderungen speichern?' ) ){
				onButtonClick(form_name,'save');
			}
		}
	}
	catch(e) {
	}
}
	
	
	
function onUnload(form_name){


	// Nachfragen, wenn Daten geaender wurden 
	try {
		fld_change = eval('document.' + form_name + '.tm_form_data_changed.value');
		cmd = eval('document.' + form_name + '.cmd.value');
		
		if ( cmd != 'save' && fld_change == 1){
			if( confirm( 'Daten wurden geaendert. Wollen Sie die Aenderungen speichern?' ) ){
				onButtonClick(form_name,'save');
			}
		}
	}
	catch(e) {
	}
}

	
	
function onButtonClick( form_name, cmd, fld ) {
	
	if(opener){
		//if ( cmd == "" || cmd == "close"){
		if ( cmd == ""){
			close();
			return true;
		}
	}
	
	// Nachfragen, wenn Daten geaender wurden 
	AskSaveData(form_name, cmd, fld);

	if ( ie_flag ){
		DisabledForm(form_name);
	}
	
	if( ! fld )  fld = 'cmd';
	fld = eval('document.' + form_name + '.' + fld);
	fld.value = cmd;
	
	frm = eval('document.' + form_name);
	frm.submit();
}

	


	
function onDataChange( form_name ) {
	try {
		fld = eval('document.' + form_name + '.tm_form_data_changed');
		fld.value = 1;
		frm = eval('document.' + form_name);
		document.all.tm_message.innerHTML = '<div class="message_data_changed">Daten geändert</div>';
	}
	catch(e) {
	}

}

	
	
function onObjectDelete( form_name, msg ) {
	if( confirm( msg ) ) {
		frm = eval( 'document.' + form_name );
		frm.cmd.value = "delete";
		frm.submit();
	}
}



function onLinkButtonClick( href ) {
	window.location.href = href + "&rand__id=" + rand;
}

	
	
function onLinkButtonClickNewWin( href, win_name, width, height ) {
	if( !win_name) var win_name = 'tmorgan_file';
	if( !width) var width = 700;
	if( !height) var height = 800;

  	var wnddoc = window.open( ROOT_PATH + '/' + ADMIN_DIR + '/empty.cfm', win_name ,'width=' + width + ',height=' + height + ',dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	resize_window(width, height, wnddoc);
	try {
		wnddoc.focus();
	}
	catch(e) {
		window.setTimeout("wnddoc.focus()", 300);
	}

}

function resize_window(Win_Width, Win_Height, win_name)
{
	// var Win_Width = 550;
	var Screen_Width = screen.availWidth;
	var Screen_Height = screen.availHeight;
	var new_x = (Screen_Width / 2) -(Win_Width / 2);
	var new_y = 60
	
	wnddoc = win_name;
	
	wnddoc.moveTo(new_x,new_y)
	wnddoc.resizeTo(Win_Width, Win_Height);
}	
	
	
	

function onHistoryRestore( form_name, vrid, msg ) {
	if( confirm( msg ) ) {
		eval('document.' + form_name + '.obj_version_restore_id').value = vrid;
		onButtonClick( form_name, 'restore' );
	}
}



function onHistoryDelete( form_name, vrid, msg ) {
	if( confirm( msg ) ) {
		eval('document.' + form_name + '.obj_version_del_id').value = vrid;
		onButtonClick( form_name, 'ver_del' );
	}
}


function FCKShowDialog(pagePath, args, width, height)
{
	return showModalDialog(pagePath, args, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}


function onOpenHref( href, trg ) {
  	var wndhr = window.open( ROOT_PATH + '/empty.cfm',trg,'dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,scrollbars=yes');
	wndhr.location.href = href;
   	if ( wndhr.opener == null ){
		wndhr.opener = window;}
	wndhr.focus();
}




function onOpenHrefwh( href, trg, t, l, w, h ) {
 		var wndhr = window.open( ROOT_PATH + '/empty.cfm',trg,'top='+t+',left='+l+',width='+w+',height='+h+',dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,scrollbars=yes');
	wndhr.location.href = href;
  		if ( wndhr.opener == null ){
		wndhr.opener = window;}
	wndhr.focus();
}






var recurs_resize = 0;
var resize_offset = 0;

function onResize( div_name, focus_name, resize_offset ) {
		
	if( ! resize_offset )  resize_offset = 0;
	if( recurs_resize != 0 ) return;
	recurs_resize = 1;
	if( document.all ) {
		area = document.all[div_name];
		if( area ) {
			if( area.style ) {
				body = document.body;
				h = body.clientHeight - area.offsetTop - area.style.border;
				h = h - 25 - resize_offset;
				if( h > 0 )
					area.style.height = h;
			}
		}
		if( focus_name ){
			if( focus_name != '' ) {
				fn = document.all[focus_name];
				if( fn )  fn.focus();
			}
		}
	}
	recurs_resize = 0;
	
	
	try {
		h_dhtml = (h - 60);
		document.all.DHTMLSafe1.style.setAttribute( 'height', h_dhtml, false );
	}
	catch(e) {
		return;
	}		
	
}










function onMoveDown( form_name, listname ) {
	ctl = eval( 'document.' + form_name + '.' + listname );
	if( ! ctl )  return;
	n = ctl.length;
	if( ctl.options[n-1].selected ){
		return;}
	for( i=n-2; i>=0; i-- ) {
		if( ctl.options[i].selected ) {
			tmp1 = new Option( ctl.options[i+1].text );
			tmp1.value = ctl.options[i+1].value;
			tmp = new Option( ctl.options[i].text );
			tmp.value = ctl.options[i].value;
			ctl.options[i] = tmp1;
			ctl.options[i+1] = tmp;
			ctl.options[i+1].selected = true;
		}
	}
}

function onMoveUp( form_name, listname ) {
	ctl = eval( 'document.' + form_name + '.' + listname );
	if( ! ctl )  return;
	if( ctl.options[0].selected ) return;
	for( i=1; i<ctl.length; i++ ) {
		if( ctl.options[i].selected ) {
			tmp1 = new Option( ctl.options[i-1].text );
			tmp1.value = ctl.options[i-1].value;
			tmp = new Option( ctl.options[i].text );
			tmp.value = ctl.options[i].value;
			ctl.options[i-1] = tmp;
			ctl.options[i-1].selected = true;
			ctl.options[i] = tmp1;
		}
	}
}



function onSaveSort( form_name, cmd, sctl, slist ) {
	ctl = eval( 'document.' + form_name + '.' + sctl );
	list = eval( 'document.' + form_name + '.' + slist );
	if( (!ctl)  ||  (!list) )  return;
	slist = '';
	for( i=0; i<ctl.length; i++ ) {
		if( slist != '' )  slist = slist + ',';
		slist = slist + ctl.options[i].value;
	}
	list.value = slist;
	onButtonClick( form_name, cmd );
}




function onAttachFile( mode, adm_func_id, win_name ) {
	var href = ROOT_PATH + '/' + ADMIN_DIR + '/DHTML_win_open.cfm?mode=' + mode+ "&adm_func_id=" + adm_func_id;
	if( !win_name){
		var win_name = 'tmorgan_file';
	}
		
  	var wnddoc = window.open( href, win_name ,'width=750,height=400,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}
	



//////////////	

function onAttach( obj_type_id, mode, obj_pair_name, adm_func_id, win_name, field_name ) {
	if( !form_name){
		var form_name = '';
	}

	if( !field_name){
		var field_name = '';
	}

	var href = ROOT_PATH + '/' + ADMIN_DIR + '/attach_win_open.cfm?obj_type_id=' + obj_type_id + '&mode=' + mode + '&obj_pair_name=' + obj_pair_name + '&adm_func_id=' + adm_func_id + '&field_name=' + field_name;
	if( !win_name){
		var win_name = 'tm_attach';
	}
		
  	var wnddoc = window.open( href, win_name ,'width=750,height=400,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}



function onAttachOne( obj_type_id, obj_id, mode, obj_type_prop_name, adm_func_id, win_name ) {
	if( !form_name){
		var form_name = '';
	}

	if( !field_name){
		var field_name = '';
	}

	var href = ROOT_PATH + '/' + ADMIN_DIR + '/attach_one_win_open.cfm?obj_type_id=' + obj_type_id + '&obj_id=' + obj_id + '&mode=' + mode + '&obj_type_prop_name=' + obj_type_prop_name + '&adm_func_id=' + adm_func_id ;
	if( !win_name){
		var win_name = 'tm_attach';
	}
		
  	var wnddoc = window.open( href, win_name ,'width=300,height=200,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}
	



function onAttachAbo( obj_type_id, adm_func_id, win_name, field_name ) {
	if( !form_name){
		var form_name = '';
	}

	if( !field_name){
		var field_name = '';
	}

	var href = ROOT_PATH + '/' + ADMIN_DIR + '/attach_win_open.cfm?obj_type_id=' + obj_type_id + '&mode=abo_obj&adm_func_id=' + adm_func_id + '&field_name=' + field_name;
	if( !win_name){
		var win_name = 'tm_attach_abo';
	}
		
  	var wnddoc = window.open( href, win_name ,'width=750,height=400,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}




function onCallbackSelectDocument (obj_uuid, title, obj_pair_name, mode, field_name ){
	if( !mode){
		var mode = '';
	}
	
	if( !field_name){
		var field_name = '';
	}

	// DHTML Image
	if( mode == 'dhtml_image'){

		eval(parent.parent).opener.setImage('reqdoc.cfm?uuid=' + obj_uuid, title);
		parent.parent.close();

		
	}

	// DHTML HYPERLINK - DOC
	else if (mode == 'dhtml_hyperlink_doc'){
		//insert the doc into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
	
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}
		
		DocWin.document.all.oHref.value = 'reqdoc.cfm?uuid=' + obj_uuid;
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}


	// DHTML HYPERLINK - IMAGE
	else if (mode == 'dhtml_hyperlink_img'){
		//insert an REQIMG JavaScript into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
	
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}
		
		DocWin.document.all.oHref.value = 'javaScript:ImageOpen(\'' + obj_uuid + '\')';
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}

	// DHTML HYPERLINK - ARTICLE
	else if (mode == 'dhtml_hyperlink_article'){
		//insert the doc into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
		
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}
			
		DocWin.document.all.oHref.value = '?uuid=' + obj_uuid;
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}

	// DHTML HYPERLINK - LINK
	else if (mode == 'dhtml_hyperlink_link'){
		//insert a Link into the hyperlink.cfm frame
		var host = '';

		DocWin = parent.parent.opener;
		
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}
		DocWin.document.all.oHref.value =  'reqlink.cfm?uuid=' + obj_uuid;
		DocWin.document.all.oName.value = title;
		//DocWin.document.all.oTarget.value = target;
		parent.parent.close();
		DocWin.focus();
	}

	// DHTML HYPERLINK - MENUE
	else if (mode == 'dhtml_hyperlink_menue'){
		//insert a menue into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
		
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}

		DocWin.document.all.oHref.value =  '?uuid=' + obj_uuid;
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}


	// DHTML HYPERLINK - PRODUCT
	else if (mode == 'dhtml_hyperlink_good'){
		//insert the doc into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
	
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}
		
		DocWin.document.all.oHref.value =  '?uuid=' + obj_uuid;
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}


	// DHTML HYPERLINK - SHOP-PRODUCT (autolink)
	else if (mode == 'dhtml_hyperlink_good_shop'){
		//insert the doc into the hyperlink.cfm frame
		var host = '';
		DocWin = parent.parent.opener;
	
		if( DocWin.document.all.href_is_abs){
			if( DocWin.document.all.href_is_abs.value == 0){
				var host = '';
			}
		}

		DocWin.document.all.oHref.value =  '||--TM_CU_INSERT_SHOP.CFM uuid="' + obj_uuid + '" TITLE="' + title + '"--||';
		DocWin.document.all.oName.value = title;
		parent.parent.close();
		DocWin.focus();
	}



	// DHTML INSERT HTML-TEMPLATE
	else if (mode == 'dhtml_ins_templ_html'){
		//insert an container into the dhtml control
		var href = ROOT_PATH + '/' + ADMIN_DIR + '/DHTML_onInsert.cfm?mode=' + mode + '&obj_uuid=' + obj_uuid;
		self.location.href = href;
	}


	// field_hyperlink_img 
	else if (mode == 'field_hyperlink_img'){
		//insert an Image into an IMAGE-Filed

		DocWin = parent.parent.opener;
		DocWinField =  eval( 'DocWin.document.all.' + field_name );

		DocWinField.value =  obj_uuid;
		
		parent.parent.close();
		DocWin.focus();
		
		DocWin.onChangeImageField(field_name);
		
	}
	


	else{
		if( parent ){
	
			if( parent.parent ){
				if( parent.parent.opener ){
					if( parent.parent.opener.CallbackSelectDocument ) {
						parent.parent.opener.CallbackSelectDocument(obj_uuid, title, obj_pair_name, mode, field_name);
						parent.parent.close();
					}}}}
	}
}

//////////////	



// Ändert ein Image. Bezieht sich auf ein Form-Field, welches die Image-UUID enhält
function onChangeImageField(field_name){

	img =  eval( 'document.all.' + field_name + '_img');
	uuid_field = eval( 'document.all.' + field_name );
	
	if (uuid_field.value == ''){
		imghref = 'http://' + ROOT_URL + ROOT_PATH + '/images/clear.gif';
	}
	else{
		imghref = 'http://' + ROOT_URL + ROOT_PATH + '/reqdoc.cfm?uuid=' + uuid_field.value;
	
	}

	frmhref = 'http://' + ROOT_URL + ROOT_PATH + '/' + ADMIN_DIR + '/image_info.cfm?uuid=' + uuid_field.value;

	var b = new Array();
	b[0] = new Image(); b[0].src = imghref;		
	img.src = b[0].src;

	// ändert Imageinfo
  	var frmWin = window.open( frmhref, field_name + '_frm' );
	frmWin.location.href = frmhref;

	
	
}

//////////////



	
	
function onPreview(obj_type_id, obj_id) {
	var href = ROOT_PATH + '/' + ADMIN_DIR + '/DHTML_onPreview.cfm?obj_type_id=' + obj_type_id + '&obj_id=' + obj_id;
  	var wnddoc = window.open( href,'tmorgan_preview' ,'width=800,height=600,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}


function onSaveDHTML(){
	try {
		tm_onSubmit();
	}
	catch(e) {
		return;
	}
}

	
function onPreviewText(parameter) {
	var href = ROOT_PATH + '/' + ADMIN_DIR + '/article_onPreview.cfm?' + parameter;
  	var wnddoc = window.open( href,'tmorgan_text_preview' ,'width=800,height=600,dependent=yes,hotkeys=yes,locationbar=yes,menubar=yes,resizable=yes,screenX=25,screenY=25,status=yes,scrollbars=yes');
	wnddoc.location.href = href;
	wnddoc.opener = window;
	wnddoc.focus();
}
	







oldID = '';
function ChangeColor(dieID){

	var OldColor = '';

	if ( oldID != dieID ){
		
		OldColor = eval('document.all.' + dieID + '.getAttribute("bgcolor","false")');
		
		eval('document.all.' + dieID + '.setAttribute("bgcolor",last_selected_color,"false")');
		if ( oldID != '' ){
			eval('document.all.' + oldID + '.setAttribute("bgcolor",OldColor,"false")');
		}

		oldID = dieID;
	}
	
}
	


function onCalendar(form_name, obj_type_name, date_time){

	var href = ROOT_PATH + '/' + ADMIN_DIR + '/calendar.cfm?form_name=' + form_name + '&obj_type_name=' + obj_type_name + '&date_time=' + date_time;
  	var CalWin = window.open( href, 'tm_calendar_win' ,'width=240,height=250,dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,screenX=25,screenY=25,status=no,scrollbars=no');
	CalWin.location.href = href;
	CalWin.opener = window;
	CalWin.focus();
}


	
function onViewVersionComment (query_string) {
	var href = ROOT_PATH + '/' + ADMIN_DIR + '/view_version_comment.cfm?' + query_string;
  	var VerWin = window.open( href, 'tm_version_win' ,'width=350,height=350,dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,screenX=25,screenY=25,status=no,scrollbars=yes');
	VerWin.location.href = href;
	VerWin.opener = window;
	VerWin.focus();
}
	
	
	

function onViewDependences (obj_type_id, obj_id) {
	var href = ROOT_PATH + '/' + ADMIN_DIR + '/obj_dependences.cfm?obj_type_id=' + obj_type_id + '&obj_id=' + obj_id;
  	var DepWin = window.open( href, 'tm_dependences_win' ,'width=600,height=600,dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,screenX=25,screenY=25,status=no,scrollbars=yes');
	DepWin.location.href = href;
	DepWin.opener = window;
	DepWin.focus();
}
	
	
	
function onSelectDate(form_name, obj_type_name, date_time){
	CalWin = opener;

	CalWinFld = eval('CalWin.document.all.' + obj_type_name);
	CalWinFld.value = date_time;

	self.close();
	CalWin.focus();
	
}


	
	
function ImageOpen( uuid ) {
	var href = ROOT_PATH + '/reqimg.cfm?uuid=' + uuid;
 		var wndhr = window.open( href,  'tm_img_win', 'top=20, left=20, width=200, height=100, dependent=no, hotkeys=no, locationbar=no, menubar=no, resizable=yes, scrollbars=auto');
	wndhr.location.href = href;
   	if ( wndhr.opener == null ){
		wndhr.opener = window;}
	wndhr.focus();
}
	

function DocOpen( uuid, obj_version_id ) {
	var href = ROOT_PATH + '/reqdoc.cfm?uuid=' + uuid + '&obj_version_id=' + obj_version_id;
 		var wndhr = window.open( href,  'tm_doc_win', 'top=20, left=20, width=200, height=100, dependent=no, hotkeys=no, locationbar=no, menubar=no, resizable=yes, scrollbars=auto');
	wndhr.location.href = href;
   	if ( wndhr.opener == null ){
		wndhr.opener = window;}
	wndhr.focus();
	
	wndhr.setTimeout("self.close()",3000)
}

	
function ObjOpen( uuid ) {
	var href = ROOT_PATH + '/reqobj.cfm?uuid=' + uuid;
 		var winobj = window.open( href,  'tm_doc_obj', 'top=20, left=20, width=200, height=100, dependent=no, hotkeys=no, locationbar=no, menubar=no, resizable=yes, scrollbars=auto');
	winobj.location.href = href;
   	if ( winobj.opener == null ){
		winobj.opener = window;}
	winobj.focus();
}
	
	
function ObjDownload( uuid, obj_version_id ) {
	var href = ROOT_PATH + '/reqobj.cfm?action=download&uuid=' + uuid + '&obj_version_id=' + obj_version_id;
 		var winobj = window.open( href,  'tm_doc_obj', 'top=20, left=20, width=200, height=100, dependent=no, hotkeys=no, locationbar=no, menubar=no, resizable=yes, scrollbars=auto');
	winobj.location.href = href;
   	if ( winobj.opener == null ){
		winobj.opener = window;}
	winobj.focus();
}



function onMaillinglistClick(form_name, email_fld,  mlt_list, current_menue_id ){

	frm =  eval( 'parent.document.' + form_name + '.' + email_fld );
	frm_email = frm.value;

	
	var href = ROOT_PATH + '/mailinglist.cfm?mlt_list=' + mlt_list + '&frm_email=' + frm_email + '&current_menue_id=' + current_menue_id ;
 		var wndhr = window.open( href,  'tm_doc_mlt', 'top=20, left=20, width=600, height=500, dependent=no, hotkeys=no, locationbar=no, menubar=no, resizable=yes, scrollbars=auto');
	wndhr.location.href = href;
   	if ( wndhr.opener == null ){
		wndhr.opener = window;}
	wndhr.focus();
}
	

// Löscht das (Email) Form-Feld bei onfocus, wenn Defaulttext im Feld
function onfocusClearField(form_name, fieldname, def_txt){
		
	frm =  eval( 'document.' + form_name + '.' + fieldname );
	frm_txt = frm.value;

   	if ( frm_txt == def_txt){
		frm.value = '';
	}
	
}


	

	
/*
-------------------------------------------------------------------------------------------------------
		erweiterte Useradministratiom	
-------------------------------------------------------------------------------------------------------
*/



function WinOpen(option,x,y,user_id) {

	var paremeter = "toolbar=no,scroll=yes,scrollbars,scrolling=yes,resizable=yes,width=" + x + ",height=" + y;
	
	if(user_id == "") {
		alert("Error...User_ID not defined");
	}
	else {
		msgWindow=window.open("options/index.cfm?tempID=#GetTickCount()#&user_id=" + user_id + "&option=" + option,"#WindowName#" + option,paremeter);
		msgWindow.focus();
	}
}
	

	
	
