// JavaScript Document

// 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;
}
//-->

// gallery zoom
function openpict(url,info,scrollbar,status,width,height,alt) {
	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_pict=open(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+"");
	open_pict.document.write('<html>\n<title>Szegedi Sport és Fürdők kft.</title>\n</head>\n\n<body bgcolor="#FFFFFF" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">\n');
	open_pict.document.write('<div align="center"><a href="javascript:;" onclick="window.close()"><img src="',url,'" border="0" width="',width,'" height="',height,'" alt="',alt,' - (klikk a bezáráshoz)"></a></div>');
	open_pict.document.write('</body></html>');
}
//-->

// new window
function OpenNewWindow(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(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+"");
}
//-->

// set home page
function setHomepage(url) {
	if (document.all) {
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
    }
    else if (window.sidebar) {
    	if(window.netscape) {
			try {  
            	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         	}  
         	catch(e) {  
    			alert("A böngésző biztonsági okoból nem támogatja a kért műveletet. A weboldal kezdőlapnak való beállítását manuálisan tudja csak engedélyezni.");  
			}
		} 
    	var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    	prefs.setCharPref('browser.startup.homepage', url);
	}
}
//-->

// add bookmark
function CreateBookmarkLink(title, url) {
	if (window.sidebar) { // mozilla
		window.sidebar.addPanel(title, url, "");
	} else if( window.external ) { // IE
		window.external.AddFavorite( url, title);
	} else if(window.opera && window.print) { // Opera
		return true;
	}
}
//-->

// 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
function chinpselconfirm(formname, inputtname, msg, actualurl) {
	var x = confirm(msg);
	var a = eval( 'document.' + formname );
	var srcList = eval( 'a.' + inputtname );
	
	if (!srcList.disabled) {
		var url = srcList.options[srcList.selectedIndex].value;
		
		if (url != "default") {
			if (x == true) {
				window.location.href = url;
			}
			else {
				window.location.href = actualurl;
			}
		}
	}
}
//-->

// 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='';
	}
}
//-->

// 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+"");
}
//-->

// 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";
	}
}
//-->

function ShowHideOneCheck(gebi) {
	if (document.getElementById(gebi).style.display == 'none') {
		document.getElementById(gebi).style.display = 'block';
	}
	else {
		document.getElementById(gebi).style.display = 'none';
	}
}

// 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);
			}
		}
	}
}
//-->
