	/**
	 * -----------------------------------------
	 *   JS注册弹框版
	 *   需要条件,需要包含pop.css,pop.js,cookie.js,jquery
	 * -----------------------------------------
	 */	
	//------------------弹框加载---------------------
	function pop_login(module_name,userinfo_type,deal_id){
		if(userinfo_type == 'open'){//开放
			pop_redirect_by_moudule_name(module_name,deal_id);	
		}else{//未开放
			if (jsGetCookie('ees_username')){//已经登录
				if(jsGetCookie('cntronics_pop_userinfo')!= null){//已弹框，跳转					
					pop_redirect_by_moudule_name(module_name,deal_id);
				}else{//未弹框，弹框
					pop_show_and_set_postion(module_name,userinfo_type);
					var popUrl = baseUrl+'/eesmart/user/userinfo/no/'+Math.random();
					$("#pop_content").load(popUrl,{module_name:module_name,userinfo_type:userinfo_type,request_type:'get',deal_id:deal_id});
				}
			}else{//未登录，弹框登录
				pop_show_and_set_postion(module_name,userinfo_type);
				var popUrl = baseUrl+'/eesmart/user/ajaxlogin/no/'+Math.random();
				$("#pop_content").load(popUrl,{module_name:module_name,userinfo_type:userinfo_type,deal_id:deal_id});
			}
		}
	}
	
	//--------------设置弹框的样式信息-------------------
	function pop_show_and_set_postion(module_name,userinfo_type){
		$("#lockdiv").remove();
		$("#popup").remove();
		//遮罩层
		var bg_str	= "<div id='lockdiv'><iframe class='lockiframe'></iframe><div class='lockinnerdiv'></div></div>";
		$("body").prepend(bg_str);
		$("#lockdiv").css({width:$(document).width()+'px',height:$(document).height()+'px'});		
		$("#lockdiv").show();
		//弹出内容层
		var content_str 	= "<div style=\"display:none;\" id=\"popup\">";
			content_str		+=		"<div id=\"pop_check\">";
			content_str		+=			"<div class=\"pop_nav\">";
			content_str		+=				"<span>用户登录</span><a id=\"pop_close\" >关闭 </a>";
			content_str		+=			"</div>";
			content_str		+=			"<div id=\"pop_content\"></div>";
			content_str		+=		"</div>";
			content_str		+=	"</div>";
		$("body").prepend(content_str);
		//加载CSS层居左
		$("#popup").css("left",($(document).width()-800)/2);
		//加载层居顶
		if(userinfo_type == 'basic'){
			var basetop = 90;
		}else if(userinfo_type == 'detail'){
			var basetop = 60;
		}else if(userinfo_type == 'complete'){
			var basetop = 30;
		}
		$("#popup").css('top',basetop+$(window).scrollTop());
		//弹出层可动
		//$("#popup").draggable();
		$("#popup").show();	
		//关闭按钮
		$("#pop_close").click(function(){
			$("#lockdiv").remove();						   
			$("#popup").remove();	
		});
		//直接弹框的不显示关闭按钮
		if(module_name=='popdirect'){
			$("#pop_close").hide();
		}
		//加载时候显示的图片
		var replace_str	 = "<div id=\"pop_content\"><img id=\"loadingImg\" src='"+baseUrl+'/images/eesmart/loadding_indicator_verybig.gif'+"'/></div>"
		$("#pop_content").replaceWith(replace_str);
		//框调整的时候，遮罩层和内容层背景宽度和位置也变化
		$(window).resize(function(){
			$("#popup").css("left",($(window).width()-800)/2+'px');					  
			$("#lockdiv").css({width:$(document).width()+'px',height:$(document).height()+'px'});				  
		});
	}
		
	//--------------根据用户模块直接跳转---------------
	function pop_redirect_by_moudule_name(module_name,deal_id){	
		switch(module_name){
			case 'webinar':{//研讨会
				//积分判断
				$("#pop_close").trigger('click');
				var view_url = baseUrl+'/webinar/view/id/'+deal_id;
				window.location.reload();
				window.open(view_url,'_blank');
				break;
			}
			case 'lecture':{//大讲台
				//登记用户报名
				var regUrl = baseUrl+'/lecture/register/no/'+Math.random();
				$.get(regUrl,{action:'reg'},function(regbackdata){
					$("#pop_close").trigger('click');								 
					if(regbackdata == 'alreadyReg'){
						alert('您已经报名过了，请不要重复报名！');
					}else if(regbackdata== 'error'){
						alert('报名大讲台请先登录！');
					}else{
						alert('大讲台报名成功！请等待管理员的审核，之后我们会尽快通过邮件通知您！');	
					}
				});
				break;
			}
			case 'whitepaper':{	//白皮书
				$("#pop_close").trigger('click');	
				alert('您的请求已提交，如果您没有看到下载提示，请确保浏览器没有阻止弹出新页面！');
				var downloadUrl = baseUrl+'/download/getfile/aid/'+deal_id+'/event/download_kb';
				window.location.replace(downloadUrl);
				break;
			}
			case 'webinar_file_download':{	//白皮书
				$("#pop_close").trigger('click');
				alert('您的请求已提交，如果您没有看到下载提示，请确保浏览器没有阻止弹出新页面！');
				//记录用户下载了				
				//var downloadSucUrl = baseUrl+'/webinar/downloadsuccess/no/'+Math.random();
				//$.get(downloadSucUrl,{aid:aid,webinar_id:webinar_id});
				var downloadUrl = baseUrl+'/download/index/id/'+deal_id;
				window.location.replace(downloadUrl);
				break;
			}
			case 'activity':{ //活动
				var activityRegUrl = baseUrl+'/activities/record';
				$.get(activityRegUrl,{id:deal_id},function(regbackdata){
					$("#pop_close").trigger('click');								 
					if(regbackdata == 'alreadyReg'){
						alert('您已经报名过了，请不要重复报名！！');
					}else if(regbackdata== 'error'){
						alert('注册报名请先登录！！');
					}else{
						alert('恭喜您报名成功！！');	
					}
				});
				break;
			}
			default :{
				$("#pop_close").trigger('click');
			}
		}
	}
		
