
function checkAll()
{
    var i,ol=document.getElementsByName("chbox")
    for(i=0;i<ol.length;i++){
        ol[i].checked=document.all("challbox").checked
    }
}

function sortByIt(v)
{
   var lastv = document.forms[0].sortby.value;
   if (v != ""){
        if (lastv!=""){
             if (v != lastv){
                 v = v;
             } else {
                 v = v + " desc";
             }
        }
        document.forms[0].action="";
        document.forms[0].sortby.value = v;
        document.forms[0].submit();
   }
}



////////////////////////////////////////////////////////////////////
////////Move ADV//////////////////

var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
//改变移动一次的时间，毫秒级
var tempo=100
//改变移动一次的x,y坐标值
var stepx=2
var stepy=2
var timer

function setValues() {
var firsttimer= setTimeout("setValues2()",10)
}

function setValues2() {
if (document.all) {
marginbottom = document.body.clientHeight-50
marginright = document.body.clientWidth-50
document.all.pic.style.posLeft=10
document.all.pic.style.posTop=10
moveball()
}

if (document.layers) {
marginbottom = window.innerHeight-10
marginright = window.innerWidth-10
document.pic.left=10
document.pic.top=10
moveball()
}
}

function randommaker(range) { 
rand=Math.floor(range*Math.random())
return rand
}

function moveball() {
if (document.all) {
checkposition()
document.all.pic.style.posLeft+=stepx
document.all.pic.style.posTop+=stepy
timer=setTimeout("moveball()",tempo)
}
if (document.layers) {
checkposition()
document.pic.left+=stepx
document.pic.top+=stepy
timer=setTimeout("moveball()",tempo)
}
}

function checkposition() {
if (document.all) {
if (document.all.pic.style.posLeft>=marginright) {
stepx=(stepx+randommaker(2))*-1
document.all.pic.style.posLeft-=10
}
if (document.all.pic.style.posLeft<=marginleft) {
stepx=(stepx+randommaker(2))*-1
document.all.pic.style.posLeft+=10
} 
if (document.all.pic.style.posTop>=marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.all.pic.style.posTop-=10
}
if (document.all.pic.style.posTop<=margintop) {
stepy=(stepy+randommaker(2))*-1
document.all.pic.style.posTop+=10
}
}
if (document.layers) {
if (document.pic.left>=marginright) {
stepx=(stepx+randommaker(2))*-1
document.pic.left-=10
}
if (document.pic.left<=marginleft) {
stepx=(stepx+randommaker(2))*-1
document.pic.left+=10
} 
if (document.pic.top>=marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.pic.top-=10
}
if (document.pic.top<=margintop) {
stepy=(stepy+randommaker(2))*-1
document.pic.top+=10
}
}
}


















///////////////////////////////////////////////////////////////////// 

