var maxHeight = 400;

$(function(){

    $(".dropdown > li").hover(function() {
    
         var $container = $(this),
             $list = $container.find("ul"),
             $anchor = $container.find("a"),
             height = $list.height() * 1.1,       // make sure there is enough room at the bottom
             multiplier = height / maxHeight;     // needs to move faster if list is taller
        
        // need to save height here so it can revert on mouseout            
        $container.data("origHeight", $container.height());
        
        // so it can retain it's rollover color all the while the dropdown is open
        $anchor.addClass("hover");
        
        // make sure dropdown appears directly below parent list item    
        $list
            .show()
            .css({
                paddingTop: $container.data("origHeight")
            });
        
        // don't do any animation if list shorter than max
        if (multiplier > 1) {
            $container
                .css({
                    height: maxHeight,
                    overflow: "hidden"
                })
                .mousemove(function(e) {
                    var offset = $container.offset();
                    var relativeY = ((e.pageY - offset.top) * multiplier) - ($container.data("origHeight") * multiplier);
                    if (relativeY > $container.data("origHeight")) {
                        $list.css("top", -relativeY + $container.data("origHeight"));
                    };
                });
        }
        
    }, function() {
    
        var $el = $(this);
        
        // put things back to normal
        $el
            .height($(this).data("origHeight"))
            .find("ul")
            .css({ top: 0 })
            .hide()
            .end()
            .find("a")
            .removeClass("hover");
    
    });
    
    // Add down arrow only to menu items with submenus
    $(".dropdown > li:has('ul')").each(function() {
         //$(this).find("a:first").append("<img src='139000index_files/down-arrow.png' />");
    });
	
	
///页面背景更换↓
 
	var mydate=new Date();
	var mym=mydate.getMonth()+1;
if(window.location.pathname=="/" || window.location.pathname=="/index4_5_2.html" )
{
	  
	 $("body").attr("background","/bgimg/0"+mym+".jpg").css("padding-top","58px");
	 if(mym==9)
	 {	 
     }
	 else
	 {	
	   $(".TopBox").css("background-color","#FFF").css("background-image","/skins/default/css/BodyBg3.jpg");
	 }
}
 else
{
 	 //$("body").attr("background","/0"+mym+".jpg").css("padding-top","0px");
	// $(".TopBox").css("background-color","#FFF").css("background-image","/skins/default/css/BodyBg3.jpg");
}
///页面背景更换↑	
    
///更换qq
var otqq="";

	 otqq="<ul><li><a rel=\"dropmenu3\" href=\"#\">华北区 </a> <br>0539-8232003           <ul><li>              <a onclick=\"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&amp;sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;\" target=\"_blank;\" ;=\"\" href=\"http://sighttp.qq.com/cgi-bin/check?sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706\"><img border=\"0\" alt=\"点击与我交谈\" src=\"http://wpa.qq.com/pa?p=1:712705999:47\"></a></li></ul></li><li><a rel=\"dropmenu4\" href=\"#\">华中区</a><br>0539-8232003         <ul><li>              <a onclick=\"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&amp;sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;\" target=\"_blank;\" ;=\"\" href=\"http://sighttp.qq.com/cgi-bin/check?sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706\"><img border=\"0\" alt=\"点击与我交谈\" src=\"http://wpa.qq.com/pa?p=1:712705999:47\"></a></li></ul></li><li><a rel=\"dropmenu6\" href=\"#\">华南区</a><br>0539-8232003<ul><li>              <a onclick=\"var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&amp;sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;\" target=\"_blank;\" ;=\"\" href=\"http://sighttp.qq.com/cgi-bin/check?sigkey=f136a2dabc9aafeb3b716a0f98684c0e545699f1fb738f438e8dc92e3a066706\"><img border=\"0\" alt=\"点击与我交谈\" src=\"http://wpa.qq.com/pa?p=1:712705999:47\"></a></li></ul></li></ul>";


$("#quyu ul").replaceWith(otqq);

//////更换qqend



//////添加联系我们 guanyu
$("#guanyu ul").append("<li><a href=\"/Aboutus/lxwm.html\">联系我们</a></li>");
//////添加联系我们 end


 //////添加 免费发送左边图片
 
$(".containerLR .L").append("<div class='L-box'> <div class='PadBox'><div style='margin-top: 10px;' id='quyu'><a href='/daili/'><img height='132' width='170' src='/agentimg1.jpg'></a></div></div><div class='clear'></div></div>");
$(".containerLR .L").append("<div class='L-box'> <div class='PadBox'><div style='margin-top: 10px;' id='quyu'><a href='http://10086.dxcx.com/reg.asp'><img height='132' width='170' src='/freesentimg.jpg'></a></div></div><div class='clear'></div></div>");

//////添加 免费发送左边图片end

//////添加 修改锚链接start

$("#lxwm >a").replaceWith("<a href='http://10086.dxcx.com/reg.asp' target='_blank'>申请试用<img src='/skins/default/css/down-arrow.png'></a>");

 //////添加 修改锚链接end
 
  
});  
///////////////////////
function get_hits(t0,t1,t2,t3) //jquery 文章点击次数
{
  $.ajax({
        type:"POST",
        url:"/inc/gethits.asp",
        data:"id="+escape(t0) +"&action="+ escape(t1) +"&t="+escape(t2) +"&num="+Math.round(Math.random()*10000),
        error:function(){alert("服务忙！！");},
        success:function(msg){
	    $('#'+t3).text(msg);
          }
    });				
				
}
