var onLoadMethods=new Array();
var onSrcollMethods=new Array();

function onResizer() {
	if (onLoadMethods) {
		for(var i=0;i<onLoadMethods.length;i++) {
			var func = onLoadMethods[i];
			func();
		}
	}
}
function onLoader() {
	onResizer();
}
function onScroller() {
	if (onSrcollMethods) {
		for(var i=0;i<onSrcollMethods.length;i++) {
			var func = onSrcollMethods[i];
			func();
		}
	}
}

/* onloaders */

function setSwitcherBorders(container) {
	var switcherObj=new Object();
	switcherObj.button=getObjfromIdorObj(container);
	switcherObj.content=getObjfromIdorObj(container.replace(/^button/,'content'));
	if (!switcherObj.button || !switcherObj.content) return false;
	switcherObj.buttons=switcherObj.button.getElementsByTagName('h2');
	switcherObj.buttonwidth=0;
	for (var i=0;i<switcherObj.buttons.length;i++) {
		switcherObj.buttonwidth+=parseInt( switcherObj.buttons[i].offsetWidth );
	}
	switcherObj.gap=parseInt(switcherObj.content.offsetWidth) - parseInt(switcherObj.buttonwidth);
	if (switcherObj.gap>0) {
		switcherObj.links=switcherObj.buttons[i-1].getElementsByTagName('a');
		if (!switcherObj.links.length)switcherObj.lastlink=switcherObj.buttons[i-1];
		else switcherObj.lastlink=switcherObj.link[0];
		switcherObj.lastlink.style.paddingRight=switcherObj.gap+"px";
	}
}


/* image func */
function preloadImages(images) {
	var doc=document;
	if (!doc.preloadedImages) doc.preloadedImages=new Array();
	for (var i=0;i<images.length;i++) {
		doc.preloadedImages[i]=new Image;
		doc.preloadedImages[i].src="design/images/fejlec/fejlec_02_02_"+images[i].replace(/headerstyle\-/g,"")+".jpg";
	}
	window.random_header_pictures_preloaded=true;
}



function detImageSizeWithRate(W,H,maxwidth,maxheight) {
		var newW,newH,resized;
		if (W>maxwidth && H>maxheight) {//mindkettő nagyobb
			if (W<H) {//álló
				newH=maxheight;
				newW=(maxheight/H)*W;
				resized=1;
			} else {//fekvő
				newW=maxwidth;
				newH=(maxwidth/W)*H;
				resized=1;
			}
		} else if (W>maxwidth && H<=maxheight) {//szélesebb
				newW=maxwidth;
				newH=(maxwidth/W)*H;
				resized=1;
		} else if (W<=maxwidth && H>maxheight) {//magasabb
				newH=maxheight;
				newW=(maxheight/H)*W;
				resized=1;
		} else {
				newW=W;
				newH=H;
				resized=0;
		}
		var picSizes=new Object();
		picSizes.x=newW;
		picSizes.W=newW;
		picSizes.y=newH;
		picSizes.H=newH;
		picSizes.resized=resized;
		return picSizes;
}
function setAllImageSize (maxWidth,maxHeight) {
	for (var i=0;i<document.images.length;i++) {
		if (document.images[i].name.match(/(imagelist-img)+/) && (document.images[i].height>maxWidth || document.images[i].width>maxHeight)) {
			var W=document.images[i].width,H=document.images[i].height,newW,newH;
			var sizes=detImageSizeWithRate(W,H,maxWidth,maxHeight);
			document.images[i].style.width=sizes.W;
			document.images[i].style.height=sizes.H;
			document.images[i].width=sizes.W;
			document.images[i].height=sizes.H;
		}
	}
}
function setImageSize(id,maxwidth,maxheight,withoutsizecheck) {
	var oldPicSizes=new Object(),resized;
	if (document.getElementById(id) && withoutsizecheck==1)  {
		var W=document.getElementById(id).width,H=document.getElementById(id).height;
		document.getElementById(id).style.width=maxwidth;
		document.getElementById(id).style.height=maxheight;
		document.getElementById(id).width=maxwidth;
		document.getElementById(id).height=maxheight;
		resized=1;
	} else if (document.getElementById(id) && (document.getElementById(id).height>maxheight || document.getElementById(id).width>maxwidth)) {
		var W=document.getElementById(id).width,H=document.getElementById(id).height,newW,newH;
		var sizes=detImageSizeWithRate(W,H,maxwidth,maxheight);
		document.getElementById(id).style.width=sizes.W;
		document.getElementById(id).style.height=sizes.H;
		document.getElementById(id).width=sizes.W;
		document.getElementById(id).height=sizes.H;
		var oldPicSizes=new Object();
		resized=sizes.resized;
	}
	oldPicSizes.x=W;
	oldPicSizes.W=W;
	oldPicSizes.y=H;
	oldPicSizes.H=H;
	oldPicSizes.resized=resized;
	return oldPicSizes;
}
function setAllImageSizeBy(resizeby) {
	for (var i=0;i<document.images.length;i++) {
		if (document.images[i].name=="imagelist-img" && ((document.images[i].height>32 && resizeby<0) || (document.images[i].height<100 && resizeby>0))) {
			var H=document.images[i].height;
			document.images[i].style.height=H+resizeby;
			document.images[i].height=H+resizeby;
		}
	}
}



