var req;
var position;
function add_products(id, oscid, pos) {
  if(oscid){
	 oscids = '&osCsid='+oscid;
  }else{
	  oscids = '';
  }
  
  position = pos;
  pqty = document.getElementById('qty'+position).value;
  var url="add.php?id="+id+"&pqnt="+pqty+oscids;
  add_products2(id, oscids, position); 
   // Internet Explorer
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req = null; } 
   }

   // Mozailla/Safari 
   if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } 

   // Call the processChange() function when the page has loaded 
   if (req != null) {
	  document.getElementById('xajaxanimat'+pos).style.display = "";
      req.onreadystatechange = processChange; 
      req.open("GET", url, true); 
      req.send(null); 
   } 
}

function processChange() { 
   // The page has loaded and the HTTP status code is 200 OK 
   if (req.readyState == 4 && req.status == 200) { 
      // Write the contents of this URL to the searchResult layer 
      getObject("lishshow").innerHTML = req.responseText;
		  document.getElementById('xajaxanimat'+position).style.display = "none";
		  document.getElementById('xcartadded'+position).style.display = "";
   } 
}

function getObject(name) { 
   var ns4 = (document.layers) ? true : false; 
   var w3c = (document.getElementById) ? true : false; 
   var ie4 = (document.all) ? true : false; 

   if (ns4) return eval('document.' + name); 
   if (w3c) return document.getElementById(name); 
   if (ie4) return eval('document.all.' + name); 
   return false; 
}

var req2;
function add_products2(id, oscid, position) {
  
  pqty = document.getElementById('qty'+position).value;
   var url="add2.php?id="+id+"&pqnt="+pqty+oscid;

   // Internet Explorer
   try { req2 = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req2 = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req2 = null; } 
   } 

   // Mozailla/Safari 
   if (!req2 && typeof XMLHttpRequest != "undefined") { req2 = new XMLHttpRequest(); } 

   // Call the processChange() function when the page has loaded 
   if (req2 != null) {
      req2.onreadystatechange = processChange2; 
      req2.open("GET", url, true); 
      req2.send(null); 
   } 
}

function processChange2() { 
   // The page has loaded and the HTTP status code is 200 OK 
   if (req2.readyState == 4 && req2.status == 200) { 
      // Write the contents of this URL to the searchResult layer 
      getObject("cartbox2").innerHTML = req2.responseText;
   } 
}

function product_page(pg, oscid) {
  if(oscid){
	 oscids = '&osCsid='+oscid;
  }else{
	  oscids = '';
  }
   var url="ajax_new_products.php?page="+pg+oscids;

   // Internet Explorer
   try { req2 = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req2 = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req2 = null; } 
   } 

   // Mozailla/Safari 
   if (!req2 && typeof XMLHttpRequest != "undefined") { req2 = new XMLHttpRequest(); } 

   // Call the processChange() function when the page has loaded 
   if (req2 != null) {
	  document.getElementById('prodanimat').style.display = "";
      req2.onreadystatechange = processChangePage; 
      req2.open("GET", url, true); 
      req2.send(null); 
   } 
}

function processChangePage() { 
   // The page has loaded and the HTTP status code is 200 OK 
   if (req2.readyState == 4 && req2.status == 200) { 
      // Write the contents of this URL to the searchResult layer
      getObjectPage("pageref").innerHTML = req2.responseText;
	  document.getElementById('prodanimat').style.display = "none";
   } 
}

function getObjectPage(name) { 
   var ns4 = (document.layers) ? true : false; 
   var w3c = (document.getElementById) ? true : false; 
   var ie4 = (document.all) ? true : false; 

   if (ns4) return eval('document.' + name); 
   if (w3c) return document.getElementById(name); 
   if (ie4) return eval('document.all.' + name); 
   return false; 
}

function fec_product_page(pg, oscid) {
  if(oscid){
	 oscids = '&osCsid='+oscid;
  }else{
	  oscids = '';
  }
   var url="ajax_featured.php?page="+pg+oscids;

   // Internet Explorer
   try { req2 = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req2 = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req2 = null; } 
   } 

   // Mozailla/Safari 
   if (!req2 && typeof XMLHttpRequest != "undefined") { req2 = new XMLHttpRequest(); } 

   // Call the processChange() function when the page has loaded 
   if (req2 != null) {
	  document.getElementById('fecprodanimat').style.display = "";
      req2.onreadystatechange = processChangeFec; 
      req2.open("GET", url, true); 
      req2.send(null); 
   } 
}

function processChangeFec() { 
   // The page has loaded and the HTTP status code is 200 OK 
   if (req2.readyState == 4 && req2.status == 200) { 
      // Write the contents of this URL to the searchResult layer
      getObjectPage("fecpageref").innerHTML = req2.responseText;
	  document.getElementById('fecprodanimat').style.display = "none";
   } 
}

function ajax_also(pg, pid, oscid) {
  if(oscid){
	 oscids = '&osCsid='+oscid;
  }else{
	  oscids = '';
  }
   var url="ajax_also_pur.php?page="+pg+"&products_id="+pid+oscids;

   // Internet Explorer
   try { req2 = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req2 = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req2 = null; } 
   } 

   // Mozailla/Safari 
   if (!req2 && typeof XMLHttpRequest != "undefined") { req2 = new XMLHttpRequest(); } 

   // Call the processChange() function when the page has loaded 
   if (req2 != null) {
	  document.getElementById('alsoprodanimat').style.display = "";
      req2.onreadystatechange = processChangeAlso; 
      req2.open("GET", url, true); 
      req2.send(null); 
   } 
}

function processChangeAlso() { 
   // The page has loaded and the HTTP status code is 200 OK 
   if (req2.readyState == 4 && req2.status == 200) { 
      // Write the contents of this URL to the searchResult layer
      getObjectPage("alsopageref").innerHTML = req2.responseText;
	  document.getElementById('alsoprodanimat').style.display = "none";
   } 
}