﻿document.write('<script type="text/javascript" src="/js/Base.js"></script>');
function AD1()
{
google_ad_client = "pub-4268312569118784";
google_ad_slot = "3437426210";
google_ad_width = 468;
google_ad_height = 15;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function AD2()
{
google_ad_client = "pub-4268312569118784";
google_ad_slot = "4237537772";
google_ad_width = 468;
google_ad_height = 60;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function BBSRight()
{
google_ad_client = "pub-4268312569118784";
google_ad_slot = "2711685286";
google_ad_width = 160;
google_ad_height = 600;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function BBSContent()
{
/*google_ad_client = "pub-4268312569118784";
google_ad_slot = "6253332384";
google_ad_width = 300;
google_ad_height = 250;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');*/
}

function MainRevertAD()
{
/*google_ad_client = "pub-4268312569118784";
google_ad_slot = "9641412943";
google_ad_width = 300;
google_ad_height = 250;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');*/
}

function MainAD()
{
google_ad_client = "pub-4268312569118784";
google_ad_slot = "2738236760";
google_ad_width = 250;
google_ad_height = 250;
document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function Search()
{
	if (SearchCheck())
	{
		NameSearch();
	}
}

function SearchCheck()
{
	if (document.getElementById("Key").value.replace(/(^\s*)|(\s*$)/g,"")=="")
	{
		alert("请输入您要搜索的内容");
		document.getElementById("Key").focus();
		return false;
	}
	return true;
}

function NameSearch()
{
	document.location="/Search.html?Key="+encodeURIComponent(document.getElementById("Key").value)+"_00_1";
}

/*function TagSearch()
{
document.location="/TagSearch.html?Key="+encodeURIComponent(document.getElementById("Key").value)+"_1";
}

function BSearch()
{
document.location="/BSearch.html?Key="+encodeURIComponent(document.getElementById("Key").value)+"_1";
}*/

function CallBack(obj)
{
	var result=obj.responseText;
	var flag = result.substring(0,2);
	if (flag == "OK")
	{
		document.location = result.substring(2,result.length);
		return;
	}
	if (flag == "RE")
	{
		document.location.reload(); 
		return;
	}
	else
		alert(result);
}

function fCommentAdd(obj)
{
	firstPost = true;
	var result=obj.responseText;
	if (result == "0")
	{
		document.location.reload(); 
		return;
	}
	if (result == "2")
	{
		alert("验证码不正确，请重新核对");
		document.getElementById("ValidateCode").focus();
		return;
	}
	else
		alert(result);
}

function CheckComment()
{
	if (BadWord("Content") == false)
		return false;
	if (document.getElementById("UserName").value=="")
	{
		alert('请输入您的名称');
		document.getElementById("UserName").focus();
		return false;
	}
	if (document.getElementById("Content").value=="")
	{
		alert('请输入您要说的话');
		document.getElementById("Content").focus();
		return false;
	}
	if (document.getElementById("Content").value.length<=10)
	{
		alert('评论长度要大于10个字');
		document.getElementById("Content").focus();
		return false;
	}
	var pattern = /^([a-z0-9]){4,4}$/;
	if ( ! pattern.exec(document.getElementById("ValidateCode").value))
	{
		alert('请输入正确的验证码');
		document.getElementById("ValidateCode").focus();
		return false;
	}
	return true;
}

function CommentClear()
{
	document.getElementById("Content").value="";
	document.getElementById("Content").focus();
}

function To(tagName)
{
	document.getElementById("Content").value="TO:"+document.getElementById(tagName).value;
	document.getElementById("Content").focus();
}

function Use(tagName)
{
	document.getElementById("Content").value=document.getElementById(tagName).innerHTML;
	document.getElementById("Content").focus();
}

function SetLogin()
{
    IsLogin = false;
	if (GetCookie("findgs_user_id") != "")
	    IsLogin = true;
}

function SetUserInfo()
{
    SetLogin();
	var loginName = GetCookie("findgs_user_name");
	if (loginName != "")
	{
		document.getElementById("Login").style.display="";
		document.getElementById("LoginName").innerHTML = loginName;
		document.getElementById("NoLogin").style.display="none";
		//if (document.getElementById("Notice") != null)
			//document.getElementById("Notice").style.display="none";
	    if (document.getElementById("TrName") != null)
			 document.getElementById("TrName").style.display="none";
	    if (document.getElementById("UserName") != null)
			 document.getElementById("UserName").value = loginName;
	}
	else
	{
		document.getElementById("NoLogin").style.display="";
	}
}

function GoToLogin()
{
	document.location = "/login.html?Return=" + encodeURI(document.location.href);
}

function ShowImage()
{
	if (document.getElementById("Validate").style.display=="")
		return;
	document.getElementById("Validate").style.display = "";
	document.getElementById("Validate").src = "/ValidateCode.aspx?rand="+new Date();
}

function EditCompany(id)
{
	if (IsLogin)
		document.location = "/Edit/" + id + ".html";
	else
		alert('您没有登陆，无法进行修改');
}

function Employer()
{
    alert("评选暂时停止");
    return;
    if (IsLogin == false)
    {
        alert("您还未登陆，无法进行投票");
        return;
    }
	SendData("Employer","CompanyID",'/Page.aspx?Fn=Employer',fEmployer);
}

function fEmployer(obj)
{
	firstPost = true;
	var result=obj.responseText;
	if (result == "0")
	{
		alert("投票成功");
		document.location = "/Employer.html";
		return;
	}
	if (result == "-1")
	{
		alert("您已经对该公司投过票了,请不要重复投票");
	}
	else
		alert(result);
}

function Employer1()
{
    if (IsLogin == false)
    {
        alert("您还未登陆，无法进行投票");
        return;
    }
    if (document.getElementById("CompanyID").value == "")
    {
		alert("请选择您要投票的公司");
		return;
    }
	SendData("Employer","CompanyID",'/Page.aspx?Fn=Employer',fEmployer1);
}

function fEmployer1(obj)
{
	firstPost = true;
	var result=obj.responseText;
	if (result == "0")
	{
		alert("投票成功");
		document.location.reload(); 
		return;
	}
	if (result == "-1")
	{
		alert("您已经对该公司投过票了,请不要重复投票");
	}
	else
		alert(result);
}

function SetEmployer(id)
{
	document.getElementById("CompanyID").value=id;
}

function BadWord(name)
{
	//if (GetCookie("findgs_user_name") == "findgs")
		//return true;
	var check = document.getElementById(name).value;
	check = check.replace(/\s+/g,"");
	if (check.indexOf("发票")>-1 || check.indexOf("开票")>-1 || check.indexOf("增值税")>-1 || check.indexOf("税务代理")>-1 || check.indexOf("财务代理")>-1 || check.indexOf("代考")>-1 || check.indexOf("地税")>-1 || check.indexOf("国税")>-1 || check.indexOf("共产党")>-1 || check.indexOf("莱州华银")>-1 || check.indexOf("孛索")>-1 || check.indexOf("下水")>-1 || check.indexOf("办证")>-1 || check.indexOf("抽粪")>-1 || check.indexOf("管道")>-1 || check.indexOf("化粪池")>-1 || check.indexOf("马桶")>-1 || check.indexOf("证件")>-1 || check.indexOf("留学论坛")>-1 || check.indexOf("文凭")>-1)	
	{
		alert("请不要发广告内容，否则直接封IP");
		return false;
	}
	return true;
}

function TC()
{
	window.open("http://www.totalcup.com");
}