var COOKIE_DAYS = 30;function getCookieVal(offset){	var endstr = document.cookie.indexOf (";", offset);	if (endstr == -1)	{		endstr = document.cookie.length;	}	return unescape(document.cookie.substring(offset, endstr));}function setCookie(name, value){	var expdate = new Date();	var argv = setCookie.arguments;	var argc = setCookie.arguments.length;	var expires = (argc > 2) ? argv[2] : null;	var path = (argc > 3) ? argv[3] : null;	var domain = (argc > 4) ? argv[4] : null;	var secure = (argc > 5) ? argv[5] : false;	expires = COOKIE_DAYS * 24 * 3600;	if (expires != null)	{		expdate.setTime(expdate.getTime() + (expires * 1000));	}	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))	+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))	+((secure == true) ? "; secure" : "");}function delCookie(name){	var exp = new Date();	exp.setTime (exp.getTime() - 1);	var cval = getCookie (name);	document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();}function getCookie(name){	var arg = name + "=";	var alen = arg.length;	var clen = document.cookie.length;	var i = 0;	while (i < clen)	{		var j = i + alen;		if (document.cookie.substring(i, j) == arg)		{			return getCookieVal (j);		}		i = document.cookie.indexOf(" ", i) + 1;		if (i == 0) break;	}	return null;}function show_hot(){	$("my_favor").style.display = "block";	$("dm72_flash_info").style.display = "none";	$("show_1").className = "label-down";	$("show_2").className = "label-link";	$("show_3").className = "label-link";	$("show_4").className = "label-link";	now_type = "hot"	flash_view.init();}function show_new(){	$("my_favor").style.display = "block";	$("dm72_flash_info").style.display = "none";	$("show_2").className = "label-down";	$("show_1").className = "label-link";	$("show_3").className = "label-link";	$("show_4").className = "label-link";	now_type = "new"	flash_view.init();}function show_favor(){	$("my_favor").style.display = "block";	$("dm72_flash_info").style.display = "none";	$("show_4").className = "label-down";	$("show_1").className = "label-link";	$("show_3").className = "label-link";	$("show_2").className = "label-link";	now_type = "favor";	flash_view.init();}function show_opus_comment(){	Query.execute('/sys/json/flash_comment_json.php?flash_id=' + flash_id, 'opus_comment', 10);}function show_now(){	show_flash_info(flash_id);	now_type = "show_now";}function show_flash_info(flash_id){	$("show_3").className = "label-down";	$("show_2").className = "label-link";	$("show_1").className = "label-link";	$("show_4").className = "label-link";	$("my_favor").style.display = "none";	$("dm72_flash_info").style.display = "block";	var url = '/sys/json/flash_one_json.php?flash_id=' + flash_id + '&rand=' + Math.random();	var request = new Ajax.Request(url, {		method: 'get',		onSuccess: function(transport) {			var flash_list = eval('(' + transport.responseText + ')').record;			var str = '正在播放:<span class="red">《' + flash_list[0].name + '》</span> <span class="yellow"><a href="#" onclick="flash_vote('+ flash_list[0].id + ');return false;" title="投它一票">投它一票</a> ';			if ($("is_manager").value == "1")			{				str += '<a class="yellow" href="flash_pub?id=' + flash_list[0].id + '" target="_blank">[修改]</a>';			}			str += '<a class="yellow" href="#" onclick="favor(' + flash_list[0].id + ', false);return false;" target="_blank">[收藏]</a>';			str += '</span><br>作者：<span class="red">' + flash_list[0].author + '</span>，人气：<span class="red">' + flash_list[0].hits + '</span>，得票：<span class="red">' + flash_list[0].votes + '</span>，被分享：<span class="red">' + flash_list[0].shares + '</span><br>简介：<br>&nbsp;&nbsp;&nbsp;&nbsp;' + flash_list[0].intro + '<br>';			$("dm72_flash_info_show").innerHTML = str;		}});		show_opus_comment();}function update_hits(flash_id){	$("dm72_action").value = "play_one";	new SimpleSubmit('dm72_form','/sys/app/flash_opus_opt.php?id=' + flash_id,{lock:false, message:false});}function in_array(dm72_array, dm72_string){	for (var i = 0, length = dm72_array.length; i < length; i++)	{		if (dm72_array[i] == dm72_string)		{			return true;		}	}	return false;}function flash_vote(flash_id){	var id = 'f'+flash_id+'f';	if (id)	{		var idc = getCookie("flash_hits");		if (idc != null)		{			idc = idc.replace(/^-+/, '').replace(/-+$/, '');			var ids = idc.split("-");			if (in_array(ids, id))			{				alert("您已经投过票了！");				return false;			}		}		else		{			idc = "";		}		idc = "-"+'f'+ flash_id + 'f';		setCookie("flash_hits", idc);//防止刷新	}	$("dm72_action").value = "vote_one";	new SimpleSubmit('dm72_form','/sys/app/flash_opus_opt.php?id=' + flash_id,{lock:false, message:false, onComplete:function(){alert("投票成功！");}});	votes[flash_id] = parseInt(votes[flash_id]) + 1;	show_flash_info(flash_id);}function category_submit(){	if (bytes(document.dm72_form.name.value) == 0)	{		alert("分类名称不能为空.");		document.dm72_form.name.focus();		return false;	}	new SimpleSubmit(	'dm72_form',	'/sys/app/flash_category_opt.php',{onComplete:function(){top.location.reload();}}	);	return false;}function opus_list(group_id, category_id){	Query.execute('/sys/json/flash_opus_json.php?group_id=' + group_id + '&category_id=' + category_id, 'opus_list', 30);}function del_favor(flash_id){	$("favor_flash_id").value = flash_id;	$("dm72_action").value = "del";	new SimpleSubmit('dm72_form','/sys/app/flash_favor_opt.php',{lock:false,message:false});	return false;}function open_url(url){	var width = 1020;	var height = 670;	var left = (screen.width > 1100)?100:0;	var top = 0;	var userAgent = navigator.userAgent.toLowerCase();	if (userAgent.indexOf("msie") >=1 && userAgent.indexOf("sv1;") < 1 )	{		var playWin = window.open(url, 'dm72_flash_play', 'width='+width+',height='+height+',top='+top+',left='+left+',scrollbars=0,resizable=0,status=1');		if(playWin === null)		{			parent.location.href = url;			return true;		}		else		{			playWin.focus();			return false;		}	}	else	{		//var playWin = window.open(url, '', 'width='+width+',height='+height+',scrollbars=1');		//playWin.focus();		return true;	}}function play_index_favor(visit_path){	var url = "/" + visit_path + "/flash_opus?dm72_action=play_favor";	return open_url(url);}function play_all_favor(){	var url = "flash_opus?dm72_action=play_favor";	return open_url(url);}function play_opus(id, visit_path){	var url = "http://our.dm72.com/" + visit_path + "/flash_opus?id="+id;	return open_url(url);}function play_flash(id, title, url, visit_path){	//favor(id, false, title, url);	return play_opus(id, visit_path);}function favor(id, show_msg){	document.getElementById("dm72_action").value = "add";	new SimpleSubmit('dm72_form','/sys/app/flash_favor_opt.php?flash_id=' + id,{lock:show_msg, message:show_msg, onComplete:function(){$("dm72_action").value = "";if (!show_msg){alert('收藏成功！');}}});	document.getElementById("num").innerHTML = getCookie("favor_num");	return false;}function set_favor_num(){	document.getElementById("num").innerHTML = getCookie("favor_num");}function flash_url_change(url_type){	$("flash_url_type").value = url_type;	if(url_type == "LOCAL")	{		$("web_flash").style.display = "none";		$("local_flash").style.display = "block";		return true;	}	$("local_flash").style.display = "none";	$("web_flash").style.display = "block";	return true;}function check_flash_path(){	var file_name = $("flash_web_path").value.strip();	$("flash_web_path").value = file_name;	var re_swf = /\.(swf)$/gi;	if(file_name.length > 200)	{		alert("URL过长请重新填写");		$("flash_web_path").focus();		return false;	}	else if (isBlank($("flash_web_path").value))	{		alert("请输入FLASH文件URL。")		$("flash_web_path").focus();		return false;	}	else if(file_name.match(re_swf))	{		return true;	}	alert("请输入FLASH文件URL，请重新填写");	$("flash_web_path").focus();	return false;}function flash_pub(){	if(isBlank($("name").value))	{		alert("名称不能为空");		$("name").focus();		return false;	}	if($("category_id").value == "")	{		alert("请选择分类");		$("name").focus();		return false;	}	if($("dm72_action").value == "add" && isBlank($("pic_path").value))	{		alert("预览图片不能为空");		$("pic_path").focus();		return false;	}	if ($("flash_url_type").value == "WEB")	{		if (!check_flash_path())		{			return false;		}	}	if($("dm72_action").value == "add" && isBlank($("flash_path").value) && $("flash_url_type").value == "LOCAL")	{		alert("您还没有上传FLASH，或者正在上传中（请稍后提交）。");		return false;	}	else	{		new SimpleSubmit('dm72_form','/sys/app/flash_opus_opt.php',{redirect:"flash_opus_list?id=" + $("category_id").value});		return false;	}}function pub_comment(){	if(isBlank($("content").value))	{		alert("请选择输入评论内容。");		$("content").focus();		return false;	}	new SimpleSubmit('dm72_flash_comment','/sys/app/flash_comment_opt.php?flash_id=' + flash_id,{lock:false, message:false, onComplete:function(){$("content").value="";show_opus_comment();}});	return false;}function del_comment(id){	if(window.confirm('确定要删除该评论吗？'))	{		new SimpleSubmit('dm72_comment_del','/sys/app/flash_comment_opt.php?id='+id+'&flash_id=' + flash_id,		{lock:false, message:false, onComplete:function(){show_opus_comment();}});	}	return false;}function file_deal(file_info){	document.getElementById("flash_path").value = file_info[0];	document.getElementById("flash_size").value = file_info[1];}
