document.write("<script type='text/javascript' src='"+Path()+"/components/com_rbids/js/netaukciohaz.js'></scr"+"ipt>");

// var nyitott = new Array();
var torolni = new Array();

var b64str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"abcdefghijklmnopqrstuvwxyz"+"0123456789+/=";
var b64str_m = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"abcdefghijklmnopqrstuvwxyz"+"0123456789-_=";
// -lett a + helyett és _ a / helyett

function setGoogleMap(cim, call_form) {
  //szélesség meghatározása
  if (call_form != 0)
    var szelesseg=380;
   else
    var szelesseg=403;

  //CÍM KONVERZIÓJA
  //Ékezetes betuk cseréje
  cim=cim.replace(/[őóö]/ig, "o");
  cim=cim.replace(/[úűü]/ig, "u");
  cim=cim.replace(/á/ig, "a");
  cim=cim.replace(/é/ig, "e");
  cim=cim.replace(/í/ig, "i");    
  //space-ek cseréje "+"-ra  
  cim=cim.replace(/ /ig, "+");
    
  //google map image letöltése
  document.getElementById('google_map_div').innerHTML='<img border="0" src="http://maps.google.com/maps/api/staticmap?center='+cim+'&zoom=11&size='+szelesseg+'x200&maptype=roadmap&markers=size:mid%7Ccolor:0xFFFF00%7Clabel:I%7C'+cim+'&sensor=false" alt="" />';
}

function evalScript(scripts)
{ try
{ if(scripts != '')
{ var script = "";
scripts = scripts.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
                                 if (scripts !== null) script += arguments[1] + '\n';
                                  return '';});
if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
}
return false;
}
catch(e)
{ alert(e)
}
}

function base64enc(inp, m) {

 if (inp=="") return("");

 var b64ch=(m==1)?b64str:b64str_m;

 for (i=0;i<inp.length;i++)
 {
   //if (inp.charCodeAt(i)>255) alert("i:"+i+" code:"+inp.charCodeAt(i)+" ch:"+inp.charAt(i));
   if (inp.charCodeAt(i)>255) 
     alert("i:"+i+" code:"+inp.charCodeAt(i)+" code:"+inp.charCodeAt(i+1));
   //alert(inp.charCodeAt(i)+inp.charAt(i));
 }

 if (typeof(btoa)=="function") {
    alap=btoa(inp);
    if (m!=1) {
     alap=alap.replace(/\x2B/g,"-");
     alap=alap.replace(/\x2F/g,"_");}
     
    return alap;}

    var out = ""; //This is the output
    var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded
    var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes
    var i = 0; //Position counter

    do
    { //Set up the loop here
        chr1 = inp.charCodeAt(i++); //Grab the first byte
        chr2 = inp.charCodeAt(i++); //Grab the second byte
        chr3 = inp.charCodeAt(i++); //Grab the third byte

        //Here is the actual base64 encode part.
        //There really is only one way to do it.
        enc1 = chr1 >> 2;
        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
        enc4 = chr3 & 63;

        if (isNaN(chr2))
        {
          enc3 = enc4 = 64;
        }
         else if (isNaN(chr3))
         {
            enc4 = 64;
         }

        //Lets spit out the 4 encoded bytes
        out = out + b64ch.charAt(enc1) + b64ch.charAt(enc2) + b64ch.charAt(enc3) + b64ch.charAt(enc4);

        // OK, now clean out the variables used.
        chr1 = chr2 = chr3 = "";
        enc1 = enc2 = enc3 = enc4 = "";                                

    } while (i < inp.length); //And finish off the loop

    //Now return the encoded values.
    return out;
}

