﻿// JavaScript Document
//function resizeHeight()   
//  {   
 //         var indexcontent=document.getElementById("indexcontent");
 //         var hbody=document.documentElement.clientHeight;
  //        indexcontent.style.height   =   parseInt(hbody-200);	  
 // } 
  
// function resizeHeight(){
//  var bobo=document.getElementById("indexcontent"); //iframe id
//  if (document.getElementById){
//   if (bobo && !window.opera){
 //   if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
 //    bobo.height = bobo.contentDocument.body.offsetHeight;
//    }else if(bobo.Document && bobo.Document.body.scrollHeight){
//     bobo.height = bobo.Document.body.scrollHeight;
//    }
//   }
//  }
 //}
function getSize() { 
       var xScroll, yScroll;        
       if (window.innerHeight && window.scrollMaxY) {        
              xScroll = document.body.scrollWidth; 
              yScroll = window.innerHeight + window.scrollMaxY; 
       } else if (document.body.scrollHeight > document.body.offsetHeight){       // all but Explorer Mac 
              xScroll = document.body.scrollWidth; 
              yScroll = document.body.scrollHeight; 
       } else {       // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
              xScroll = document.body.offsetWidth; 
              yScroll = document.body.offsetHeight; 
       } 
       var windowWidth, windowHeight; 
       if (self.innerHeight) {       // all except Explorer 
              windowWidth = self.innerWidth; 
              windowHeight = self.innerHeight; 
       } else if (document.documentElement && document.documentElement.clientHeight) {       // Explorer 6 Strict Mode 
              windowWidth = document.documentElement.clientWidth; 
              windowHeight = document.documentElement.clientHeight; 
       } else if (document.body) {       // other Explorers 
              windowWidth = document.body.clientWidth; 
              windowHeight = document.body.clientHeight; 
       }        
       // for small pages with total height less then height of the viewport 
       if(yScroll < windowHeight){ 
              pageHeight = windowHeight; 
              y = pageHeight; 
       } else {  
              pageHeight = yScroll; 
              y = pageHeight; 
       } 
       if(xScroll < windowWidth){        
              pageWidth = windowWidth; 
       } else { 
              pageWidth = xScroll; 
       } 
       arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)  
       return arrayPageSize; 
} 
 
function resizeHeight() { 
       var x = new getSize(); 
       document.getElementById("indexcontent").style.height=x[1]-199+"px"; 
} 


  
function changeclassandposition(str,str1,str2)
{
	var myobj1 = document.getElementById(str1);	
	myobj1.className = str2;
	
	if (str!="")
	{
	var mytableleft = 0;
	var e_l = str;
	while(e_l)
	{
	mytableleft = mytableleft + e_l.offsetLeft;
	e_l = e_l.offsetParent;
	}
	myobj1.style.left = mytableleft ;
	}
}

function isEmail(s) {
	if (s.length > 100)	return false;
	if (s.indexOf("'")!=-1 || s.indexOf("/")!=-1 || s.indexOf("\\")!=-1 || s.indexOf("<")!=-1 || s.indexOf(">")!=-1) return false;
    s = s.replace('(', '');
    s = s.replace(')', '');
    s = s.replace('（', '');
    s = s.replace('）', '');
	var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[_.0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+(.+)$";
	var re = new RegExp(regu);
	if (s.search(re) != -1)
		return true;
	else
		return false;
	}

function checkreg(){
	var flag = false;
  if(document.myform.sex != null){
    var msglen=document.myform.sex.length;
    for(i=0;i<msglen;i++){
      if(document.myform.sex[i].checked==true){
        flag = true;
      }
    }
  }
  if (flag == false)
  {
    alert("请选择姓别");
    return false;
  }
	if(document.myform.FirstName.value==""){
		alert("请填写名字!");
		document.myform.FirstName.focus();
		return false;
	}
	if(document.myform.LastName.value==""){
		alert("请填写姓氏!");
		document.myform.LastName.focus();
		return false;
	}
	if(document.myform.Email.value==""){
		alert("请填写邮箱地址!");
		document.myform.Email.focus();
		return false;
	}
	if(isEmail(document.myform.Email.value))
		{
		}
		else
		{
			alert('邮箱地址填写错误!');
			document.myform.Email.focus();
			return false;
		}
	if(document.myform.Country.value==""){
		alert("请填写国家/经济体!");
		document.myform.Country.focus();
		return false;
	}
	if(document.myform.Ministry.value==""){
		alert("请填写所在单位!");
		document.myform.Ministry.focus();
		return false;
	}
	if(document.myform.PositionTitle.value==""){
		alert("请填写职位/部门!");
		document.myform.PositionTitle.focus();
		return false;
	}
	if(document.myform.LoginName.value==""){
		alert("请填写用户名!");
		document.myform.LoginName.focus();
		return false;
	}
	if(document.myform.Password.value==""){
		alert("请填写密码!");
		document.myform.Password.focus();
		return false;
	}
	if(document.myform.Password.value!=document.myform.Verifypass.value){
		alert("两次密码输入不一致，请重新填写");
		document.myform.Verifypass.focus();
		return false;
	}
	return true;
}

function checklogin(){
	if(document.form1.username.value==""){
		alert("用户名不能为空!");
		document.form1.username.focus();
		return false;
	}
	if(document.form1.password.value==""){
		alert("密码不能为空!");
		document.form1.password.focus();
		return false;
	}
	return true;
}

function Saveit(){ 
temp.location=event.srcElement.src //在隐藏帧中加载图片 
//100毫秒后在id为temp的隐藏帧上执行saveas命令  
setTimeout("temp.document.execCommand('saveas')",100) 
} 