function set_warning(pid)
{  
  var xmlHttp;
  var price,email; 


  price=document.getElementById('pw_price').value;
  email=document.getElementById('pw_email').value;

  document.getElementById('warning_div').innerHTML="";

    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('warning_div').innerHTML=xmlHttp.responseText;
        }
      }
    var rn=Math.floor(Math.random()*1000000);
    xmlHttp.open("GET","/ajax/set_price.php?pid="+pid+"&email="+email+"&price="+price+"&rn="+rn,true);
    xmlHttp.send(null);  

}

function get_search(group,c1,c2,c3,scat,mid,gid)
{  
  var xmlHttp;

  document.getElementById('search_div').innerHTML="kis türelmet...";

  if(gid>0) scat=0;
    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('search_div').innerHTML=xmlHttp.responseText;
        }
      }

    var rn=Math.floor(Math.random()*1000000);
    xmlHttp.open("GET","/ajax/get_search.php?group="+group+"&c1="+c1+"&c2="+c2+"&c3="+c3+"&searchcat="+scat+"&gid="+gid+"&mid="+mid+"&rn="+rn,true);
    xmlHttp.send(null);  

}

function get_popular_products(cid,mid)
{  
  var xmlHttp;

  if(!cid) cid="0";

//  document.getElementById('popular_div').innerHTML="";

    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('popular_div').innerHTML="";
          document.getElementById('popular_div').innerHTML=xmlHttp.responseText;
        }
      }
    var rn=Math.floor(Math.random()*1000000);

    xmlHttp.open("GET","/ajax/get_popular_products.php?cid="+cid+"&mid="+mid+"&rn="+rn,true);
    xmlHttp.send(null);  

}

function get_popular_products(cid,mid)
{  
  var xmlHttp;

  if(!cid) cid="0";

//  document.getElementById('popular_div').innerHTML="";

    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('popular_div').innerHTML="";
          document.getElementById('popular_div').innerHTML=xmlHttp.responseText;
        }
      }
    var rn=Math.floor(Math.random()*1000000);

    xmlHttp.open("GET","/ajax/get_popular_products.php?cid="+cid+"&mid="+mid+"&rn="+rn,true);
    xmlHttp.send(null);  

}

function eki()
{
  var xmlHttp;
  var name;
  var email;
  var message;
  var p_id;
  var v_id;
  var type=0;
  var vendor;
  var price=0;
  var transport;

  name=document.send_form.fullname.value;
  email=document.send_form.email.value;
  message=document.send_form.message.value;
  vendor=document.send_form.vendor.value;
  price=document.send_form.price.value;
  transport=document.send_form.transport.value;
  p_name=document.send_form.p_name.value;
  p_id=document.send_form.p_id.value;
  v_id=document.send_form.v_id.value;

  var radioObj=document.send_form.problemtype;
  var radioLength = document.send_form.problemtype.length;
  if(radioLength == undefined)
	if(radioObj.checked)
	    return radioObj.value;
	else
	    return "";
  for(var i = 0; i < radioLength; i++) {
	if(radioObj[i].checked) {
	    type=radioObj[i].value;
	}
  }


  if(!name){ alert('Meg kell adnia a nevét!'); return false; }
  if(!email){ alert('Meg kell adnia az e-mail címét!'); return false; }
  if(!message){ alert('Nem írt üzenetet!'); return false; }
  if(!type){ alert('Nem adta meg a probléma típusát'); return false; }

  document.getElementById('sender_form').innerHTML="kis türelmet...";
    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('sender_form').innerHTML=xmlHttp.responseText;
        }
      }

    var rn=Math.floor(Math.random()*1000000);
    xmlHttp.open("GET","/ajax/send_message.php?fullname="+name+"&email="+email+"&p_id="+p_id+"&p_name="+p_name+"&message="+message+"&v_id="+v_id+"&type="+type+"&vendor="+vendor+"&price="+price+"&transport="+transport+"&rn="+rn,true);
    xmlHttp.send(null);  

}

function send_vote(vid,rate,vtype)
{  
  var xmlHttp;

    
  try
    {    
     // Firefox, Opera 8.0+, Safari    
     xmlHttp=new XMLHttpRequest();    
    }
  catch (e)
    {
      // Internet Explorer    
      try
        {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      
      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
       }    
     }

    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
          document.getElementById('voter_div'+vtype).innerHTML="";
          document.getElementById('voter_div'+vtype).innerHTML=xmlHttp.responseText;
        }
      }
    var rn=Math.floor(Math.random()*1000000);

    xmlHttp.open("GET","/ajax/send_vote.php?vid="+vid+"&rate="+rate+"&vtype="+vtype+"&rn="+rn,true);
    xmlHttp.send(null);  

}
