// JavaScript Document

function ServiceskTab(gebi) {
	szdata = document.getElementById("sz_data");
	szitems = szdata.getElementsByTagName("div");
	
	for (a = 0; a < szitems.length; a++) {
		if (document.getElementById("sz_" + a)) {
			document.getElementById('sz_' + a).style.display = "none";
		}
	}
	
	document.getElementById('sz_' + gebi).style.display = "block";
}


// roolover, rollout
function on(rp, pic, id, ptype) {
	if (id == '') {
		id = pic;
	}
	if (ptype == '') {
		ptype = 'jpg';
	}
	document.getElementById(id).src = rp + "pics/menu/over/" + pic + "." + ptype;
}

function off(rp, pic,id, ptype) {
	if (id == '') {
		id = pic;
	}
	if (ptype == '') {
		ptype = 'jpg';
	}
	document.getElementById(id).src = rp + "pics/menu/out/" + pic + "." + ptype;
}
//-->

// admin open new window
function openadmin(url, info, scrollbar, status, width, height) {
	var width_center = (screen.width - width) / 2;
	var height_center = (screen.height-height) / 2;
	if (width > (screen.width)) {
		window_width = (screen.width - 30);	
	}
	else {
		window_width = width;
	}
	
	if (height > (screen.height)) {
		window_height = (screen.height - 30);	
	}
	else {
		window_height = height;
	}
	
	open("elements/jswindowadmin.php"+url, info, "scrollbars=" + scrollbar + ", toolbar=no, menubar=no, directories=no, status=" + status + ", " + "resizable=no, left=" + width_center + ", top=" + height_center + ", width=" + window_width + ", height=" + window_height);
}
//-->

// change selected option
function chinpsel(formname, inputtname, target) {
	var a = eval( 'document.' + formname );
	var srcList = eval( 'a.' + inputtname );
	
	if (!srcList.disabled) {
		var url = srcList.options[srcList.selectedIndex].value;
		
		if (url != "default") {
			if (target == "_parent" || target == '') {
				window.location.href = url;
			}
			if (target == "_blank") {
				open(url, "newwindow");
			}
		}
	}
}
//-->

// change selected option (mod)
function chinpsel2(formname, inputtname1, inputtname2, divname) {
	var a = eval( 'document.' + formname );
	var srcList1 = eval( 'a.' + inputtname1 );
	var srcList2 = eval( 'a.' + inputtname2 );
	
	var selvalue = srcList1.options[srcList1.selectedIndex].value;
	
	if (selvalue == 999) {
		document.getElementById(divname).style.display = "block";
		srcList2.focus();
	}
	else {
		document.getElementById(divname).style.display = "none";
		srcList2.value = '';
	}
}
//-->

// html tag hide/show
function showhtmltag(id, gebi) {
	if (id == 0) { 
		document.getElementById(gebi).style.display = "none";
	}
	if (id == 1) { 
		document.getElementById(gebi).style.display = "block";
	}
}
//-->

// confirm
function ConfirmMsg(msg) {
	x = window.confirm(msg);
	return x;
}
//-->

// confirm
function ConfirmCancel(msg) {
	var x = confirm(msg);
	
	if (x == true) {
		window.close();
	}
}
//-->

// cancel
function cancel(url) {
	window.location=url;
}
//-->

// checkall
var ie  = document.all  ? 1 : 0;

function hl(cb) {
   if (ie) {
	   while (cb.tagName != "TR") {
		   cb = cb.parentElement;
	   }
   }
   else {
	   while (cb.tagName != "TR") {
		   cb = cb.parentNode;
	   }
   }
   cb.className = 'ReadMsgSelected';
}

function dl(cb) {
   if (ie) {
	   while (cb.tagName != "TR") {
		   cb = cb.parentElement;
	   }
   }
   else {
	   while (cb.tagName != "TR") {
		   cb = cb.parentNode;
	   }
   }
   cb.className = 'ReadMsgNonSelected';
}

function cca(cb) {
   if (cb.checked) {
	   hl(cb);
   }
   else {
	   dl(cb);
   }
}

// roll selected list
function rollselected(cba) {
	cba_tra = 'tra'+cba;
   	document.getElementById(cba_tra).className = 'ReadMsgSelected';
}
function rollunselected(cba) {
	cba_tra = 'tra'+cba;
	cba_inp = 'inp'+cba;
	locked_img = 'locked'+cba
	if (document.getElementById(cba_inp).checked == false) {
		document.getElementById(cba_tra).className = 'ReadMsgNonSelected';
	}
	if (document.getElementById(cba_inp).name == locked_img) {
		document.getElementById(cba_tra).className = 'ReadMsgNonSelected';
	}
}
//-->

function CheckAll(formname,checkboxname,othercheckbox,cb) {
	var fmobj = eval( 'document.' + formname );
	var fmobj2 = eval ( 'fmobj.' + checkboxname );
	for (var i=0;i<fmobj.elements.length;i++) {
		var e = fmobj.elements[i];
		if ((e.name != checkboxname) && (e.type=='checkbox') && (!e.disabled)) {
			e.checked = fmobj2.checked;
			if (fmobj2.checked) {
			   hl(e);
			}
			else {
			   dl(e);
			}
		}
	}
}
//-->
