// JavaScript Document
$(function(){
	if($(".news")!=null){
		$(".news").find("span").removeAttr("style");
		$(".news").find("span").css("font-size","14px");
		$(".news").find("Font").removeAttr("size");
		$(".news").find("Font").removeAttr("color");
		$(".news").find("P").removeAttr("style");
		$(".news").find("Font").css("font-size","14px");
		$(".news").find("a").addClass("linked");
		$(".news div").css("width","96%")
		$(".news div").css("margin-top","20px;")
		$(".news img").each(function(i){
			if($(this).width()>828 || $(this).width()==0){
					$(".news img").css("width","600px");
					$(".news img").css("height","450px");
			}
		});
		$(".news table tr td span").each(function(i){
			$(this).removeClass();
			$(this).css("line-height","24px");});
		
		$(".news div").each(function(i){
				if($(this).html()=="&nbsp;" && $(this).next("div").html()=="&nbsp;"){$(this).remove()}
				$(".news div div").css("width","89%");
			});
	}
});
function showToggle(id,index){
	$(id).eq(index).hover(function(){
		$(this).find("ul").slideDown();
	},function(){
		$(this).find("ul").hide("fast");
	})
}
function menuLinked(index){
	$(".tbl_head ul li").eq(index).find("a").css("color","#DB6B17");
	$(".tbl_head ul li").eq(index).find("a").css("font-weight","bold");
}

function lencommnet(id,maxLen){
	var obj = document.getElementById(id);
	if(obj.value.length>maxLen){
		obj.innerText=obj.value.substring(0,maxLen)
	}
}

function showServices(){
	var strUrl=window.location.href;
	var page=strUrl.substring(strUrl.lastIndexOf("/")+1,strUrl.length);
	if(page=="server_system.asp"){
		$(function(){		$("#sUp").next("div").show();})
	}

/*	}	*/
}
function subAction(){
            var name= document.getElementById('luname');
            var phone = document.getElementById('lphone');
            var email = document.getElementById('lemial');
	    	var content = document.getElementById("lcontent");
            var msg="",count=0;
			var emailStr=/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/
			var phoneStr=/^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/;
           
            if(name.value==''){
                msg+="请填写您的姓名……\n\n"
            }
            if(phone.value==""){
				count+=1;
            }else{
                if(!phoneStr.test(phone.value)){
					msg+="联系电话格式有误……\n\n";}
            }
            if(email.value==""){
				count+=1;
            }else{
                if(!emailStr.test(email.value)){
					msg+="邮箱格式有误……\n\n";}
            }
			if(content.value==''){
                msg+="请输入您要说的话……\n\n"
            }
	    if(count==2){
			msg+="至少输入一个联系方式(电话，邮箱地址)"
		}
        if(msg==""){
            	$.ajax({
					   type:"POST",
					   url:"/phonemsg.asp",
					   data:{name:name.value,phone:phone.value,email:email.value,content:content.value},
					   success:function(msg){alert(msg);document.getElementById("leftForm").reset()},
					   error:function(msg){alert("对不起,您输入的内容中包含非法字符……")}
					   });
            }else{
				alert(msg);return;
            }
        }
function SetWinHeight(obj)
{
	var win=obj;
	if (document.getElementById)
	{
		if (win && !window.opera)
		{
		 if (win.contentDocument && win.contentDocument.body.offsetHeight) 
		 {
		  win.height = win.contentDocument.body.offsetHeight; 
		  win.width =win.contentDocument.body.offsetWidth;
		  }
		 else if(win.Document && win.Document.body.scrollHeight)
		 {
		  win.height = win.Document.body.scrollHeight;
		  win.width=win.Document.body.scrollWidth;
		  }
		}
	}
}

function leftMenuLinked(index){
	$(".menu_content ul li").each(function(i){
		$(".menu_content ul li").eq(i).find("a").removeClass();	
	})
	$(".menu_content ul li").eq(index).find("a").eq(0).addClass("linked");
}

function childLinked(id,index,pid){
	leftMenuLinked(pid);
	$(".menu_content ul li").find(id).find("a").each(function(i){
		$(this).removeClass();
	})
	$(".menu_content ul li").find(id).find("a").eq(index).addClass("linked");
}