//图片按比例缩放
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;
        }
    }
}
//收展菜单
function onChange(i,path){
var childSort=document.getElementById("child" + i);
var downgif=document.getElementById("down" + i);
	if (childSort.style.display=="none"){
		 childSort.style.display="block";
		 downgif.src=path+'-.gif';
		 
	}else{
		 childSort.style.display="none";
		 downgif.src=path+'+.gif';
	}
}
//搜索检查
function checkSearSubmit(){
	if(document.formSear.TextKeyword.value==""){
		alert("请输入关键字");
		document.formSear.TextKeyword.focus();
		return false;
	}
}
//订购检查
function checkOrderSubmit(){
	if(document.formOrder.username.value==""){
		alert("请输入您的姓名.");
		document.formOrder.username.focus();
		return false;
	}
	if(document.formOrder.email.value==""){
		alert("请输入您的E-mail地址!");
		document.formOrder.email.focus();
		return false;
	}
	if (document.formOrder.email.value.indexOf("@",0)== -1||document.formOrder.email.value.indexOf(".",0)==-1){
		window.alert("对不起，你输入的E-mail格式有误！")
		document.formOrder.email.focus()
		return false
    }
	if(document.formOrder.usertell.value==""){
		alert("请输入您的联系电话.");
		document.formOrder.usertell.focus();
		return false;
	}
}

//检查在线提交简历
function checkBioSubmit(){
	if(document.formBio.job_will.value==""){
		alert("请填写您的求职意向.");
		document.formBio.job_will.focus();
		return false;
	}
	if(document.formBio.u_name.value==""){
		alert("请填写您的姓名.");
		document.formBio.u_name.focus();
		return false;
	}
	if(document.formBio.u_mobile.value==""){
		alert("请填写您的移动电话.");
		document.formBio.u_mobile.focus();
		return false;
	}
	if(document.formBio.u_mail.value==""){
		alert('请输入您的E-mail.');
		document.formBio.u_mail.focus();
		return false;
	}
	if (document.formBio.u_mail.value.indexOf("@",0)== -1||document.formBio.u_mail.value.indexOf(".",0)==-1){
		window.alert("对不起，你输入的E-mail格式有误！")
		document.formBio.u_mail.focus()
		return false
    }
	if(document.formBio.u_school.value==""){
		alert("请填写您毕业院校的名称.");
		document.formBio.u_school.focus();
		return false;
	}
	if(document.formBio.u_jy.value==""){
		alert("请填写您的就业状况.");
		document.formBio.u_jy.focus();
		return false;
	}
}

//标签轮换
function getObj(objName){
	return(document.getElementById(objName));
}
function changeOver(objName,objId,num,contentid){
    for(i=0;i<num;i++){
		getObj(objName+i).className="h_bg2";
		getObj(contentid+i).style.display = "none";
	}
	getObj(objName+objId).className="h_bg1 cur";
	getObj(contentid+objId).style.display = "";
}


//-- 栏目频道切换按钮-->
function getObj(objName){
	return(document.getElementById(objName));
}
function changeOvers(objName,objId,num){
    /*for(i=0;i<num;i++){
		getObj(objName+i).className="bg2";
	}
	getObj(objName+objId).className="bg1 cur";*/
}

//接收地址栏参数
function getParameter(param)
{
var query = window.location.search;
var iLen = param.length;
var iStart = query.indexOf(param);
if (iStart == -1)
　return "";
iStart += iLen + 1;
var iEnd = query.indexOf("&", iStart);
if (iEnd == -1)
　return query.substring(iStart);
return query.substring(iStart, iEnd);
}
//留言ajax
function showMessage(){
	var taget_obj = document.getElementById('messageDiv');
	myajax = new webAjax(taget_obj,false,false,'','','');
	var url='';
	var page = getParameter('page');//接收页数
	var keyword = getParameter('TextKeyword');//接收关键字
	if (page!=''&&keyword!=''){
		url='?page='+page+'&TextKeyword='+keyword;
	}else if (page!=''&&keyword==''){ 
		url='?page='+page;
	}else if (page==''&&keyword!=''){ 
		url='?TextKeyword='+keyword;
	}
	myajax.SendGet2("../guestbook.php"+url);
	webXHTTP = null;
}

