WEBAUDIT=function() {
    
  this.WACID=null;
  this.WACIDName="WACID";
  
  
  this.getCookie=function(name)  {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
    {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  }
  
  this.setCookie=function(name,value,topDomain) {
    var date = new Date(2020,12,31,23,59,59);
    var expires = "; expires="+date.toGMTString();
    document.cookie = name+"="+value+expires+"; path=/; domain=" + topDomain;  
  }
  
  this.generateID=function(splitter) {
    var sp=(splitter) ? splitter : 'A';
    var now=new Date();
    return Date.parse(now.toGMTString()) + sp + Math.floor(Math.random()*1000000);
  }
  
  this.getTopDomain=function(fullDomain) {
    var darabok=fullDomain.split('.');
    return darabok[(darabok.length-2)] + '.' + darabok[(darabok.length-1)];
  }
  
  this.getDomain=function(url) {
    var urlDarabok=url.split('/');
    return urlDarabok[2];
  }
  
  this.WACID=this.getCookie(this.WACIDName);
}

var wa=new WEBAUDIT();
var felbontas = "";
var same =  Math.floor(Math.random()*1000000);

if(wa.WACID==null)
{
  wa.WACID=wa.generateID('A');
  wa.setCookie(wa.WACIDName,wa.WACID,wa.getTopDomain(wa.getDomain(document.URL)));
}

same = same + "@welid=" + wa.WACID;
if(screen) felbontas='@felbontas='+screen.width+'x'+screen.height;
same = same + felbontas;












	var lang='hu';

	function setbtn(o,state,name) {
		state=(state?"a.gif":".gif");
		o.src="images/"+lang+"/"+name+state;
	}

function SwitchContent(obj,dname,state,xtra)
{
	if(document.getElementById)
	{
		var el = document.getElementById(obj);
		var ar = document.getElementById(dname).getElementsByTagName("DIV");

		if(state!='')
		{
			el.style.display = state;
		}
		else
		{
			if(el.style.display == "none")
			{
				if(!xtra)
				{
					for (var i=0; i<ar.length; i++){
						ar[i].style.display = "none";
					}
				}
				el.style.display = "block";
			}
			else
			{
				el.style.display = "none";
			}
		}
	}	
}

function set_search(fname)
{
	var city_id;
	var cval='';
	var rent=0;
	var panel=0;
	var tegla=0;
	var haz=0;
	var villa=0;


	idx=document[fname].city.selectedIndex;
	city_id=document[fname].city.options[idx].value;

	if(document[fname].rent.value!='')
		rent=document[fname].rent.value;
			
	if(city_id=='14')
	{		
		bplen =document[fname].budapest.length;
		bpi = 0;

		for (bpi = 0; bpi < bplen; bpi++)
		{
			if (document[fname].budapest[bpi].selected)
			{
				cval = cval + document[fname].budapest[bpi].value + ";";
			} 
		}
	}

	if(city_id=='15')
	{			
		bolen =document[fname].budaors.length;
		boi = 0;

		for (boi = 0; boi < bolen; boi++)
		{
			if (document[fname].budaors[boi].selected)
			{
				cval = cval + document[fname].budaors[boi].value + ";";
			} 
		}
	}
	
	if(cval=='')
		cval=0;
	if(document[fname].panel.checked)
		panel=1;
	if(document[fname].tegla.checked)
		tegla=1;
	if(document[fname].haz.checked)
		haz=1;
	if(document[fname].villa.checked)
		villa=1;
	
	document.location=site_url+fname+'/'+site_lang+'/search/main/'+city_id+'/'+cval+'/'+rent+'/'+panel+'/'+tegla+'/'+haz+'/'+villa+'/';

}


		function city_submit(fname,cc)
		{

			idx=document["subsearch"+cc].city.selectedIndex;
			val=document["subsearch"+cc].city.options[idx].value;
			
			if(val=='14')
			{					
				bplen =document["subsearch"+cc].budapest.length;
				bpi = 0;
				bpc= "";

				for (bpi = 0; bpi < bplen; bpi++)
				{
					if (document["subsearch"+cc].budapest[bpi].selected)
					{
						bpc = bpc + document["subsearch"+cc].budapest[bpi].value + ";";
					} 
				}
				document["subsearch"+cc].cval.value=bpc;

				return true;
			}

			if(val=='15')
			{					
				bolen =document["subsearch"+cc].budaors.length;
				boi = 0;
				boc= "";

				for (boi = 0; boi < bolen; boi++)
				{
					if (document["subsearch"+cc].budaors[boi].selected)
					{
						boc = boc + document["subsearch"+cc].budaors[boi].value + ";";
					} 
				}
				document["subsearch"+cc].cval.value=boc;

				return true;
			}


		}

		function null_city()
		{

			for(i=1;i<2;i++)
			{
				sc = document.getElementById('sub_city'+i);
				sc.style.display = 'block';
			}
		}


		function ch_city(fname)
		{
		
			idx=document[fname].city.selectedIndex;
			val=document[fname].city.options[idx].value;
			
			if(val=='14' || val=='15')
			{
				if(val=='14')
				{
					SwitchContent('bors','sub_city','none');
					SwitchContent('bpest','sub_city','block');
				}
				else
				{
					SwitchContent('bpest','sub_city','none');
					SwitchContent('bors','sub_city','block');
				}
			}
			else
			{
				SwitchContent('bpest','sub_city','none');
				SwitchContent('bors','sub_city','none');
				SwitchContent('empty','sub_city','block');
			}
		}


		function set_district(fname,sname)
		{
		   idx=sname.selectedIndex;
			val=sname.options[idx].value;
			
			document[fname].district.value=val;
		}


function side_search(id)
{
	document.forms['ssearch'].city.value=id;
	document.forms['ssearch'].submit();
}

function viewpic(url,sx,sy,capt) {
	params="left=10,top=10,width="+sx+",height="+sy;
	h=window.open("","",params);
	with(h.document){
		open();
		writeln("<title>"+capt+"</title>");
		writeln("<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onkeypress='if(event.keyCode==27)window.close();'>");
		writeln("<img src='"+url+"' alt='"+capt+"'>");
		close();
	}
  }

function owin(url2,params)
{
	back=window.open(url2,'x',params);
}


	function set_horoscope()
	{

		var astro=new Array();
		astro['aries']=['Kos','Már. 21. - Ápr. 20.'];
		astro['taurus']=['Bika','Ápr. 21. - Máj. 20.'];
		astro['gemini']=['Ikrek','Máj. 21. - Jún. 21.'];
		astro['cancer']=['Rák','Jún. 22. - Júl. 22.'];
		astro['leo']=['Oroszlán','Júl. 23. - Aug. 23.'];
		astro['virgo']=['Szűz','Aug. 23 - Szept. 22.'];
		astro['libra']=['Mérleg','Szept. 24. - Okt. 23.'];
		astro['scorpio']=['Skorpió','Okt. 24. - Nov. 23.'];
		astro['sagittarius']=['Nyilas','Nov. 24. - Dec. 21.'];
		astro['capricorn']=['Bak','Dec. 22. - Jan. 19.'];
		astro['aquarius']=['Vízöntő','Jan. 20. - Feb. 20.'];
		astro['pisces']=['Halak','Feb. 21 - Már. 20'];

		idx=document.forms['hscope'].horoscope.selectedIndex;
		val=document.forms['hscope'].horoscope.options[idx].value;
	
		document.getElementById('htitle').innerHTML='<center><b>'+astro[val][0]+'</b><br>'+astro[val][1]+'</center>';
		document.getElementById('himg').src='http://astro.technetium.be/sign.png?'+val;
	
	}


function play_game(site,game,width,height)
{
	owin(site+'jatek/hu/data/'+game,'width='+width+',height='+height);
}