// JavaScript Document
<!--
//浏览器判断
ie4 = (document.all) ? true : false;  
ns4 = (document.layers) ? true : false;  
function LMYC(number) {
var lbmc;
var lbmc_div;
    for (i=1;i<=number;i++) {
        lbmc = "LM" + i;
		lbmc_div = document.getElementById(lbmc);
        lbmc_div.style.display = 'none';
    }
}

function showDiv(i) {
	var focusDiv = "LM" + i;
	getbyid(focusDiv).style.display = '';	
}

function hideDiv(i) {
	var blurDiv = "LM" + i;
	getbyid(blurDiv).style.display = 'none';	
}

function ShowFLT(i,number) {
    lbmc = "LM" + i;
	lbmc_div = document.getElementById(lbmc);
    if (lbmc_div.style.display == 'none') {
        LMYC(number);
        lbmc_div.style.display = '';
    }
    else {
        lbmc_div.style.display = '';
    }
}

function getbyid(id) {
	//获取document节点
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.all) {
		return document.all[id];
	} else if (document.layers) {
		return document.layers[id];
	} else {
		return null;
	}
}
function selectTag(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
	
	
}
function selectTags(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("cCommend").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tag"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
	
	
}

/*commend ----------------------------------*/
function clearCommentContent(){
		if (getbyid("spcontent").value== "请在这里发表您个人的看法，发言时请遵守注意文明"){
			getbyid("spcontent").value=""
		}
}

function checkCommentContent(){
    var author = getbyid("news_comment_author")
    var anonymous = getbyid("news_comment_anonymous")
    var content = getbyid("spcontent");
   
    var errormsg = "";
	
    if(!anonymous.checked && author.value == ""){
		 errormsg = "* 用户不能为空, 您可以选择匿名发表\n";
		 author.focus();
    }
 
    if(!anonymous.checked && author.value.length > 16){
		 errormsg = "* 用户不能超过16个字符\n";
		 author.focus();
    }
    
	if(content.value.match(/^\s*$/)){
		 errormsg = errormsg + "* 内容不能为空\n";
		 content.focus();
		}
	if(content.value=="请在这里发表您个人的看法，发言时请遵守注意文明"){
		 errormsg = errormsg + "* 请先发表您个人的看法\n";
		 content.focus();
		}
    
	if(content.value.length > 1500){
		 errormsg = errormsg + "* 内容不能超过1500个字符\n";
		 content.focus();
		}

    if(errormsg){
    	alert(errormsg);
    	return false;
    }else{
		document.add_comment.submit();
	}
	
}

function switchAnonymous(){
	var author = getbyid("news_comment_author");
    var anonymous = getbyid("news_comment_anonymous");
    if(anonymous.checked){
    	author.value = "家居保障网网友";
    	anonymous.value="true";
    }else{
    	author.value = "";
    	anonymous.value="false";
    	author.focus();
    }
}

function changeAuthor(){
	var author = getbyid("news_comment_author");
	var anonymous = getbyid("news_comment_anonymous");
	if(author.value != "家居保障网网友"){
		anonymous.checked = false;
		anonymous.value="false";
	}else{
		anonymous.checked = true;
		anonymous.value="true";
	}
	
}

/* ----------------------------------*/

function jumper(o){
    var v=o.options[o.selectedIndex].value;
    if(v=='#'){
       location.href=location;
    }
    location.href=v;
}

function changetype(y){
	var rightsrefer1 = document.getElementById("need_refer1");
	var rightsrefer2 = document.getElementById("need_refer2");
	if ( y == "2"){
		rightsrefer1.style.display = "none";
		rightsrefer2.style.display = "block";
		}
	if ( y == "1"){
		rightsrefer2.style.display = "none";
		rightsrefer1.style.display = "block";
		}
	
}

function initNew(){
	}
function initNews(){
	var xNewsInfo = new Ajax('loginshow', 'HTML');
	var xNewsInfo_url= '/tuijian-list.asp?' + Math.random();
	//alert (xNewsInfo_url);
	xNewsInfo.get(xNewsInfo_url,function(s){
		//alert (s);
		getbyid("tag8").innerHTML = s;
	}
	);
	var xNewsInfo = new Ajax('loginshow', 'HTML');
	var xNewsInfo_url= '/hot-list.asp?' + Math.random();
	xNewsInfo.get(xNewsInfo_url,function(s){
		//alert (s);
		getbyid("tag9").innerHTML = s;
	}
	);
}

