/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
    try {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e2) {
      xmlHttp = false;
    }
  }
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

/*Put Item into comparation list*/
function AddToCompareList(section_id, id, is_compare){
  // Build the URL to connect to
  var url = "/dinamic/st_compare.php?action=putItem&section_id="+section_id+"&id="+id;
try {
  document.getElementById('t_compare').style.display = '';
  document.getElementById('t_compare2').style.display = '';
} catch (e) {}

  xmlHttp.open("GET", url, true);
  if(is_compare)
	  xmlHttp.onreadystatechange = updateCompare;
  xmlHttp.send(null);
}

function updateCompare() {
  if (xmlHttp.readyState == 4) {
      var response = xmlHttp.responseText;
	  if(response=='refresh')
		history.go(0);
    }
}

