var NS = (navigator.appName=="Netscape")?true:false;
var KONYVTAR_HTML = "../html_demo/blue/";

function ujablak(mit,hova,w,h) {
  ablakneve = window.open(mit, hova, "resizable=1,status=0,menubar=0,scrollbars=yes,location=0,toolbar=0,width="+w+",height="+h+",left=0,top=0");
  ablakneve.moveTo((screen.width/2)-(w/2),(screen.height/2)-(h/2));
}

function teljesablak(mit,hova,kepx,kepy) {
  kepx = parseInt(kepx) + 20;
  kepy = parseInt(kepy) + 25;
  ablakneve = window.open(mit, hova, "menubar=0,width="+kepx+",height="+kepy+",left=0,top=0");
  ablakneve.moveTo((screen.width/2)-(kepx/2),(screen.height/2)-(kepy/2));
  ablakneve.moveTo((screen.width/2)-(kepx/2),(screen.height/2)-(kepy/2));
}

function teljesablak2(mit,hova) {
  ablakneve = window.open(mit, hova, "menubar=0,width=10,height=10,left=0,top=0");
}

function ablakbezar(){
window.close();
}

function ablak_atmeretezes(x,y) {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = x - iWidth;
iHeight = y - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
}

function okbe(){
document.images["okgomb"].src = KONYVTAR_HTML+"OK_lenyomva.gif";
}

function okki(){
document.images["okgomb"].src = KONYVTAR_HTML+"OK_alap.gif";
}

function foto_feltoltes_submit() {
	fotot_tolt=1;
	waitWin=window.open('ip_galeria_nagykep.php?kep='+KONYVTAR_HTML+'keremvarjon.gif','waitWin','menubar=0,scrollbars=no,left=0,top=0,width=0,height=0');
}

function foto_feltoltes_kisablak_tunjonel(){
        if (fotot_tolt == 1){
        	waitWin.close()
        }
        fotot_tolt = 0;
}


var mezoidnevetomb = new Array();  //Ebbe gyüjtöm az ellenőrizendő mezőneveket.

function urlap_mezo_kitoltve(mezoidneve)
{
//alert("Az értéke: KLIKK! :)");
var div = document.getElementById(mezoidneve);
if (div.value) return(1);
 else return(0);

/*
if (div.value) alert(mezoidneve+' értéke: '+div.value);
 else alert(mezoidneve+' értéktelen: '+div.value);
*/

/*
alert("Az értéke: "+document.portal.input[mezoidneve].value);
var div = document.getElementById(mezoidneve);
if (div.value) alert('Van értéke: '+mezoidneve);
 else alert('Nincs értéke: '+mezoidneve);
*/
}

function osszes_urlap_mezo_kitoltve()
{
var mindenoke;
mindenoke = 0;
for (i=0; i < mezoidnevetomb.length; ++i)
  {
  if (!urlap_mezo_kitoltve(mezoidnevetomb[i])) mindenoke = mindenoke+1;
  //alert('hmm:'+mezoidnevetomb[i]);
  }
if (mindenoke>0)
  {
  alert(mindenoke+' fontos mező nincs kitöltve!');
  return(false);
  }
 else
  return(true);
}


/*
Plusz minuszos eltüntetőset, hogy ne zavarjon be a sok adat
*/
function lenyilas(id)
{
	var lenyiloText = document.getElementById('k' + id);
	var lenyiloKep = document.getElementById('pic' + id);

	if (lenyiloText.style.display == 'none') {
  		lenyiloText.style.display = 'block';
  		lenyiloKep.src = KONYVTAR_HTML+'minus.gif';
	}
	else {
  		lenyiloText.style.display = 'none';
  		lenyiloKep.src = KONYVTAR_HTML+'plus.gif';
	}
}

//Elvileg ez megoldja a : Az aktiváláshoz és használathoz kattintson a vezérlőre. problémát
//http://www.codingforums.com/showthread.php?t=82694
function rewriteContent() {
        if (navigator.appName=='Microsoft Internet Explorer')
        {
        //alert(navigator.appName);
	var v=document.getElementsByTagName("noscript");
	for(i=0;i<v.length;i++){
	    if(v[i].className=="ACSel"){
			var el=v[i];
			var nel=document.createElement("span");//create new span element to hold content
			nel.innerHTML=el.innerHTML;// fill the newly inserted span with the active content
			el.parentNode.replaceChild(nel,el); // and replace the <noscript> element with the <span> element
	      }
	}
	}
}

function setPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
}