// JavaScript Document
$(document).ready(function(){
	$("#surlbtn").click(function(){
		var url=document.getElementById("surl").value;
               if(url==""){
alert("请输入网站地址");
return false;
}
		$("#url").val(url);
		$("#surldiv").hide();
		$("#urldiv").show();
		url=url.replace("http://","");
		url=url.split("/");
		url=url[0];
		$.post("../global/pr.php",{url:url},function(data){
			if(data.length>20)
				$("#pr").val("读取失败!请校对网址");
			else
			$("#pr").val(data);
			$("#prget").hide();
													 });
		$.post("../global/baidu.php",{url:url},function(data){
			if(data.length>20)
				$("#baidu").val("读取失败!请校对网址");
			else
			$("#baidu").val(data);
			$("#baiduget").hide();
													 });
		$.post("../global/linkstate.php",{url:url},function(data){
			if(data.length>20)
				$("#linkstate").val("读取失败!请校对网址");
			else
			$("#linkstate").val(data);
			$("#linkstateget").hide();
													 });
								 });
	
			$("#type").change(function(){
				$("#sform").submit();					   
									   });	
			$("#user").change(function(){
				$("#sform").submit();					   
									   });
			$("#linkstate").change(function(){
				$("#sform").submit();					   
									   });
						   
						   
						   
						   
						   
						   
						   
						   
						   
						   
						   
						   });
// --- 设置cookie
 function setCookie(sName,sValue,expireHours) {
  var cookieString = sName + "=" + escape(sValue);
  //;判断是否设置过期时间
  if (expireHours>0) {
    var date = new Date();
    date.setTime(date.getTime + expireHours * 3600 * 1000);
    cookieString = cookieString + "; expire=" + date.toGMTString();
  }
  document.cookie = cookieString;
 }
 
 //--- 获取cookie
 function getCookie(sName) {
   var aCookie = document.cookie.split("; ");
   for (var j=0; j < aCookie.length; j++){
  var aCrumb = aCookie[j].split("=");
  if (escape(sName) == aCrumb[0])
    return unescape(aCrumb[1]);
   }
   return null;
 }