$(document).ready(fHideFocus)
var ua = navigator.userAgent.toLowerCase();
	isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); 
function showsubmenu($sid){
    var temp=document.getElementById($sid);	
    if (temp.style.display == 'none'){
		document.cookie = "lastmenu=" + escape($sid); 
        temp.style.display='block';
    }
    else{
		document.cookie = "lastmenu=" + escape('') ;
        temp.style.display='none';
    }
}

function openScript(url,title,width, height){
	var Win = window.open(url,title,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,status=no' );
}
function op(url,urlid){
window.open(url,urlid,"width=400,height=360,scrollbars=no")
}
function PutKey(_obj,str){
	_obj.onblur=function(){
		if (this.value==''){
			this.value='请输入产品编号';
			this.style.color=''
		}
	}
	_obj.style.color='#f00'
	if (_obj.value==str){
		_obj.value=''
	}
}
function changevote(_2,_1,_0){
	/*if (_2=='pagevalue'){
		document.getElementById('productvalue').style.display='none';
		document.getElementById('fridgelike').style.display='none';
	}
	if (_2=='productvalue'){
		document.getElementById('pagevalue').style.display='none';
		document.getElementById('fridgelike').style.display='none';
	}
	if (_2=='fridgelike'){
		document.getElementById('pagevalue').style.display='none';
		document.getElementById('productvalue').style.display='none';
	}	*/
	//document.getElementById(_2).style.display
	if (document.getElementById(_2).style.display=='block'){
		return
	}
	$('div.vote').css({display:'none'});	
	$('#'+_2+' h3').click(function(){   
     hiddenList(_2)
   }); 
	displayList(_2);	
	//if (document.getElementById(_2).style.display=='block'){
		//document.getElementById(_2).style.display='block';
	//	hiddenList(_2);

	//}
	//else{
		//document.getElementById(_2).style.display='none';
	//	displayList(_2);
	//}
}
function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}

// 显示列表框
function displayList(_s){
	getObject(_s).style.height = 0; 
	getObject(_s).style.display="block";
	var h = getObject(_s).offsetHeight;
	var max_h = 175;
	var anim = function(){
		h += 3;				    
		if(h >= max_h){
			getObject(_s).style.height = "175px";
			if(tt){window.clearInterval(tt);}
		}
		else{
			getObject(_s).style.height = h + "px";
		}
	}
	var tt = window.setInterval(anim,2);
}

// 隐藏列表框
function hiddenList(_s){
	var h = getObject(_s).offsetHeight; 
	var anim = function(){
		h -= 3;
		if(h <= 3){
			getObject(_s).style.display="none";
			if(tt){window.clearInterval(tt);}
		}
		else{
			getObject(_s).style.height = h + "px";
		}
	}
	var tt = window.setInterval(anim,2);
}

//=======================================================
//函数名称：showClassList()
//函数功能：隐藏-显示级分类列表框
//返 回 值：无
//=======================================================
function showClassList(_s){   
   if(getObject(_s).style.display == "none"){
       displayList(_s);
   }
   else{ 
	     hiddenList(_s); 
	 }
}
function fHideFocus(tName){
aTag=document.getElementsByTagName("a");
for(i=0;i<aTag.length;i++)aTag[i].hideFocus=true;
//for(i=0;i<aTag.length;i++)aTag[i].onfocus=function(){this.blur();};
}

function hideElms(elmTag) {
	for (i=0; i<document.all.tags(elmTag).length; i++){
		obj = document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "hidden";
	}
}

