var xmlHttp;



function vytvorXMLHttpRequest() {

  if (window.ActiveXObject) {

    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

  }

  else if (window.XMLHttpRequest) {

    xmlHttp = new XMLHttpRequest();

  }

}





function add_to_cart(addc)

{

	//alert('Omlouváme se, e-shop je ve výstavbě. Děkujeme za pochopení.');

	

	//return false;





  vytvorXMLHttpRequest();

  xmlHttp.onreadystatechange = zpracujAdd;

  xmlHttp.open("GET","http://www.fiona.cz/"+ addc, true);

  xmlHttp.send(null);

 

 

 return false; 

}





function zpracujAdd() 

{

  if(xmlHttp.readyState == 4) 

  {

    if(xmlHttp.status == 200) 

    {

        rep=xmlHttp.responseText.trim();

        el = document.getElementById('cart');

        el.innerHTML = rep; 

        alert("Zboží bylo přidáno do košíku.");

        

    }

}

}


function clicka() 

{

  vytvorXMLHttpRequest();

  xmlHttp.onreadystatechange = zpracuT;

  xmlHttp.open("GET", "http://www.fiona.cz/ajaxret?edit=1", true);

  xmlHttp.send(null);

}



function replacebad()

{



    var data = ''; 

  var f_el = document.frm.getElementsByTagName('input'); 

  var f_length = f_el.length; 

  for(i=0;i<f_length;i++)

  {  

     data += f_el[i].name + '=' + f_el[i].value + '&'; 

  } 



  vytvorXMLHttpRequest();

  xmlHttp.onreadystatechange = zpracu;

  xmlHttp.open("GET", "http://www.fiona.cz/ajaxret?replacebad=1&"+data, true);

  xmlHttp.send(null);



}



function ajaxl(addc)

{

  vytvorXMLHttpRequest();

  xmlHttp.open("GET", "http://www.fiona.cz/"+addc, true);

  xmlHttp.send(null);

 

 return false; 

}



function voteprod(idx,val)

{

  vytvorXMLHttpRequest();

  xmlHttp.onreadystatechange = getmsg;

  xmlHttp.open("GET", 'http://www.fiona.cz/ajaxret?vote=1&idx='+idx+'&val='+val, true);

  xmlHttp.send(null);

 

 return false; 

}



function getmsg() {

  if(xmlHttp.readyState == 4) {

    if(xmlHttp.status == 200) 

    {

	//	$('hodnoceniProduktu').innerHTML = xmlHttp.responseText;

        alert(xmlHttp.responseText);

    }    

 }

}



function zpracuT() {

  if(xmlHttp.readyState == 4) {

    if(xmlHttp.status == 200) 

    {

   

        

    }    

 }

}

function zpracu() {

  if(xmlHttp.readyState == 4) {

    if(xmlHttp.status == 200) 

    {

        $('wait').innerHTML="";

        alert("Nahrazeno + "+xmlHttp.responseText.trim()+" krat");

        

        

    }else

    {

      $('wait').innerHTML="Čekejte.....";

    

    }    

 }

}



function regNews()

{

  if (window.RegExp) { 

  		re = new RegExp("^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$"); 

        		if (!re.test(document.getElementById("form-email").value)) { 

        			window.alert("Emailová adresa nemá správný formát: "+document.getElementById("form-email").value); 

        			return false; 

        		} 

        	}





  vytvorXMLHttpRequest();

  xmlHttp.onreadystatechange = zpracujregNews;

  xmlHttp.open("GET", "http://www.fiona.cz/ajaxret?pnews="+self.document.forms.regNews.email.value, true);

  xmlHttp.send(null);

 

 

 return false; 

}





function zpracujregNews() 

{

  if(xmlHttp.readyState == 4) 

  {

    if(xmlHttp.status == 200) 

    {

        rq=xmlHttp.responseText.trim();

        if (rq == '0')

        {

            alert("Váš email byl již zaregistrován.");

        }

        

        if (rq == '1')

        {

            alert("Váš email byl zaregistrován.");

        }

        

        return false;



        

        

    }

}

}





var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-4485858-1");

pageTracker._initData();

pageTracker._trackPageview();


