
//加载时显示	
	function foodShowFirst(){
	//	alert("==============1");
		var d = new Date();
		var ftIds= d.getMonth()+1;
		for(var i = 1; i <= 12; i++){
		if(i == ftIds){
			if(eval("document.getElementById('iatp"+i+"')")!=null){
				eval("document.getElementById('iatp"+i+"').style.display='block'");
			}
			if(eval("document.getElementById('iapp"+i+"')")!=null){
				eval("document.getElementById('iapp"+i+"').style.display='block'");
			}
			if(eval("document.getElementById('monthid"+i+"')")!=null){
				eval("document.getElementById('monthid"+i+"').className='ing'");
				//alert(eval("document.getElementById('monthid"+i+"')").class);
			}
		}else{
			if(eval("document.getElementById('iatp"+i+"')")!=null){
				eval("document.getElementById('iatp"+i+"').style.display='none'");
			}
			if(eval("document.getElementById('iapp"+i+"')")!=null){
				eval("document.getElementById('iapp"+i+"').style.display='none'");
			}
			if(eval("document.getElementById('monthid"+i+"')")!=null){
				eval("document.getElementById('monthid"+i+"').className=''");
			}
		}
	}
}

function gethelp(){
		DoHelp('搜索');
}

if (window.ActiveXObject && !window.XMLHttpRequest) {
	window.XMLHttpRequest=function() {
      return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP');
	};
}

//设为首页
	function h(obj,url){obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);}

//搜索
	function searchResult(type){
			if(type=='menu'){
				Search.action="http://search.keko.com.cn/searchResult.htm";
				Search.target="_blank";
				Search.submit();
			}else if(type="material"){
				Search.action="http://search.keko.com.cn/materialSearch.htm";
				Search.target="_blank";
				Search.submit();
			}
	}
	
//默认回车为食谱搜索
	function KeyDown()
	{
	    if (event.keyCode == 13)
	    {
	        Search.action="http://search.keko.com.cn/searchResult.htm";
	        Search.target="_blank";
			Search.submit();
	    }
	}
	


	
//健康测试
 function healthtest(){
	 if(document.getElementById("height").value!=''&&document.getElementById("weight").value!=''&&document.getElementById("age").value!=''){

		health.action = "onlineTest.htm";
		health.target="_blank";
		health.submit();
	 }else{
	 	alert("您好！成人营养自测各项均为必填项");
	 }
 }
 

 
//登陆
function login(){
	 var nick = document.getElementById("nick").value;
	 var password = document.getElementById("password").value;
	 if(nick!=''&&password!=''){
	 var condition = "?accounts.nick=" + nick + "&accounts.password=" + password;
	 var req=new XMLHttpRequest();
	if (req) {
		req.onreadystatechange=function() {
		if (req.readyState==4 && req.status==200) {//判断状态，4是已发送，200已完成
           var value = req.responseText;
			document.getElementById("member").innerHTML=value;
		}
     }
    document.getElementById("member").innerHTML =  "登录中...";
    req.open('POST','/userLogin.htm'+condition);//改变原料ID和原料量
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    req.send("");//发送参数如果有参数req.send("username="+user_name);用request取得
  }
  }
}

function login1(){
	var req=new XMLHttpRequest();
		if (req) {
		req.onreadystatechange=function() {
			if (req.readyState==4 && req.status==200) {//判断状态，4是已发送，200已完成
	           var value = req.responseText;
					document.getElementById("member").innerHTML=value;
			}
     }
    document.getElementById("member").innerHTML =  "";
    req.open('POST','/userLogin.htm');//改变原料ID和原料量
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    req.send("");//发送参数如果有参数req.send("username="+user_name);用request取得
  }
}

function register(){
	window.location.href="http://www.keko.com.cn/memberAdd.htm";
}


function KeyDown1()
{
    if (event.keyCode == 13)
    {
      login();
    }
}

//提交调查
function submitForm() {
    var t = 0;
    var t1 = 0;
    var temp = "";
    temp = "";
    t = t + 1;
    t1 = 0;
    t1 = t1 + 1;
    if (document.getElementById("radio" + t + t1).checked) {
        temp = temp + document.getElementById("radio" + t + t1).value + "#";
    }
    t1 = t1 + 1;
    if (document.getElementById("radio" + t + t1).checked) {
        temp = temp + document.getElementById("radio" + t + t1).value + "#";
    }
    t1 = t1 + 1;
    if (document.getElementById("radio" + t + t1).checked) {
        temp = temp + document.getElementById("radio" + t + t1).value + "#";
    }
    t1 = t1 + 1;
    if (document.getElementById("radio" + t + t1).checked) {
        temp = temp + document.getElementById("radio" + t + t1).value + "#";
    }
    document.getElementById("opa").value = temp;
    investForm.action = "/shike/investigationWebSave0.htm";
    if (Validator.Validate(document.investForm, 3)) {
        var msgbox;
        document.investForm.target="_blank";
        document.investForm.submit();
    }
}
