function checkGuestForm(form)
{
	
	//alert(checkemail());
	if(checkemail())
	{
		form.psubmit.disabled=true;
	}
	else
	{
		alert("�����ʽ���ԣ�");
		return false;
	}
}
function checkemail()
{
	var email = $("#email").val();
	if (email != "") {
		var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
		if (reg.test(email))
		{
			//$('#emailstatus').html("<img src='/images/check_right.gif'>");
			return true;
		}
	}
	//$('#emailstatus').html("<img src='/images/check_error.gif'>$l_user[notemail]");
	$("#email").focus();
	return false;
}
function showpopwindowhavebutton(title,url,frame,width,height)
{
	if (width==0)
	{
		width = Math.floor($(window).width() / 1.5);
	}
	if (height==0)
	{
		height = Math.floor($(window).height() / 1.5);
	}
	
	var left = ($(document.documentElement).width()- width)/2,
		top = ($(window).height() - height)/2,
		controller = $('<div title="'+title+'"><div style="width:100%;height:100%;position:relative;"><img src="images/loading.gif" style="position:absolute;top:45%;left:45%;"/></div></div>').dialog({
			width:width,
			height:height,
			//modal:true,
			resizable:false,
			draggable:false,
			open:function(){
				var box = $('.ui-dialog').css({'position':'fixed',
						'left':	left,
						'top': top
				});						
				if (!$.browser.msie) {
					box.css({opacity:0,
						top: -height
					}).animate({
							opacity:1,
							top:top + 30			
					},330).animate({
							top:top		
					},270);						
				}
			},											
			beforeclose:function(){
				if ($.browser.msie) {
					$('#xhePanel').hide();
					controller.dialog('destroy').remove();
					overlay.remove();					
				}else{
					controller.css('opacity',0);
					var box = $('.ui-dialog');
					box.animate({
						opacity:0,
						top: -height			
					},450,function(){
							$('#xhePanel').hide();
							controller.dialog('destroy').remove();
							overlay.animate({opacity:0},50,function(){
								overlay.remove();
							});													
					});							
				}
				return false;
			},
			buttons: {
				'取消': function(){
					controller.dialog('close');
				},
				'确定': function(event){
					controller.dialog('close');	
				}
			},	
			zIndex:10002
		});
		

	var overlay=overlayDialog(10001).click(function(){
		controller.dialog('close');
	});
	
	if(url){
		if(frame){
			controller.html('<iframe id="newsappend" width="100%" height="'+(height-100)+'" frameborder="no" marginheight="1" marginwidth="0" border="0" src="'+url+'"/>');
		}else{
			controller.load(url);
		}
	}
}
function showpophrefwindow(title,url,frame,width,height)
{
	//alert(title);
	if (width==0)
	{
		width = Math.floor($(window).width() / 1.5);
	}
	if (height==0)
	{
		height = Math.floor($(window).height() / 1.5);
	}
	
	var left = ($(document.documentElement).width()- width)/2,
		top = ($(window).height() - height)/2,
		controller = $('<div title="'+title+'"><div style="width:100%;height:100%;position:relative;"><img src="images/loading.gif" style="position:absolute;top:45%;left:45%;"/></div></div>').dialog({
			width:width,
			height:height,
			//modal:true,
			resizable:false,
			draggable:false,
			open:function(){
				var box = $('.ui-dialog').css({'position':'fixed',
						'left':	left,
						'top': top
				});						
				if (!$.browser.msie) {
					box.css({opacity:0,
						top: -height
					}).animate({
							opacity:1,
							top:top + 30			
					},330).animate({
							top:top		
					},270);						
				}
			},											
			beforeclose:function(){
				if ($.browser.msie) {
					$('#xhePanel').hide();
					controller.dialog('destroy').remove();
					overlay.remove();					
				}else{
					controller.css('opacity',0);
					var box = $('.ui-dialog');
					box.animate({
						opacity:0,
						top: -height			
					},450,function(){
							$('#xhePanel').hide();
							controller.dialog('destroy').remove();
							overlay.animate({opacity:0},50,function(){
								overlay.remove();
							});													
					});							
				}
				return false;
			},
			zIndex:10002
		});
		

	var overlay=overlayDialog(10001).click(function(){
		controller.dialog('close');
	});
	
	if(url){
		if(frame){
			controller.html('<iframe id="newsappend" width="100%" height="'+(height-100)+'" frameborder="no" marginheight="1" marginwidth="0" border="0" src="'+url+'"/>');
		}else{
			controller.load(url);
		}
	}
}
function overlayDialog(zindex)
{
	var width = $(document.documentElement).width(),
	height = $(document).height();
	return $('<div class="ui-widget-overlay" style="z-index:'+zindex+';width:'+width+'px;height:'+height+'px;"/>').appendTo(document.body);
}
function MyMessageBox(data)
{
	var popup = $('<div align=center>'+data+'</div>').dialog(
	{
		width:200,
		height:50,
		resizable:false,
		title:'',
		close:function()
		{
		},
		modal:true,
		zIndex:10002
	});
	setTimeout(function(){
		popup.dialog('close');
		}
	,2000);
}
function ajaxStart()
{
	$("#ajaxloading").html('loading...');
	$("#ajaxloading").css('top',$(document).scrollTop()+20);
	$("#ajaxloading").fadeIn("fast");
}

function ajaxEnd(data){
	if(data)
	{
		$('#ajaxloading').html(data);
	}
	else
	{
		$('#ajaxloading').html('done.');
	}
	$("#ajaxloading").fadeOut(300).fadeIn(100).fadeOut(100);
}
function se_changeImg()
{
	var img=document.getElementById("imgVerify");
	try{
		if(img!=null){
			img.src="/security.php?time="+Math.random();
			var B=document.getElementById("verifycode");
			if(B!=null&&B.disabled==false){
				B.focus();B.select()
			}
		}
	}catch(E){

	}
}
