var xmlhttp_obj = false;
//create the XMLHttpRequest
function city_xmlhttp(){  
 if (window.XMLHttpRequest){ // if Mozilla, Safari etc  
  xmlhttp_obj = new XMLHttpRequest();  
 }else if (window.ActiveXObject){ // if IE  
  try{  
   xmlhttp_obj = new ActiveXObject("Msxml2.XMLHTTP");  
  }catch (e){  
   try{  
    xmlhttp_obj = new ActiveXObject("Microsoft.XMLHTTP");  
   }catch (e){  
   }  
  }  
 }else{  
  xmlhttp_obj = false;  
 }  
 return xmlhttp_obj;  
}   //get content via GET  

function pic_replace(data,data2)
{
    document.getElementById('fenykep').src = "images/galeria/big/" + data;
    document.getElementById('text').innerHTML = data2;    
}
function insertsmiley(smiley) {
	var text = document.newpost.message.value;
	text = text+' '+smiley+' ';
	document.newpost.message.value = text;
	document.newpost.message.focus();
}
function toggle(id) {
  var e = document.getElementById(id)
/*	for (var x = 1; x <= osszes; x++)
	{
  		var f = document.getElementById(x);
  		f.style.display="none";
	}*/
	e.style.display = (e.style.display != 'none' ? 'none' : '' );
	if (e.style.display == '')
		document.getElementById('kibont_'+id).src='images/minus.gif';
	else
		document.getElementById('kibont_'+id).src='images/plus.gif';	
		
}
function toggle_left(id1) {
  var e = document.getElementById(id1);
	e.style.display = (e.style.display != 'none' ? 'none' : '' );
}
function pic_open(data,data1,data2)
{
    window.open ('pic_big.php?id=' + data + '', 'newwin', 'width='+data1+', height='+data2+', top=0, left=0');
}
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_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_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 change_prod_pic(adat)
{
    document.getElementById('prodpic').src="images/termekek/big/" + adat;
}
var aktualis=0
function prev()
{
    aktualis--;
    if( aktualis<0 )
    {
    	aktualis=masodik.length-1;
    }
    document.getElementById('fenykep').src="images/galeria/big/" + masodik[aktualis];
    document.getElementById('text').innerHTML=masodik_text[aktualis];    
}
function next() {
    aktualis++;
    if( aktualis>=masodik.length )
    {
    	aktualis=0;
    }
    document.getElementById('fenykep').src="images/galeria/big/" + masodik[aktualis];
    document.getElementById('text').innerHTML=masodik_text[aktualis];    
}
function prev2()
{
    aktualis--;
    if( aktualis<0 )
    {
    	aktualis=masodik.length-1;
    }
    document.getElementById('prodpic').src="images/termekek/big/" + masodik[aktualis];
    document.getElementById('text').innerHTML=szamlalo[aktualis];    
}
function next2() {
    aktualis++;
    if( aktualis>=masodik.length )
    {
    	aktualis=0;
    }
    document.getElementById('prodpic').src="images/termekek/big/" + masodik[aktualis];
    document.getElementById('text').innerHTML=szamlalo[aktualis];    
}
function replace(name)
{
    document.getElementById('map').src="images/" + name;
}
function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.rendbox)
        target=document.images.rendbox;
      if (document.all && document.getElementById("rendbox"))
        target=document.getElementById("rendbox");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        target.src=dimages[nextImage].src;
        curImage=nextImage;
      }

      setTimeout("swapPicture()", 4000);

    }
    else
    {
      setTimeout("swapPicture()", 500);
    }
  }
}
function confirmation(URL)
{
if (confirm("Biztos, hogy törölni akarja?\n"))
{location = String(URL);}
}

function getpersons(num,meddig){  
  if(num!=0){
  var xmlhttp_obj = city_xmlhttp();  
  document.getElementById('person').style.display="";
  document.getElementById('person').innerHTML = '<p align="center"><img src="images/loading.gif"></p>';
  //document.getElementById(containerid).innerHTML = document.getElementById('city').options[document.getElementById('city').options.length] = new Option('...adatok betöltése...','0');   
  xmlhttp_obj.onreadystatechange=function(){  
         loadpage(xmlhttp_obj, 'person');  
         }  
  xmlhttp_obj.open('GET', 'main/getpersons.php?n='+num+'&m='+meddig, true);  
  xmlhttp_obj.send(null);
  }
  else document.getElementById('person').style.display="none";  
}

function loadpage(xmlhttp_obj, containerid){  
 if ( xmlhttp_obj.readyState == 4 && xmlhttp_obj.status == 200 ){  
  document.getElementById(containerid).innerHTML = xmlhttp_obj.responseText;  
 }  
}   
function popup(){
    window.open ("http://www.lottica.hu/rendezvenyek.html", "mywindow","menubar=1,resizable=1,width=690,height=540"); 
}
