/*KEH JS */
function go(target) { location.href = target; }
function dopop(page,name,w,h,scroll,status,fixed) {
 LeftPosition = ((screen.width) ? (screen.width-w)/2 : 0);
 TopPosition = ((screen.height) ? (screen.height-h)/2 : 0);
 settings =  'height='+h+',width='+w+',';
 settings += 'top='+TopPosition+',left='+LeftPosition+',';
 settings += 'scrollbars='+scroll+',status='+status+',resizeable='+fixed;
 var its = window.open(page,name,settings);
 its.focus();
 }
function openpopup(page,name,w,h,scroll,status,fixed) {dopop(page,name,w,h,scroll,status,fixed);}

function chgBg(obj,color){

 if (document.all || document.getElementById) {
  obj.style.backgroundColor = color;
 }

}
function activeRegister(set,ActiveID) {
 for(i=1;i<=eval(set+'_count');i++) {
	 className = (i == ActiveID )? 'mmain_a' : 'mmain';
    tes = 'titel_'+set+'_'+i;
    chgBg( document.getElementById( tes ) , className );
 }
}
function confirmDelete(MSG) {

    var is_confirmed = confirm(MSG);
    return is_confirmed;

} // end of the 'confirmLink()' function
function setSelectOptions(selectID,do_check) {

/**
  * Checks/unchecks all options of a <select> element
  *
  * @param   string   the form name
  * @param   string   the element name
  * @param   boolean  whether to check or to uncheck the element
  *
  * @return  boolean  always true
  */


    var selectObject = document.getElementById(selectID);
    var selectCount  = selectObject.length;

    for (var i = 0; i < selectCount; i++) {
        selectObject.options[i].selected = do_check;
    } // end for

    return true;
} // end of the 'setSelectOptions()' function
function toggle(itemID){
var te = document.getElementById(itemID);
// alert(document.getElementById(itemID));
te.className = te.className == 'visible' ? 'hidden' : 'visible';
}

function visibility_switch(itemID){
itemEL = document.getElementById(itemID);
itemEL.className = itemEL.className == 'visible' ? 'hidden' : 'visible';
}

function activateContent(ActiveID,MaxCount,ContentLayerGroup,MenuGroup) {
// alert('activateContent - max:'+MaxCount+' - '+ActiveID+' - '+ContentLayerGroup+' - '+MenuGroup);
	aOneOG(ActiveID,ContentLayerGroup,MaxCount,'hidden','visible') ;
	aOneOG(ActiveID,MenuGroup,MaxCount,'tab','tab_a') ;
}
function aOneOG(ActiveID,Group,MaxGroupCount,styleFrom,styleTo) {
	// alert('aOneOG - max:'+MaxGroupCount+' - '+ActiveID+' - '+Group+' - '+styleFrom+' - '+styleTo);
	for(i=1;i<=MaxGroupCount;i++) {
		switchStyle(  Group+'_'+i , styleFrom);
	}
	switchStyle(  Group+'_'+ActiveID  , styleTo);
}
function switchStyle(itemID,style) {
	// alert('switchStyle: '+itemID+' changed to class '+style);
	itemEL = document.getElementById(itemID);
	itemEL.className = style;
}

/* find Position */
function findPos(obj) {
	var curleft = curtop = 0;
	if(obj) {
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
	}
	return [curleft,curtop];
}