/*checkscript*/

function checkemptyitems_fromarray(mezotomb,mezotomb_uzi,mezoparam,mezofuggo,hibak) {
	var allowto_submit=1;
	var lastusername="",lastpassword="";
	if (hibak!="" || hibak=="undefined")allowto_submit=0;
	for (i=0;i<mezotomb.length;i++) {
		if (document.getElementById(mezotomb[i]) && (!mezofuggo[i] || mezofuggo[i]=="" || mezofuggo[i]=="undedfined" || (mezofuggo[i] && document.getElementById(mezofuggo[i]) && document.getElementById(mezofuggo[i]).checked==true))) {
//alert(mezotomb[i]+" "+mezoparam[i]+"==number && ("+isNaN(document.getElementById(mezotomb[i]).value)+" || "+document.getElementById(mezotomb[i]).value);			
			if(mezoparam[i]!="checkbox" && document.getElementById(mezotomb[i]).value=="") {//Üres-e
				hibak+=mezotomb_uzi[i]+"\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();//nem mindenhol jó a focus, mert rejtett layernél hibát dobhat!
				allowto_submit=0;
			} else if (mezoparam[i]=="email" && !emailType(document.getElementById(mezotomb[i]).value)) {//ha email típus
				hibak+="A megadott email cím nem a megfelelő formátumú!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="domain" && !domainType(document.getElementById(mezotomb[i]).value)) {//ha domain típus/
				hibak+="A megadott domain név nem a megfelelő formátumú!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="ip" && !ipAddressType(document.getElementById(mezotomb[i]).value)) {//ha ip cím típus/
				hibak+="A megadott IP cím nem a megfelelő formátumú!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="domainip" && (!domainType(document.getElementById(mezotomb[i]).value) && !ipAddressType(document.getElementById(mezotomb[i]).value))) {//ha ip vagy domain típus/
				hibak+="A megadott cím nem a megfelelő formátumú!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="number" && (isNaN(document.getElementById(mezotomb[i]).value) || document.getElementById(mezotomb[i]).value<20)) {//ha szám típus 
//				hibak+=mezotomb[i]+" - számot kell megadnia!\r\n";
				hibak+=mezotomb_uzi[i]+"\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="username" && document.getElementById(mezotomb[i]).value.indexOf(" ")!=-1 && hibak.indexOf("A felhasználói név nem tartalmazhat szóközt!")==-1) {//ha username tartalmaz szünetet
				hibak+="A felhasználói név nem tartalmazhat szóközt!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="password" && lastusername!="" && lastusername==document.getElementById(mezotomb[i]).value) {//ha jelszó, és már néztük a felh nevet 
				hibak+="A jelszó nem lehet azonos a felhasználói névvel!\r\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			} else if (mezoparam[i]=="password" && lastpassword!="" && lastpassword!=document.getElementById(mezotomb[i]).value) {//ha két jelszó vanmeg kell egyezniük 
				hibak+="Nem egyezik meg a két jelszó!\n";
				if (allowto_submit==1)document.getElementById(mezotomb[i]).focus();
				allowto_submit=0;
			}
			if (mezoparam[i]=="password"){lastpassword=document.getElementById(mezotomb[i]).value;}
			else if (lastpassword!="")lastpassword="";
			if (mezoparam[i]=="username"){lastusername=document.getElementById(mezotomb[i]).value;}
		}
	}
	if (allowto_submit==0) {
		alert("Az űrlap elküldéséhez kérjük ellenőrizze az alábbi adatokat:\n-----------------------------------\n"+hibak);
		return false;
	}
}


