﻿// JScript 文件
  
     function goto( prd , price)
    {
      var pdnumber = prd ;
      var prices = price ;
      var a =document.getElementById("select3").value
     location.href="/user/shoppingadd.aspx?productIDs="+pdnumber+"&quanty="+a+"&price="+prices;
      
    }
    
   function  Favarite (PID)
    {
     var datas ="pIDs="+PID ;
     var urs   ="/favort.aspx";
      $.ajax({ 
     type:"POST", 
     url: urs,
     data:datas ,
     beforeSend: function(XMLHttpRequest){ 
       
        },
     success:function(Message){  
         if(Message =="SUC")
         {
           alert("Erfolgreich hinzugefügt!");
         }
         else if(Message =="Login")
         {
           alert("Login ersten");
         }
         else if(Message == "FAIL")
          {
           alert("Bitte versuchen Sie es noch einmal!");
          }
         else if(Message =="Exit")
          {
            alert("Ihre hinzugefügt");
          }
        }, 
     error:function(){
             alert("Netzwerkfehler");
                }
           });
     
   }
    
    
    
       function  special()
   {
  var pro_Id = document.getElementById("pID").value;
  url ="/deal_spcv.aspx";
 var data ="prodcutID="+pro_Id+"&flg=func";
             $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
          
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
            //alert(Message);
            // document.write(Message);
            $("#tag_content0").html(Message);
         }
         //alert(document.getElementById("addrsend").innerHTML)
        }, 
     error:function(){
             alert("Netzwerkfehler");
                }
           });

      
      }
      
      
      
      
      
       function  SetCookie(name,value) {   
          var   Days   =   365;       
          var   exp     =   new   Date();         
          exp.setTime(exp.getTime()   +   Days*24*60*60*1000);   
          document.cookie   =   name   +   "="+   escape   (value)   +   ";expires="   +   exp.toGMTString();   
                }  
                
       function GetCookie(name)
             {
                var arg = name + "=";
                var alen = arg.length;
                var clen = document.cookie.length;
                var i = 0;
                while (i < clen)
                 {
                   var j = i + alen;
                   if (document.cookie.substring(i, j) == arg)return GetCookieVal (j);
                    
                      i = document.cookie.indexOf(" ", i) + 1;
                        if (i == 0) break;
                     }
                          return null;
                  }


                 function GetCookieVal(offset)
                   {
                     var endstr = document.cookie.indexOf (";", offset);
                      if (endstr == -1)
                        endstr = document.cookie.length;
                     return unescape(document.cookie.substring(offset, endstr));
                    }
                    
                    
       function DelCookie(name)
        {
           var exp = new Date();
           exp.setTime (exp.getTime() - 1);
           var cval = GetCookie (name);
           document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
         }

 
       function set_Cookie()
      {
      
         var dats = 240;
         var cookename = "viewp";
         var t ="";
          if(navigator.cookieEnabled)
            {
             var cookis =  GetCookie(cookename);
              if(cookis != "")
               {
                 
                   t = document.getElementById("pID").value;
                   t = cookis+"D"+t;
                   SetCookie('viewp',t)
               
               }
               else {
               t = document.getElementById("pID").value;
                   SetCookie(cookename,t);
                  
               }
        
               
            }
      
      }
      
      /*
      function change_currency(osel)
      {
       if(navigator.cookieEnabled)
        {
          var countryID = osel.options[osel.selectedIndex].value;
          }
      	var url = "/changecurrent.aspx?c="+countryID;
			//alert("111111111111");
		    $.ajax({
	 	    type:"post",
		    url:url,
		   // async:false,
		    //timeout: 3000,
		    beforeSend:function(){ },
		    success:function(msg){
			     $("#curt").html("");
			     $("#curt").html(msg);
			      top.window.location.reload(true);   
		    },
		    error:function(){//alert("Please check your network");
		    }
		    });
      }*/
      
         function change_currency(cy)
     {
      	   var url = "/changecurrent.aspx?c="+cy.value;
      	   //alert(url);
      	    //return false ;
			//alert("111111111111");
		    $.ajax({
	 	    type:"get",
		    url:url,
		   // async:false,
		    //timeout: 3000,
		    beforeSend:function(){ },
		    success:function(msg){
		        
			     $("#curt").html("");
			     $("#curt").html(msg);
			     
			      top.window.location.reload(true);   
			      //alert("cc");
		    },
		    error:function(){//alert("Please check your network");
		    }
		    });
     }      
      
      
      
      // 更改货币类型
       function  change_currency2(osel)
       {
        var cookename ="currenty";
       if(navigator.cookieEnabled)
        {
          var countryID = osel.options[osel.selectedIndex].value;
       //document.cookie ="currenty" +countryID;
       /*
        var   Days   =   365;       
          var   exp     =   new   Date();         
          exp.setTime(exp.getTime()   +   Days*24*60*60*1000);   
          document.cookie = "currenty" + "="+ countryID+   ";expires="   +   exp.toGMTString();
        //   
        */
      //  alert(countryID);
          SetCookie("rmb",countryID);
           SetCookie("eondd",countryID);
            var cookis =  GetCookie(cookename);
             if(cookis != "")
             {
             
           //   alert(cookis);
                DelCookie(cookename);
                SetCookie(cookename,countryID);
                alert(countryID);
                
                 
             }else
             {
            // alert('123');
                SetCookie(cookename,countryID);
             }
             window.location.reload(true);    
      }
      else
       {
        // alert("");
       }
   
   }
      
      
          
  
