
function chng_pic(obj){
	var is_selected = (obj.src.charAt(obj.src.length-5) == "s");
	obj.src = (obj.src.substring(0, obj.src.length-5)+(is_selected ? "n" : "s")+obj.src.substr(obj.src.length-4));
}

function delete_confirm(){
	var retVal = window.confirm('Biztos törölni akarok a kijelölt elemeket?');
	if(event) event.returnValue = retVal;
	return retVal;
}


var heightdiff = 35;
var widthdiff = 26;
 
 // check for XP SP2
if(document.all){
	if (window.navigator.userAgent.indexOf("SV1")!= -1){
      		heightdiff = heightdiff+10
      	}
}
 
function adjustwndpos(){
	//return; // do not adjust position
 	var x,y;
 	x = ((screen.width - (window.document.body.clientWidth+widthdiff)) / 2);
 	y = ((screen.height - (window.document.body.clientHeight+heightdiff)) / 2);
 	window.moveTo(x,y);
}
 
function adjustwndheight(){
	var fits, docend, docheight, newheight, newwidth;
	
	fits = true;
 	docend = document.getElementById('pagebottom');
 	if(docend=="undefined") return false;
 	docheight = docend.offsetTop;
 	newheight = docheight+heightdiff;
 	newwidth = window.document.body.clientWidth;
 	newwidth = (newwidth+widthdiff);
 	//newwidth = ((newwidth-6)/16)*16;
 	
 	if (newheight>screen.height){
 		newheight = screen.height - 160; 
 		fits = false; 
 	}
 	window.resizeTo(newwidth, newheight);
 	if (fits) window.document.body.style.overflow='hidden';
 	//adjustwndpos();
 	return true;
}

function link_it(url){
        if (parseInt(navigator.appVersion) >= 4){ 
        	window.open(url,"","toolbar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,menubar=yes,width=" + ((screen.width/100)* 80) + ",height=" + (((screen.height/100)* 85)-200) + ",left=" + ((screen.width/100)* 9) + ",top=" + ((screen.height/100)* 14));
        }else{
          	window.open(url,"","toolbar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,menubar=yes,width=600,height=280");
        }
 	return true;
}

function change_disabled_stat(els){
	var el = null;
	
	for(var i=0; i<els.length; i++){
		el = document.getElementById(els[i][0]);
		if(!el) alert("Element '"+els[i][0]+"' not found!");
		 el.disabled = els[i][1];
	}
}


function highlight_row(row_obj, check){
	//var select = !row_obj.tmp_class;
	var color = "#DBAA9D";
	row_obj.style.backgroundColor = (check===null ? (row_obj.style.backgroundColor=="" ? color : "") : (check ? color : ""));
	
	/*if(select){
		row_obj.tmp_class = (row_obj.className ? row_obj.className : true);
		row_obj.className = "list_highlighted";
	}else{
		row_obj.className = row_obj.tmp_class;
		row_obj.tmp_class = null;
	}*/
	
}

function doError(msg,url,ln){
	var strValues = "errMsg=" + escape(msg),
	    server = "<?php echo SERVER ?>";
	strValues += "&errLine=" + ln;
	strValues += "&queryString=" + escape(location.search);
	strValues += "&Url=" + escape(location.pathname);
	strValues += "&HTTPRef=" + escape(document.referrer);
	
	var img = document.createElement("IMG");
	img.src = server + "/error_save/index.php?action=js_error&" + strValues;
	img.width = 1;
	img.height = 1;
	//document.body.appendChild(img);
}

try{
	window.onerror = doError;
}catch(er){}


function contains(container, containee) {
  while(containee){
    if(container == containee){
      return true;
    }
    containee = containee.parentNode;
  }
  return false;
}

//document.onkeydown = login_handle;
