/* 
	<!-- 为相册下载增加的层 Melon`` @ 2009-03-13 -->
		<div id="dialogDownload" class="dialog1" style="display: none;">
			<div class="bgBlankBig" id="bgBlankBig"></div>
			<div class="d_dialog">
				<div class="getSource1" id="dialogContent"></div>
				<div class="bgBlank" id="bgBlank"></div>
			</div>
		</div>
	<!-- 为相册下载增加的层 END -->
*/

if(typeof("jLoader") != "function"){ 
	function jLoader (source,autoRemove,id, charset){
		id = id||"";
		charset = charset||"gb2312";
		autoRemove = autoRemove||false;
		var b=document.getElementsByTagName("head")[0];
		var c=document.createElement("script");
		c.type="text/javascript";
		c.charset=charset;
		if(id){
			c.id = id;
		}
		c.src=source;
		var remove=function(){
			c.onload=null;
			var h=c.parentNode;
			h.removeChild(c);
			delete c;
		};
		var e=function(h){
			var j=(h?h:window.event).target?(h?h:window.event).target:(h?h:window.event).srcElement;
			if(j.readyState=="loaded"||j.readyState=="complete")
			{
				j.onreadystatechange=null;
				if(autoRemove){
					remove();
				}
			}
		};
		if(navigator.product=="Gecko"&&autoRemove){
			c.onload=remove;
		}
		else{
			c.onreadystatechange=e;
		}
		b.appendChild(c);
	}
}
if(typeof("getcookie") != "function"){ 
	function getcookie(name) {
		var cookie_start = document.cookie.indexOf(name);
		var cookie_end = document.cookie.indexOf(";", cookie_start);
		return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
	}
}

//用户信息
if(typeof(usr)=="undefined"){
	var usr =
	{
		user_id  : function(){
				var  user_id = getcookie("member_id");
				user_id = user_id.split("@");
				return /^(guest|guest_|sg_|game-){1}([a-z0-9]{2,}_)?\d{4,}$/ig.test(user_id) ? false : user_id[0];
			},
		nickname : function(){
				//return getcookie("user_nickname");
				return this.user_id();
			}
	};
}

