$(function(){
    //**********common**********//
    //rightKey
    //$(document).bind("contextmenu", function() { return false; });
    $(".head ul li img[alt='logo']").hover(function(){$(this).css("cursor","pointer");})
    .click(function(){window.location='../index.htm'});
    //rellyPopup
    $("#inforSubmit").click(function(){$(".divPopUp").css("display","block");})
    $("#inforCanonl").click(function(){$(".divPopUp").css("display","none");})
    $("#inforSubmitTrue").click(function(){$(".divPopUp").css("display","none");$(".divPopUp2").css("display","block");})
    $("#inforSuccess").click(function(){$(".divPopUp2").css("display","none");})
    //loginOutPopup
    $("#logionOutSubmit").click(function(){$(".loginOutPopup").css("display","block");})
    $("#logionOutCanonl").click(function(){$(".loginOutPopup").css("display","none");})
    $("#logionOutTrue").click(function(){$(".loginOutPopup").css("display","none");})
    
    

    
    //**********emailSel**********//
    $(".emailSel").change(function(){
        if($(".emailSel option:selected").val()=="input"){
            $(this).fadeOut(0);
            $(".txtEmail").fadeIn(0);
        }
    })
    
    
   //**********contect**********//
    $('#shop li').click(function(){ 
	$(this).css({"background-position":"right -15px"}).siblings('.shopadd').css({"background-position":"right 1px"});				
	$(this).next().css('display','block').siblings('.answer').css('display','none')});
    

    //**********滚动条**********//
    $('.scroll-pane').jScrollPane({showArrows:true});
    //**********index**********//
    //Login
    $(".imgSidebar").toggle(
        function(){$(".login").animate({"left":"-377px"},1000,function(){$(".imgSidebar").attr("alt","out").attr("src","images/index/out.png")})},
        function(){$(".login").animate({"left":"0"},1000,function(){$(".imgSidebar").attr("alt","in").attr("src","images/index/in.png")})}
    );
    
    
    //**********图片滚动**********//
    //index
    $('.indexPhoto').cycle({
        timeout:10000,
        fx:'scrollHorz',
        pager:'.indexNav'
    });
    $(".indexPhoto img").hover(
    function(){$('.indexPhoto').cycle('pause');},
    function(){$('.indexPhoto').cycle('resume');})
    
    //news
    $('.newsTxt').cycle({
        timeout:5000,
        fx:'scrollHorz',
        pager:'.newsTxtNav'
    });
     $('.newsPhoto').cycle({
        timeout:5000,
        fx:'scrollHorz',
        pager:'.newsPhotoNav'
    });
    $(".newsPhotoNav a").click(function(){
        var i=$(this).index();
        $(".newsTxtNav a:eq("+i+")").click();
    })
    
    //sale
     $('.salePhoto').cycle({
        timeout:5000,
        fx:'scrollHorz',
        pager:'.saleNav'
    });
})

//方法描述：把指定输入框中的全角字符转为半角字符，并在输入框失去焦点时自动改变输入框中的全角字符   
  	//原理说明：   
  	//1、全角空格为12288，半角空格为32   
  	 // 2、其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248   
   function FullToDBC(obj){  
   var Str = obj.value;
    var DBCStr = "";   
    for(var i = 0; i < Str.length; i++){   
       var c = Str.charCodeAt(i);  

       if(c == 12288){   
         DBCStr += String.fromCharCode(32);   
         continue;   
       }   
       if(c > 65280 && c < 65375){   
         DBCStr += String.fromCharCode(c - 65248);   
         continue;   
       }   
         DBCStr += String.fromCharCode(c);   
       }   
       obj.value = DBCStr;   
   }
