﻿$(document).ready(function(){
    var count=10;
    loadLine("Line1",1,count);
    loadLine("Line2",2,count);    
    loadLine("Line3",3,count);    
    loadLine("Line4",4,count);    
    loadLine("Line5",5,count);
    loadLine("Line6",6,count);   
    loadLine("Line7",7,count);    
    
    loadNews("News1",2,5);
    loadNews("News2",3,5);
    
    loadJing("Jing_Content",10);
    loadJingShow("JingShow_Content",12);
    
    loadHotel("Hotel_Content",10);
    loadImage();
})

function loadLine(_id,index,top){
    var lineURL="lineTop.ashx?timeStamp="+new Date().getTime()+"&index="+index+"&top="+top;
    AjaxDiv(_id,lineURL,function(){
        $("#"+_id+" ul li a").hover(function(){
            $(this).css("color","Red");
        },function(){
            $(this).css("color","#333");
        })
    }); 
}

function loadNews(_id,index,top){
    var newsURL="newsTop.ashx?timeStamp="+new Date().getTime()+"&index="+index+"&top="+top;
    AjaxDiv(_id,newsURL,function(){
        $("#"+_id+" ul li a").hover(function(){
            $(this).css("color","Red");
        },function(){
            $(this).css("color","#333");
        })
    }); 
}

function loadJing(_id,top){
    var jingURL="jingTop.ashx?timeStamp="+new Date().getTime()+"&top="+top;
    AjaxDiv(_id,jingURL,function(){        
        $("#"+_id+" ul li a").hover(function(){
            $(this).css("color","Red");
        },function(){
            $(this).css("color","#333");
        })
    }); 
}

function loadJingShow(_id,top){
    var jingURL="jingShowTop.ashx?timeStamp="+new Date().getTime()+"&top="+top;
    AjaxDiv(_id,jingURL,function(){        
        $("#"+_id+" a img").hover(function(){
            $(this).css("border-color","Red");
        },function(){
            $(this).css("border-color","#333");
        })
        
            var speed=30;
            var node=$("#JingShow_Content")[0];
            var tag=false;
            var marquee=function(){
                if(node.scrollTop==node.scrollHeight-node.clientHeight){
                    tag=true;
                } 
                else if(node.scrollTop==0){
                    tag=false;
                }
                

                    if(!tag) node.scrollTop++ ;
    
                    if(tag) node.scrollTop--;
            }
            
            var MyMar=setInterval(marquee,speed) ;
            $(node).mouseover(function(){
                clearInterval(MyMar);
            })
            $(node).mouseout(function(){
                MyMar=setInterval(marquee,speed);
            })   
        
        
    }); 
}

function loadHotel(_id,top){
    var hotelURL="hotelTop.ashx?timeStamp="+new Date().getTime()+"&top="+top;
    AjaxDiv(_id,hotelURL,function(){        
        $("#"+_id+" ul li a").hover(function(){
            $(this).css("color","Red");
        },function(){
            $(this).css("color","#333");
        })
    }); 
}

function loadImage(){
    var linkURL="adTop.ashx?top=2&timeStamp="+new Date().getTime();
    AjaxDiv("Ad_Content",linkURL,function(){
        $("#Ad_Content a img").hover(function(){
            $(this).css("border-color","Red");
        },function(){
            $(this).css("border-color","000");
        })
    })
}