function GetAuctions_AJAX(cat_id, url, url2) {
  //cat_id-t jelen pillanatban nem használjuk, de jó ha itt van :)

  //FF-ben használható a ).text de IE alatt csak az ).innerHTML  
  if ((document.getElementById('active_menu') != null) && (document.getElementById('active_menu').innerHTML=="Kezdőlap")) {
    if (document.getElementById('content1') != null)
      document.getElementById('content1').style.display="block";      
    readFile1('kiemelt', url2);}
   else {
    if (document.getElementById('content1') != null)
      document.getElementById('content1').style.display="none";} 
      
//  if (document.getElementById('content') != null)
//    document.getElementById('content').style.display="block";
  readFile3('tartalom', url);
}

function showHideChildren(id, live_site, arrow_image, cc, task, kiemarv_count, Itemid) {          
  if (cc != "")
    if (document.getElementById('loading'+id) != null) 
      document.getElementById('loading'+id).innerHTML='<img src="'+Path()+'/components/com_rbids/gallery/images/loading_small_fb.gif">';

  readFile('Tree', "index2.php?option=com_rbids&task=mod_katlist&openCat="+id+"&no_html=1&Itemid="+Itemid);

  if (arrow_image!='nincs')
    document.getElementById(arrow_image).src=live_site+"/modules/rtreecat_js/images/arrow1.gif";
  if (cc != "") {
    document.getElementById(cc).style.color='blue';  

    if (document.getElementById('loading'+id) != null) 
      document.getElementById('loading'+id).innerHTML='<img src="'+Path()+'/components/com_rbids/gallery/images/loading_small_fb.gif">';            
  }  
  if (kiemarv_count != 0) {
    if (task != "mainpage") {
      if (document.getElementById('content') != null)
        document.getElementById('content').style.display="block";}
     else {
      if (document.getElementById('cse-search-results')==null)      
        if (document.getElementById('content') != null)
          document.getElementById('content').style.display="none";}
  }                       
}

function showSubCat(element,lvl, color) {
	id = element.options[element.selectedIndex].value;
	if (color != null)
	  color_url='&color='+color;
	 else
    color_url='';
    
	url = "index2.php?option=com_rbids&task=getKatsAJAX&parent="+id+"&no_html=1&Itemid=84&lvl="+lvl+color_url;
// 	alert(element.options[element.selectedIndex].value);

	readFile('subKategoriak'+lvl,url);                                          
}

function showSubCat_search(element,lvl) {
	id = element.options[element.selectedIndex].value;
	url = "index2.php?option=com_rbids&task=getKatsAJAX_search&parent="+id+"&no_html=1&Itemid=84&lvl="+lvl;
// 	alert(element.options[element.selectedIndex].value);

	readFile('subKategoriak_search'+lvl,url);
}

function showSubCat_myauctions_search(element,lvl) {
	id = element.options[element.selectedIndex].value;
	url = "index2.php?option=com_rbids&task=getKatsAJAX_myauctions_search&parent="+id+"&no_html=1&Itemid=84&lvl="+lvl;

	readFile('subKategoriak_myauctions_search'+lvl,url);  	
}

function delBlue() {
  element1=document.getElementById('Tree');
  for (var i0=0; i0<element1.childNodes.length; i0++) {
      if (element1.childNodes[i0].nodeName == 'SPAN') 
        element1.childNodes[i0].style.color='';
		  if (element1.childNodes[i0].nodeName == 'DIV') {		  
        for (var i1=0; i1<element1.childNodes[i0].childNodes.length; i1++) {	
            if (element1.childNodes[i0].childNodes[i1].nodeName == 'SPAN') 
              element1.childNodes[i0].childNodes[i1].style.color='';
      	    if (element1.childNodes[i0].childNodes[i1].nodeName == 'DIV') {
              for (var i2=0; i2<element1.childNodes[i0].childNodes[i1].childNodes.length; i2++) { 	
                  if (element1.childNodes[i0].childNodes[i1].childNodes[i2].nodeName == 'SPAN') 
                    element1.childNodes[i0].childNodes[i1].childNodes[i2].style.color='';
                  if (element1.childNodes[i0].childNodes[i1].childNodes[i2].nodeName == 'DIV') {
                    for (var i3=0; i3<element1.childNodes[i0].childNodes[i1].childNodes[i2].childNodes.length; i3++) {
                        if (element1.childNodes[i0].childNodes[i1].childNodes[i2].childNodes[i3].nodeName == 'SPAN')                      
                          element1.childNodes[i0].childNodes[i1].childNodes[i2].childNodes[i3].style.color='';                            
                        if (element1.childNodes[i0].childNodes[i1].childNodes[i2].childNodes[i3].nodeName == 'DIV')
                          element1.childNodes[i0].childNodes[i1].childNodes[i2].childNodes[i3].childNodes[0].style.color='';                                                                                                                           
                    }//for-3
                  }//if-2
              }//for-2     
            }//if-1
        }//for-1
      }//if-0
  }//for-0
}

