<!--
function validate(theform){	
	if (document.all||document.getElementById){
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			tempobj.disabled=true
		}
	}
}
//-->

//弹出窗口
function openwin(url, w, h)
{
	window.open(url, "BrowseWindow", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width="+w+",height="+h) ;
}

//测量图片
function resizepic(theImg,w,h)
{
	var i = theImg.width/theImg.height;
	
	if(theImg.width > w)
	{
		theImg.width = w;
	}
	if(theImg.height > h)
	{
		theImg.width = h*i;
		theImg.height = h;
	}
}
//显示图片
function ChangePIC(strValue,obj,w,h)
{	
	obj.innerHTML = '<img src="' + strValue + '" onload="resizepic(this,' + w + ',' + h + ')">';
}

//高亮显示
function doClickStyle(obj,objclassname){
document.getElementById(obj).className=objclassname;
}

//移动变色
function sbar(st,scolor) {
 st.style.backgroundColor = scolor;
}
function cbar(st,scolor) {
 st.style.backgroundColor = scolor;
}
//对比
  function doCompare(){
    window.open('contrast.html');
  }


//全选
function selall(form1)
{
	var form = eval(form1);
	for(var i = 0;i < form.elements.length; i++) {
		var e = form.elements[i];
		if (e.disabled != true) {
			e.checked = true;
		}
	}
}

//全不选
function clearall(form1)
{
	var form = eval(form1);
	for(var i = 0;i < form.elements.length; i++) {
		var e = form.elements[i];
		if (e.disabled != true) {
			e.checked = false;
		}
	}
}

//反选
function seloth(form1)
{
	var form = eval(form1);
	for(var i = 0;i < form.elements.length; i++) {
		var e = form.elements[i];
		if (e.disabled != true) {
			if (e.checked != false) {
				e.checked = false;
			} else {
				e.checked = true;
			}
		}
	}
}

//选择当前
function selcur(form1, r)
{
	var form = eval(form1);
	var m = 0
	for(var i = 0;i < form.elements.length; i++) {
		var e = form.elements[i];
		if (e.type == 'checkbox') {
			if (m == (r - 1)) {
				if (e.checked != false) {
					e.checked = false;
				} else {
					e.checked = true;
				}
				break;
			}
			m++;
		}
	}
}


//选中变色
function clickcompareBox(id,box) {
	var trTag = document.getElementById("compareColor"+id);
	var m = 0
	for(var i = 0;i < box.elements.length; i++) {
		var e = box.elements[i];
		if (e.type == 'checkbox') {
			if (m == (id - 1)) {
				if (e.checked != false) {
					trTag.style.backgroundColor = "#BEF2FF";
				} else {
					trTag.style.backgroundColor = "";
				}
				break;
			}
			m++;
		}
	}
}

//全选、反选、全部不选变色
function clickcompareBox2(box) {
	var id = 1;
	for(var i = 0;i < box.elements.length; i++) {
		var e = box.elements[i];
		if (e.type == 'checkbox') {
			var trTag = document.getElementById("compareColor"+id);
			if (e.checked != false) {
				trTag.style.backgroundColor = "#BEF2FF";
			} else {
				trTag.style.backgroundColor = "";
			}
			id++;
		}
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//获得表单值
function GetValue(obj,mod)
{
	if(mod=='value')
	{
		var m=obj.options[obj.selectedIndex].value
		//alert(m);//获取value
	}
	else
	{
		var m=obj.options[obj.selectedIndex].text
		//alert(m);//获取文本
	}
	
	return n;
}

function SelTitleWord(str)
{
	document.form1.title.value += GetValue(str) + " ";
}

//合理图片尺寸
function resizeImg(thispic,str){
	if(thispic.width>str){thispic.height=thispic.height*str/thispic.width;thispic.width=str;}
}

//首页合理尺寸
function resizeImgHome(thispic,height,width)
{	
	if(thispic.width>width)
	{
		thispic.height=thispic.height*width/thispic.width;
		thispic.width=width;		
	}
	else if(thispic.height>height)
	{
		thispic.width=thispic.width*height/thispic.height;
		thispic.height=height;		
	}
}

function doDelete(str)
{
	if(confirm(str))
	{
		return true;
	}
	return false;
}
