﻿var gname;
var gbracelet;
var gprice;
var price;
var gstyle="N/A";
var gsize="N/A";
var action;
var hold;
var productID;
//====================================================================================




    

//=========================================================================================
  
   function buy()
   {
    
  top.window.location.href="Information.aspx";
   var argument ="&action=" + encodeURI("buy");
   takeout(argument);
   
   }

//==================================================================================

 var xHRObject = false;
if (window.XMLHttpRequest)
{
xHRObject = new XMLHttpRequest();

}
else if (window.ActiveXObject)
{
xHRObject = new ActiveXObject("Microsoft.XMLHTTP");

}

//===================================================================================

function getData(){
          
    if ((xHRObject.readyState == 4)&& (xHRObject.status == 200))
    {
    
  
       
        if (window.ActiveXObject)
            {  
           
                var xml=xHRObject.responseXML;
            
             
                var xsl=new ActiveXObject("Microsoft.XMLDOM");
                xsl.async=false;
                xsl.load("Cart77test.xsl");
               
                var transform=xml.transformNode(xsl);
               

        
                 var spanb=document.getElementById("cartstuff");
          
              spanb.innerHTML=transform;
             
               
             }
             else
             {   
               
                var xsltProcessor=new XSLTProcessor();
                var xslStylesheet=document.implementation.createDocument("","doc",null);
                xslStylesheet.async=false;
                
                xslStylesheet.load("Cart77test.xsl");
                xsltProcessor.importStylesheet(xslStylesheet);
                var xmlDoc=xHRObject.responseXML;
                
                var fragment=xsltProcessor.transformToFragment(xmlDoc,document);
                
                document.getElementById("cartstuff").innerHTML=new XMLSerializer().serializeToString(fragment);
              
             }
          
     }}
//=============================================================================================

function add(action)
{

    
        var bodyform=getBody(action);
    
     
        
    


   
    xHRObject.open("POST","managecart.aspx",true);
    xHRObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xHRObject.onreadystatechange=getData;

 
    xHRObject.send(bodyform);
   window.scrollTo(0,0); 
   return false;
}

//=============================================================================================

  function getBody(action)
{   

   var name = gbracelet;
    var name = gname;
    var price =gprice;
    
     
     var argument ="needlepoint="
     argument += encodeURI("needlepoint");
     argument += "&name=";
     argument += encodeURI(name); 
     argument += "&style=";
     argument += encodeURI(""); 
     argument += "&size=";
     argument += encodeURI(""); 
     argument += "&price=";
     argument += encodeURI(price);
     argument += "&action=";
     argument += encodeURI(action);
     argument += "&productID="
     argument += encodeURI(productID); 
    
    
     return argument;
     }
     
     //===================================================================================
      function getShow(action)
{   

   var name = gbracelet;
    var name = gname;
    var price =gprice;
    
     
     var argument ="needlepoint="
     argument += encodeURI("needlepoint");
     argument += "&name=";
     argument += encodeURI(""); 
     argument += "&style=";
     argument += encodeURI(""); 
     argument += "&size=";
     argument += encodeURI(""); 
     argument += "&price=";
     argument += encodeURI("");
     argument += "&action=";
     argument += encodeURI(action); 
     argument += "&productID="
     argument += encodeURI(productID); 
    
     return argument;
     }
     //====================================================================================

 function allgone()
   {
  
   var argument ="&action=" + encodeURI("all");
   takeout(argument);
   }
   
//==========================================================================================




function content1(){
   
  
  document.getElementById("content").innerHTML="<b>Select Row To Remove Bracelet From Shopping Cart</b>";
  
   
   }
   
   
   //======================================================================================

function takeout(argument)
   {
      
    var bodyform=argument;
  
    xHRObject.open("POST","managecart.aspx",true);
    xHRObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xHRObject.onreadystatechange=getData;
   
    xHRObject.send(bodyform);
    
    window.scrollTo(0,0); 
   return false;
  
   }



//=======================================================================================

//function removal(message){
   function removal(x,z,zz,y){
 
 var newPara=document.getElementById('content');
 newPara.style.color = "white";

   newPara.innerHTML="You Have Removed <br /><b><span class='s1'>" + x + " @ " + y + " </span></b><br />From You Cart";
   
 //  var info = message.split(" ");
// alert(info[0]);
   var  argument = "&name=";
     argument += encodeURI(x); 
     argument += "&style=";
     argument += encodeURI(""); 
     argument += "&size=";
     argument += encodeURI(""); 
     argument += "&price=";
     argument += encodeURI(y);
     argument += "&action=";
     argument += encodeURI("remove"); 
      argument += "&productID="
     argument += encodeURI(productID); 
     
       takeout(argument);
 
   
   }
   
 //================================================================================= 
 
 
   function show(){
 

   var  argument = "&name=";
     argument += encodeURI(""); 
     argument += "&style=";
     argument += encodeURI(""); 
     argument += "&size=";
     argument += encodeURI(""); 
     argument += "&price=";
     argument += encodeURI("");
     argument += "&action=";
     argument += encodeURI("show"); 
      argument += "&productID="
     argument += encodeURI(productID); 
    
       takeout(argument);
 
   
   }
 
 

 

 
