﻿// JScript 文件
var All_productprice1=0.00 
function OpenMoreInfoChooseWindow (_url) {	
	var winplay = window.open(_url, 'SelectProduct', "width=800, height=400, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no ,left=0 ,top=0");
	if (parseInt(navigator.appVersion) >= 4) { winplay.window.focus(); }
	 return false;
  } 
  function OpenMoreInfoChooseWindowAdmin (_url) {	
	var winplay = window.open(_url, 'SelectProduct', "width=900, height=600, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no ,left=0 ,top=0");
	if (parseInt(navigator.appVersion) >= 4) { winplay.window.focus(); }
	 return false;
  }  
function Uni_change(str1,str2)
  {
  var pronub =document.getElementById("uni_"+str1);
  var proprice =document.getElementById("Sum_prict"+str1);
//  var ToalPr=eval("document.all.ProductToalPrice1");
//  ToalPr.innerHTML=
//  alert(ToalPr.value)
   
  var sumprice=eval(pronub.value)*eval(proprice.value);

  var headif2 = document.getElementById("Allproductprice1");
  var headif1 = document.getElementById("SingleSumPrice"+str1);
  All_productprice1=eval(headif2.innerHTML).toFixed(2)-eval(headif1.innerHTML).toFixed(2);
  headif1.innerHTML=sumprice.toFixed(2);
  All_productprice1=eval(All_productprice1.toFixed(2))+eval(sumprice.toFixed(2));
  headif2.innerHTML=All_productprice1.toFixed(2);
  
  var url="shoppingcardpross.aspx"
  var poststr="productid="+str2+"&nuber="+eval(pronub.value)
  SendData(url,poststr,str1,"")
  }
function Uni_Del(str,str1)
{
  var url="shoppingcardpross.aspx"
  var poststr="delete="+str
  var str2="delete"
  SendData(url,poststr,str1,str2)
}
function SendData(url,poststr,str1,str2)
{
var ajax= InitAjax();
  ajax.open("post", url, true); 
　//定义传输的文件HTTP头信息
　ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
　//发送POST数据
　ajax.send(poststr);
　//获取执行状态
  for (var i=0;i <100000;i++) //延时
     {
     i++;
     }
　ajax.onreadystatechange = function() 
　{ 
　　//如果执行状态成功，那么就把返回信息写到指定的层里
　　if (ajax.readyState == 4 && ajax.status == 200) 
　　{ 
　　    if(str2=="delete")
　　    {
          if (ajax.responseText!="Err")
           {
//            var headif2 = eval("document.all.Allproductprice1");
//            var headif1 = eval("document.all.SingleSumPrice"+str1);
//            All_productprice1=eval(headif2.innerHTML)-eval(headif1.innerHTML);
//            headif2.innerHTML=All_productprice1;
//　　       var tr = eval("document.all.tr_"+str1);
//　　       tr.style.display='none';
           location.href("cartview.aspx") 
           }
        }
　　} 
　}

}
function chocksub()
{
var total=document.getElementById("Allproductprice1");
window.location="https://www.aicmicro.com/Checkpro.aspx?Price="+total.innerHTML;
//location.href('https://www.aicmicro.com/Checkpro.aspx?Price='+total.innerHTML);
//  if (adminhave=="True")
//   {
 //window.location="Checkpro.aspx?Price="+total.innerHTML
//   } 
//   else
//  {
//     window.location="Account_Login.aspx"
//  }
}
function GetUPSP()
{
 
  var zipcode =document.getElementById("ZIP_Postal_Code")
   if (zipcode.value.length==5) 
   {
    var infostr=document.getElementById("info1")
     infostr.innerHTML=""
    infostr.innerHTML="&nbsp&nbsp<font color='red' >loading......</font>"
     var ajax =InitAjax();
     var url="NetFreightPro.aspx"
     ajax.open("POST", url, true); 
     ajax.setRequestHeader("content-type","application/x-www-form-urlencoded");
     ajax.send("zipcode="+zipcode.value)
     ajax.onreadystatechange=function()
       {
       　if (ajax.readyState == 4 && ajax.status == 200) 
　　         { 
　　           var url="showModalDialog.aspx?"+ajax.responseText;
　　            location=url
　　          // var winplay =window.showModalDialog(url,'','dialogHeight:50px;dialogwidth=600px;status=no;help=no;');
　　          // var winplay = window.open(url, 'MoreInfo', "width=700, height=40, channelmode=no,top=500,left=400,location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes");
           	//if (parseInt(navigator.appVersion) >= 4) { winplay.window.focus(); }
　　          // window.open(url, 'MoreInfo', "width=500, height=50, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no")
　           } 
       }
            //var url="NetFreightPro.aspx?zipcode="+zipcode.value
           //var winplay = window.open(url, 'MoreInfo', "width=500, height=50, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes");
          //if (parseInt(navigator.appVersion) >= 4) 
         //{ winplay.window.focus(); }
      
   }
   else
   {
　  alert('please reapet input The Zip/Code'); 
   } 
}
function Go_To_Cart(str)
  {
  var ajax =InitAjax();
  var str1=str.split("?");
     ajax.open("POST", str1[0], true); 
     ajax.setRequestHeader("content-type","application/x-www-form-urlencoded");
     ajax.send(str1[1])
     ajax.onreadystatechange=function()
       {
       　if (ajax.readyState == 4 && ajax.status == 200) 
　　         { 
　　           if (ajax.responseText=="Add to cart")
　　           {
　　          parent.window.location='cartview.aspx';
　　           }
　　           else
　　           {
　　            alert(ajax.responseText)
　　           }
　           } 
       }

  }
