/**
 * v1.0
 *
 * @author		card126 <card126@gmail.com>
 * @website		http://passport.07073.com/
 * @version		1.0
 * @charset		GBK
 * @license		2009 07073.com
 */ 
$(document).ready(function(){
	if($('#ajax_jqm_login_form').length < 1)
	{
		$('body').append('<form action="" id="ajax_jqm_login_form" method="post"></form>');
	}
	if($('#dwindow').length < 1)
	{
		$('.header').after('<div id="dwindow" class="clearfix" style="display: none;"></div>');
	}
	
	if($('#rwindow').length < 1)
	{
		$('#dwindow').after('<div id="rwindow" class="clearfix" style="display: none;"></div>');
	}
	
	$('#ajax_jqm_login_form').attr("action", '/plus/ajax_login.php?dopost=stats');
	var ajax_login_options = {target: '#userlogin'};	
	$('#ajax_jqm_login_form').ajaxForm(ajax_login_options);
	$('#ajax_jqm_login_form').submit();
});

(function($) {
	$.fn.login = function(){};
	$.fn.login.loadform = function ()
	{
		$('#dwindow').hide();$('#rwindow').hide();
		$('#dwindow').show();
		$('#ajax_jqm_login_form').attr("action", '/plus/ajax_login.php');
		ajax_login_options = {target: '#dwindow'};	
		$('#ajax_jqm_login_form').ajaxForm(ajax_login_options);
		$('#ajax_jqm_login_form').submit();		
	};
	$.fn.login.register = function ()
	{
		$('#dwindow').hide();$('#rwindow').hide();
		$('#rwindow').show();
		$('#ajax_jqm_login_form').attr("action", '/plus/ajax_login.php?dopost=regform');
		ajax_login_options = {target: '#rwindow'};	
		$('#ajax_jqm_login_form').ajaxForm(ajax_login_options);
		$('#ajax_jqm_login_form').submit();	
	};
	
	$.fn.login.exit = function ()
	{
		$('#ajax_jqm_login_form').attr("action", '/plus/ajax_login.php?dopost=exit');
		var ajax_login_options = {target: '#userlogin'};	
		$('#ajax_jqm_login_form').ajaxForm(ajax_login_options);
		$('#ajax_jqm_login_form').submit();
	}
})(jQuery);

$(document).ready(function(){
	var ___arcPageNext = 0; var ___arcPagePrev = 0;
	if($('ul.pagelist li.thisclass').next('li').length > 0)
	{
		___arcPageNext = 1;
	}
	if($('ul.pagelist li.thisclass').prev('li').length > 0)
	{
		___arcPagePrev = 1;
	}
	function keyUp(e) {
		var currKey=0,e=e||event;
		currKey=e.keyCode||e.which||e.charCode;
		var keyName = String.fromCharCode(currKey);
		if(currKey=='39' && ___arcPageNext==1){
			window.location.href = $('ul.pagelist li.thisclass').next('li').find('a').attr('href');
		}else if(currKey=='37' && ___arcPagePrev==1){
			window.location.href = $('ul.pagelist li.thisclass').prev('li').find('a').attr('href');	
		}
	}
	document.onkeyup = keyUp;
});