﻿// JScript 文件

$(document).ready(function(){
        code()
        $('.huanbackground').click(function(){
            $('.huanbackground').css({'background-image':'url(images/botten_back02_off.jpg)'});
            $(this).css({'background-image':'url(images/botten_back02_on.jpg)'});
        })
        $('.daobackground').click(function(){
            $('.daobackground').css({'background-image':'url(images/botten_back01_off.gif)'}); 
            $(this).css({'background-image':'url(images/botten_back01_on.gif)'});
        })
    })
    var flash = function(){
        $('#products').fadeOut("slow",function(){
            $('#products_falsh').fadeIn("slow");
        }); 
    }
    var cid=0;
    var tid=0;
    var nofalsh = function(Codeid){
        if(Codeid==1){
            tid=101;
        }
        if(Codeid==2){
            tid=20101;
        }
        if(Codeid==3){
            tid=301;
        }
        if(Codeid==4){
            tid=401;
        }
        $('#products_falsh').fadeOut("slow",function(){
            $('#products').fadeIn("slow");
        });
         $('#typeCodeMin').hide();
        
        typeCode(Codeid);
        cid = Codeid;
        products_table(tid,Codeid)
    }
    var products_type = function(Typeid){
            $('#typeCodeMin').hide();
        tid=Typeid;
        products_table(Typeid,cid);
    }
    var products_table = function(Typeid,Codeid){
        if(Typeid==0){
            tid=101;
        }else if(Codeid==0){
            cid=1;
        }
        ajaxproducts(1);
    }
    var ajaxproducts = function(page){
            $('#products_table').html("<br /><br /><br /><br /><br /><br /><img src='images/loading.gif' />");
        $.ajax({
           type: "POST",
           url: "server/products.aspx",
           data: "mode=product&type=0&page="+page+"&t="+tid+"&c="+cid,
           success: function(msg){
               $('#products_table').fadeOut('slow',function(){
                    if(msg!=""){
                        $(this).html(msg).fadeIn('slow');
                    }else{
                        $(this).html("<br /><br /><br /><a class='txt_blacken'>Sorry,暂无产品记录!</a>").fadeIn('slow');
                    }
               })
           }
        }); 
    }
    var code = function(){
        var codehtml =  '<table width="929" border="0" cellspacing="0" cellpadding="0">\
                        <tr>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"><div class="daobackground" style="background-image:url(images/botten_back01_on.gif);width:152px;height:23px;line-height: 23px;"><a href="javascript:void(0)" onclick="flash();" class="txt_blacken2"><strong>最新上市产品　NEW</strong></a></div></td>\
                        <td width="2" align="left"></td>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"><div class="daobackground" style="background-image:url(images/botten_back01_off.gif);width:152px;height:23px;line-height: 23px;"><a href="javascript:void(0)" onclick="nofalsh(1)" class="txt_blacken2"><strong>兰蔻护肤产品</strong></a></div></td>\
                        <td width="2" align="left"></td>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"><div class="daobackground" style="background-image:url(images/botten_back01_off.gif);width:152px;height:23px;line-height: 23px;"><a href="javascript:void(0)" onclick="nofalsh(2)" class="txt_blacken2"><strong>兰蔻彩妆产品</strong></a></div></td>\
                        <td width="2" align="left" ></td>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"><div class="daobackground" style="background-image:url(images/botten_back01_off.gif);width:152px;height:23px;line-height: 23px;"><a href="javascript:void(0)" onclick="nofalsh(3)" class="txt_blacken2"><strong>兰蔻香水产品</strong></a></div></td>\
                        <td width="2" align="left"></td>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"><div class="daobackground" style="background-image:url(images/botten_back01_off.gif);width:152px;height:23px;line-height: 23px;"><a href="javascript:void(0)" onclick="nofalsh(4)" class="txt_blacken2"><strong>兰蔻男仕产品</strong></a></div></td>\
                        <td width="2" align="left"></td>\
                        <td width="153" align="left" style="width:153px;height:23px;text-align:center;"></td>\
                        </tr>\
                        </table>'
         $('#code').html(codehtml);
    }
    var typeCode = function(Codeid){
        var typeCodehtml = "";
            if(Codeid==1){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(101);" class="txt_blacken1"><strong>洁肤水/柔肤露</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(102);" class="txt_blacken1"><strong>面膜/磨砂膏</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(103);" class="txt_blacken1"><strong>水份缘舒悦系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(104);" class="txt_blacken1"><strong>青春优氧系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(105);" class="txt_blacken1"><strong>立体塑颜系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(106);" class="txt_blacken1"><strong>金纯卓颜系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(107);" class="txt_blacken1"><strong>智能愉悦臻白系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(108);" class="txt_blacken1"><strong>柔皙舒缓防晒露</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(109);" class="txt_blacken1"><strong>臻萃华光系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(110);" class="txt_blacken1"><strong>眼霜系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(111);" class="txt_blacken1"><strong>铂菁臻妍系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(112);" class="txt_blacken1"><strong>蜜养润颜系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(113);" class="txt_blacken1"><strong>精华肌底液</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(Codeid==2){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground" ><a href="javascript:void(0)" onclick="products_type(201);" class="txt_blacken1" id="mouse1"><strong>肤色</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground" ><a href="javascript:void(0)" onclick="products_type(202);" class="txt_blacken1" id="mouse2"><strong>眼部</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground" ><a href="javascript:void(0)" onclick="products_type(203);" class="txt_blacken1" id="mouse3"><strong>唇部</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground" ><a href="javascript:void(0)" onclick="products_type(204);" class="txt_blacken1" id="mouse4"><strong>指甲</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(Codeid==3){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(301);" class="txt_blacken1"><strong>奇迹香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(302);" class="txt_blacken1"><strong>梦魅香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(303);" class="txt_blacken1"><strong>引力香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(304);" class="txt_blacken1"><strong>珍爱香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(305);" class="txt_blacken1"><strong>奇迹男用香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(306);" class="txt_blacken1"><strong>是我香水</strong></a></div></td>\
                  </tr>\
                   <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(307);" class="txt_blacken1"><strong>璀璨香水</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(308);" class="txt_blacken1"><strong>兰蔻梦魅男士香水</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(Codeid==4){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(401);" class="txt_blacken1"><strong>清洁系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(402);" class="txt_blacken1"><strong>剃胡系列</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(403);" class="txt_blacken1"><strong>分龄系列</strong></a></div></td>\
                  </tr>\
                    <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(404);" class="txt_blacken1"><strong>防晒系列</strong></a></div></td>\
                  </tr>\
                  </table>'
            }
            $('#typeCode').html(typeCodehtml);
            $('#mouse1').mouseover(function(){
                typeCodeMin(1);
            })
            $('#mouse2').mouseover(function(){
                typeCodeMin(2);
            })
            $('#mouse3').mouseover(function(){
                typeCodeMin(3);
            })
            $('#mouse4').mouseover(function(){
                typeCodeMin(4);
            })
    }
    var typeCodeMin = function(typeCodeid){
        var typeCodehtml = "";
        if(typeCodeid==1){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20101);" class="txt_blacken1"><strong>粉底液</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20102);" class="txt_blacken1"><strong>粉饼</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20103);" class="txt_blacken1"><strong>散粉</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20104);" class="txt_blacken1"><strong>胭脂</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20105);" class="txt_blacken1"><strong>遮暇膏</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(typeCodeid==2){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20201);" class="txt_blacken1"><strong>睫毛膏</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20202);" class="txt_blacken1"><strong>眼影</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20203);" class="txt_blacken1"><strong>眼线</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20204);" class="txt_blacken1"><strong>眉毛</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(typeCodeid==3){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20301);" class="txt_blacken1"><strong>唇膏</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20302);" class="txt_blacken1"><strong>唇彩</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20303);" class="txt_blacken1"><strong>唇线</strong></a></div></td>\
                  </tr>\
                </table>'
            }else if(typeCodeid==4){
                typeCodehtml='<table width="154" id="backgroudtable" border="0" cellspacing="0" cellpadding="0">\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20401);" class="txt_blacken1"><strong>指甲油</strong></a></div></td>\
                  </tr>\
                  <tr>\
                    <td valign="middle" style="width:152px;height:36px;text-align:center;"><div class="huanbackground"><a href="javascript:void(0)" onclick="products_type(20402);" class="txt_blacken1"><strong>指甲护理</strong></a></div></td>\
                  </tr>\
                </table>'
            }
        $('#typeCodeMin').html(typeCodehtml).show();
    }
