﻿/*****************内容页面*****************/
var PerUrl = "";
var xmlHttp;
function createxmlHttpRequest(){ 
xmlHttp=null; 
try 
{ 
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP") 
} 
catch(e) 
{ 
	try 
	{ 
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP") 
	} 
	catch(oc) 
	{ 
		xmlHttp=null 
	} 
} 
if ( !xmlHttp && typeof XMLHttpRequest != "undefined" ) 
{ 
	xmlHttp=new XMLHttpRequest() 
} 
return xmlHttp;
} 



function GoLogin(){
		var d  = new Date();
        var url=PerUrl+"/Ajax/GoLogin.aspx?uid="+escape(document.getElementById('U_ID').value)+"&pass="+escape(document.getElementById('U_PWd').value)+"&time="+d.getUTCSeconds();
        createxmlHttpRequest();
        xmlHttp.open("get",url,false);    
        xmlHttp.send(null);
		GoLogin_do();
		
}

function GoLogin_do(){
	
if (xmlHttp.responseText == 'NotEmailVerification')
{	
ymPrompt.alert({message:'您未验证邮箱激活账号，暂时无法查看资料，请登陆您的注册邮箱点击链接激活账号',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/index.aspx';}},btn:[['确认','yes']]});
}
else if (xmlHttp.responseText == 'ParameterErr')
{			
		ymPrompt.errorInfo('参数错误...',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'LOCK')
{			
		ymPrompt.errorInfo('帐号被禁用...',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'Delete')
{			
		ymPrompt.errorInfo('帐号被删除...',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'NotExist')
{			
		ymPrompt.errorInfo('用户密码不正确...',null,null,'系统提示',null);
}
else
{			
		ymPrompt.succeedInfo({message:'恭喜您，登录成功！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=window.location.href;}},btn:[['确认','yes']]});
		setTimeout(function(){ymPrompt.close();window.location.href=window.location.href;},2000);
		document.getElementById('LoginBox').innerHTML =xmlHttp.responseText;		
}
}

function GoLoginOut(){
		var d  = new Date();
        var url=PerUrl+"/Ajax/GoLoginOut.aspx?time="+d.getUTCSeconds();
        createxmlHttpRequest();
        xmlHttp.open("get",url,false);    
        xmlHttp.send(null);
		GoLoginOut_do();
		
}

function GoLoginOut_do(){
	
if (xmlHttp.responseText != '')
{	
ymPrompt.succeedInfo({message:'恭喜您，注销成功！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/login.aspx?Url='+escape(document.location.href);}},btn:[['确认','yes']]});
document.getElementById('LoginBox').innerHTML =xmlHttp.responseText;
}

}

function KeyWord() 
{ 
if(event.keyCode==13) 
{
     document.all.Search.click(); 
}
}

function KeyWord_404() 
{ 
if(event.keyCode==13) 
{
     document.all.Search_404.click(); 
}
}

function GoSearch(){
var url=PerUrl+"/Search.html?keyword="+encodeURIComponent(document.getElementById('KeyWord').value);
window.open(url);      
		
}
function GoSearch_404(){
var url=PerUrl+"/Search.html?keyword="+encodeURIComponent(document.getElementById('KeyWord_404').value);
window.open(url);      
		
}

function GoSearch2(){
var url=PerUrl+"/Search.html?keyword="+encodeURIComponent(document.getElementById('S_KeyWord').value);
window.open(url);      
		
}

function Login()
{
ymPrompt.alert({message:'登录后系统会自动带您进入此页面！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/login.aspx?Url='+escape(document.location.href);}if(tp=='no'){}},btn:[['确认','yes'],['取消','no']]});	
}

function Action(Type,ArticleID){
		var d  = new Date();
        var url=PerUrl+"/Ajax/Action.aspx?type="+Type+"&fid="+ArticleID+"&time="+d.getUTCSeconds();
        createxmlHttpRequest();
        xmlHttp.open("get",url,false);    
        xmlHttp.send(null);
		Action_do();
		
}

function Action_do(){

if (xmlHttp.responseText == 'LoginFail')
{				
		ymPrompt.confirmInfo({message:'系统找不到您的登录信息！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/login.aspx?Url='+escape(document.location.href);}if(tp=='no'){}},btn:[['确认','yes'],['取消','no']]});
}
else if (xmlHttp.responseText == 'ParameterErr')
{			
		ymPrompt.errorInfo('参数错误',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'TypeErr')
{			
		ymPrompt.errorInfo('参数错误',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'Fail')
{			
		ymPrompt.alert({message:'操作失败,请稍候再试或者和管理员联系！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){}},btn:[['确认','yes']]});
}
else if (xmlHttp.responseText == 'favoriteOk')
{			
		ymPrompt.succeedInfo({message:'收藏成功！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){}},btn:[['确认','yes']]});
		setTimeout(function(){ymPrompt.close();},2000);
}
else if (xmlHttp.responseText == 'readOk')
{			
		ymPrompt.succeedInfo({message:'扣去积分成功，你可以正常浏览此文章！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){document.location.href=document.location.href}},btn:[['确认','yes']]});
}
else if	(xmlHttp.responseText == 'Exist')
{
		ymPrompt.alert({message:'您已经进行过此操作了！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='no' ){}},btn:[['确认','yes']]});
}
else
{
		ymPrompt.errorInfo('系统繁忙',null,null,'系统提示',null);
}
}


function FavoriteDel(ArticleID){
		var d  = new Date();
        var url=PerUrl+"/Ajax/FavoriteDel.aspx?fid="+ArticleID+"&time="+d.getUTCSeconds();
        createxmlHttpRequest();
        xmlHttp.open("get",url,false);    
        xmlHttp.send(null);
		FavoriteDel_do();
		
}
function FavoriteDel_do(){
if (xmlHttp.responseText == 'LoginFail')
{				
		ymPrompt.confirmInfo({message:'系统找不到您的登录信息！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/login.aspx?Url='+escape(document.location.href);}if(tp=='no'){}},btn:[['确认','yes'],['取消','no']]});
}
else if (xmlHttp.responseText == 'NotExist')
{			
		ymPrompt.errorInfo('你操作的记录不存在！',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'Fail')
{			
		ymPrompt.alert({message:'操作失败,请稍候再试或者和管理员联系！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){}},btn:[['确认','yes']]});
}
else if (xmlHttp.responseText == 'Success')
{			
		ymPrompt.succeedInfo({message:'操作成功！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href='Favorite.aspx'}},btn:[['确认','yes']]});
}
else
{
		ymPrompt.errorInfo('系统繁忙',null,null,'系统提示',null);
}



}

function LoadCode()
{
ymPrompt.confirmInfo({icoCls:'',msgCls:'confirm',message:'<table border=\'0\' align=\'center\' cellpadding=\'0\' cellspacing=\'1\' style=\'margin-top:20px;\'><tr><td width=\'60\' height=\'30\' align=\'center\'>验证码：</td><td width=\'140\'><input type=\'text\' id=\'MyCodeInput\' style=\'width:150px;height:18px; padding-top:3px;padding-left:2px;background-color: #FFFF99;border: 1px solid  #460758;\' onfocus=\'this.select()\' /></td></tr><tr><td height=\'30\'>&nbsp;</td><td><img id=\'imgCheckCode\' onclick=\'reloadcode();\' src=\''+PerUrl+'/images/validatecode.aspx\'  style=\'cursor: pointer; width: 55px; height: 26px;\' alt=\'看不清？点击图片刷新\' class=\'lowyzimg\' /></td></tr></table>',title:'你的访问速度过快',height:150,handler:GetCode,autoClose:false});

}

function $(id){
			return document.getElementById(id)
		}

function GetCode(tp){
			if(tp!='ok') return ymPrompt.close();
			var sCode=$('MyCodeInput').value;
			var ArticleID=$('MyArticleID').value;
			if(sCode=='')
				ymPrompt.errorInfo('请输入验证码！',null,null,'系统提示',null);
			else{
				var d  = new Date();
                var url=PerUrl+"/Ajax/CheckCode.aspx?fid="+ArticleID+"&Code="+sCode+"&time="+d.getUTCSeconds();
                createxmlHttpRequest();
                xmlHttp.open("get",url,false);    
                xmlHttp.send(null);
		        CheckCode_do();
			
			}
		}
function CheckCode_do(){
if (xmlHttp.responseText == 'CodeErr')
{				
		ymPrompt.confirmInfo({message:'验证码错误！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){}if(tp=='no'){}},btn:[['确认','yes'],['取消','no']]});
}
else if (xmlHttp.responseText == 'LoginFail')
{				
		ymPrompt.confirmInfo({message:'系统找不到您的登录信息！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){window.location.href=PerUrl+'/Member/login.aspx?Url='+escape(document.location.href);}if(tp=='no'){}},btn:[['确认','yes'],['取消','no']]});
}
else if (xmlHttp.responseText == 'ParameterErr')
{			
		ymPrompt.errorInfo('参数错误',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'TypeErr')
{			
		ymPrompt.errorInfo('参数错误',null,null,'系统提示',null);
}
else if (xmlHttp.responseText == 'Fail')
{			
		ymPrompt.alert({message:'操作失败,请稍候再试或者和管理员联系！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){}},btn:[['确认','yes']]});
}
else if (xmlHttp.responseText == 'Ok')
{			
		ymPrompt.succeedInfo({message:'操作成功！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='yes' ){document.location.reload();}},btn:[['确认','yes']]});
		setTimeout(function(){ymPrompt.close();},2000);
}

else if	(xmlHttp.responseText == 'Exist')
{
		ymPrompt.alert({message:'您已经进行过此操作了！',title:'系统提示',fixPosition:true,handler:function(tp){if(tp=='close' || tp=='no' ){document.location.href = document.location.href;}},btn:[['确认','yes']]});
}
else
{
		ymPrompt.errorInfo('系统繁忙',null,null,'系统提示',null);
}


}


function passWord() 
{ 
if(event.keyCode==13) 
{
     document.all.BntGoLogin.click(); 
}
}

function Go()
{
    window.location.href=PerUrl+'/Member/MyArticle.aspx';
}

function Regist()
{
    window.location.href=PerUrl+'/Regist.aspx';
}