function hideShowElements(live_site, element, id) {

  if (document.getElementById('loading'+id) != null) 
    document.getElementById('loading'+id).innerHTML='<img src="'+Path()+'/components/com_rbids/gallery/images/loading_small_fb.gif">';
   
  while(element.nextSibling) {
		element = element.nextSibling;
		if (element.style.display=="none") {
      element.style.display="block";
      document.getElementById('pic'+id).src=live_site+"/modules/rtreecat_js/images/arrow1.gif";}
		 else {
      element.style.display="none";
      document.getElementById('pic'+id).src=live_site+"/modules/rtreecat_js/images/arrow2.gif";}
	}	
}

// pár kedvenc függvényem

function removeElement(parentid, element) {
	ClearElement(element);
	parentid.removeChild(element);
}

function MakeCaller(func,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) {
	return function(){func(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);};
}

function AppendElement(parent,elementType,properties) {
	var element=document.createElement(elementType);
	for(property in properties)
		if(property=='style') {
			for(nestedProperty in properties[property]) element.style[nestedProperty]=properties['style'][nestedProperty];
		}
		else element[property]=properties[property];
	parent.appendChild(element);
	return element;
}

function ClearElement(element) {
	while(element.firstChild!=null){
		ClearElement(element.firstChild);
		element.removeChild(element.firstChild);
	}
}

function pause(millis)  {
	var date = new Date();
	var curDate = null;

	do {
		curDate = new Date();
	} while(curDate-date < millis);
}

// AJAX függvények //

function newXmlHTTP() {                               
	var xmlHttp;
	try { xmlHttp=new XMLHttpRequest(); }
	catch (e) {
		try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");  }
		catch (e) {
			try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
      			catch (e) {
				alert("Az Ön böngészője nem támogatja az AJAX technológiát!");
				return false;
			}
		}
	}
	return xmlHttp;
}

function Load_Kategoriafa_Ajax(HTML_Element, url) { 
  xmlhttp=newXmlHTTP();
  xmlhttp.open("GET", url+"&aid="+Math.random(), true);
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {     
      if (document.getElementById(HTML_Element) != null) {
        document.getElementById(HTML_Element).innerHTML=xmlhttp.responseText;
      }  
    }      
  }
  xmlhttp.send(null);
}

function Load_globalSearch_Ajax(HTML_Element, url) { 
  xmlhttp1=newXmlHTTP();
  xmlhttp1.open("GET", url+"&aid="+Math.random(), true);
  xmlhttp1.onreadystatechange=function() {
    if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200) {    
      if (document.getElementById(HTML_Element) != null) {
        document.getElementById(HTML_Element).innerHTML=xmlhttp1.responseText;
        
      	$(".btn-slide").click(function() {                  
      		$(this).toggleClass("active");                                    
          $('.slide').toggleClass("active_a");
          $("#panel").slideToggle("slow");          
          return false;       
        });
      
      	$('#end_date_tol').datepicker({                                                       
            showOn: 'button', 
            buttonImage: Path()+'/components/com_rbids/jquery-ui-1.7.2.custom/images/calendar_red.gif', 
            buttonImageOnly: true,                    
            showMonthAfterYear: true,
            showButtonPanel: true
      	});
      
      	$('#end_date_ig').datepicker({
            showOn: 'button', 
            buttonImage: Path()+'/components/com_rbids/jquery-ui-1.7.2.custom/images/calendar_red.gif', 
            buttonImageOnly: true,                    
            showMonthAfterYear: true,
            showButtonPanel: true
      	});                        
      }  
    }        
  }                                                        
  xmlhttp1.send(null);
}