/**  
 * 	@name album相册下载单独js
 *	@author Melon @ 09-03-13
 */
 
 var albumController = {
	isClickConfirm : 0, //用户是否点击过“确认支付”,若点击过就提示信息 
	id : 0,
	wrap : null,
	type : "mp4", //下载类型
	phone : 0,    //3gp类型时填写手机号
	 
	/**  
	 * 	@name 启动 
	 *  @param int id 相册ID（非encode的ID）
	 *  @example javascript:;albumController.showDownloadDialog(85313275,'','3gp');	
	 */
	 showDownloadDialog : function(id, container, type){
			this.wrap = container || null;
			this.type = (type == "mp4" || type == "3gp") ? type : "mp4";
			this.phone = 0;//为每次点下载时重置手机号。
		 	if(parseInt(id) > 0){
				this.id = parseInt(id);
			}else if(get.id){
				this.id = parseInt(get.id);
			}else if(typeof(b)!="undefined" && b.indexOf("xml_id") > -1){
				//this.id = b.replace(/^.*?xml_id=(\d+)&.*?$/ig,"$1");
				var _get = getParams(b);
				this.id = parseInt(_get.xml_id);
				//if(usr.user_id()=='melon_huang')alert(_get.xml_id);
			}
			if(!usr.user_id()) {
				var ourl = "";
				if(document.location.search){
					ourl = document.location.href+"&callback=albumController.showDownloadDialog("+this.id+","+this.wrap+","+this.type+")#Disp";
				}else{
					ourl = document.location.href+"?callback=albumController.showDownloadDialog("+this.id+","+this.wrap+","+this.type+")#Disp";
				}
				userAlbumController.showLogin(ourl); 
				return;
			}
			 if(this.type == "mp4"){	
				 var html =  '\
						<div class="msg_title"><h3>下载相册视频，放到mp4、手机、电脑上炫吧</h3><a title="关闭窗口" onclick="albumController.cancelDownload(1)" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
						<div class="block">\
							<p class="pay_tip"><em>推广期内</em>下载资费2元(2个56币)<a href="http://pay.56.com/ways/tenpay.php?n=5" onclick="albumController.setStat(\'phdown3\')" target="_blank">我要充值</a><a href="javascript:;" id="down_tip_link" onclick="document.getElementById(\'pay_tips\').style.display=\'block\'">下载提示</a></p>\
							<p class="pay_btns">\
								<input type="button" id="btn_confirm" class="btn_confirm1" value="" onclick="albumController.confirmDownload()">\
								<input type="button" class="btn_cancel" value="" onclick="albumController.cancelDownload(1)">\
							</p>\
							<div id="pay_tips" style="display:none;">\
								<p class="pay_tip_title">提示：</p>\
								<p class="pay_tip_sub">1.手机上播放必须手机支持mp4播放</p>\
								<p class="pay_tip_sub">2.相片超过50张时可能被截取到适当长度</p>\
								<p class="pay_tip_sub red">3.暂时只支持幻灯片模式下载，其他模式下载时将会被转换到幻灯片模式</p>\
							</div>\
						</div>\
						';
				 //加统计
				this.setStat('phdownmp');
				
			 }else{
			 	var html =  '\
						<div class="msg_title"><h3>发到手机上炫吧！或发到手机好友，制造惊喜</h3><a title="关闭窗口" onclick="albumController.cancelDownload(1)" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
						<div class="block">\
								<p class="pay_tip"><em>推广期内</em>下载资费2元(2个56币)<a href="http://pay.56.com/ways/tenpay.php?n=5" onclick="albumController.setStat(\'phdown3\')" target="_blank">我要充值</a><a href="javascript:;" id="down_tip_link" onclick="document.getElementById(\'pay_tips\').style.display=\'block\'">转换提示</a></p>\
								<p class="pay_btns">\
									<input type="button" id="btn_confirm" class="btn_confirm1" value="" onclick="albumController.confirmDownload()">\
									<input type="button" class="btn_cancel" value="" onclick="albumController.cancelDownload(1)">\
								</p>\
								<div id="pay_tips" style="display:none;">\
									<p class="pay_tip_title">转换提示：</p>\
									<p class="pay_tip_sub">1.建议相片数在20张以内，超过会被截取到适当长度</p>\
									<p class="pay_tip_sub">2.暂时只支持幻灯片模式下载，其他模式下载时将会被转换到幻灯片模式</p>\
								</div>\
								<div id="pay_tips2">\
									<p class="pay_tip_title">下载提示：</p>\
									<p class="pay_tip_sub">1.部分手机可能不支持接收服务短信。<a href="javascript:;" onclick="albumController.setPhone(\'test\')">先发范例到我的手机试试（免费）</a>；如果您收不到服务短信，也可以通过网页下载后再传到手机上播放。</p>\
									<p class="pay_tip_sub">2.部分手机可能不支持3gp格式播放，<a href="http://down.mv.56.com/dl/index.php?action=DownloadTest&do=PcDownLoad3gpTest" target="_blank">下载测试视频试试（免费）</a>；下载后您可以传到手机上播放。</p>\
								</div>\
							</div>\
							';
				 //验证相片数量
				 this.checkPhotoCount(this.id);
				 
				 //加统计
				this.setStat('phdowngp');
			 }
			//加统计
			this.setStat('phdown1');		
			//$("#dialogContent").html(html);	
			document.getElementById("dialogContent").innerHTML = html;
			//蒙版
			this._setMask();
			
			//自动适应
			this.autoAdjust();
			
			document.getElementById("dialogDownload").style.display = "block";
			
		},
	checkPhotoCount : function(id){
			jLoader("http://pxml.56.com/photo2video/m2vApi.php?id="+id+"&callback=albumController.checkPhotoCountCallback&type=json&return=count")
		},	
	checkPhotoCountCallback : function(count){
			if(parseInt(count) > 20){
				document.getElementById('pay_tips').style.display = 'block';
				document.getElementById('down_tip_link').style.display = 'none';
			}
		},
	 autoAdjust : function(){
		 	var d_dialogStyle = document.getElementById("d_dialog").style;
			var box = document.getElementById(this.wrap) || null ;
			if (!box) {
				if(!document.body.scrollTop){
					d_dialogStyle.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - d_dialogStyle.height) / 2 - 110 + "px";
				}else{
					d_dialogStyle.top = document.body.scrollTop + (document.body.clientHeight - d_dialogStyle.height) / 2 - 110 + "px";
				}
			} else {
				d_dialogStyle.top = box.scrollTop + (document.documentElement.clientHeight - d_dialogStyle.height) / 2 - 110 + "px";
			}
			d_dialogStyle.position = "absolute";
			d_dialogStyle.zindex = "10000";
		 },	
	 _setMask : function(){
			var box = document.getElementById(this.wrap) || null;
		 	//蒙版
			if (!box) {
				if(navigator.userAgent.indexOf("MSIE") > -1){
					//$("#bgBlankBig").css("width",document.body.clientWidth+"px");
					//$("#bgBlankBig").css("height",document.body.clientHeight+"px");
					document.getElementById("bgBlankBig").style.width = document.body.clientWidth+"px";
					document.getElementById("bgBlankBig").style.height = document.body.clientHeight+"px";
				}else{
					//$("#bgBlankBig").css("width",document.documentElement.clientWidth+"px");
					//$("#bgBlankBig").css("height",document.documentElement.offsetHeight+"px");
					document.getElementById("bgBlankBig").style.width = document.documentElement.clientWidth+"px";
					document.getElementById("bgBlankBig").style.height = document.documentElement.offsetHeight+"px";
				}
			} else {
				document.getElementById("bgBlankBig").style.width = box.clientWidth + 'px';
				document.getElementById("bgBlankBig").style.height = box.scrollHeight + 'px';
			}
		 },
	 cancelDownload : function(step){
		 	step = step||"";
			if(step == 1){
				this.setStat('phdown7');
			}
		 	document.getElementById('dialogDownload').style.display = 'none'; 
			return;
		 },	
	 confirmDownload : function(){
		 	this._submitInterval("btn_confirm");
			if(!usr.user_id()) return;
			
			//提交
			if(this.type == "3gp" && this.phone == 0){
				this.setPhone();
			}else{
				jLoader("http://down.mv.56.com/index.php?id="+this.id+"&type="+this.type+"&phone="+this.phone+"&callback=albumController.confirmDownloadCallback");
				this.isClickConfirm++;
				
				if(this.type == "3gp"){
					if(this.phone == -1){
						this.setStat('phdown20');
					}else{
						this.setStat('phdown21');
					}	
				}
				
			}
		 },
	 confirmDownloadTest : function(){
		 	try{this._submitInterval("btn_confirm");}catch(e){}
			if(!usr.user_id()) return;
			 
			//提交
			if(this.type == "3gp" && this.phone == 0){
				this.setPhone('test');
			}else{
				jLoader("http://down.mv.56.com/dl/index.php?action=DownloadTest&type="+this.type+"&phone="+this.phone+"&callback=albumController.confirmDownloadCallback");
				this.isClickConfirm++;
			}
		 },	 
	 setPhone : function(dtype){
		 dtype = (dtype == "normal" || dtype == "test") ? dtype : "normal";
	 	 this.phone = -1;//跳过设置手机号码	
		 	var html =  '\
						<div class="msg_title"><h3>输入手机号码，相册视频将发送到该手机</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
						<div class="block">\
							<p>\
								<label>输入手机号码：</label>\
								<span class="user_id"><input type="text" class="user_id" name="phone" id="phone" /></span>\
						     </p>\
							 <p>\
								  <label>确认手机号码：</label>\
								 <span class="user_id"><input type="text" class="user_id" name="phone2" id="phone2"/></span>\
							 </p>\
							 <div id="pay_tips">\
							 </div>\
							 <p class="pay_btns">\
							     <input type="button" value="" id="btn_confirm" onclick="albumController.checkPhone(\''+dtype+'\')" class="btn_confirm1" />\
								 ';
							if(dtype == "normal"){
								html += '<p><a href="javascript:albumController.confirmDownload()">不用手机接收，通过网页下载</a></p>';
								}	 
								 
							html += '</p>\
						</div>\
						';
			
		  	document.getElementById("dialogContent").innerHTML = html;
		 },	
	 checkPhone : function(dtype){
		    
		    if(/^\d+$/.test(document.getElementById("phone").value) === false || document.getElementById("phone").value.length < 10){
				document.getElementById("pay_tips").innerHTML = "<p>您输入的手机号码不合法</p>";
			}else if(document.getElementById("phone").value != document.getElementById("phone2").value){
				document.getElementById("pay_tips").innerHTML = "<p>您两次输入的手机号码不相同</p>";
			}else{
				this.phone = document.getElementById("phone").value;
				if(dtype == "normal"){
					this.confirmDownload();
				}else if(dtype == "test"){
					this.confirmDownloadTest();
				}
			}
		 },	 
	 confirmDownloadCallback : function(o){
		 	
		 	var html =  '\
				<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
				<div class="block">\
					<p>友情提示：服务器忙，请稍后再试。</p>\
				</div>\
				';
			if(typeof(o[0])=="undefined"){
				this.hideDivAuto();	
			}else{
				switch(o[0]){
						//操作成功的情况
						case 1:
							 if(this.type == "mp4"){
								 html =  '\
									<div class="msg_title"><h3>支付成功，相册转换处理中</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
									<div class="block">\
										<div class="loading"><img src="http://www.56.com/admin/style/20090219_mv_play/loading.gif" /></div>\
										<p class="loading">转换需要一点时间，请耐心等待。你也可以离开或关闭此页面。转换成功后,下载地址会通过站内<a target="_blank" href="http://msg.56.com/?/sms-sysmsg.html">系统信息</a>发送给您，请注意查收。</p>\
									</div>\
									';
							 }else if(this.type == "3gp"){
							 	html =  '\
									<div class="msg_title"><h3>支付成功，相册转换处理中</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
									<div class="block">\
										<div class="loading"><img src="http://www.56.com/admin/style/20090219_mv_play/loading.gif" /></div>\
										<p class="loading">转换需要一点时间（预计10分钟），您可以关闭或离开此页面，转换成功后会发短信到您刚才输入的手机号码。</p>\
										<p class="loading">如果没有选择手机接收，而通过选择页面下载，转换下载地址会通过<a target="_blank" href="http://msg.56.com/?/sms-sysmsg.html">系统信息</a>发送给您。</p>\
									</div>\
									';
							 }
							this.convert(o[2]);//参数为任务号 	
							//this.hideDivAuto();		
							break;	
						case -1:
						case -2:
							var tipDisplay = this.isClickConfirm > 1 ? "block": "none" ;
							 html =  '\
								<div class="msg_title"><h3>56币余额不足，请先充值</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
								<div class="block">\
									<p>1.请选择充值方式</p>\
									<ul class="pay_way">\
										<li><a href="http://pay.56.com/ways/liandongyoushi.php" onclick="albumController.setStat(\'phdown5\')" target="_blank"><img src="http://www.56.com/admin/style/20090219_mv_play/icon_sms.jpg" />短信充值</a></li>\
										<li><a href="http://pay.56.com/ways/tenpay.php?n=5" onclick="albumController.setStat(\'phdown3\')" target="_blank"><img src="http://www.56.com/admin/style/20090219_mv_play/qq.jpg" />网上银行</a></li>\
										<li><a href="http://pay.56.com/ways/junwang.php" onclick="albumController.setStat(\'phdown4\')" target="_blank"><img src="http://www.56.com/admin/style/blue_2009/m2v/junwang.jpg" />骏网</a></li>\
									</ul>\
									<p class="other_way"><a href="http://pay.56.com/ways/tenpay.php" onclick="albumController.setStat(\'phdown8\')" target="_blank">其它充值方式</a></p>\
									<p>2.充值完毕后请点确认支付</p>\
									<p class="pay_btns">\
										<input type="button" id="btn_confirm" class="btn_confirm2" value="" onclick="albumController.confirmDownload();albumController.setStat(\'phdown9\')"/>\
									</p>\
									<p id="showCommitMsg" style="display:'+tipDisplay+';"><font>请先充值，充值成功后点击确认支付</font></p>\
								</div>\
								';
							//this.hideDivAuto();	
							break;
							//-3 系统忙，定单申请失败，重试；-4 校验失败；-5 商品不存在
						case -3:
							html =  '\
							<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
							<div class="block">\
								<p>友情提示：系统忙，定单申请失败，请重试。</p>\
							</div>\
							';
							this.hideDivAuto();
							break;
						case -4:
							html =  '\
							<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
							<div class="block">\
								<p>友情提示：校验失败。</p>\
							</div>\
							';
							this.hideDivAuto();
							break;
						case -5:
							html =  '\
							<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
							<div class="block">\
								<p>友情提示：商品不存在。</p>\
							</div>\
							';
							this.hideDivAuto();
							break;
						default:
							html =  '\
							<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="albumController.cancelDownload()" href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
							<div class="block">\
								<p>'+o[1]+'</p>\
							</div>\
							';
					}
			 }
			//加统计
			html += '<iframe name="photoDown" src="http://stat3.corp.56.com/player.htm?s=phdown2" marginWidth="0" marginHeight="0" frameBorder="0" width="0" scrolling="0" height="0"></iframe>';
			document.getElementById("dialogContent").innerHTML = html;
		 },	
	 setStat : function(key){
		 	var t = Math.floor(Math.random() * 10) % 5;
			setTimeout(function(){jLoader("http://stat3.corp.56.com/player.htm?s="+key)},t * 1000);
			t++;
			if(key=="phdown1"){
				var url = document.location.href;
				if(url.indexOf("w.56.com/admin") > -1 || url.indexOf("www.56.com/m2v/code") > -1){ //列表或制作完毕
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown10");
				}else{//其它页面如：播放页 外连 mm space
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown11");
				}
				if(url.indexOf("w.56.com/admin") > -1)	{
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown12"); //列表页
				}else if(url.indexOf("www.56.com/m2v/code") > -1){
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown13"); //制作完毕
				}else if(/.*?u_\w+\.html$/.test(url)){
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown14"); //space
				}else if(url.indexOf("mm.56.com") > -1){
					jLoader("http://stat3.corp.56.com/player.htm?s=phdown15"); //mm
				}
			}
		 },	 
	 convert : function(taskId){
		 	var interval = setInterval(function(){
						jLoader("http://down.mv.56.com/index.php?task_id="+taskId+"&do=GetStatus&callback=albumController.convertCallback");
												},1000 * 60 * 1);
		 },
	 //javascript:;albumController.convertCallback();	
	 convertCallback : function(o){
		 	var html = "";
			if(o[0]==2){
					if(this.type == 'mp4'){
						html =  '\
						<div class="msg_title"><h3>转换成功</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
						<div class="block">\
							<p>相册视频下载服务：相册视频已经转换成功，请<a target="_blank" href="'+o[2]+'">点击此处</a>下载视频。</p>\
							<p>如果不能正常播放，请<a target="_blank" href="http://www.baofeng.com/down.html">下载播放器</a>\
							<a target="_blank" href="http://msg.56.com/feedback/">问题反馈</a></p>\
						</div>\
						';
					}else if(this.type == "3gp"){
						html =  '\
						<div class="msg_title"><h3>转换成功</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
						<div class="block">\
							<p class="done_tip">相册视频下载服务：相册视频已经转换成功，已通过短信发送到您刚才输入的手机号码，可直接通过手机点击下载。您也可以点击此处<a target="_blank" href="'+o[2]+'">下载视频</a></p>\
							<p class="done_tip"><a href="http://msg.56.com/?/sms-sysmsg-i-no.html" target="_blank">系统消息</a>中会有您的转换记录，以后需要重新下载可在系统消息点击<a href="javascript:;" onclick="albumController.wap_push(\''+o[3]+'\')">“重发短信”</a></p>\
							<p class="done_tip">如果不能正常播放，请<a target="_blank" href="http://www.baofeng.com/down.html">下载播放器</a>\
							<a target="_blank" href="http://msg.56.com/feedback/">问题反馈</a></p>\
						</div>\
						';
					}
			}else if(o[0]==-1){
				html =  '\
					<div class="msg_title"><h3>转换失败</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
					<div class="block">\
						<p>相册视频《相册名称》转换失败，并且您的56币已经退还到您的账户。</p>\
					</div>\
					';
			}else if(o[0]==1){
			
			}else{
				html =  '\
					<div class="msg_title"><h3>相册转换</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
					<div class="block">\
						<p>'+o[0]+'</p>\
					</div>\
					';
			}
			if(html){
				document.getElementById("dialogContent").innerHTML = html; 	
			}
			
		},	
	 wap_push : function(url){
		 url = url + "&callback=albumController.wap_push_callback";
		 jLoader(url);
	 },
	 wap_push_callback : function(o){
	 	 html =  '\
			<div class="msg_title"><h3>发送短信</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
			<div class="block">\
				<p>'+o[1]+'</p>\
			</div>\
			';
		document.getElementById("dialogContent").innerHTML = html; 	
	 },	
	 hideDivAuto : function(ele,time){
			 ele = ele||"dialogDownload";
			 time = time||8000;
			 try{
				 setTimeout(function(){
								 document.getElementById(ele).style.display = 'none';
								 },time);
			 }catch(e){}
		 },	 
	 
	 _submitInterval : function(ele){
	 		document.getElementById(ele).disabled = "disabled";
			var flag = 2;
			var submitInterval = setInterval(function(){
				try{	
					document.getElementById(ele).disabled = "disabled";
					//document.getElementById(ele).value = document.getElementById(ele).value.replace(/(\(\d{0,1}\))/,"") + "("+flag+")";
					--flag;
					if(flag==-1){
						clearInterval(submitInterval);
						document.getElementById(ele).disabled = "";
						//document.getElementById(ele).value = document.getElementById(ele).value.replace(/(\(\d{0,1}\))/,"");
					}
				}catch(e){clearInterval(submitInterval);}	
			},1000);
		}
	 };
	 
 var userAlbumController = {
	 showLogin : function(ourl){
		 ourl = ourl||"";
		 	var html =  '\
					<div class="msg_title"><h3>下载相册视频</h3><a title="关闭窗口" onclick="document.getElementById(\'dialogDownload\').style.display = \'none\'; return false; " href="#"><img src="http://msg.56.com/images/close.gif"/></a></div>\
					<div class="block">\
						<form action="http://space.56.com/php/urs.php" method="post" name="userLogin">\
							 <p>\
								<label>帐&nbsp;&nbsp;号：</label>\
								<span class="user_id"><input type="text" class="user_id" name="username" id="username" /></span>\
						     </p>\
							 <p>\
								  <label>密&nbsp;&nbsp;码：</label>\
								 <span class="pwd"><input type="password" class="pwd" name="password" id="password"/></span>\
							 </p>\
							 <div>\
							     <input type="hidden" value="'+ourl+'" name="ourl"/>\
								 <input type="submit" value="" class="btn_lgn" />\
								 <input type="button" value="" class="btn_reg" onclick="javascript:window.open(\'http://reg.56.com/newreg/register/index.html\');"/>\
							 </div>\
						</form>\
					</div>\
					';
			document.getElementById("dialogContent").innerHTML = html;
			//自动适应 
			albumController.autoAdjust();
			//蒙版
			albumController._setMask();
			//$("#dialogDownload").css("display","block");
			document.getElementById("dialogDownload").style.display = "block";
		 }
	 }; 	 