function emailType(email) {
	if (email.indexOf(" ")==-1 && email.match(/[a-z0-9]+[a-z0-9\-]*@[a-z0-9]+[a-z0-9\-]+\.[a-z0-9\-]+[a-z0-9\-]+/)) {
		return true;
	} else if (ekezetesEmailType(email)){
//		alert("Vigyázat! Ékezetes Email!");
		return true;
	} else return false;
}

function ekezetesEmailType(email) {
	if (email.indexOf(" ")==-1 && email.match(/[a-záéőúöüóűí0-9]+[a-záéőúöüóűí0-9\-]*@[a-záéőúöüóűí0-9]+[a-záéőúöüóűí0-9\-]+\.[a-záéőúöüóűí0-9\-]+[a-záéőúöüóűí0-9\-]+/)) {
		return true;
	} return false;
}

function domainType(url) {
	if (url.indexOf(" ")==-1 && url.match(/[a-z0-9]+[a-z0-9\-]+\.[a-z0-9\-]+[a-z0-9\-]+/)) {
		return true;
	} else if (ekezetesDomainType(url)){
//		alert("Vigyázat! Ékezetes Domain!\nA rendszer automatikusan konvertálja a megadott domain nevet,\nazonban kérjük ellenőrizze a konvertálás helyességét!");
		return true;
	} else return false;
}

function ekezetesDomainType(url) {
	if (url.indexOf(" ")==-1 && url.match(/[a-záéőúöüóűí0-9]+[a-záéőúöüóűí0-9\-]+\.[a-záéőúöüóűí0-9\-]+[a-záéőúöüóűí0-9\-]+/)) {
		return true;
	} return false;
}

function ipAddressType(url) {
	if (url.match(/\d+\.\d+\.\d+\.\d+/)) {
		return true;
	} return false;
}



/*notown*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src;x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v='hide')?'none':v; }
    obj.display=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

/*own layer*/

function layer_fel(name){
		document.getElementById(name).style.visibility='visible';
		document.getElementById(name).style.display='';
		MM_showHideLayers(name,'','show');
}

function layer_le(name){
		document.getElementById(name).style.visibility='hidden';
		document.getElementById(name).style.display='none';
		MM_showHideLayers(name,'','hide');
}

/*own irszam*/

var varos_irszam_tomb=new Array();
var elozoirszam=0;

function set_varos_fromirszam(irszam,varos_input_id) {//ügyfeleknél árányítószámhoz városkeresés
	if (irszam && varos_irszam_tomb[irszam] && document.getElementById(varos_input_id))document.getElementById(varos_input_id).value=varos_irszam_tomb[irszam];
	else if(irszam && elozoirszam!=irszam) {
		alert("Nincs ilyen irányítószám!");
	//	document.getElementById(varos_input_id).focus();
	}
	elozoirszam=irszam;
}

function set_irszam_fromvaros(varos,irszam_input_id) {//ügyfeleknél városhoz irányítószám
	if (varos && document.getElementById(irszam_input_id)) {
		for (i=1010;i<=9999;i++) {
			var string1=new String(varos);
			var string2=new String(varos_irszam_tomb[i]);
			if (string1.toUpperCase()==string2.toUpperCase()){
				document.getElementById(irszam_input_id).value=i;
				return true;
			}
		}
	} else if(varos) {
//		document.getElementById(irszam_input_id).focus();
		alert("Nincs ilyen irányítószám!");}
	return true;

}



/*egyeb*/

function kepkeretnyito(kep,type) {
	if (type=="undefined") type="";
	window.open('kepmutato.php?kep='+kep+'&type='+type,'_blank','width=450,height=340,menubar=no,scrollbars=auto,resizable=no');
	return false;
}

function ujablaknyito(mit,target,width,height) {
	if (typeof width=="undefined" || !width)width=820;
	if (typeof height=="undefined" || !height)height=768;
	if (typeof target=="undefined" || !target)target='blank';
	window.open(mit,target,'width='+width+' height='+height+' menubar=no status=0 scrollbars=1 scrolling=1 resizable=yes');
	return false;
}

function oldal_cimke_elotag(str) {
	if (document.getElementById('oldal_cimke_elotag')) {
		document.getElementById('oldal_cimke_elotag').innerText=str;
	}
}