function initDefaultNews(){
	var xNewsInfo = new Ajax('loginshow', 'HTML');
	var xNewsInfo_url= '/tuijian-list.asp?' + Math.random();
	//alert (xNewsInfo_url);
	xNewsInfo.get(xNewsInfo_url,function(s){
		//alert (s);
		getbyid("tag0").innerHTML = s;
	}
	);
	var xNewsInfo = new Ajax('loginshow', 'HTML');
	var xNewsInfo_url= '/hot-list.asp?' + Math.random();
	xNewsInfo.get(xNewsInfo_url,function(s){
		//alert (s);
		getbyid("tag1").innerHTML = s;
	}
	);
	var xNewsInfo = new Ajax('loginshow', 'HTML');
	var xNewsInfo_url= '/getnotice.asp?' + Math.random();
	xNewsInfo.get(xNewsInfo_url,function(s){
		//alert (s);
		getbyid("index_notice").innerHTML = s;
	}
	);
	
}
function initfoot(){
	var xInfo = new Ajax('foot', 'HTML');
	var xInfo_url= '/include/foot.asp?' + Math.random();
	xInfo.get(xInfo_url,function(s){
		getbyid("foot").style.display="block";
		getbyid("foot").innerHTML = s;
	}
	);
}
function initUseInfo(){
	var xInfo = new Ajax('loginshow', 'HTML');
	var xInfo_url= '/showuseinfo.asp?' + Math.random();
	xInfo.get(xInfo_url,function(s){
		getbyid("showUseinfo").innerHTML = s;
	}
	);
	initfoot();
}

function getMyInfobyUserId(infoType,userId){
	var xInfo = new Ajax('myInfoShow_info', 'HTML');
	var xStr = "key1="+ infoType +"&key2=" + userId ;
	var xInfo_url= '/my/getuserinfo.asp?'+ Math.random();
	xInfo.post(xInfo_url,xStr,function(s){
		getbyid("myInfoShow").innerHTML = s;
	}
	);
}
function tuijian(){
	}
	
function setMaxFont(){
	getbyid("news_content").style.fontSize="16px" ;
}	
function setMinFont(){
	getbyid("news_content").style.fontSize="12px" ;
}
function setFont(){
	getbyid("news_content").style.fontSize="14px";
}