function JoinJob(job_id) {
	var name_tmep,txt,formAction;	
	formAction = "http://zr.haijiagroup.com/join.asp?job_id="+job_id;
	if(isIE)hideElms('select');
	txt=" <form method=\"post\" id=\"alertform\"action=\""+formAction+"\" target=\"frameCheckForm\" \">"
	txt+=" <ul>"
	txt+="  <li style=\"list-style:none;padding-left:30px;background:#fafafa\">&nbsp;</li>"
	txt+="  <li style=\"list-style:none;padding-left:30px;background:#fafafa\"><div style=\"width:60px;float:left\">你的姓名:</div><input type=\"text\" name=\"j_name\" id=\"j_name\" /></li><br />"
	txt+="  <li style=\"list-style:none;padding-left:30px;background:#fafafa\"><div style=\"width:60px;float:left\">联系电话:</div><input type=\"text\" name=\"j_tel\" id=\"j_tel\" /></li><br />"
	txt+="  <li style=\"list-style:none;padding-left:30px;background:#fafafa\"><div style=\"width:60px;float:left\">性别:</div><select name='j_sex' style='width:65px;'><option value='男'>男</option><option value='女'>女</option></select></li><br />"
	txt+="  <li style=\"list-style:none;padding-left:30px;background:#fafafa\"><div style=\"width:60px;float:left\">详细说明:</div><textarea name=\"j_body\" id=\"j_body\" rows=\"8\" cols=\"40\"></textarea></li>"
	txt+=" </ul>"

	var alertFram = document.createElement("DIV");
	alertFram.id="alertFram";
	alertFram.style.position = "absolute";
	alertFram.style.left = "50%";
	alertFram.style.top = "50%";
	alertFram.style.marginLeft = "-250px" ;
	alertFram.style.marginTop = -160+document.documentElement.scrollTop+"px";
	alertFram.style.width = "500px";
	alertFram.style.height = "350px";
	//alertFram.style.background = "#fff";
	alertFram.style.textAlign = "center";
	alertFram.style.lineHeight = "350px";
	alertFram.style.zIndex = "10001";

	strHtml  = "<div style=\"margin:0px;padding:0px;width:100%\">\n";
	strHtml += "	<iframe id=\"frameCheckForm\" name=\"frameCheckForm\" src=\"about:blank\" style=\"display:none\"></iframe>"
	strHtml += "	<div style=\"background:#FF6500;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #FF9E33;\">[请填写你的信息]</div>\n";
	strHtml += "	<div style=\"background:#fff;padding-top:14px;text-align:left;font-size:12px;height:330px;line-height:180%;border-left:1px solid #FF9E33;border-right:1px solid #FF9E33;\">"+txt+"</div>\n";
	strHtml += "	<div style=\"background:#FFECDF;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #FF9E33;\"><input type=\"button\" value=\"提交\" id=\"do_OK\" class=\"cool\" onclick=\"doSubmit();return false \"/>&nbsp;&nbsp;<input type=\"button\" value=\"返回\" id=\"do_OK_change\" onclick=\"doOk()\"  class=\"cool\" /></div>\n";
	strHtml += "</form></div>\n";
	alertFram.innerHTML = strHtml;
	document.body.appendChild(alertFram);
	this.doOk = function(){
		document.body.removeChild(alertFram);
	}
	this.doSubmit = function(){
	//alert("请填写完整的备注信息以便我们确定错误谢谢")
		if (document.getElementById("j_name").value.length<1){
			alert("请填写您的姓名以便我们联系谢谢");
		}
		else if (document.getElementById("j_tel").value.length<1){
			alert("请填写您的联系电话以便我们联系谢谢");
		}		
		else if (document.getElementById("j_body").value.length<1){
			alert("请填写您的详细信息以便我们更准确的作出选择谢谢");
		}
		else {
			document.getElementById("alertform").submit();
			document.body.removeChild(alertFram);
			//alert('成功提交请等待我们的回复谢谢');
			//window.setTimeout('alert("感谢您的意见我们会尽快作出修改谢谢")',500);
		}		
	}	
}
function changeProduct(t){
	if (t.value=='washer'){
		window.location.href='index.asp?u=2&c=1';
	}
	else if (t.value=='fridge'){
		window.location.href='index.asp?u=2&c=2';
	}
	else{
		window.location.href='index.asp?u=2&id='+t.value+'&m=product';
	}
}
