function onButtonClick( form_name, fld, cmd ) {
	
	if(opener){
		//if ( cmd == "" || cmd == "close"){
		if ( cmd == ""){
			close();
			return true;
		}
	}
	
	DisabledForm(form_name);
	
	if( ! fld )  fld = 'cmd';
	fld = eval('document.' + form_name + '.' + fld);
	fld.value = cmd;
	
	frm = eval('document.' + form_name);
	frm.submit();
	
}


function setCMDvar( form_name, fld, val ) {
	try {	
		if( ! fld )  fld = 'cmd_2';
		fld = eval('document.' + form_name + '.' + fld);
		fld.value = val;
	
		frm = eval('document.' + form_name);
	}
	catch(e) {
	}
}


function DisabledForm(form_name){
//	try {

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

//	catch(e) {
//	}

}


function EnabledForm(form_name){
//	try {

		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=false;
					fe.enabled=true;
					if (fe.style){
						//fe.style.setAttribute('color','silver',false);
					}
				}
			}
		}

//	catch(e) {
//	}

}




function OpenTestWin (type, form_name, field_1, field_2){
	
	t_url = '';
	
	if (type == 'page'){
		fld = eval('document.' + form_name + '.' + field_2 + '.value');
		t_url = field_1 + fld;
	}
	
	if (type == 'url'){
		fld = eval('document.' + form_name + '.' + field_1 + '.value');
		t_url = fld;
	}

	if (type == 'direct'){
		t_url = field_1;
	}
	
	t_url = t_url.replace(/http:\/\//i, "");
	
	//alert(t_url);
	
	if (t_url != ''){
		t_url = 'http://' + t_url;
		window.open(t_url);
	}

}

function OpenCalcWin (type, form_name, field_1, field_2){
	
	t_url = '';
	
	if (type == 'page'){
		fld = eval('document.' + form_name + '.' + field_2 + '.value');
		t_url = field_1 + fld;
	}
	
	if (type == 'url'){
		fld = eval('document.' + form_name + '.' + field_1 + '.value');
		t_url = fld;
	}

	if (type == 'direct'){
		t_url = field_1;
	}
	
	t_url = t_url.replace(/http:\/\//i, "");
	
	//alert(t_url);
	
	if (t_url != ''){
		t_url = '/content/?page=tex_pub_link_calculator&F_url_target=' + t_url;
		window.open(t_url);
	}

}






function TestContainer (form_name, field, container_id, domain_id){

	url = eval('document.' + form_name + '.' + field + '.value');
		
	var win_width = 500;
	var win_height = 360;
	
	var Screen_Width = screen.availWidth;
	var new_x = (Screen_Width / 2)-(win_width / 2);
	
	//var wndhr = window.open( 'about:blank','win_test_container','top=50,left=' + new_x + ',width=' + win_width + ',height=' + win_height+ ',dependent=yes,hotkeys=no,locationbar=no,menubar=no,resizable=yes,scrollbars=no');
	//wndhr.location.href = '/content/pop_test_container.cfm?container_id=' + container_id + '&domain_id=' + domain_id + '&test_url=' + url;
	location.href = '/content/pop_test_container.cfm?container_id=' + container_id + '&domain_id=' + domain_id + '&test_url=' + url;
	/*
	if ( wndhr.opener == null ){
		wndhr.opener = window;
	}
	wndhr.focus();
	*/
		
	
}


function onLinkButtonClick_plus_rand( href ) {
	window.location.href = href + "&rand__id=" + Math.random();
}

function onLinkButtonClick( href ) {
	window.location.href = href;
}

function openWin(url){
	window.open(url);
}



function ChangeColor2(dieID, color, on_off){
	
	if ( on_off == 1 ){
		cc_color_last = document.getElementById(dieID).getAttribute("bgcolor","false");
		document.getElementById(dieID).setAttribute("bgcolor", color, "false");
	}
	
	if ( on_off == 0 ){
		document.getElementById(dieID).setAttribute("bgcolor",cc_color_last,"false");
	}
}



function onShowHide( div ) {
	/*
	if( document.getElementById(div).style.display == 'none' ){
		document.getElementById(div).style.setAttribute( 'display', 'inline', false );
	}
	else{
		document.getElementById(div).style.setAttribute( 'display', 'none', false);
		document.getElementById(div).style.display = "none";
	}
	*/
	document.getElementById(div).style.display = "none";
}

function SetShowHide( div, status ) {
	document.getElementById(div).style.display = status;
}



function change_img(img_name,img_src) {
	document[img_name].src=img_src;
}


function INDEX_dissable_all_text(){
	SetShowHide('home_text_trade', 'none');
	SetShowHide('home_text_buy', 'none');
	SetShowHide('home_text_sell', 'none');
}

function INDEX_enable_text(div){
	INDEX_dissable_all_text();
	SetShowHide(div, 'inline');
}





var formular = null;
var textfeld = null;
var uebrigFeld = null;
var intv = null;
var maxZeichen = 0;

function Zaehlen ()
{
    var laenge = textfeld.value.length;
    var uebrig = maxZeichen - laenge;

    if (uebrig < 0)
    {
          var inhalt = textfeld.value;
          var neuerInhalt = inhalt.substr(0, maxZeichen);
          textfeld.value = neuerInhalt;
          uebrig = 0;
          //alert('Sie dürfen maximal ' + maxZeichen + ' Zeichen verwenden!');
    }
 
    uebrigFeld.value = uebrig;
}

   
   
/* ---------------------------------------------------
	ADMIN
----------------------------------------------------*/
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 openHelpbox(box_id, h){ 
	t_url = '/content/pop_helpbox.cfm?infobox_id=' + box_id;
	var wnddoc = window.open(t_url, 'MLS_Helpbpx', 'width=650,height=' + h + ',resizable=yes,scrollbars=yes');

	var new_x = 650;
	var new_y = h;
	
	wnddoc.resizeTo(new_x, new_y);
	wnddoc.focus();
	
}
	