function viewflash(ur,w,h){
      document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
      document.write('<param name="movie" value="' + ur + '">');
      document.write('<param name="quality" value="high"> ');
      document.write('<param name="wmode" value="transparent">');
      document.write('<param name="menu" value="false"> ');
      document.write('<embed src="' + ur + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
      document.write('</object> ');
}

function checksearch(){
	var keywords=document.mySearchForm.keywords;
	var keytype=document.mySearchForm.keytype;
	var getUrl;
	if( keywords.value.match(/^\s*$/)){
		 alert("* 内容不能为空\n");
		 keywords.focus();
		}else{
			var keywordsStr=keywords.value.replace(/\s{2,}/g," ");
			keywordsStr=keywordsStr.replace(/\s{1,}/g,",");
			if (keytype.value=="Tags"){
				getUrl="/tag?tags="+ escape(keywordsStr) ;
			}else if(keytype.value=="News"){
				getUrl="/search?keywords="+ escape(keywordsStr) + "&keytype=" + keytype.value;
			}else{
				getUrl="/search?keywords="+ escape(keywordsStr) + "&keytype=" + keytype.value;
				}
			window.location.href= getUrl;
	}
}

function checksearch_1(){
	var keywords=document.mySearchForm.keywords;
	var keytype=document.mySearchForm.keytype;
	var getUrl;
	if( keywords.value.match(/^\s*$/)){
		 alert("* 内容不能为空\n");
		 keywords.focus();
		}else{
			var keywordsStr=keywords.value.replace(/\s{2,}/g," ");
			keywordsStr=keywordsStr.replace(/\s{1,}/g," ");
			if (keytype.value=="Tags"){
				getUrl="/article/tag/"+ escape(keywordsStr) ;
			}else if(keytype.value=="News"){
				getUrl="/article/tag/"+ encodeURI(keywordsStr) ;
			}else{
				getUrl="/article/tag/"+ encodeURI(keywordsStr)  ;
				}
			window.location.href= getUrl;
	}
}

function checksearchs(){
	var keywords=document.quickSearch.key_words;
	var keytype=document.quickSearch.key_type;
	var getUrl;
	if( keywords.value.match(/^\s*$/)){
		 alert("搜索内容不能为空\n");
		 keywords.focus();
		}else{
			//alert(keywords.value);
			var keywordsStr=keywords.value.replace(/\s{2,}/g," ");
			keywordsStr=keywordsStr.replace(/\s{1,}/g,",");
			if (keytype.value=="Tags"){
				getUrl="/tag?tags="+ escape(keywordsStr) ;
			}else if(keytype.value=="News"){
				getUrl="/search?keywords="+ escape(keywordsStr) + "&keytype=" + keytype.value;
			}else{
				getUrl="/search?keywords="+ escape(keywordsStr) + "&keytype=" + keytype.value;
				}
			
			window.location.href= getUrl;
	}
}



function showNoticeInfo(n_Id){
	 	var noticeId1= "notice" +n_Id;
		var noticeId2= "notice_all" +n_Id;
		var noticeObj= getbyid(noticeId1);
		
		var noticeObjall= getbyid(noticeId2);
		if (noticeObj.style.display=="none"){
			noticeObj.style.display="block";
			noticeObjall.style.display="none";
		}else{
			noticeObj.style.display="none";
			noticeObjall.style.display="block";
		}
}

function initDisplayInfo(userId){
	var urlStr=document.location.toString();
	var intPos = urlStr.indexOf("=");
   	urlStr = urlStr.substr(intPos + 1);
	urlStr = urlStr.replace("#","")
	if (urlStr.indexOf("id=")>0){
		var intPos2 = urlStr.indexOf("id=");
		var referId = urlStr.substr(intPos2 + 3);
		urlStr = urlStr.substr(0,intPos2-1);
	}
	if (urlStr=="modify_details"){
		getMyInfobyUserId("details",userId)
	}else if(urlStr=="modify_pwd"){
		getMyInfobyUserId("pwd",userId)
	}else if(urlStr=="creat_enquiry"){
		getbyid("name_title").innerHTML="添加咨询信息";
		getEnquiryInfobyUserId("addEnquiry",referId);
	}else if(urlStr=="show_enquiry"){
		getbyid("name_title").innerHTML="我的咨询列表 <span><a href='/my?action=creat_enquiry' style='color:#ff6600;font-size:12px;'>我要咨询</span>";
		getEnquiryInfobyUserId("enquiry",userId)
	}else if(urlStr=="show_refer"){
		getbyid("name_title").innerHTML="我的维权列表 <span><a href='/my?action=creat_refer' style='color:#ff6600;font-size:12px;'>我要维权</span>";
		getMyInfobyUserId("refer",userId)
	}else if(urlStr=="creat_refer"){
		getbyid("name_title").innerHTML="添加维权信息";
		getMyInfobyUserId("addRights",userId)
	}else if(urlStr=="modify_refer"){
		getbyid("name_title").innerHTML="修改维权信息";
		getMyInfobyUserId("modifyRights",referId);
	}else if(urlStr=="view_refer"){
		getbyid("name_title").innerHTML="查看维权详细信息";
		getMyInfobyUserId("viewRights",referId);
	}else {
		getMyInfobyUserId("all",userId)
	}
}
function hideDivById(x){
	getbyid(x).style.display="none";
	}
	
function DrawImage(ImgD,widthStr,heightStr){ 
	var image=new Image(); 
	image.src=ImgD.src;
	//alert (ImgD)
	if(image.width>0 && image.height>0){ 
		if(image.width/image.height>= 1){ 
 			if(image.width>widthStr){
   				ImgD.width=widthStr; 
   				ImgD.height=(image.height*widthStr)/image.width; 
  			}else{ 
  			 	ImgD.width=image.width;
   				ImgD.height=image.height; 
  			} 
  				/*ImgD.alt="bigpic" */
		}else{ 
  			if(image.height>heightStr){
   				ImgD.height=heightStr; 
   				ImgD.width=(image.width*heightStr)/image.height; 
  			}else{ 
   				ImgD.width=image.width;
   				ImgD.height=image.height; 
  			} 
		} 
	}
} 
function showit(x){
	getbyid("f_1").className="f_link";
	getbyid("f_2").className="f_link";
	getbyid("f_m_1").style.display="none";
	getbyid("f_m_2").style.display="none";
	if (x==2) {x=2;}else{x=1;}
	var m="f_m_"+ x;
	var n= "f_"+ x;
		getbyid(n).className="f_focus";
		getbyid(m).style.display="block";
	}
	
var picArr;
picArr=[0,"/365/images/img.gif","/gongyi/images/ad-01.jpg","/gongyi/images/ad-02.jpg","/gongyi/images/ad-03.jpg","/gongyi/images/ad-04.jpg"]
function showPic(x){
	getbyid("365pic").src=picArr[x];
	}
	
var currslid = 0;
var slidint;
function setfoc(id){
	document.getElementById("focpic").src = picarry[id];
	document.getElementById("foclnk").href = lnkarry[id];
	document.getElementById("fttltxt").innerHTML = '<a href="'+lnkarry[id]+'" target="_blank">'+ttlarry[id]+'</a>';
	currslid = id;
	for(i=0;i<4;i++){
		document.getElementById("tmb"+i).className = "thubpic";
	};
	document.getElementById("tmb"+id).className ="thubpiccur";
	focpic.style.visibility = "hidden";
	focpic.filters[0].Apply();
	if (focpic.style.visibility == "visible") {
		focpic.style.visibility = "hidden";
		focpic.filters.revealTrans.transition=12;
	}
	else {
		focpic.style.visibility = "visible";
		focpic.filters[0].transition=12;
	}
	focpic.filters[0].Play();
	stopit();
}

function playnext(){
	if(currslid==3){
		currslid = 0;
	}
	else{
		currslid++;
	};
	setfoc(currslid);
	playit();
}
function playit(){
	slidint = setTimeout(playnext,4500);
}
function stopit(){
	clearTimeout(slidint);
	}
function changeValidate(){
	$("#yanzhen").attr("src","/getValidata?t="+Math.random());
}
function showMore(){
	$(".more_info").css("display","block");
}
function hideMore(){
	$(".more_info").css("display","none");
}
//===========================================
//函数名：user_log
//参数：log_na,log_pwd
//Create by leo @2008-08-25
//last updated @2009-06-02
//===========================================
function user_log(a){
	var usr_na;
	var usr_pwd;
	usr_na=$("#log_user_na").val();
	usr_pwd=$("#log_user_pwd").val();
	if (usr_na=="" || usr_pwd=="") {
		if (usr_na=="") $("#log_user_na").removeClass().addClass("top_input_1");
		if (usr_pwd=="") $("#log_user_pwd").removeClass().addClass("top_input_2");
	}else{
		//	Ajax调用，判读用户名和密码的正确性
		var str = "key=" + usr_na + "&key1=" + usr_pwd;
		//alert (str);
		$.post('/login/checklogin.asp',str,function(s){
			//alert(s);
			if (s=="err"){
				$("#log_user_na").val('').removeClass().addClass("top_input_4");
				return false;
			}else if (s=="err0"){
				$("#log_user_pwd").val('').removeClass().addClass("top_input_3");
				return false;
			}else if (s=="deled"){
				$("#log_user_na").val('').removeClass().addClass("top_input_5");
				return false;	
			}else if (s=="locked"){	
				$("#log_user_na").val('').removeClass().addClass("top_input_6");
				return false;	
			}else{
				if (a!=null || a==1){
					//var comeurl;
					//if (getbyid("comeurl")) comeurl=getbyid("comeurl").value;
					//if (comeurl==null || comeurl=="") comeurl="/";
					window.location.href=comeurl;
				}else{
					var temparry=new Array;
					temparry=eval(s);

					var loged_info = "<div class=\"user_info\" onmouseover=\"showMore()\" onmouseout=\"hideMore()\">"+ temparry[0].Name +" | " + temparry[0].Email + "，欢迎登录！";
						loged_info = loged_info + "<a href=\"/profile\">修改资料</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
						loged_info = loged_info + "<a href=\"/logout\">退出</a>";
						loged_info = loged_info + "</div><div class=\"more_info\">当前积分："+ temparry[0].integral +"&nbsp;&nbsp;上次登录："+ temparry[0].LastLogTime +"&nbsp;&nbsp;上次登录IP："+ temparry[0].LastLogIp +" </div>";
					$("#usr_log").html(loged_info)
				}
				return false;
			}							  
		}
		);	
	}
}
//window.onload = function(){
//	playit();
//}
//-->