function checkurl(id) {
	if (document.getElementById(id) && document.getElementById(id).host && document.getElementById(id).href) {
		var href=document.getElementById(id).href;
		var host=document.getElementById(id).host;
		if (host=="www.nemesvamos.hu:80")document.getElementById(id).href=href.replace(/www.nemesvamos.hu\//,"");
	}
}

function oldalKereso(mitkeresid,formname) {
if (!formname || formname=="undefined") {
	if (document.getElementById('holkeres')) {
		if (document.getElementById(mitkeresid)) {
			var mitkeres=document.getElementById(mitkeresid).value;
		}
		var holkeres=document.getElementById('holkeres').value;
		if (holkeres) {
			location.href="?page="+holkeres+"&holkeres="+holkeres+"op=search&mitkeres="+mitkeres;
			return false;
			//ha nem jó a location.href
			document.getElementById('jobbkereso').action="?page="+holkeres+"&holkeres="+holkeres+"op=search&mitkeres="+mitkeres;
		}
	} 
} else {
	if (document.getElementById(mitkeresid)) {
		var mitkeres=document.getElementById(mitkeresid).value;
	}
	document.getElementById(formname).action+="&mitkeres="+mitkeres;
}
}


var needtoclickfokateg_tomb=new Array();
function needtoclickfokateg(mtid) {
	var this_length=needtoclickfokateg_tomb[mtid].length;
	for (var i=0;i<this_length;i++) {
		if(document.getElementById("tids_"+needtoclickfokateg_tomb[mtid][i])){
			document.getElementById("tids_"+needtoclickfokateg_tomb[mtid][i]).checked=document.getElementById("tids_"+needtoclickfokateg_tomb[mtid][i]).checked?false:true;
		}
	}
}

function elsofele(str,len,rettype) {
	if (typeof rettype=='undefined')rettype='write';
	if (typeof len=='undefined')len=45;
	if (str.length>len)str=str.substring(0,len)+"...";
	if (rettype=='return')return str;
	else document.write(str);
}



function domain_kereso(){
	if (document.getElementById('domainname') && document.getElementById('domainname').value) {
		if (document.getElementById('domainname').value!=String(document.getElementById('domainname').value).match(/[a-z0-9éáűőúöüóí\-\.]+/)) {
//			alert("Hibás domain név formátum! Csak '-' jelet, betűket és betűket használjon!");
			document.getElementById('domainform').action='?page=domaincheck&op=hibasformatum';
//			return false;
		}
		if (String(document.getElementById('domainform').action).match(/page=/)) {
			return true;
		} else {
			if (document.getElementById('ext').value==".hu") {
				window.open("http://www.domain.hu/domain/domainsearch/?domain="+document.getElementById('domainname').value+"&tld=hu&lang=magyar");
				return false;
			} else {
				window.open("http://www.whois.sc/name-spinner/?q="+document.getElementById('domainname').value);
				return false;
			}
		}
	} 
	alert("Töltse ki a domain nevet!");
    return false;
}


function checkDomainDefValue(defval) {
	var obj=getObjfromIdorObj("domain");
	if (obj && obj.value==defval) {
		alert("Kérjük adja meg a keresendő domain nevet!");
		return false;
	} 
	return true;
}


function cancelDomainWhois() 
{
	hideProgressLine();
	closeUnderLayer();
	clearTimeout(window.timeout_setProgressLine);
	window.currentProgressLinePercent = window.maxProgressLinePercent;
	window.dontWriteGetDomainWhois = 1;
}

function getDomainWhois() 
{
	if (! domainWhoisList)
  {
    return false;
  }
	if (typeof window.domainWhoisListLenght=='undefined')
  {
    domainWhoisListLenght=domainWhoisList.length;
  }
	if (domainWhoisList.length) 
  {
		var currpercent=(domainWhoisListLenght-domainWhoisList.length)/domainWhoisListLenght*100;
		var nexpercent=(domainWhoisListLenght-domainWhoisList.length+1)/domainWhoisListLenght*100;
    // Remove first(or last) item.
		var domainArray = domainWhoisList.shift();
		//showProgressLine(currpercent, nexpercent, "Vizsgált domain név: <b>"+domainArray[0]+"."+domainArray[1]+"</b>");
		//openUnderLayer();
    showObj('div_popupdomainsearch');
		
		var PostData="page=whois_domain.php&domain="+domainArray[0]+"&tld="+domainArray[1]+"&length="+domainWhoisList.length+"&domaincontainerlength[0]="+domainContainerLengths[0]+"&domaincontainerlength[1]="+domainContainerLengths[1];
		var opts = {
      url: 'ajax.php',
			type: 'POST',
			data: PostData,
      dataType: 'json',
			success: function(t) {
				//hideProgressLine();
				//closeUnderLayer();
        hideObj('div_popupdomainsearch');
				if (window.dontWriteGetDomainWhois==1) 
        {
          return false;
        }
        
				JSONObj = t;
				if (JSONObj) 
        {
          writeDomainWhois(JSONObj);
        }
				else 
        {
          alert(t.responseText);
        }
        
				//requ till have domain
				getDomainWhois();
			},
			error: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
			}
		}
		$.ajax(opts);
	} 
  else {
		cancelDomainWhois();
	}
	return false;
}


