// JavaScript Document
var xmlhttp;
var divid;
var divId2;
var divId3;
function loadXMLDoc(url)
{
xmlhttp=null;
//alert(divid);
//alert(url)
//document.getElementById(divid).innerHTML='';
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}
function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  	  //alert(xmlhttp.responseText);
	  if (xmlhttp.status==200)
		{// 200 = "OK"
			var mySplitResult  = xmlhttp.responseText.split("<>",2);
			document.getElementById(divid).innerHTML = mySplitResult[0];
			document.getElementById(divId2).innerHTML = mySplitResult[1];
			document.getElementById(divId3).innerHTML = mySplitResult[1];
		}
	  else
		{
		alert("Problem retrieving data:" + xmlhttp.statusText);
		}

  }
}

function changecurrency(strurl,pdivid,pdivid2,pdivid3)
{
	if(document.getElementById("currencysymbolfrom")==undefined)
	{return false;}
	strurl = strurl +	'?currencysymbolfrom=' + document.getElementById("currencysymbolfrom").value+'&currencyamountfrom='+ document.getElementById("currencyamountfrom").value+'&currencycodefrom='+ document.getElementById("currencycodefrom").value+'&affiliatefee='+document.getElementById("affiliatefee").value;
    divid = pdivid;
	divId2 = pdivid2;
	divId3 = pdivid3;
	loadXMLDoc(strurl)
}

function setsession(strurl,pdivid,pdivid2,pdivid3,currencyIdTo)
{
	strurl = strurl +	'?currencysymbolfrom=' + document.getElementById("currencysymbolfrom").value+'&currencyamountfrom='+ document.getElementById("currencyamountfrom").value+'&currencycodefrom='+ document.getElementById("currencycodefrom").value+'&currencyIdTo='+ currencyIdTo+'&affiliatefee='+document.getElementById("affiliatefee").value;
	divid = pdivid;
	divId2 = pdivid2;
	divId3 = pdivid3;
	loadXMLDoc(strurl)
}

function loadXMLDocStore(url,divid)
{
	var xmlhttp;
	var pdivid = divid;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById(pdivid).innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
	
function getProductSample(strurl,pdivid)
{
	loadXMLDocStore(strurl,pdivid)
}

function getSalesRank(strurl,pdivid)
{
	loadXMLDocStore(strurl,pdivid);
}
