
function killErr(){
	return true;
}
window.onerror=killErr;

document.write("<script src='js/validator.js' type='text/javascript' language='javascript'></script>");

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=400,screenX=150,screenY=150,top=150,left=300')
}
//关闭窗口
function closeit(){  
window.opener=null;
window.open("","_self");
window.close(); 
}


function DrawImage(ImgD,awidth,aheight){ 

var image=new Image(); 

image.src=ImgD.src; 

if(image.width>0 && image.height>0){ 

  flag=true; 

  if(image.width/image.height>= awidth/aheight){ 

   if(image.width>awidth){

    ImgD.width=awidth; 

    ImgD.height=(image.height*aheight)/image.width; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   }

   /*ImgD.alt="bigpic"  */

  } 

  else{ 

   if(image.height>aheight){

    ImgD.height=aheight; 

    ImgD.width=(image.width*awidth)/image.height; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   } 

    /*ImgD.alt="bigpic"  */ 

  } 

}

}



function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function  addFav() {   //加入收藏夹  
             if  (document.all) {  
                window.external.addFavorite('http://www.hpys.cn', '好普养生网');  
            }  
             else   if  (window.sidebar) {  
            window.sidebar.addPanel('好普养生网', 'http://www.hpys.cn',  "" );  
            }  
        }  



function cswitch(tid,box,num,tag){
if(tid==null || box==null || num==null) return;
var tabs=document.getElementById(tid);
if(tabs==null) return;
if(tag=="") tag="LI";
tabs=tabs.getElementsByTagName(tag);
for(n=0;n<tabs.length;n++){
	 if(num==n){
		tabs[n].className="current";
		document.getElementById(box+n).className="sw";
	 }else{
		tabs[n].className="";
		document.getElementById(box+n).className="hd";
	 }	
}	
}


function closewin() {
   if (opener!=null && !opener.closed) {
      opener.window.newwin=null;
      opener.openbutton.disabled=false;
      opener.closebutton.disabled=true;
   }
}

var count=0;//做计数器
var limit=new Array();//用于记录当前显示的哪几个菜单
var countlimit=1;//同时打开菜单数目，可自定义

function expandIt(el) {
   obj = eval("sub" + el);
   if (obj.style.display == "none") {
      obj.style.display = "block";//显示子菜单
      if (count<countlimit) {//限制2个
         limit[count]=el;//录入数组
         count++;
      }
      else {
         eval("sub" + limit[0]).style.display = "none";
         for (i=0;i<limit.length-1;i++) {limit[i]=limit[i+1];}//数组去掉头一位，后面的往前挪一位
         limit[limit.length-1]=el;
      }
   }
   else {
      obj.style.display = "none";
      var j;
      for (i=0;i<limit.length;i++) {if (limit[i]==el) j=i;}//获取当前点击的菜单在limit数组中的位置
      for (i=j;i<limit.length-1;i++) {limit[i]=limit[i+1];}//j以后的数组全部往前挪一位
      limit[limit.length-1]=null;//删除数组最后一位
      count--;
   }
}


<!--
function checkAddForm(objForm) {
	if (objForm.fname.value=="") {
	    alert("请输入姓名！");
		objForm.fname.focus();	    
		return false;
	}
	if (objForm.birth.value=="") {
	    alert("请选择出生年月！");
		objForm.birth.focus();	    
		return false;
	}
	if (objForm.nation.value=="") {
	    alert("请填写民族！");
		objForm.nation.focus();	    
		return false;
	}
		if (objForm.culture.value=="") {
	    alert("请填写文化！");
		objForm.culture.focus();	    
		return false;
	}
		if (objForm.place.value=="") {
	    alert("请填写籍贯！");
		objForm.place.focus();	    
		return false;
	}
		if (objForm.mobile.value=="") {
	    alert("请填写手机！");
		objForm.mobile.focus();	    
		return false;
	}
		if (objForm.email.value==""){ 
	  	alert("请输入邮箱地址！");
		objForm.email.focus();	    
		return false;
	}		
	var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
    if (!filter.test(objForm.email.value)) { 
    	alert("邮箱地址不正确,请重新填写！"); 
        objForm.email.focus();
        objForm.email.select();
        return (false); 
    } 
		if (objForm.pic.value=="") {
	    alert("请上传照片！");
		objForm.pic.focus();	    
		return false;
	}
		if (objForm.specialty.value=="") {
	    alert("请填写专业特长！");
		objForm.specialty.focus();	    
		return false;
	}
		if (objForm.job.value=="") {
	    alert("请填写志愿岗位！");
		objForm.job.focus();	    
		return false;
	}
		if (objForm.stime.value=="") {
	    alert("请填写志愿开始时间！");
		objForm.stime.focus();	    
		return false;
	}
		if (objForm.experience.value=="") {
	    alert("请填写学习工作经历！");
		objForm.experience.focus();	    
		return false;
	}
		if (objForm.objective.value=="") {
	    alert("请填写志愿目的！");
		objForm.objective.focus();	    
		return false;
	}
	
}
//-->

<!--
function checkAddForm2(objForm) {
	if (objForm.fname.value=="") {
	    alert("请输入姓名！");
		objForm.fname.focus();	    
		return false;
	}
	if (objForm.birth.value=="") {
	    alert("请选择出生年月！");
		objForm.birth.focus();	    
		return false;
	}
	if (objForm.nation.value=="") {
	    alert("请填写民族！");
		objForm.nation.focus();	    
		return false;
	}
		if (objForm.culture.value=="") {
	    alert("请填写文化！");
		objForm.culture.focus();	    
		return false;
	}
		if (objForm.place.value=="") {
	    alert("请填写籍贯！");
		objForm.place.focus();	    
		return false;
	}
		if (objForm.mobile.value=="") {
	    alert("请填写手机！");
		objForm.mobile.focus();	    
		return false;
	}
		if (objForm.email.value==""){ 
	  	alert("请输入邮箱地址！");
		objForm.email.focus();	    
		return false;
	}		
	var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
    if (!filter.test(objForm.email.value)) { 
    	alert("邮箱地址不正确,请重新填写！"); 
        objForm.email.focus();
        objForm.email.select();
        return (false); 
    } 
		if (objForm.pic.value=="") {
	    alert("请上传照片！");
		objForm.pic.focus();	    
		return false;
	}
		if (objForm.day1.value=="") {
	    alert("请选择罗浮山养生之旅天数！");
		objForm.day1.focus();	    
		return false;
	}
		if (objForm.day2.value=="") {
	    alert("请选择圣莲山养生之旅天数！");
		objForm.day2.focus();	    
		return false;
	}
		if (objForm.day3.value=="") {
	    alert("请选择梅花山养生之旅天数！");
		objForm.day3.focus();	    
		return false;
	}
		if (objForm.body.value=="") {
	    alert("请填写身体状况！");
		objForm.body.focus();	    
		return false;
	}
		
	
}
//-->

function showalert(msg){
	alert(msg);
}





function setHomepage(pageURL) {
	
	pageURL=location.href;
    if (document.all) {
        document.body.style.behavior='url(#default#homepage)';
        document.body.setHomePage(pageURL);
    }
    else if (window.sidebar) {
        if(window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项signed.applets.codebase_principal_support 值该为true" );
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage',pageURL);
    }
}