/**  
 * 	@name 半透明蒙版
 *  @example
    	//添加蒙版
		mask2009.showMask();
		//去除蒙版
		mask2009.removeMask();
 *	@author Melon @ 09-02-06 
 */
mask2009 = {
	showMask : function(){
		 this.removeMask(); //防止生成多层蒙版
		 try{
				var maskDiv = window.top.document.createElement("div");
				maskDiv.id = "maskDiv";
				maskDiv.style.backgroundColor = "#000";
				maskDiv.style.width = "100%";
				maskDiv.style.height = window.top.document.body.clientHeight+"px";
				maskDiv.style.position = "absolute";
				maskDiv.style.left = 0;
				maskDiv.style.top = 0;
				maskDiv.style.zIndex = 1000;
				if(navigator.userAgent.indexOf("MSIE") > -1){
					maskDiv.style.filter = "alpha(opacity=60)";
					window.top.document.body.appendChild(maskDiv);
				}else{
					maskDiv.style.opacity = 60/100;
					window.top.document.documentElement.appendChild(maskDiv);
				}
			}catch(e){}
	},
	removeMask : function(){
			try{
				if(navigator.userAgent.indexOf("MSIE") > -1){
					window.top.document.body.removeChild(document.getElementById("maskDiv"));
				}else{
					window.top.document.documentElement.removeChild(document.getElementById("maskDiv"));
				}
			}catch(e){}
		}
	};


/**  
 * 	@name 获取地址参数对象
 *  @example
    	//http://huodong.56.com/love09/index.php?do=showList&page=40
		paraObj.do
		paraObj.page
 *	@author Melon @ 09-02-16 
 */
if (typeof(getParams) != "function"){
	function getParams(url){
		var url = url ? url : window.location.href.replace(/(#.*?)$/,"");
		var para = url.substr(url.indexOf("?")+1);
		var paraArray = para.split("&");
		var paraObj = {};
		for(var i=0;i<paraArray.length;i++){
				var _temp = paraArray[i].split("=");
				paraObj[_temp[0].toLowerCase()] = _temp[1];
		}
		_temp = null;
		return paraObj;
	}
}
 
 
//运行，针对没有登录的用户（因为当前没有登录不允许相册，下面语句其实可以省略）
var get = getParams();
if(get.callback) eval(get.callback);
 
