function toggle(sDivId) {
                var oDiv = document.getElementById(sDivId);
                oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}
var isnDays=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
function format(num)
{
    if(num < 10)
        return ("0" + num);
    else
        return num;
}
function ShowToday()
{
    var today = new Date();
    var year = today.getFullYear();
    var month = today.getMonth()+1;
    var date = today.getDate();
    var day = today.getDay();
    var hour = today.getHours();
    var minute = today.getMinutes();
    var second = today.getSeconds();   
    
    var strDate = year+ "年" + format(month) + "月" + format(date) + "日"  + " " + format(hour) + ":" + format(minute) + ":" + format(second)+ " &nbsp&nbsp" + isnDays[day];
    var oDiv = document.getElementById("showTime");
        oDiv.innerHTML = strDate;
    window.setTimeout("ShowToday()",1000);
}
function newimg(imgurl, w, h) {
    if (w && h) {
        var pw = 'width=' + w + ',height=' + h;
        newwin = window.open(imgurl, 'newwindow', pw);
    } else {
        newwin = window.open(imgurl, 'newwindow', 'width=800,height=620');
    }
newwin.focus();
newwin.document.close();
} 
function newimg1(imgurl) { 
newwin=window.open('','newwindow','width=10,height=10'); 
newwin.focus();
newwin.document.write('<body leftmargin=25px topmargin=10px><img id="img1" src='+imgurl+' onload="self.resizeTo(this.offsetWidth+50,this.offsetHeight+50);">');
newwin.document.close();
} 

function validate_form_joinus() {
	validate = true;
	if(!check_empty(document.form.NAME.value)) {
		validate=false;
		alert('[姓名]不能为空！');
	}
	if(validate && !check_empty(document.form.phone.value)) {
		validate=false;
		alert('[电话]不能为空！');
	}
	if(validate && !check_empty(document.form.address.value)) {
		validate=false;
		alert('[地址]不能为空！');
	}
	if(validate && !check_email(document.form.EMAIL.value)) {
		validate=false;
		alert('[电子邮箱]格式不对！');
	}
	if(validate && !check_empty(document.form.TITLE.value)) {
		validate=false;
		alert('[标题]不能为空！');
	}
	if(validate && !check_empty(document.form.DESCRIPTION.value)) {
		validate=false;
		alert('[内容]不能为空！');
	}
	return validate;
}

function validate_form_contactus() {
	validate = true;
	if(!check_empty(document.form.NAME.value)) {
		validate=false;
		alert('[姓名]不能为空！');
	}
	if(validate && !check_empty(document.form.COMPANY.value)) {
		validate=false;
		alert('[公司名称]不能为空！');
	}
	if(validate && !check_empty(document.form.phone.value)) {
		validate=false;
		alert('[电话]不能为空！');
	}
	if(validate && !check_empty(document.form.address.value)) {
		validate=false;
		alert('[地址]不能为空！');
	}
	if(validate && !check_email(document.form.EMAIL.value)) {
		validate=false;
		alert('[电子邮箱]格式不对！');
	}
	if(validate && !check_empty(document.form.TITLE.value)) {
		validate=false;
		alert('[标题]不能为空！');
	}
	if(validate && !check_empty(document.form.DESCRIPTION.value)) {
		validate=false;
		alert('[内容]不能为空！');
	}
	return validate;
}

function check_empty(text) {
  return (text.length > 0); 
}
function check_email(address) {
  if ((address == "")
    || (address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1))
      return false;
  return true;
}

function setLanguage(){
	var lan = document.all("setLan").value;
	if(lan == 'en'){
		document.location.href="en/index.htm";
	}else if(lan == 'cn'){
		document.location.href="index.htm";
	}
}


