/*
 * Shopping Cart System Olive-Cart.
 * copyright (C) 2008-2009 Olive-Design, Corp.
 * link http://www.cart-ya.com/
 * package Olive-Cart
 * version 2.2.11
 *
 * This is the integration file for JavaScript.
/* $Id: cart.js  2009-01-28 15:10:03 $ */

function cartopen(){
	var url=CartUrl+'?step=2';
	var win1=window.open(url,"newopen","resizable=yes,directories=yes,menubar=yes,location=yes,status=yes,toolbar=yes,scrollbars=yes,width=700,height=600,screenX=600, screenY=100,left=500, top=100,",false);
	win1.window.focus();
}

function postIn(Number){
  var number = Number;
  var size = Number+'-size';
    if(document.getElementById(size)){
      var Size = document.getElementById(size).value;
      number+= Size;
    }
  var color = Number+'-color';
    if(document.getElementById(color)){
      var Color = document.getElementById(color).value;
      number+=Color;
    }
  var count = document.getElementById(Number).value; 
  var Post_data="step=1&number="+number+"&count="+count;
  CartIn(Post_data);
}
function CartIn(Post_data){
  httpObj = createXMLHttpRequest(displayData);
  if (httpObj){
    httpObj.open("POST",CartUrl,true);
    httpObj.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");
    httpObj.send(Post_data);
  }
}

function Onload(){
  var postdata='step=1';
  var postdata2='mode=message';
  httpObj = createXMLHttpRequest(displayData);
  httpObj2 = createXMLHttpRequest(displayData);
  if (httpObj){
    httpObj.open("POST",CartUrl,true);
    httpObj.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");
    httpObj.send(postdata);
  }
  if (httpObj2){
    httpObj2.open("POST",MypageUrl,true);
    httpObj2.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");
    httpObj2.send(postdata2);
  }

}


function displayData()
{
  if ((httpObj.readyState == 4) && (httpObj.status == 200)){
    document.getElementById("maincart").innerHTML= httpObj.responseText;
  }
  if ((httpObj2.readyState == 4) && (httpObj2.status == 200)){
    document.getElementById("userlogin").innerHTML= httpObj2.responseText;
  }
}


function createXMLHttpRequest(object)
{
  var XMLhttpObject = null;
  try{
    XMLhttpObject = new XMLHttpRequest();
  }catch(e){
    try{
      XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        return null;
      }
    }
  }
  if (XMLhttpObject){
     XMLhttpObject.onreadystatechange = object;
     return XMLhttpObject;
  }
}