//ajax函数
<!--
//xmlhttp和xmldom对象
var webXHTTP = null;
var webXDOM = null;
var webContainer = null;
var webShowError = false;
var webShowWait = false;
var webErrCon = "";
var webErrDisplay = "下载数据失败";
var webWaitDisplay = "正在下载数据...";

//获取指定ID的元素

function $DE(id) {
	return document.getElementById(id);
}

//gcontainer 是保存下载完成的内容的容器
//mShowError 是否提示错误信息
//webShowWait 是否提示等待信息
//mErrCon 服务器返回什么字符串视为错误
//mErrDisplay 发生错误时显示的信息
//mWaitDisplay 等待时提示信息
//默认调用 webAjax('divid',false,false,'','','')

function webAjax(gcontainer,mShowError,mShowWait,mErrCon,mErrDisplay,mWaitDisplay)
{

	webContainer = gcontainer;
	webShowError = mShowError;
	webShowWait = mShowWait;
	if(mErrCon!="") webErrCon = mErrCon;
	if(mErrDisplay!="") webErrDisplay = mErrDisplay;
	if(mErrDisplay=="x") webErrDisplay = "";
	if(mWaitDisplay!="") webWaitDisplay = mWaitDisplay;


	//post或get发送数据的键值对
	this.keys = Array();
	this.values = Array();
	this.keyCount = -1;

	//http请求头
	this.rkeys = Array();
	this.rvalues = Array();
	this.rkeyCount = -1;

	//请求头类型
	this.rtype = 'text';

	//初始化xmlhttp
	//IE6、IE5
	if(window.ActiveXObject) {
		try { webXHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { }
		if (webXHTTP == null) try { webXHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { }
	}
	else {
		webXHTTP = new XMLHttpRequest();
	}

	//增加一个POST或GET键值对
	this.AddKey = function(skey,svalue) {
		this.keyCount++;
		this.keys[this.keyCount] = skey;
		svalue = svalue.replace(/\+/g,'$#$');
		this.values[this.keyCount] = escape(svalue);
	};

	//增加一个POST或GET键值对
	this.AddKeyUtf8 = function(skey,svalue) {
		this.keyCount++;
		this.keys[this.keyCount] = skey;
		svalue = svalue.replace(/\+/g,'$#$');
		this.values[this.keyCount] = encodeURI(svalue);
	};

	//增加一个Http请求头键值对
	this.AddHead = function(skey,svalue) {
		this.rkeyCount++;
		this.rkeys[this.rkeyCount] = skey;
		this.rvalues[this.rkeyCount] = svalue;
	};

	//清除当前对象的哈希表参数
	this.ClearSet = function() {
		this.keyCount = -1;
		this.keys = Array();
		this.values = Array();
		this.rkeyCount = -1;
		this.rkeys = Array();
		this.rvalues = Array();
	};


	webXHTTP.onreadystatechange = function() {
		//在IE6中不管阻断或异步模式都会执行这个事件的
		if(webXHTTP.readyState == 4){
			if(webXHTTP.status == 200)
			{
				if(webXHTTP.responseText!=webErrCon) {
					webContainer.innerHTML = webXHTTP.responseText;
				}
				else {
					if(webShowError) webContainer.innerHTML = webErrDisplay;
				}
				webXHTTP = null;
			}
			else { if(webShowError) webContainer.innerHTML = webErrDisplay; }
		}
		else { if(webShowWait) webContainer.innerHTML = webWaitDisplay; }
	};

	//检测阻断模式的状态
	this.BarrageStat = function() {
		if(webXHTTP==null) return;
		if(typeof(webXHTTP.status)!=undefined && webXHTTP.status == 200)
		{
			if(webXHTTP.responseText!=webErrCon) {
				webContainer.innerHTML = webXHTTP.responseText;
			}
			else {
				if(webShowError) webContainer.innerHTML = webErrDisplay;
			}
		}
	};

	//发送http请求头
	this.SendHead = function() {
		//发送用户自行设定的请求头
		if(this.rkeyCount!=-1)
		{ 
			for(;i<=this.rkeyCount;i++)
			{
				webXHTTP.setRequestHeader(this.rkeys[i],this.rvalues[i]);
			}
		}
		　if(this.rtype=='binary'){
		　webXHTTP.setRequestHeader("Content-Type","multipart/form-data");
	}else{
		webXHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	}
};

//用Post方式发送数据
this.SendPost = function(purl) {
	var pdata = "";
	var i=0;
	this.state = 0;
	webXHTTP.open("POST", purl, true);
	this.SendHead();
	//post数据
	if(this.keyCount!=-1)
	{
		for(;i<=this.keyCount;i++)
		{
			if(pdata=="") pdata = this.keys[i]+'='+this.values[i];
			else pdata += "&"+this.keys[i]+'='+this.values[i];
		}
	}
	webXHTTP.send(pdata);
};

//用GET方式发送数据
this.SendGet = function(purl) {
	var gkey = "";
	var i=0;
	this.state = 0;
	//get参数
	if(this.keyCount!=-1)
	{ 
		for(;i<=this.keyCount;i++)
		{
			if(gkey=="") gkey = this.keys[i]+'='+this.values[i];
			else gkey += "&"+this.keys[i]+'='+this.values[i];

		}
		if(purl.indexOf('?')==-1) purl = purl + '?' + gkey;
		else  purl = purl + '&' + gkey;
	}
	webXHTTP.open("GET", purl, true);
	this.SendHead();
	webXHTTP.send(null);
};

//用GET方式发送数据，阻塞模式
this.SendGet2 = function(purl) {
	var gkey = "";
	var i=0;
	this.state = 0;
	//get参数
	if(this.keyCount!=-1)
	{ 
		for(;i<=this.keyCount;i++)
		{
			if(gkey=="") gkey = this.keys[i]+'='+this.values[i];
			else gkey += "&"+this.keys[i]+'='+this.values[i];
		}
		if(purl.indexOf('?')==-1) purl = purl + '?' + gkey;
		else  purl = purl + '&' + gkey;
	}
	webXHTTP.open("GET", purl, false);
	this.SendHead();
	webXHTTP.send(null);
	//firefox中直接检测XHTTP状态
	this.BarrageStat();
};

//用Post方式发送数据
this.SendPost2 = function(purl) {
	var pdata = "";
	var i=0;
	this.state = 0;
	webXHTTP.open("POST", purl, false);
	this.SendHead();
	//post数据
	if(this.keyCount!=-1)
	{
		for(;i<=this.keyCount;i++)
		{
			if(pdata=="") pdata = this.keys[i]+'='+this.values[i];
			else pdata += "&"+this.keys[i]+'='+this.values[i];
		}
	}
	webXHTTP.send(pdata);
	//firefox中直接检测XHTTP状态
	this.BarrageStat();
};


} // End Class webAjax

//初始化xmldom
function InitXDom() {
	if(webXDOM!=null) return;
	var obj = null;
	// Gecko、Mozilla、Firefox
	if (typeof(DOMParser) != "undefined") { 
		var parser = new DOMParser();
		obj = parser.parseFromString(xmlText, "text/xml");
	}
	// IE
	else { 
		try { obj = new ActiveXObject("MSXML2.DOMDocument");} catch (e) { }
		if (obj == null) try { obj = new ActiveXObject("Microsoft.XMLDOM"); } catch (e) { }
	}
	webXDOM = obj;
};



//读写cookie函数
function GetCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start = document.cookie.indexOf(c_name + "=")
		if (c_start != -1)
		{
			c_start = c_start + c_name.length + 1;
			c_end   = document.cookie.indexOf(";",c_start);
			if (c_end == -1)
			{
				c_end = document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return null
}

function SetCookie(c_name,value,expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); //使设置的有效时间正确。增加toGMTString()
}

-->