﻿<!--//--><![CDATA[//><!--

var dataInfo = {
	title : '',
	commUrl : '', //图集评论地址
	others : {	
    	downloadPic : true, //允许下载图片
		PVCountUrl_m : '',	//流量统计地址
        PVCountUrl_a : ''
	}
};
function echoFocus(){
	var flashPic = "",flashTxt = "";
	var newHref;
	var datas = sina.$('eData').getElementsByTagName('dl');
	for(var i=0;i<datas.length;i++){
		//try{
			var title,pic,middlePic,smallPic,datetime,intro,commUrl;
			title = datas[i].getElementsByTagName('dt');
			if(title){
				title = title[0].innerHTML;
			}else{
				title = 'null';
			};
			var info = datas[i].getElementsByTagName('dd');
			if(info){
				pic = info[0].innerHTML;
				middlePic = info[1].innerHTML;
				smallPic = info[2].innerHTML;
				datetime = info[3].innerHTML;
				intro = info[4].innerHTML;
				commUrl = info[5].getElementsByTagName('a');
				if(commUrl){
					commUrl = commUrl[0].href;
				}else{
					commUrl = '';
				};
			};
			epidiascope.add({
							src : pic,
							lowsrc_b : middlePic,
							lowsrc_s : smallPic,
							date : datetime,
							title : title,
							text : intro,
							comment : commUrl
						});
			//for flash
			/*if(flashPic != ""){flashPic += "|"};
			flashPic += encodeURIComponent(pic);
			
			if(flashTxt != ""){flashTxt += "|"};
			flashTxt += encodeURIComponent(title) + "#　　" + encodeURIComponent(intro);*/
		//}catch(e){}
	};
	
	epidiascope.PVUrl_m = dataInfo.others.PVCountUrl_m;
	epidiascope.PVUrl_a = dataInfo.others.PVCountUrl_a;
	epidiascope.autoPlay = false;
	epidiascope.init();
	//fullFlash(flashTxt,flashPic);
	
	if(Math.random()<=0.01){
		epidiascope.PVUrl_a = epidiascope.PVUrl_m = "http://mil.news.sina.com.cn/hdphoto/lltj_photo_manual_test.html";
		epidiascope.stop();
	};

	//if(dataInfo.others.downloadPic===true){
		//document.getElementById("downloadPicObj").style.display="inline";
	//};
};
function fullFlash(txt,pic){	
	var flashurl = "http://" + window.location.hostname + "/js/loop_8.17.swf";
	/*var fullScreen = new sinaFlash(flashurl, "fullScreenObj", "100%", "100%", "8", "#000000");
	fullScreen.addParam("quality", "best");
	fullScreen.addParam("wmode", "transparent");
	fullScreen.addParam("allowFullScreen", "true");
	fullScreen.addVariable("mylinkpic", pic);		//此处添加组图标题
	fullScreen.addVariable("infotxt",dataInfo.title);
	//此处添加图片文字标题，导语，分别用“|”，“#”分割
	fullScreen.addVariable("mytxt",txt);
	fullScreen.addVariable("fulls_btnx","0");
	fullScreen.addVariable("fulls_btny","0");
	fullScreen.addVariable("fulls_btnalpha","0")
	fullScreen.write("fullScreenFlash");*/
};
function flash_to_js(name){
	name = new String(name);
	var status = name.split("|");
	epidiascope.speedBar.setGrade(status[1]);
	epidiascope.select(parseInt(status[0]));
};
function js_to_flash(){
	epidiascope.stop();
	return epidiascope.selectedIndex + "|" + epidiascope.speedBar.grade;
};
function errorFocus(str){//错误
	document.getElementById("d_picTit").innerHTML = str;
	document.getElementById("d_BigPic").innerHTML = '<img src="http://image2.sina.com.cn/home/ddt/images/err02.gif" alt="' + str + '" />';
};
//下载图片
function downloadPic(){
	try{
		var src = epidiascope.filmstrips[epidiascope.selectedIndex].src;
		src = src.replace(/http\:\/\/(i0|i1|i2|i3|www)\.sinaimg\.cn\//i,"");
		document.getElementById("downloadPicFrame").src ="http://slide.news.sina.com.cn/iframe/download.php?img=" + src;
	}catch(e){};
};

var sendT = {
	getHeader : function(){
		return document.getElementById("txtTitle").innerHTML + '-' + document.getElementById("d_picTit").innerHTML;
	},
	getFirstImgSrc : function(){
		if (document.getElementById("d_BigPic").getElementsByTagName("img")[0]){
			return document.getElementById("d_BigPic").getElementsByTagName("img")[0].src;
		}else{
			return null;
		}
	}
}

function shareTblog(){
	(function(s,d,e,r,l,p,t,z,c){
		 var f='http://v.t.sina.com.cn/share/share.php?',u=z||d.location,p=['url=',	e(u),'&title=',	e(sendT.getHeader()),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');
		 function a(){
			 if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');
		 };
		 if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();
	})(screen,document,encodeURIComponent,'新浪娱乐','http://ent.sina.com.cn',sendT.getFirstImgSrc(),null,null,null);	
}

var ul_obj = jQuery('#eData');

var items = parseUri(window.location.href);
var file  =  "http://"+ items.host + items.directory;
function ajaxXml(dir)
{
var ajaxdir = file  + dir + "/index.xml";
//var ajaxdir = dir + "index.xml";
//alert(ajaxdir);
		ul_obj.html("");
		jQuery.ajax({
			url:ajaxdir,
			type:"GET",
			dataType:"xml",
			success:function (xml){
				
		var i = 0;
				$(xml).find('item').each(function (){
					
					++i;
					var $item=$(this);					
					
					var title=$item.find("title").text();
  					var author=$item.find("author").text();
					  var people=$item.find("people").text();
					  var address=$item.find("address").text();
					  var datetime=$item.find("datetime").text();
					  var keywords=$item.find("keywords").text();
					  var summary=$item.find("summary").text();
					  var url=file + dir + $item.find("url").text().replace('./','/');
					  var surl=file + dir + $item.find("surl").text().replace('./','/');
					  //alert(url);
					if(i==1)
					{
						dataInfo.title = title;
					}
					
	var html = '<DL>';
  html += '<DT>'+ title;
  html += '<DD>'+ url;
  html += '<DD>'+ surl;
  html += '<DD>'+ surl;
  html += '<DD>'+ datetime;
  html += '<DD>';
  //html += '<DIV>'+author+ ': ';
  html += '<DIV>';
  html += keywords+ summary + '</DIV>&nbsp;&nbsp;&nbsp;&nbsp';
					html += '<DD><A ';
  html += 'href="http://comment4.news.sina.com.cn/comment/skin/default.html?channel=yl&amp;newsid=slidenews-168-13740">评论</A>';
  html += '</DD></DL>';
					ul_obj.append(html);
					
					
				});
				
				
				
			},
			error:function (x,e){
				
				
				alert("error");
				
				//alert(x.responseText);                 
				
				
			},
			complete:function (x){
				
				echoFocus();
			}
			
			
		});
		}
function getUrl()
{
//location.href;
var str = location.href;
var strs=str.split("/");
var dirs = strs.length - 2;
var file = strs[dirs];
var dir = str.split(file)[0] + "index.xml";
var filetemp ="";
var filepre="";
var filenext="";
var filestatus = "normal";
var filebool = false;
jQuery.ajax({
			url:dir,
			type:"GET",
			dataType:"xml",
			success:function (xml){
				var i = 0;
				var j = 0
				var mycars=new Array()
				$(xml).find('channel').each(function (){
					var $item=$(this);	
					//mycars[j] = "." + $item.text();
					var channel=$item.text().split("/")[1];
					mycars[j] = channel;
					if(file == channel)
					{
						i = j;
					}
					j++;
				});
				var len = $(xml).find('channel').length - 1;
				if(i==0)
				{
					filepre = mycars[len];
					filenext = mycars[1];
				}
				else if(i==len)
				{
					filepre = mycars[(len - 1)];
					filenext = mycars[0];
				}
				else
				{
					
					filepre = mycars[(i - 1)];
					filenext = mycars[(i + 1)];
				}
				filepre = filepre + GetUrlFileName();
				filenext = filenext + GetUrlFileName();
				$("#filepre").attr("href",filepre);
				$("#filenext").attr("href",filenext);
				$('#nextPicsBut').attr("href",filenext);
			}
		});
		}
		
var dir = "";
var dir_name = "";
if(items.query)
{
	//alert(items.query);
	dir = items.query.split("=")[1];
	//alert(dir);
}
		function GetXml(files)
		{
var filepre="";
var filenext="";
jQuery.ajax({
			url:"index.xml",
			type:"GET",
			dataType:"xml",
			success:function (xml){
				var i = 0;
				var j = 0
				var mycars=new Array();
				var mydirname = new Array();
				$(xml).find('channel').each(function (){
					var $item=$(this);	
					//mycars[j] = "." + $item.text();
					var channel=$item.text().split("/")[1];
					mycars[j] = channel;
					mydirname[j] = $(this).attr("name");
					if(files == channel)
					{
						i = j;
						dir_name
					}
					j++;
				});
				var len = $(xml).find('channel').length - 1;
				if(i==0)
				{
					dir_name = mydirname[0];
					dir = mycars[0];
					filepre = mycars[len];
					filenext = mycars[1];
				}
				else if(i==len)
				{
					dir_name = mydirname[len];
					dir = mycars[len];
					filepre = mycars[(len - 1)];
					filenext = mycars[0];
				}
				else
				{
					
					dir_name = mydirname[i];
					dir = mycars[i];
					filepre = mycars[(i - 1)];
					filenext = mycars[(i + 1)];
				}
				$("#txtTitle").html(dir_name);
				document.title=dir_name;
				filepre = file + GetUrlFileName()+"?c=" + filepre;
				filenext = file + GetUrlFileName()+"?c=" + filenext;
				$("#filepre").attr("href",filepre);
				$("#filenext").attr("href",filenext);
				$('#nextPicsBut').attr("href",filenext);
				ajaxXml(dir);
			}
		});

		}
		GetXml(dir);


function GetUrlFileName(){
	var str_url,str_pos,str_para; 
	var arr_param=new Array(); 
	str_url = window.location.href; 
	/*str_pos = str_url.indexOf("."); 
	str_para = str_url.substring(str_pos-2,str_pos);*/ 
	str_pos = str_url.lastIndexOf("/");
	str_end = str_url.indexOf("?");
	if(str_end!=-1){
		str_para = str_url.substring(str_pos+1,str_end);
	}else{
		str_para = str_url.substring(str_pos+1);
	}
	return(str_para);
}
		//getUrl();
//--><!]]>