﻿
<!--
//图片按比例缩放
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
//参数(图片,允许的宽度,允许的高度)
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
}
} 
//调用：<Img src="图片" onload="javascrip:DrawImage(this,100,100)">
//-->
function ShowMin(m,n){
 for(var i=1;i<=n;i++)
	if(m == i){		
		document.getElementById('MinTab'+i).style.display = "";		
		document.getElementById('MinMenu'+i).style.background = "url(images/changePic/"+ i + "a.jpg)"
	}
	else{
		document.getElementById('MinTab'+i).style.display = "none";
		document.getElementById('MinMenu'+i).style.background = "url(images/changePic/"+ i + ".jpg)"
	}
}
function sShowMin(m,n){
 for(var i=1;i<=n;i++)
	if(m == i){
		document.getElementById('sMinTab'+i).style.display = "";
		document.getElementById('sMinMenu'+i).style.background = "url(images/testPic/"+ i + "a.jpg)"
	}
	else{
		document.getElementById('sMinTab'+i).style.display = "none";
		document.getElementById('sMinMenu'+i).style.background = "url(images/testPic/"+ i + ".jpg)"
	}
}
function preShowMin(m,n){
 for(var i=1;i<=n;i++)
	if(m == i){
		document.getElementById('preMinTab'+i).style.display = "";
		document.getElementById('preMinMenu'+i).style.background = "url(images/Preparing/"+ i + "a.jpg)"
	}
	else{
		document.getElementById('preMinTab'+i).style.display = "none";
		document.getElementById('preMinMenu'+i).style.background = "url(images/Preparing/"+ i + ".jpg)"
	}
}

function OverCheck(id){
	document.getElementById('menu'+id).src= "images/menu/" + id + "a.jpg";	
}

function OutCheck(id){
	document.getElementById('menu'+id).src= "images/menu/" + id + ".jpg";
}
//删除并判断空格
function spaces(v)
{
	v=v.replace(/ /gi,"");
	var len = 0;
	for(i=0;i<v.length;i++)
	   if(v.charCodeAt(i)>256)
	       len+= 2;
	   else
	       len++;	    
return len;
}
//检查email的合法性
function checkemail(inputstr){
	if(inputstr.indexOf('@') != -1 && inputstr.indexOf('.')!= -1)
		return true;
	else 
   		return false;	
}
//检验表单的合法性
function CheckOrder() {
	var checked = false;
	var radios = document.getElementsByName('OrderContent');
	for (var x=0; x<radios.length; x++) {
		checked = checked || radios[x].checked;
	}
	
	if (spaces(document.order.ContactMan.value) == 0) {
		alert("\请输入联系人姓名!");
		document.order.ContactMan.focus();
	}
	//else if (document.AddFeedback.Tel.value == "") {
	//	alert("\Please Fill In Tel!");
	//	document.AddFeedback.Tel.focus();
	//}
	//else if (document.AddFeedback.Fax.value == "") {
	//	alert("\Please Fill In Fax!");
	//	document.AddFeedback.Fax.focus();
	//}
	else if (spaces(document.order.Tel.value) == 0) {
		alert("\请输入联系电话！");
		document.order.Tel.focus();
	}
	else if (spaces(document.order.Email.value) == 0) {
		alert("\请输入联系人E-mail地址！");
		document.order.Email.focus();
	}
	else if (!checkemail(document.order.Email.value)) {
		alert("\请输入正确的E-Mail！");
		document.order.Email.focus();
	}
	else if (!checked) {
		alert("请选择索取资料的类型！");
		return false;
	}
	else {
        return true;
    }
    return false;
}

function CheckTest() {
	if (spaces(document.Test.ContactMan.value) == 0) {
		alert("\请输入联系人姓名!");
		document.Test.ContactMan.focus();
	}
	else if (spaces(document.Test.Tel.value) == 0) {
		alert("\请输入联系电话！");
		document.Test.Tel.focus();
	}
	else if (spaces(document.Test.Email.value) == 0) {
		alert("\请输入联系人E-mail地址！");
		document.Test.Email.focus();
	}
	else if (!checkemail(document.Test.Email.value)) {
		alert("\请输入正确的E-Mail！");
		document.Test.Email.focus();
	}
	else {
        return true;
    }
    return false;
}

function CheckReg() {
	var checked = false;
	var radios = document.getElementsByName('RadioClass');
	for (var x=0; x<radios.length; x++) {
		checked = checked || radios[x].checked;
	}
	
	if (spaces(document.Reg.ContactMan.value) == 0) {
		alert("\请输入姓名!");
		document.Reg.ContactMan.focus();
	}
	else if (spaces(document.Reg.Tel.value) == 0) {
		alert("\请输入联系电话！");
		document.Reg.Tel.focus();
	}
	else if (spaces(document.Reg.Address.value) == 0) {
		alert("\请输入联系地址！");
		document.Reg.Address.focus();
	}
	else if (!checked) {
		alert("请选择你要报读的班级！");
		return false;
	}
	else {
        return true;
    }
    return false;
}

function jsCheck(){
	if(spaces(document.ChannelForm.RealName.value) == 0)
	{
		alert("请填写姓名");
		document.ChannelForm.RealName.focus();
		return false;
	}
	else if(spaces(document.ChannelForm.Age.value) == 0)
	{
		alert("请填写年龄");
		document.ChannelForm.Age.focus();
		return false;
	}	
	else if(spaces(document.ChannelForm.firstschool.value) == 0)
	{
		alert("请填写第一志愿学校");
		document.ChannelForm.firstschool.focus();
		return false;
	}
	else if(spaces(document.ChannelForm.idnum.value) == 0)
	{
		alert("请填写身份证号");
		document.ChannelForm.idnum.focus();
		return false;
	}
	else if(spaces(document.ChannelForm.zkzh.value) == 0)
	{
		alert("请填准考证号");
		document.ChannelForm.zkzh.focus();
		return false;
	}
	else if(spaces(document.ChannelForm.Phone.value) == 0)
	{
		alert("请填写电话");
		document.ChannelForm.Phone.focus();
		return false;
	}
	else if (spaces(document.ChannelForm.Email.value) > 0) {
		 if (!checkemail(document.ChannelForm.Email.value)) {
			alert("\请输入正确的E-Mail！");
			document.ChannelForm.Email.focus();
			return false;
		 }
		else{
			return true;
		}
	}
	else {
        return true;
    }
    return false;
}

var online= new Array();
