﻿ gallery_idx=0;
function addGallery(t,src,num,w,h){
	document.write('<div align="center"><div id="galleryholder'+gallery_idx+'" >&nbsp;</div></div>');
	var fo = new SWFObject("/swf/gallery.swf", "gallery", w+50 ,h+100 , "7", "#333333", true);
	fo.addParam("allowScriptAccess", "always");
	fo.addVariable("galleryName",t);
	fo.addVariable("img_dir",src);
	fo.addVariable("maxImg",num);
	fo.addVariable("width",w+50);
	fo.addVariable("height",h+100);
	fo.addVariable("jump",10);
	fo.write("galleryholder"+gallery_idx);
	gallery_idx++;
}

var movie_idx=0;
function addMovie(url,t,w,h){
	var isMp4 = (url.indexOf(".mp4")==url.length-4);
	if(IP=="campusO"){
		url = url.replace("http://v.hbd.just.edu.cn:81/", "http://202.195.195.143:81/");
		url = url.replace("http://hbd.just.edu.cn:81/", "http://202.195.195.143:81/");
	}
	document.write('<div align="center"><div><div id="flowplayerholder'+movie_idx+'" >&nbsp;</div></div>');
	//if(IP.indexOf("campus")!=0&&(url.indexOf(':81/public/')||url.indexOf(':81/news/'))==-1){
	//	$("#flowplayerholder"+movie_idx).hide();
	//	document.write('<a href="javascript:playVideo(\''+url+'\')" style="font-size:16px">点击播放</a><br />');
	//}
	var lw = 0;
	var ls ="";
	// need this next line for local testing, it's optional if your swf is on the same domain as your html page
	var params = {
		allowScriptAccess:"always",
		allowFullScreen: "true",
		menu: "false"
	};
	var flashvars = {
		file:encodeURI(url),
		streamer:'lighttpd',
		fullscreen:'true',
		stretching:'none'
	};
	if(url.indexOf("video/playlist.php")>1){
		lw=300;
		flashvars.playlistsize=lw;
		flashvars.playlist='right';
	}
	var attributes = {id:"flowplayerholder"+movie_idx,name: "flowplayerholder"+movie_idx };
	//	initialScale: 'scale',\
	if(!isMp4||swfobject.hasFlashPlayerVersion("9.0.115")){
		swfobject.embedSWF("/swf/player.swf","flowplayerholder"+movie_idx , w+lw, h+23, "8.0.0", "expressInstall.swf", flashvars, params, attributes);
	}else{
		document.write("对不起，航标灯视频H.264格式需要flash 9.0.115 以上的版本才可以收看，请升级flashplayer<br />");
		if(/msie/i.test(navigator.userAgent)){
			document.write("<a href=\"http://get.adobe.com/flashplayer/\">Adobe官方下载</a> <a href=\"/swf/Install Flash Player 10 ActiveX.exe\">校内下载</a><br /><br />");
		}else{
			document.write("<a href=\"http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe\">Adobe官方下载</a> <a href=\"/swf/install_flash_player.exe\">校内下载</a><br /><br />");
		}
	}
	document.write(t)
	if(isMp4)document.write("<br /><span style=\"color:#ff0000\">H.264格式试播，影片缓冲时间较长，请耐心等待</span>");
	document.write("</div>");
	movie_idx++;
}
function playVideo(url){
	$.facebox('<div style="width:480px;height:382px" id="loginBox"><span id="loginMsg"></span>用户名<input type="text" id="user" size=10> 密码<input type="password" id="pass" size=10> <input type="button" value="提交" onclick="flvLogin("'+url+'");" /></font><br /><span style="color:#ff0000">声明:江苏科技大学综合信息服务系统帐号由学校管理，宣传部不保存帐号和密码.<br />有关帐号事宜请与网络中心联系。电话：84402882</span></div>');
}
function flvLogin(URL){
	
	$.post("/JAccount/verif.php",	{user:$("#user").val(), 	pass: $("#pass").val()},
	function(data){
		if(data>0){url.replace("http://hbd.just.edu.cn:81/","http://v.hbd.just.edu.cn:81/v/");
			$("#loginBox").hide();
			$("flowplayerholder").show();
		}else{
			$("#loginMsg").html("登录失败，请重试");
		}
	});
};

$(document).ready(function($) {
	$(document).pngFix();
});