﻿document.write(unescape("<script src=\"/js/jquery.js\" language=\"JavaScript\"></script>"));

var Cimg=0;
var totalN=5;
var autoTimmer;
function startRunImg()
{
    if(Cimg>=totalN)
    {
        Cimg=0;
    }
    else
    {
        Cimg=Cimg+1;
    }
    
    $("#_topImg a").hide();
    $("#_topImg a:eq("+Cimg+")").fadeIn("slow");
}

function initImgBox()
{
    totalN=$("#_topImg a").length-1;
    
    $("#_topImg a").hide();
    $("#_topImg a:first").show();
    $("#_topImg a").bind("mouseover",function(){clearInterval(autoTimmer);});
    $("#_topImg a").bind("mouseout",function(){autoTimmer = setInterval(startRunImg,3500);});
    autoTimmer = setInterval(startRunImg,3500);
}

function initClassSelect(cid,ccid)
{
    $("#_childID").load("/public/loadClass.aspx?cid="+cid+"&ccid="+ccid);
    $("#cid").bind("change",function(){loadchild(this.value,ccid);});
}
function loadchild(cid,ccid)
{
    $("#_childID").load("/public/loadClass.aspx?cid="+cid+"&ccid="+ccid);
}

//调整图片大小
function DownImage(ImgD,MaxHeight,MaxWidth)
{ 
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0)
	{ 
		var rate = (MaxWidth/image.width < MaxHeight/image.height)?MaxWidth/image.width:MaxHeight/image.height;
		if(rate <= 1)
		{
			ImgD.width = image.width*rate;
			ImgD.height =image.height*rate;
		}
    }
}