var domainContainerLengths=new Array(0,0);
function writeDomainWhois(JSONObj) 
{
/*	var obj=getObjfromIdorObj("domainContainer" + (JSONObj.data.isregistered ? '1' : '0') );
	domainContainerLengths[(JSONObj.data.isregistered ? '1' : '0')]++;
*/
	var obj = getObjfromIdorObj("domainContainer0" );
	domainContainerLengths[0]++;
	//if (!JSONObj.data.isregistered) {
		showObj("order-button");
		showObj("order-detail");
	//}
	if (obj) {
		obj.innerHTML+=JSONObj.data.html;
		obj.style.display='block';
	}
}

function hideProgressLine()
{
    closeObj('progressline');
}

function setProgressLine(dontincrement) {
	var secondsforonedomain=20
	clearTimeout(window.timeout_setProgressLine);
	if (window.currentProgressLinePercent+1 < window.maxProgressLinePercent){
		if (dontincrement!=1) window.currentProgressLinePercent++;
	} else return false;
	//set width
	var line_id='progressline_line';
	var lineObj = getObjfromIdorObj(line_id);
	if (lineObj) {
		lineObj.style.width=parseInt(window.maxProgressLineMaxWidth*window.currentProgressLinePercent/100);
		lineObj.width=parseInt(window.maxProgressLineMaxWidth*window.currentProgressLinePercent/100);
	}
	//write percent
	var percent_id='progressline_percent';
	var percentObj = getObjfromIdorObj(percent_id);
	if (percentObj){
		percentObj.innerHTML=Math.round(window.currentProgressLinePercent)+"%";
	}
	window.timeout_setProgressLine=setTimeout("setProgressLine()", window.domainWhoisListLenght ? (secondsforonedomain/(100/window.domainWhoisListLenght))*1000 : 600);
	return true;
}

function showProgressLine(percent,nexpercent,text) {
	var layer_width=300, layer_padding=10;
	var layer_id='progressline';
	var marquee_id='progressline_text';
    var layer = getObjfromIdorObj(layer_id);
	if (layer)
	    var marqueeObj = getObjfromIdorObj(marquee_id);
		window.currentProgressLinePercent=percent;
		window.maxProgressLinePercent=nexpercent;
		window.maxProgressLineMaxWidth=layer_width-2*layer_padding;
		setProgressLine(1);
		if (marqueeObj && typeof text!='undefined'){
			marqueeObj.style.display='block';
			marqueeObj.innerHTML=text;
		} else if (marqueeObj) marqueeObj.style.display='none';
		layer.style.display='block';
		layer.style.width=layer_width;
    layer.width=layer_width;
		layer.style.left=parseInt((getMaxWidth(true)-layer_width)/2);
    layer.left=((getMaxWidth(true)-layer_width)/2);
}


function openUnderLayer() {
    var under_frame_id='div_under_layer';
    var underframe = getObjfromIdorObj(under_frame_id);
	if (underframe)
    {
    	underframe.style.height=getMaxHeight();
      underframe.style.display='block';
		  setOpacity('div_under_layer',0,70);
      //if (getBrowserType('ie'))showHideElementsInObj('select',null,'hidden');
    }
}
function closeUnderLayer()
{
    closeObj('div_under_layer');
		//FIXME: show all, not switch
    //if (getBrowserType('ie') && parent.showHideElementsInObj)
    //{
    //  parent.showHideElementsInObj('select',null,'visible');
    //}
}

