

function set_honap(selected_elem, select_nev, select_ertek, lista_nev ){
    document.getElementById(select_nev).value = select_ertek;
    document.getElementById(lista_nev).style.display = 'none';
}
function lista_mutat(elem){
    if( !document.getElementById(elem).style.display  || document.getElementById(elem).style.display == 'none'){
        document.getElementById(elem).style.display = 'block';
    }
/*     else
        document.getElementById(elem).style.display = 'none'; */
}

function rejt(elem){
    document.getElementById(elem).style.display = 'none';
}

function check_ajanlat_urlap(szam){  
    x = parseInt(szam);
    if(isNaN(x)){
        return true;
    }
    else{
        alert('csak számot irhatsz ide');
        return false;
    }
/*     if(isNaN(szam)){
         return = true;
    }else{
        alert('csak számot irhatsz ide');
        return false;
    } */
}


var inputs; 
var imgFalse = '../images/false.png'; 
var imgTrue = '../images/true.png'; 
var imgRadioFalse = '../images/radio_uncheck.png'; 
var imgRadioTrue = '../images/radio_check.png'; 

var imgRadioFalse_szurke = '../images/radio_uncheck_szurke.png'; 
var imgRadioTrue_szurke = '../images/radio_check_szurke.png'; 


//this function runs when the page is loaded, put all your other onload stuff in here too. 
function init() {
    replaceChecks();
} 

function replaceChecks() { 
     
    //get all the input fields on the page 
    inputs = document.getElementsByTagName('input'); 

    //cycle trough the input fields 
    for(var i=0; i < inputs.length; i++) {

        //check if the input is a checkbox 
        
        if(inputs[i].getAttribute('type') == 'checkbox' || inputs[i].getAttribute('type') == 'radio') {
             
            //create a new image 
            var img = document.createElement('img'); 
             
            //check if the checkbox is checked 
            if(inputs[i].checked) {
                if(inputs[i].getAttribute('type') == 'radio'){
                    if(inputs[i].getAttribute('id') =='ajanlat_foglalas')
                        img.src = imgTrue; 
                    else
                        img.src = imgRadioTrue;                     
                }
                else
                    img.src = imgTrue; 
            } else {
                if(inputs[i].getAttribute('type') == 'radio'){
                    if(inputs[i].getAttribute('id') =='ajanlat_foglalas'){
                        img.src = imgFalse; 
                    }
                    else
                        img.src = imgRadioFalse; 
                }
                else
                    img.src = imgFalse; 
            } 

            //set image ID and onclick action 
            img.id = 'checkImage'+i; 
            //set image 
            img.onclick = new Function('checkChange('+i+')'); 
            //place image in front of the checkbox 
            inputs[i].parentNode.insertBefore(img, inputs[i]); 
             
            //hide the checkbox 
            inputs[i].style.display='none'; 
        }
    }
} 

//change the checkbox status and the replacement image 

function checkChange(i) {
    //get all the input fields on the page 
    inputs = document.getElementsByTagName('input'); 

    //cycle trough the input fields 
    
    for(var j=0; j < inputs.length; j++) {
            if(inputs[j].getAttribute('name') == inputs[i].getAttribute('name')){
                if(inputs[j].getAttribute('type') == 'radio')
                {
                    if(inputs[j].checked){
                        inputs[j].checked = false; 
                        if(inputs[j].getAttribute('name')=='ajanlat_foglalas')
                            document.getElementById('checkImage'+j).src=imgFalse; 
                        else
                            document.getElementById('checkImage'+j).src=imgRadioFalse; 
                     }
                }
            }
            
    }
    
    
     if(inputs[i].checked) {
        inputs[i].checked = ''; 
        if(inputs[i].getAttribute('type') == 'radio'){
        
            document.getElementById('checkImage'+i).src=imgRadioFalse; 
            
        }
        else
            document.getElementById('checkImage'+i).src=imgFalse; 
    } else {
        inputs[i].checked = 'checked'; 
        if(inputs[i].getAttribute('type') == 'radio'){
            if(inputs[i].getAttribute('id') =='ajanlat_foglalas'){
                    document.getElementById('checkImage'+i).src=imgTrue; 
                    if(inputs[i].getAttribute('value')=='igen')
                            document.getElementById('credi_card_box').style.display ='none';
                    if(inputs[i].getAttribute('value')=='nem')
                        document.getElementById('credi_card_box').style.display='block';
            }
            else
                    document.getElementById('checkImage'+i).src=imgRadioTrue; 
        }
        else
            document.getElementById('checkImage'+i).src=imgTrue; 
    }
    

}

 

//window.onload = init;

/******************/

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' : '' );
}
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);
    }
  }
}
