function ConvertToInt(strPx)
{
   return parseInt(strPx.replace("px",""));
}

function ConverToPix(iPos)
{
   return iPos+"px";
}


 //获得COOKIE
 
  function getCookie(name) 
    {

      var search;
      search = name + "="
      offset = document.cookie.indexOf(search) 
      if (offset != -1) {
        offset += search.length ;
        end = document.cookie.indexOf(";", offset) ;
        if (end == -1)
          end = document.cookie.length;
        return unescape(document.cookie.substring(offset, end));
      }
      else
      {
        return "";
       }
    }


   //删除COOKIES
   
    function delCookie(name)
    {
        var  cookies=this.getCookie(name);
    	document.cookie = name + "=" +cookies+";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
   //设置COOKIE    
     
   function setCookie(name, value) 
   {

      //document.cookie = name + "=" + escape(value) + "; path=/; domain=qqshow.qq.com";
      document.cookie = name + "=" + value + ";";
    }
    
    
    //分割字符串
    
   function split_dealwith_str(str,splitstr)
    {
        
          var search_length;
          var  offset;
          offset = str.indexOf(splitstr) ;
          search_length=splitstr.length;
         return str.substring(offset +search_length , str.length);
    }
    
function shop_mouse_move(obj)
  {
     var trunpoint=false;
       var html;
        html="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;height:125px;\">"
        var   x,y;  
        oRect =obj.getBoundingClientRect();  
        x=oRect.left  ;
        y=oRect.top  ;
        document.getElementById("shop_show_div").style.top = y+document.documentElement.scrollTop-5;
        document.getElementById("shop_show_div").style.display="block";
         if(x>580 &&x< 665)
         {  
            document.getElementById("shop_show_div").style.left = x -120 ;
            trunpoint=true;
         }
         else
         {
            document.getElementById("shop_show_div").style.left = x -5 ;
         }
        idstr=split_dealwith_str(obj.id,"_")  ;
        var info_ds=WebApplication1.Class.Ajax.Get_Shop_Info(idstr).value;
        for(var i=0;i<info_ds.Tables[0].Rows.length;i++)
        {
                 var sex=tran_sex(info_ds.Tables[0].Rows[i].qq_show_use_sex);
                 if(trunpoint)
                  {
                  html+="<tr>"
                  html+="<td style=\"width:200px;PADDING-LEFT: 6px\">" +info_ds.Tables[0].Rows[i].qq_show_commodity_name+"</td>" 
                  html+="<td style=\"PADDING-right:3px;\" rowspan=\"4\"><img class='imgclass' src='"+info_ds.Tables[0].Rows[i].qq_show_thumimg+"' alt='"+info_ds.Tables[0].Rows[i].qq_show_commodity_name+"' width=\"84px\" height=\"84px\" style='border:solid 1px #B1B1B1;margin-top:2px; cursor:hand;'/></td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td style=\"width:200px;PADDING-LEFT: 6px\">";
                  html+= "适用于:("+sex+")</td>";
                  html+="</tr>";
                  html+=" <tr>";
                  html+="<td style=\"width:200px;PADDING-LEFT: 6px\">";
                  html+=" 价 格:"+info_ds.Tables[0].Rows[i].qq_show_commodity_cast+"</td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td style=\"width: 200px;PADDING-LEFT: 6px\">"
                  html+="点击图片换装</td>"
                  html+=" </tr>"
                  html+=" <tr><td style=\"width:200px;\"> </td>"
                  html+="<td style=\"text-align:center;padding-top:4px\">";
                  html+="<a href=\"javascript:void(0)\"><img src=\"images/buyimg.gif\"  style=\" border:0px; cursor:hand;\" onclick=\"buy("+info_ds.Tables[0].Rows[i].qq_show_commodity_id+",'"+info_ds.Tables[0].Rows[i].qq_show_use_sex+"')\"/></a>&nbsp;<a href=\"javascript:void(0)\"><img src=\"images/sendimg.gif\" style=\" border:0px; cursor :hand;\"  onclick=\"send("+info_ds.Tables[0].Rows[i].qq_show_commodity_id+")\" /></a>";
                  html+="</td>"
                  html+="</tr>"
                  
                  }
                  else
                  {
                  html+="<tr>";
                  html+="<td style=\"width: 93px;text-align:center;\" rowspan=\"4\"><img class='imgclass' src='"+info_ds.Tables[0].Rows[i].qq_show_thumimg+"' alt='"+info_ds.Tables[0].Rows[i].qq_show_commodity_name+"' width=\"84px\" height=\"84px\" style='border:solid 1px #B1B1B1;margin-top:2px; cursor:hand;'/>"
                  html+="</td>"
                  html+="<td >" +info_ds.Tables[0].Rows[i].qq_show_commodity_name+"</td>" 
                  html+= "</tr>";
                  html+= "<tr>"
                  html+= "<td style=\"height: 23px\">"
                  html+= "适用于:("+sex+")</td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td style=\"height: 23px\">"
                  html+=" 价 格:"+info_ds.Tables[0].Rows[i].qq_show_commodity_cast+"</td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td >"
                  html+= "点击图片换装</td>"
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td  style=\"height: 20px;text-align:center;padding-top:4px\">";
                  html+="<a href=\"javascript:void(0)\"><img src=\"images/buyimg.gif\"  style=\" border:0px; cursor:hand;\" onclick=\"buy("+info_ds.Tables[0].Rows[i].qq_show_commodity_id+",'"+info_ds.Tables[0].Rows[i].qq_show_use_sex+"')\"/></a>&nbsp;<a href=\"javascript:void(0)\"><img src=\"images/sendimg.gif\" style=\" border:0px; cursor :hand;\"  onclick=\"send("+info_ds.Tables[0].Rows[i].qq_show_commodity_id+")\" /></a>"
                  html+="</td><td></td>"
                  html+="</tr>" 
                  }
                document.getElementById("shopparamarr_str").value= info_ds.Tables[0].Rows[i].qq_show_commodity_name+","+info_ds.Tables[0].Rows[i].qq_show_postiton_left.toString()+","+info_ds.Tables[0].Rows[i].qq_show_postiton_top.toString()+","+info_ds.Tables[0].Rows[i].qq_show_use_sex+","+info_ds.Tables[0].Rows[i].qq_show_commodity_img+","+info_ds.Tables[0].Rows[i].qq_show_position_id.toString()+","+info_ds.Tables[0].Rows[i].qq_show_commodity_id.toString()+","+info_ds.Tables[0].Rows[i].qq_show_postiton_zindex.toString();
        }
          html+="</table>";
         document.getElementById("shop_show_div").innerHTML=html;
  }
    function shop_mouse_over(obj)
  {
        document.getElementById("shop_show_div").innerHTML="<img src='images/loading.gif'/>"
        document.getElementById("shop_show_div").style.display="none";
  }
  
  function buy_shop_mouse_move(obj)
  {
     var trunpoint=false;
       var html;
        html="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%\;\">"
        var   x,y;  
        oRect =obj.getBoundingClientRect();  
        x=oRect.left  ;
        y=oRect.top  ;
        document.getElementById("buy_shop_div").style.top = y+document.documentElement.scrollTop-5;
        document.getElementById("buy_shop_div").style.display="block";
        document.getElementById("buy_shop_div").style.left = x -5 ;
        idstr=split_dealwith_str(obj.id,"_")  ;
        var info_ds=WebApplication1.Class.Ajax.Get_Shop_Info(idstr).value;
        for(var i=0;i<info_ds.Tables[0].Rows.length;i++)
        {
                 var sex=tran_sex(info_ds.Tables[0].Rows[i].qq_show_use_sex);
                  html+="<tr>";
                  html+="<td style=\"width: 93px;text-align:center;\" rowspan=\"4\"><img class='imgclass' src='"+info_ds.Tables[0].Rows[i].qq_show_thumimg+"' alt='"+info_ds.Tables[0].Rows[i].qq_show_commodity_name+"' width=\"84px\" height=\"84px\" style='border:solid 1px #B1B1B1;margin-top:2px; cursor:hand;'/>"
                  html+="</td>"
                  html+="<td >" +info_ds.Tables[0].Rows[i].qq_show_commodity_name+"</td>" 
                  html+= "</tr>";
                  html+= "<tr>"
                  html+= "<td style=\"height: 23px\">"
                  html+= "适用于:("+sex+")</td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td style=\"height: 23px\">"
                  html+=" 价 格:"+info_ds.Tables[0].Rows[i].qq_show_commodity_cast+"</td>";
                  html+="</tr>"
                  html+="<tr>"
                  html+="<td >"
                  html+= "</td>"
                  html+="</tr>";
            
                document.getElementById("shopparamarr_str").value= info_ds.Tables[0].Rows[i].qq_show_commodity_name+","+info_ds.Tables[0].Rows[i].qq_show_postiton_left.toString()+","+info_ds.Tables[0].Rows[i].qq_show_postiton_top.toString()+","+info_ds.Tables[0].Rows[i].qq_show_use_sex+","+info_ds.Tables[0].Rows[i].qq_show_commodity_img+","+info_ds.Tables[0].Rows[i].qq_show_position_id.toString()+","+info_ds.Tables[0].Rows[i].qq_show_commodity_id.toString()+","+info_ds.Tables[0].Rows[i].qq_show_postiton_zindex.toString();
        }
          html+="</table>";
         document.getElementById("buy_shop_div").innerHTML=html;
  }
    function buy_shop_mouse_over(obj)
  {
        document.getElementById("buy_shop_div").innerHTML="<img src='images/loading.gif'/>"
        document.getElementById("buy_shop_div").style.display="none";
  }
  
  
  function tran_sex(sexobj)
  {
      if(sexobj=="W")
      {
       return "女";
      }
      if(sexobj=="M")
      {
       return "男";
      }
      if(sexobj=="O")
      {
       return "男女适用";
      }
  }

  
  
       // 改变图片大小
      function sb_chang_image_width(img,wid)
			    {  
				    if(img.width>wid) 
				    {
					    i=img.width; 
					    j=img.height; 
					    img.width=wid; 
					    img.height=j/i*wid;
				    }
    				
			    }	
       //弹出新窗体
　　　function openwindow(url,name,iWidth,iHeight)
         {
          var url;                                //转向网页的地址;
          var name;                           //网页名称，可为空;
          var iWidth;                          //弹出窗口的宽度;
          var iHeight;                        //弹出窗口的高度;
          var iTop = (window.screen.availHeight-30-iHeight)/2;       　　//获得窗口的垂直位置;
          var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
          window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
         }

　　　//获得ＩＤ
　　　function getId(id)
            {
               var odiv;
               if(document.getElementById(id))
               {
                  odiv = document.getElementById(id);
               }else
               {
                  odiv  = null;
               }
               return odiv;
            }
       
     //赠送
     function send(shop_id)
     {

           //清空赠送的参数   
         document.location.href="send_shop.aspx?shop_id="+shop_id;

     }
    //购买
    function buy(shop_id,shop_use_sex)
    { 

        if(show_info.Is_Member_Login())
        {
            var membersex= parent.window.frames['qqshow'].document.getElementById("membersex_hidden").value;
     　 　  if(membersex==shop_use_sex || shop_use_sex=="O")
     　 　  {
     　 　       parent.window.frames['qqshow'].document.getElementById("buy_hidden").value=parent.window.frames['qqshow'].document.getElementById("buy_hidden").value+shop_id+",";
     　 　       var success=WebApplication1.Class.Ajax.setBuy_Shops_Cookie(parent.window.frames['qqshow'].document.getElementById("buy_hidden").value).value;
                 if(success=="true")
                  {
                      if(confirm("你是否要去购物车中查看"))
                         {
                            parent.window.frames['shopshow'].document.location.href='buy_shop.aspx'
                           //openwindow("buy_shop.aspx","购物车",800,400);
                         }
                  }
                  else
                  {
                  alert("你的购买车为空");
                  }
           }
           else
           {
            alert("很抱歉，你不能购买异性的商品");
           }
        } 
        else
        {
            alert("你还没有登陆");
        }
    }
    //索要 
  　function  ask_for(shop_id)
    {
         if(show_info.Is_Member_Login())
         {
     　　    document.location.href="askfor_qq_show.aspx?ask_id="+shop_id;
         }
         else
         {
            alert("你还没有登陆");
         }
   
    }
    
 function Add_Img_OnclickEvent()
  {

    var show_info1=new  QQ_Show_Info();
    var imgarr= document.getElementById("shop_show_div").getElementsByTagName("img");
    for(var i=0;i<imgarr.length;i++)
     {
      if(imgarr[i].className=="imgclass")
        {
           imgarr[i].onclick=function(name,left,top,sex,img,pos_id,id,zindex)
           {
           
           param_arr=document.getElementById("shopparamarr_str").value.split(',');
           show_info1.Show_shop(new Array(param_arr[0],parseInt(param_arr[1]),parseInt(param_arr[2]),param_arr[3],param_arr[4],parseInt(param_arr[5]),parseInt(param_arr[6]),parseInt(param_arr[7])));
       //    show_info1.Show_shop(new Array('女式包包2',28,115,'W','/goods_images/20080617173605093304.gif',12,75,6500));
           }
        }
     }

  }    
    
//状态栏信息
function kstatus() {
self.status="乐谷虚拟形象商城";
}
setTimeout("kstatus()",1);

