﻿var i=50;
$(document).ready(function(){
    setTimeout(function(){
    if($("#noticecon").html().length<3){return;}
      var t=$(document).scrollTop()+$(window).height()-$("#newnotice").outerHeight()-2;

        $("div[id=newnotice]").css({"right":"0px","top":t+"px"});
      $("div[id=newnotice]").slideDown("slow",function(){
       var t=$(document).scrollTop()+$(window).height()-$("#newnotice").outerHeight()-2;

        $("div[id=newnotice]").css({"right":"0px","top":t+"px"});
      });
      
    $(window).scroll(function(){
        var t=$(document).scrollTop()+$(window).height()-$("#newnotice").outerHeight()-2;
        $("div[id=newnotice]").css({"right":"0px","top":t+"px"});
    });
    $(window).resize(function(){
        var t=$(document).scrollTop()+$(window).height()-$("#newnotice").outerHeight()-2;
        $("div[id=newnotice]").css({"right":"0px","top":t+"px"}); 
    });
   
    $("label[id=tomin]").click(function(){
        
        i=50;
         bid();
        $("div[id=noticecon]","div[id=newnotice]").slideUp(); 
       

    });
   
    $("label[id=tomax]").click(function(){
    i=50;
        bid();
        $("div[id=noticecon]","div[id=newnotice]").slideDown()-2;
    });
   
    $("label[id=toclose]").click(function(){
        $("div[id=newnotice]").hide();
    });
    },2000);
});

$(document).ready(function(){
    setTimeout(function(){
        if($("#PictureLeftTop").html().length<3) return;
        $("#PictureLeftTop").css({"left":"0px","top":"0px"});
         $("#PictureRightTop").css({"right":"0px","top":"0px"});
        $("#PictureLeftTop").show();
        $("#PictureRightTop").show();
         $(window).scroll(function(){
            $("#PictureLeftTop").css({"top":$(document).scrollTop()});
             $("#PictureRightTop").css({"top":$(document).scrollTop()});
         });
         $(window).resize(function(){
         $("#PictureLeftTop").css({"top":$(document).scrollTop()});
         $("#PictureRightTop").css({"top":$(document).scrollTop()});
         });
    },1500);
});

function bid(){
if(i<=0){return;}
var t=$(document).scrollTop()+$(window).height()-$("#newnotice").outerHeight();
        $("div[id=newnotice]").css({"right":"0px","top":t+"px"}); 
        i--;
    setTimeout("bid()",20);
}

var Ptx=1;
var Pty=1;
var height=0;
var width=0;
var divH=0;
var divW=0;
var t;
var bltw=false;
function Piao(){
    if(bltw)return;
    var left=$(t).position().left;
    var top=$(t).position().top;
    if(left<=0){Ptx=1;}
    else if(left>=width-divW)Ptx=-1;
    if(top<=0){Pty=1;}
    else if(top>=height-divH) Pty=-1;
    $(t).css({"left":(parseInt(left)+parseInt(Ptx)),"top":(parseInt(top)+parseInt(Pty))});
}
$(document).ready(function (){
setTimeout(function(){
height=$("body").height();
width=$("body").width();
t=$(".pic_topiao");
if($(t).position()==null||$(t).position()==undefined)
{return;}
t.show();
divH=$(t).outerHeight();
divW=$(t).outerWidth();
$(".pic_topiao").mouseover(function(){bltw=true;});
$(".pic_topiao").mouseout(function(){bltw=false;});
bltw=false;
setInterval("Piao()",30);
},4000);
});