function getAJAX_Answer(url) {
	xmlHttp = newXmlHTTP();  	
	xmlHttp.open("GET", url, false);                               
	xmlHttp.send(null);                                     

	return xmlHttp.responseText;
}

function getFile(file) {
	xmlHttp = newXmlHTTP();
	xmlHttp.open("GET",file,false);                               
	xmlHttp.send(null);                                     
	var td = eval(xmlHttp.responseText);
	
	return td;
}                                                                
                                                        
function readFile(id, file) {
  var xmlHttp = newXmlHTTP();
	xmlHttp.open("GET",file,false);
	xmlHttp.send(null);
	if (document.getElementById(id))         
    document.getElementById(id).innerHTML=xmlHttp.responseText;      
   else
    id.innerHTML = xmlHttp.responseText;        
}

function readFile3(id, file) {
  var xmlHttp = newXmlHTTP();
	xmlHttp.open("GET",file,false);
	xmlHttp.send(null);
	if (document.getElementById(id))         
    document.getElementById(id).innerHTML=xmlHttp.responseText;      
   else
    id.innerHTML = xmlHttp.responseText;
  evalScript(xmlHttp.responseText);        
}

function readFile1(id, file){
  var xmlHttp = newXmlHTTP();
	xmlHttp.open("GET",file,false);
	xmlHttp.send(null);
	if (document.getElementById(id)) {        
    document.getElementById(id).innerHTML=xmlHttp.responseText;    
   
    if (document.getElementById('content1').style.display=='block') {
      var HTML_Code=xmlHttp.responseText;
      var beginer="<script>";
      var ender="</script>";
      var JS_Codes=new Array();     
      var position=HTML_Code.indexOf(beginer, 0);
      if (position!=-1) {
        var position_end=HTML_Code.indexOf(ender, position);                      
        if (position_end!=-1)        
          JS_Codes[0]=HTML_Code.substr(position+8, position_end-position-8);    
      }
      while (position!=-1) {         
        position=HTML_Code.indexOf(beginer, position+8);
        if (position!=-1) {
          position_end=HTML_Code.indexOf(ender, position);
          if (position_end!=-1)        
            JS_Codes[JS_Codes.length]=HTML_Code.substr(position+8, position_end-position-8);
        }
      }      
      for (i=0;i<JS_Codes.length;i++)
        eval(JS_Codes[i]);
    }
/*        if (document.getElementById('content1').style.display=='block') {
          var JS_Code=document.getElementById('FAAuctionName_0').innerHTML;
          var beginer=/<script>/i;                    
          JS_Code=JS_Code.replace(beginer, "");
          JS_Code=JS_Code.replace("</script>", ""); //Firefox miatt
          JS_Code=JS_Code.replace("</SCRIPT>", ""); //IE miatt                           
          eval(JS_Code);      
        }*/
  }
  else
   id.innerHTML = xmlHttp.responseText;  
}//readFile1

function loadXMLDoc(dname) {
	try { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } //Internet Explorer
	catch(e) {
		try { xmlDoc=document.implementation.createDocument("","",null); } //Firefox, Mozilla, Opera, etc.
		catch(e) { alert(e.message); }
  } //try-catch
  try {
	  xmlDoc.async=false;
	  xmlDoc.load(dname);
	  return(xmlDoc);
  } catch(e) { alert(e.message); }
  //try-catch
  return(null);
}//loacXMLDOC

