var Ajax; 

function setupAjax() 
{ 
    if(window.ActiveXObject) 
        Ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
    else if(window.XMLHttpRequest) 
        Ajax = new XMLHttpRequest(); 
}

function hae_ostoskori() 
{ 
    setupAjax(); 
    Ajax.onreadystatechange = handleAjaxResponse; 
	Ajax.open("GET", "http://www.hoplaa.fi/ostoskori/avaa_kori", true); 
    Ajax.send(null); 
}


function lisaa_tuote_ostoskoriin(a, b) 
{ 
    setupAjax(); 
    Ajax.onreadystatechange = handleAjaxResponse; 
	Ajax.open("GET", "http://www.hoplaa.fi/ostoskori/lisaa_koriin/" + a + "/" + b, true); 
	Ajax.send(null); 
}

function handleAjaxResponse() 
{ 
	if(Ajax.readyState == 4) 
    { 
        if(Ajax.status == 200) 
        { 
	    	if(window.ActiveXObject) 
	    	{
	  	    	var selText = Ajax.responseText;
	            document.getElementById('basket').innerHTML="";
	            document.getElementById('basket').outerHTML= document.getElementById('basket').outerHTML.replace("</DIV>",selText + "</DIV>");
            }
            else
	            document.getElementById('basket').innerHTML=Ajax.responseText;
		} 
    } 
}