function changeopacity(obj,opacity){
	if (getBrowserType('ie'))obj.style.filter='Alpha(Opacity='+opacity+')';
	else obj.style["MozOpacity"] = opacity/100;
}
function setOpacity(id,from,to) {
    var underframe = getObjfromIdorObj(id);
	underframe.style.height=getMaxHeight();//csak underlayer miatt kell
	clearTimeout(window.setOpacity_timeout);
	if (from+10<to) {
		from+=10;
		changeopacity(underframe,from);
		window.setOpacity_timeout=setTimeout("setOpacity('"+id+"',"+from+","+to+")",100);
	}
}


function showBigImage(obj) {
	obj=getObjfromIdorObj(obj);
	var imgs=obj.getElementsByTagName('img');
	if (imgs[0]) {
		var bigpic=imgs[0].src.replace(/kicsi\//,"");
		swapImage('bigimage',bigpic);
		showObj('bigimagecontainer');
		var imgobj=getObjfromIdorObj('bigimagecontainer');
		var pos=getAnchorPosition({object:obj});
		if (getBrowserType('ff')) pos.y-=imgs[0].clientHeight;
		imgobj.style.left=pos.x+"px";
		imgobj.style.top=pos.y+"px";
		imgobj.left=pos.x+"px";
		imgobj.top=pos.y+"px";
		openUnderLayer();
	}
}

function hideBigImage() {
	closeObj('bigimagecontainer');
	closeUnderLayer();
}


function swapImage(id,src) {
    var x=getObjfromIdorObj(id);
    if (x && x.src && x.src!=src) {
//        document.swapImage_src=x;
        if(!x.oSrc)x.oSrc=x.src;
        if(getBrowserType()=="ie")IExploreTimeHack("getObjfromIdorObj('"+x.id+"').src='"+src+"'");
        else x.src=src;
    }
}

function swapOverImage(id) {
    var obj=getObjfromIdorObj(id);
    var newsrc=obj.src.replace(/_over(\.gif|\.jpg)$/i,'$1');
    var newsrc=newsrc.replace(/(\.gif|\.jpg)$/i,'_over$1');
    swapImage(obj, newsrc);
}
function swapOutImage(id) {
    var obj=getObjfromIdorObj(id);
    var newsrc=obj.src.replace(/_over(\.gif|\.jpg)$/i,'$1');
    swapImage(obj, newsrc);
}
function IExploreTimeHack(evalstr)
{
  setTimeout(evalstr,1);
	return true;
}

function switchBgImage(id,to) {
    var obj=getObjfromIdorObj(id);
	alert(obj.style.background);
//	obj.style.backgroundImage='images/design/bal/bal_box_allec2.gif';
}



function openAjaxPage(PostData,posObj) {
	posObj=getObjfromIdorObj(posObj);
	var opts = {
		method: 'post',
		postBody:PostData,
		onSuccess: function(t) {
			JSONObj=t.responseText.parseJSON();
			if (!JSONObj) {
				alert("A keresett oldal nem található! (2)");
//				alert("A kapott eredmény hibás: "+t.responseText);//nem jött helyes JSON
			} else {
				if (JSONObj.data && JSONObj.data.error) {//hibával jött vissza
					alert("A keresett oldal nem található!");
				} else if (!JSONObj.html) {//nem az jött amit akartunk
					alert("A keresett oldal nem található! (3)");
//					alert("A kapott eredmény hibás: "+t.responseText);
				} else { //ok, minden jó
					openUnderLayer();
					setValue('div_popuplayer_content',JSONObj.html);
					showObj('div_popuplayer');
					var popupObj=getObjfromIdorObj('div_popuplayer');
					if (posObj && 0) {
						var coords=getAnchorPosition({object:posObj});
						coords.x-=parseInt(popupObj.offsetWidth/2);
						coords.y-=parseInt(popupObj.offsetHeight/2);
					} else {
						var coords=new Object();
						coords.x=(getMaxWidth()-parseInt(popupObj.offsetWidth))/2;				
						coords.y=document.body.scrollTop+20;				
					}
					if (coords.y+popupObj.offsetHeight+10>getMaxHeight()) {//nagyobb mint a max magasság
						coords.y=getMaxHeight()-popupObj.offsetHeight-10;
					}
					popupObj.style.left=coords.x;
					popupObj.style.top=coords.y;
				}
			}
		},
		on404: function(t) {
			alert("no input file");
		},
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}
	}
	new Ajax.Request('ajax.php', opts);
}
function closeAjaxPage() 
{
	closeUnderLayer();
	hideObj('div_popuplayer');
}
