function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}


if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}


function changeStyle(obj){
	var tid = obj.id.replace("img","");
	
	if(obj.getAttribute("src").match("_up."))
	{
		obj.setAttribute("src", obj.getAttribute("src").replace("_up.", "_down."));
		document.getElementById(tid).checked = true;
	}
	else
	{
		obj.setAttribute("src", obj.getAttribute("src").replace("_down.", "_up."));
		document.getElementById(tid).checked = false;
	}
}


//选择一级课程
function SelectSubCourse(TopCourseID)
{
    //provincebox = document.all.Province;
    var tSubCourse = new Array();
    var selSubCourse = TopCourseID;
    
    var tSubCourse = tSubCourses[selSubCourse];
    var SubCoursebox = document.getElementById('SubCourse');
    if(tSubCourse != null)
    {
        SubCoursebox.length=1;
        SubCoursebox.options[0] = new Option("Please Select...",-1);
        var j = 1
        for(var i in tSubCourse)
        {       	
            str = tSubCourse[i];
            SubCoursebox.options[j] = new Option(str, i);
            j++;
        }
    }
    else
    {
        if (SubCoursebox != null)
        {
           SubCoursebox.options[0] = new Option("Please Select...",-1);
           SubCoursebox.length = 1;
        }
    }
}

//选择二级课程
function SelectThirdCourse(SubCourseID)
{
    
    //provincebox = document.all.Province;
    var tSubCourse = new Array();
    var selSubCourse = SubCourseID; 
    var tThirdCourse = tThirdCourses[selSubCourse];
    var SubCoursebox = document.getElementById('ThirdCourse');
    if(tSubCourse != null)
    {
        SubCoursebox.length=1;
        SubCoursebox.options[0] = new Option("Please Select...",-1);
        var j = 1
        for(var i in tThirdCourse)
        {       	
            str = tThirdCourse[i];
            SubCoursebox.options[j] = new Option(str, i);
            j++;
        }
    }
    else
    {
        if (SubCoursebox != null)
        {
           SubCoursebox.options[0] = new Option("Please Select...",-1);
           SubCoursebox.length = 1;
        }
    }
}



//function submitForm()
//{
//	if(document.getElementById('TopCourse').value == "-1" || document.getElementById('SubCourse').value == "-1")
//	{
//		alert('请选择课程分类!');
//		return false;
//	}
//	else
//	{
//		document.ConfirmForm.submit();
//	}
//}




function checkForm()
{
	if(document.getElementById('TopCourse').value == "-1" || document.getElementById('SubCourse').value == "-1")
	{
		alert("Please Select Course");
		return false;
	}
	return true;
}
