/** open a new window (popup) **/
var newwin = function (url,width,height,parameter) {
		if(!width) width=720;
		if(!height) height=540;
		if(!parameter) parameter = "scrollbars=1,resizable=1";
		nF = open(url,"nF","width="+width+",height="+height+","+parameter+"");	nF.focus();
		return false;		
		};
/** ommit display inside a frame **/
function frameless() { if(top.frames.length > 0) { top.location.href=self.location; } }	
/** switch display of a html element **/
var salga = function (e) { e = $(e); return switch_display(e); };
function switch_display(e) 
	{ if(!e) return false;
	if(e.style.display=="block"){ e.style.display="none";} 
	else {e.style.display="block"; }
	}	

/** textfield input length */
function ismaxlength(obj) {
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength) {
		alert( mlength + " characters are allowed here.\nThe text you typed is too long ");
		obj.value=obj.value.substring(0,mlength)
		}
	}

/** dyn td column mark */
function setPointer() { return false; }


/** statusbg,statustx info Dialog */
var DLG = 0; // has dialog, 0|1|2(with bg)
var DLGsize = null; // css size
var DlgTO= false;   
function hasDialog() { if(DLG>0) return DLG;
	var tbg = $("statusbg"); var ttx = $("statustx");
	if(tbg) DLG++; if(ttx) DLG++;
	return DLG; 	
	}
	 
function show_infoDialog(dlg, width, height, showtimeout, opacity) {
	if(hasDialog()) {
		var tbg = $("statusbg"); var ttx = $("statustx");
		if(dlg) {
			var cont = '<p><b>'+dlg+'</b></p>'
			+ '<p><img src="' + _jsGlobal.HTTP_ROOT + _jsGlobal.MPC_THEME + '/images/loadring.gif"/></p><p>loading ...</p>';
			ttx.innerHTML = cont;
			}
		if(!showtimeout) showtimeout = 1000;
		if(!DlgTO) DlgTO = setTimeout( function(){hide_infoDialog();} , showtimeout);
		resize_infoDialog(width,height,opacity)
		tbg.style.display = "block"; ttx.style.display = "block";
		} 
	return false; 
	}
function hide_infoDialog() {
	if(hasDialog()) {
		var tbg = $("statusbg"); var ttx = $("statustx");
		tbg.style.display = "none"; 
		ttx.style.display = "none";
		DlgTO = false;
		}
	return false; 
	}
function resize_infoDialog(w,h,o)
	{
	var tbg = $("statusbg"); var ttx = $("statustx");
	if(!DLGsize || DLGsize == null) { // default values
		if(!tbg.style.width)  tbg.style.width = "40%"; 
		if(!tbg.style.height) tbg.style.height = "40%";
		DLGsize = { width: tbg.style.width, height: tbg.style.height, opacity:"98" };
		}
	if(!w) w = DLGsize.width; if(!h) h = DLGsize.height; if(!o) o = DLGsize.opacity;
	tbg.style.width = w; tbg.style.height = h;
	ttx.style.width = w; ttx.style.height = h;
	tbg.style.opacity = o;
		
	}	
	
	
	
		
