/*
=====================================
mypoco相册 JS类(需Sarissa库支持)
cody by sky@poco
date:2006-02-09
=====================================
*/

/**
*	myPoco相册类
*/
//http://my.poco.cn/items/item_details.htx&user_id=30624136&item_id=13368427&_TEST=1
function Album(){}


var re =/http:\/\/(.+?)\//;
re.test(window.location.href);
Album.host = RegExp.$1 ? RegExp.$1 : "my.poco.cn";

//图片缩放
Album.resizeImg = function(imgObj, rectWidth, rectHeight)
{
	var resizeFunc = function() {
		var x = imgObj.width>rectWidth ? rectWidth : imgObj.width;
		var y = imgObj.height>rectHeight ? rectHeight : imgObj.height;
		var scale	= imgObj.width/imgObj.height;
		if( x>y*scale ) {
			imgObj.width	= Math.floor(y*scale);
			imgObj.height	= y;
		}else {
			imgObj.width	= x;
			imgObj.height	= Math.floor(x/scale);
		}
		imgObj.style.width = imgObj.width+"px";
		imgObj.style.height = imgObj.height+"px";
	}
	if( (imgObj.width==0 || imgObj.height==0 ||imgObj.width==28 ||imgObj.width==30) && document.all) {
		imgObj.onreadystatechange = function(){
			if (imgObj.readyState=="complete")
				resizeFunc();
		}
	} else {
		resizeFunc();
	}
}
//固定高缩放
Album.resizeHeight = function(imgObj, height)
{
	var resizeFunc = function() {
		//setTimeout("alert(imgObj.style.width + ',' + imgObj.style.height + ';' + imgObj.width + ',' + imgObj.height)", 3000);
		//alert(imgObj.width + ',' + imgObj.style.width + ';' + height + ',' + scale);
		scale = imgObj.width/imgObj.height;
		
		if (document.all)
		{
			imgObj.height = height;
			imgObj.width = height*scale;	//height*scale;
			imgObj.style.height = height+"px";
			imgObj.style.width = height*scale+"px";
		}
		else
		{
			imgObj.setAttribute("height", (height + 'px'));
			imgObj.setAttribute("width", (height*scale + 'px'));
		//imgObj.setAttribute("title", parseInt(height*scale) + ',' + height);
		}
		//alert(height + ',' + scale);
		//alert(height*scale + ',' + height + ';' + imgObj.style.width + ',' + imgObj.style.height + ';' + imgObj.width + ',' + imgObj.height);
		imgObj.style.display = "inline";
	}
	imgObj.onerror = function(){
		imgObj.style.display = "inline";
	}
	if( (imgObj.width==0 || imgObj.height==0 ||imgObj.width==28 ||imgObj.width==30) && document.all) {
		imgObj.onreadystatechange = function(){
			if (imgObj.readyState=="complete")
				resizeFunc();
		}
	} else {
		resizeFunc();
	}
}
//固定宽缩放
Album.resizeWidth = function(imgObj, width)
{
	
	var resizeFunc = function() {
		scale = imgObj.width/imgObj.height;
		imgObj.height = width/scale;
		imgObj.width = width;
		imgObj.style.width = imgObj.width+"px";
		imgObj.style.height = imgObj.height+"px";
		imgObj.style.display = "inline";
	}
	imgObj.onerror = function(){
		imgObj.style.display = "inline";
	}
	if( (imgObj.width==0 || imgObj.height==0 ||imgObj.width==28 ||imgObj.width==30) && document.all) {
		imgObj.onreadystatechange = function(){
			if (imgObj.readyState=="complete")
				resizeFunc();
		}
	} else {
		resizeFunc();
	}
}


/**
*	设置头象
*/
Album.set_user_face = function(id) {
	var frameObj = document.createElement("iframe");
	frameObj.style.display = "none";
	frameObj.setAttribute("src", 'http://'+Album.host+'/album/album_act.php?do=face&id=' + id);
	document.body.appendChild(frameObj);
}

/**
* 删除
*/
Album.delete_photo = function(id) {
	var frameObj = document.createElement("iframe");
	frameObj.style.display = "none";
	frameObj.setAttribute("src", 'http://'+Album.host+'/album/album_act.php?do=delete&ids_to_del[]=' + id);
	document.body.appendChild(frameObj);
}

/**
*	幻灯片显示类
*/
//this.album = new Album.slideShow('{user_id}', "albumView", true, "album", false,"albumView2",'{set_hash}','{item_id}'); 
Album.slideShow = function(user_id, viewDiv, resizeImg, channel, showAll,viewDivTopic,tag_id,item_id){

	this.init = function() {
		if(showAll!=null)
			this.showAllPhoto = showAll;
			
		if(resizeImg!=null)
			this.resizeImg = resizeImg;
		if(channel==null)
			this.channel = "album";
		else
			this.channel = channel;

		this.user_id = user_id;
		this.item_id = item_id;
		
		var albumXmlUrl = "";
		if(this.channel=="photo") {
			albumXmlUrl = "http://"+Album.host+"/lastphoto_v2.php?id="+user_id+"&_xml";
		} else {
			albumXmlUrl = "http://"+Album.host+"/items/item_get_user_items.xml.php?b_hidden_user_name=1&item_type[]=album&op=get_items&tag_id[]="+tag_id+"&user_id="+user_id;
		}
		if(!this.showAllPhoto)
			albumXmlUrl += "&limit=0,10";

		if (typeof viewDiv == 'string')
			this.viewObj = document.getElementById(viewDiv);
		else
			this.viewObj = viewDiv;
		
		if (typeof viewDivTopic == 'string' && viewDivTopic)
			this.viewObj2 = document.getElementById(viewDivTopic);
		else
			this.viewObj2 = viewDivTopic;
	
			

		if( this.viewObj.offsetWidth) {
			this.viewWidth = this.viewObj.offsetWidth;
			this.viewObj.style.width = this.viewObj.offsetWidth+"px"; //需设置style中width或height或position的值才能使用滤镜效果
		}
		else {
			this.viewWidth = parseInt(this.viewObj.style.width);

		}

		if(this.viewObj.offsetHeight) 
			this.viewHeight = this.viewObj.offsetHeight;
		else
			this.viewHeight= parseInt(this.viewObj.style.height);
		
		//this.viewWidth = this.viewObj.offsetWidth;
		//this.viewObj.style.width = this.viewObj.offsetWidth+"px"; //需设置style中width或height或position的值才能使用滤镜效果
		//this.viewHeight = this.viewObj.offsetHeight;
		//this.viewObj.style.height = this.viewObj.offsetWidth+"px";

		this.viewObj.style.filter	 = "progid:DXImageTransform.Microsoft.Fade(Overlap=1.00)";
		this.xmlobject.load(albumXmlUrl);
		var topThis = this;
		//this.pKey = 1;
		this.xmlobject.onreadystatechange = function() {

			if (topThis.xmlobject.readyState==4)
			{
				
				topThis.albumObj	= topThis.xmlobject.getElementsByTagName('user_res')[0];
				if(topThis.albumObj==null) {
					topThis.viewObj.innerHTML = "返回数据错误,请稍候再试";
					return;
				}
				topThis.photoObjs	= topThis.albumObj.getElementsByTagName("item");
				if(topThis.photoObjs.length==0) {
					topThis.viewObj.innerHTML = "此相册暂没数据";
					if(topThis.preObjParent && !topThis.prvObj) {
						topThis.preObjParent.innerHTML = "";//"初始化失败";
					}
					return;
				}
				
				for(i=0;i<topThis.photoObjs.length;i++) 
				{
					topThis.photoStore[i] = new Image();
					topThis.photoStore[i].setAttribute("border", "0");
					topThis.photoTitle[i] = topThis.photoObjs[i].getAttribute("title");
					
					if (item_id == topThis.photoObjs[i].getAttribute("id"))
					{
						topThis.item_set = i;		//记录当前图片
					}
					
				}
				

				//缓存主图：当前图片左右N张图片
				for (x = topThis.item_set - 4; x < topThis.photoObjs.length && (x < topThis.item_set + 5); x++)
				{
					if (x >=0 && x < topThis.photoObjs.length)
					{
						if (topThis.photoStore[x].src == '' || topThis.photoStore[x] == null)
						{
							topThis.photoStore[x].setAttribute("src", topThis.photoObjs[x].getAttribute("url") );	//缓存图片当前图片左右N张图片
							if(this.resizeImg)
							{
								Album.resizeImg(topThis.photoStore[x], topThis.viewWidth, topThis.viewHeight);
							}
						}
					}
				}				
				
				
				topThis.viewObj.innerHTML = '<a name="slideShow"></a><div></div>'; //暂时使用innerHTML方法解决
				if(topThis.numObj.length>0){
					for(i=0; i<topThis.numObj.length; i++)	
					{
						topThis.numObj[i].innerHTML = 1+"/"+topThis.photoStore.length;
					}
				}

				if(topThis.preObjParent && !topThis.prvObj)
					topThis.showImgPreview();
				topThis.stop();
				topThis._showphoto(0);
				if(topThis.photoObjs.length>1){
					topThis.play();	
				}					
				/*
				//topThis._showphoto(0);
				//alert(topThis.item_set);
				//document.title = topThis.item_set;
				topThis.stop();
//				topThis.play();
//				topThis.pause();
				////topThis._showphoto(topThis.item_set);
				//topThis.selectPrvImg(topThis.item_set,topThis) ;
//				topThis.play();
//				topThis.pause();				
				//topThis.item_set
				if(topThis.photoObjs.length>1){
					//topThis.play();	//加载时自动播放;
				}
				*/
			}
		}
	}

	this.changeAlbum = function(tagId) {
		var albumXmlUrl = "";
		if(tagId==""){
			albumXmlUrl = "http://"+Album.host+"/items/item_get_user_items.xml.php?b_hidden_user_name=1&item_type[]=album&op=get_items&tag_id[]=-1&user_id="+user_id;
			if(!this.showAllPhoto)
				albumXmlUrl = "http://"+Album.host+"/items/item_get_user_items.xml.php?b_hidden_user_name=1&item_type[]=album&op=get_items&user_id="+user_id;
		}else{
			albumXmlUrl ="http://"+Album.host+"/items/item_get_user_items.xml.php?b_hidden_user_name=1&item_type[]=album&op=get_items&tag_id[]="+tagId+"&user_id="+user_id;
		}
		//alert('changeAlbum_stop()');
		this.stop();
		clearInterval(this.timer);
		clearInterval(this.PrvImgtimer);
		this.viewObj.innerHTML = "";
		this.photoFlag = 0;
		this.photoObjs = new Array();
		this.photoStore = new Array();
		this.viewObj.innerHTML = "数据加载中...";
		if(this.prvObj)
			this.prvObj.innerHTML = "加载中...";

		this.xmlobject.load(albumXmlUrl);
		var topThis = this;
					
		this.xmlobject.onreadystatechange = function() {
			if (topThis.xmlobject.readyState==4)
			{
				topThis.albumObj	= topThis.xmlobject.getElementsByTagName('user_res')[0];
				if(topThis.albumObj==null) {
					topThis.viewObj.innerHTML = "返回数据错误,请稍候再试";
					return;
				}
				topThis.photoObjs	= topThis.albumObj.getElementsByTagName("item");
				if(topThis.photoObjs.length==0) {
					topThis.viewObj.innerHTML = "此相册暂没数据";
					if(topThis.preObjParent && !topThis.prvObj) {
						topThis.preObjParent.innerHTML = "";//"初始化失败";
					}
					return;
				}
					
				
				//未分类相册只取20幅
				if(tagId==0)
				{
					var tmpObj = new Array();
					var photoStoreLength = ( topThis.photoObjs.length>20) ? 20 : topThis.photoObjs.length;
					for(i=0;i<photoStoreLength;i++) 
					{
						tmpObj[i] = topThis.photoObjs[i];
					}
					topThis.photoObjs = tmpObj;
				}

				for(i=0;i<topThis.photoObjs.length;i++) {
				  
					topThis.photoStore[i] = new Image();
					topThis.photoStore[i].setAttribute("border", "0");
					topThis.photoStore[i].setAttribute("src", topThis.photoObjs[i].getAttribute("url") );
					topThis.photoTitle[i] = topThis.photoObjs[i].getAttribute("title");
					if(this.resizeImg)
						Album.resizeImg(topThis.photoStore[i], topThis.viewWidth, topThis.viewHeight);
				}
				
				topThis.viewObj.innerHTML = '<a name="slideShow"></a><div></div>'; //暂时使用innerHTML方法解决
				//topThis.showPhoto(0);
				for(i=0; i<topThis.numObj.length; i++)	
				{
					topThis.numObj[i].innerHTML = 1+"/"+topThis.photoStore.length;
				}
				if(topThis.preObjParent)
				{
					topThis.showImgPreview();
				}
				topThis._showphoto(0);
				if(topThis.photoObjs.length>1){
					topThis.play();	
				}
			}
		}
	}

	this.showPhoto = function(key) {
		key = parseInt(key);
		var topThis = this;
		
		if(key<0 || key>=this.photoObjs.length) {
			if(key>=this.photoObjs.length && this.loop && this.photoObjs.length!=1 ) {
				key=0
			} else {
				//alert('showphtot_stop()');
				this.stop();
				//alert(0);
				return ;
			}
		}
		
		//if(this.playLock) return;
		//防止在初始化时因异步读取远程数据而使图片预览栏初始化失败
		if(this.preObjParent) {
			if(!this.prvObj)
			{
				//alert(1);
				this._showImgPreviwe();				//显示预览栏
			}
			else
			{
				//alert(2);
				this.selectPrvImg(key, topThis)();	//显示大图
			}
		}
		else
		{
			//alert(3);
			this._showphoto(key);
		}
	}
	
	this._showphoto = function(key) {
		if(this.cmtObj!=null)
			this.cmtObj.innerHTML = "";
	
		this.viewObj2.innerHTML =	this.photoTitle[key];
		var aObj;
		if(this.channel == "photo"){
			aObj = this.photoStore[key];
		}else{
			aObj = document.createElement("a");
			//aObj.setAttribute("target", "_blank");
			aObj.setAttribute("href", "http://"+Album.host+"/album/album_show_details.htx&user_id="+this.user_id+"&item_id="+this.photoObjs[key].getAttribute("id"));
			aObj.appendChild(this.photoStore[key]);
		}
		
		if(this.viewObj.filters) {
			this.viewObj.filters[0].Apply();
		}
		
		this.viewObj.replaceChild(aObj, this.viewObj.childNodes[1]);
		if(this.resizeImg)
			Album.resizeImg(this.photoStore[key], this.viewWidth, this.viewHeight);
		
		if(this.viewObj.filters) {
			this.viewObj.filters[0].Play();
		}
		this.photoFlag = key;
		for(i=0; i<this.numObj.length; i++)	
		{
			this.numObj[i].innerHTML = (key+1)+"/"+this.photoStore.length;
		}
	}
	
	this.setPlayInterval = function(iMilliSeconds) {
		this.pause();
		this.playInterval = iMilliSeconds;
		this.play();
	}
	
	this.play = function() {
		if(this.photoObjs.length>0) {
			//this.timer = setInterval(this.objName+".next()", this.playInterval);
			var topThis = this;
			this.timer = setInterval(function(){ topThis.showPhoto(topThis.photoFlag+1);}, this.playInterval);
			this.changePlayStatus(1);
		}
	}
	
	this.stop = function() {
		if(this.photoObjs.length>0) {
			this.showPhoto(0); //bug ?在竖排时不能重定位到第一张图片
			clearInterval(this.timer);
			clearInterval(this.PrvImgtimer);
			this.showPhoto(0); //fixed bug ?
			this.changePlayStatus(0);
		}
	}
	
	this.pause = function() {
		if(this.photoObjs.length>0) {
			clearInterval(this.timer);
			this.changePlayStatus(2);
		}
	}
	
	this.next = function() {
		if(this.photoObjs.length>0) {
			//this.pause();
			this.showPhoto(this.photoFlag+1);
		}
	}
	
	this.previous = function() {
		if(this.photoObjs.length>0) {
			//this.pause();
			this.showPhoto(this.photoFlag-1);
		}
	}
	this.speed = function(speed) {
		this.playInterval = speed;
		if(this.playStatus ==1 ) {
			this.pause();
			this.play();
		}
	}
	this.changePlayStatus = function(status) {
		if(status!=this.playStatus) {
			this.playStatus = status;
			this.onPlayStatusChange(status);
		}
	}

	/**
	* 显示评论
	*/
	this.showComment = function(cmtDiv) {
		if(this.albumObj==null && this.photoObjs.length<=0)
			return;

		if (typeof cmtDiv == 'string')
			this.cmtObj = document.getElementById(cmtDiv);
		else
			this.cmtObj = cmtDiv;

		if(this.cmtObj==null) return;
		this.cmtObj.innerHTML = "";
		var cmt_tag = document.createElement("div");
		cmt_tag.setAttribute("id", "_cmt_tag_");
		this.cmtObj.appendChild(cmt_tag);

		var jsObj = document.createElement("script");
		var url = escape("http://my.poco.cn/album/album_show.php?user_id="+this.albumObj.getAttribute("owner_id")+"&id="+this.photoObjs[this.photoFlag].getAttribute("id")+"&no_cmt_def_row_bgcolor=1" );

		jsObj.setAttribute("src", "http://my.poco.cn/cmt/?tpl_name=album&url="+url);
		this.pause();
		document.body.appendChild(jsObj);
	}

	/**
	*	显示内置控制面板
	*/
	this.showControlPanel = function(controlPanelDiv) {
		var controlObj;
		var topThis = this;
		if (typeof controlPanelDiv == 'string')
			controlObj = document.getElementById(controlPanelDiv);
		else
			controlObj = controlPanelDiv;
		controlObj.innerHTML = "";

		var pauseBtn = new Image();
		pauseBtn.setAttribute("border", 0);
		pauseBtn.setAttribute("src", "http://my.poco.cn/album/images/pause.gif?ver=1.0");
		pauseBtn.setAttribute("title", "暂停");
		pauseBtn.style.cursor = "pointer";
		pauseBtn.style.margin = "3px";
		pauseBtn.onclick = function() { topThis.pause() };
		controlObj.appendChild(pauseBtn);
		
		var playBtn = new Image();
		playBtn.setAttribute("border", 0);
		playBtn.setAttribute("src", "http://my.poco.cn/album/images/play.gif?ver=1");
		playBtn.setAttribute("title", "播放");
		playBtn.style.cursor = "pointer";
		playBtn.style.margin = "3px";
		playBtn.style.clear = "left";
		playBtn.onclick = function() { topThis.play() };
		controlObj.appendChild(playBtn);
		
		var stopBtn = new Image();
		stopBtn.setAttribute("border", 0);
		stopBtn.setAttribute("src", "http://my.poco.cn/album/images/stop.gif?ver=1.0");
		stopBtn.setAttribute("title", "停止");
		stopBtn.style.cursor = "pointer";
		stopBtn.style.margin = "3px";
		stopBtn.style.clear = "left";
		stopBtn.onclick = function() { topThis.stop(); };
		controlObj.appendChild(stopBtn);
		
		var prevBtn = new Image();
		prevBtn.setAttribute("border", 0);
		prevBtn.setAttribute("src", "http://my.poco.cn/album/images/previous.gif?ver=1");
		prevBtn.setAttribute("title", "上一张");
		prevBtn.style.cursor = "pointer";
		prevBtn.style.margin = "3px";
		prevBtn.onclick = function() { topThis.previous() };
		controlObj.appendChild(prevBtn);
		
		var nextBtn = new Image();
		nextBtn.setAttribute("border", 0);
		nextBtn.setAttribute("src", "http://my.poco.cn/album/images/next.gif?ver=1");
		nextBtn.setAttribute("title", "下一张");
		nextBtn.style.cursor = "pointer";
		nextBtn.style.margin = "3px";
		nextBtn.onclick = function() { topThis.next()  };
		controlObj.appendChild(nextBtn);

		if(topThis.playStatus==1) { //播放时
			playBtn.style.display	= "none";
			pauseBtn.style.display	= "";
		}
		else {
			playBtn.style.display	= "";
			pauseBtn.style.display	= "none";
		}
		this.onPlayStatusChange = function() {
			if(topThis.playStatus==1) { //播放时
				playBtn.style.display	= "none";
				pauseBtn.style.display	= "";
			}
			else {
				playBtn.style.display	= "";
				pauseBtn.style.display	= "none";
			}
			
			var photoFlag = topThis.photoFlag;
			this.selectPrvImg(photoFlag,topThis)();//fixed 控制按钮移到bug in IE6.0
		}
		//topThis.attachEvent('onPlayStatusChange', setBtnStat);
		//this.showSpeedControl(controlObj);
	}
	this.showSpeedControl_clock = function(obj) {
		var controlObj;
		if (typeof obj == 'string')
			SpeedObj = document.getElementById(obj);
		else
			SpeedObj = obj;
		var topThis = this;
		for(i=1;i<=5;i++)
		{	
			var radioObj = document.createElement("radio");	
			radioObj.value=i;
			radioObj.onclick=topThis.speed(i);;
			SpeedObj.appendChild(radioObj);
			SpeedObj.innerHTML = i;
		}
		
		
	
	}
	this.showSpeedControl = function(obj) {
		var controlObj;
		if (typeof obj == 'string')
			SpeedObj = document.getElementById(obj);
		else
			SpeedObj = obj;

		var topThis = this;
		var maxPlayInterval = topThis.playInterval; 

		var img = new Image();
		img.setAttribute("src", "http://my.poco.cn/album/images/scroll.gif");

		var scrollHandle = document.createElement("div");
		scrollHandle.appendChild(img);
		
		scrollHandle.style.width = img.width+"px";
		scrollHandle.style.height = img.height+"px";
		
		var scrollObj = document.createElement("div");
		scrollObj.style.height = img.height+"px";
		scrollObj.style.background = "#CCCCCC";
		try{scrollObj.style.cursor = 'pointer';}catch(e){}
		
		scrollObj.appendChild(scrollHandle);
		
		SpeedObj.appendChild(scrollObj);
		
		var textObj = document.createElement("div");
		textObj.style.height = img.height+"px";
		textObj.style.width = "50px";
		textObj.style.height = img.height+"px";
		textObj.style.background = "#000000";
		textObj.style.color = "#ffffff";
		textObj.style.float = "left";
		textObj.innerHTML = this.playInterval/1000+"秒";
		try{scrollObj.style.cursor = 'pointer';}catch(e){}
		
		SpeedObj.appendChild(textObj);
		
		
		
		var scrollObjLeft = 0;
		var tObj = scrollObj;
		
		do {
			scrollObjLeft += tObj.offsetLeft+tObj.clientLeft;
			tObj = tObj.offsetParent;
		}
		while(tObj);

		scrollHandle.style.position = "absolute";
		scrollHandle.style.left		= scrollObjLeft+(scrollObj.offsetWidth-scrollHandle.offsetWidth)/2+"px";
		
		scrollObj.firstChild.onmousedown=function(){return false;};
		var thisvalue;
		scrollObj.onclick = function(pEvent) {
				if(!pEvent)	
					pEvent=window.event;
				var x = pEvent.pageX ? pEvent.pageX : pEvent.clientX;
				x = x<scrollObjLeft ? x=scrollObjLeft : x>scrollObjLeft+(scrollObj.offsetWidth-scrollHandle.offsetWidth) ? scrollObjLeft+(scrollObj.offsetWidth-scrollHandle.offsetWidth) : x;
				scrollHandle.style.left= x+"px";
				thisvalue = Math.abs(maxPlayInterval*( 1-scrollHandle.offsetLeft/(scrollObj.offsetWidth-scrollHandle.offsetWidth) ));
				thisvalue = Math.abs((thisvalue/1000)*(thisvalue/1000))*100;
				topThis.speed(thisvalue.toFixed(0));
				rethisvalue = thisvalue/1000;
				textObj.innerHTML = rethisvalue.toFixed(0)+"秒";
				//alert(rethisvalue.toFixed(0));
		}
			
		scrollObj.onmousedown=function(pEvent){
			if(scrollObj.setCapture)
				scrollObj.setCapture();
			else if(window.captureEvents)
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);

			document.onmousemove=function(pEvent){
				if(!pEvent)	
					pEvent=window.event;
				var x = pEvent.pageX ? pEvent.pageX : pEvent.clientX;
				x = x<scrollObjLeft ? x=scrollObjLeft : x>scrollObjLeft+(scrollObj.offsetWidth-scrollHandle.offsetWidth) ? scrollObjLeft+(scrollObj.offsetWidth-scrollHandle.offsetWidth) : x;
				scrollHandle.style.left= x+"px";

				thisvalue = Math.abs(maxPlayInterval*(1-scrollHandle.offsetLeft/(scrollObj.offsetWidth-scrollHandle.offsetWidth)));
				thisvalue = Math.abs((thisvalue/1000)*(thisvalue/1000))*100;
				topThis.speed(thisvalue.toFixed(0));
				rethisvalue = thisvalue/1000;
				textObj.innerHTML = rethisvalue.toFixed(0)+"秒";
				//alert(rethisvalue.toFixed(0));
			};

			document.onmouseup=function(){
				if(scrollObj.releaseCapture)
					scrollObj.releaseCapture();
				else if(window.captureEvents)
					window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
				document.onmousemove=null;
				document.onmouseup=null;
			};
		}
		
		
	}
	/**
	*	显示图片预览栏(外部调用接口)
	*/
	this.showImgPreview = function(prvElm) {
		if(!this.preObjParent){
			if (typeof prvElm == 'string') {
				this.preObjParent = document.getElementById(prvElm);
			} else {
				this.preObjParent = prvElm;
			}
		}
		var topThis = this;
		var loadImgCount = 0;
		this.prvImgs[0] = new Image();
		for(i=0; i<this.photoObjs.length; i++) 
		{
			this.prvImgs[i] = new Image();

			this.prvImgs[i].style.cursor = "pointer";
			this.prvImgs[i].onclick = topThis.selectPrvImg(i,topThis) ;
			
			
			//写死预览图片大小		不使用预览图ONLOAD事件
			this.prvImgs[i].style.marginLeft = topThis.prvImgsMargin+"px";
			this.prvImgs[i].style.marginRight = topThis.prvImgsMargin+"px";
			if (document.all)
			{
				this.prvImgs[i].height = 50;
				this.prvImgs[i].width = 50;	//height*scale;
				this.prvImgs[i].style.height = 50+"px";
				this.prvImgs[i].style.width = 50+"px";
			}
			else
			{
				this.prvImgs[i].setAttribute("height", '50px');
				this.prvImgs[i].setAttribute("width", '50px');
				//imgObj.setAttribute("title", parseInt(height*scale) + ',' + height);
			}			
			//写死预览图片大小		不使用预览图ONLOAD事件
			
			
			//this.prvImgs[i].style.display = "none";
			//this.prvImgs[i].style.visibility = "hidden";

					
			this.prvImgs[i].className = "border_color2";
			this.prvImgs[i].style.borderWidth = this.prvImgsBorder+"px";
			this.prvImgs[i].style.borderStyle = "solid";
			if(i!=0) {
				this.prvImgs[i].style.filter = "Gray(enabled=bEnabled)";		//this.prvImgs[i].style.filter = "alpha(opacity=25)";
			}

			
			
			//预定义加载成功处理函数，加载在后面执行
			/*
			this.prvImgs[i].onload = function()	
			{
				if (this.src != '' && this.src != null)
				{
					loadImgCount++;
					
					if(topThis.preObjParent.offsetWidth > topThis.preObjParent.offsetHeight || 1)
					{
						Album.resizeHeight(this, 50);
						//this.style.width = '50px';
						//this.style.height = '50px';
						
						this.style.marginLeft = topThis.prvImgsMargin+"px";
						this.style.marginRight = topThis.prvImgsMargin+"px";
					}
					else
					{
						Album.resizeWidth(this, 50);
						this.style.marginTop = topThis.prvImgsMargin+"px";
						this.style.marginBottom = topThis.prvImgsMargin+"px";
					}
				}
			}
			*/
		}
		
		
		//缓存预览图：第0张----本页主图后面的8张图
		for (x = topThis.item_set - 8; x < topThis.photoObjs.length && (x < topThis.item_set + 8); x++)
		{
			if (x >=0 && x < topThis.photoObjs.length)
			{
				if (topThis.prvImgs[x].src == '' || topThis.prvImgs[x] == null)
				{
					imgsrc = topThis.photoObjs[x].getAttribute("url").replace(/(.+)\.jpg/ig, "$1_165.jpg");		//imgsrc = this.photoObjs[i].getAttribute("url");
					topThis.prvImgs[x].setAttribute("src",  imgsrc);					
				}
			}
		}			
		
		

		//topThis._showImgPreviwe();
	}
//////////////////////////////////////////////////////////////////////////////////////////	
	this.DonwPreviwe = function(DPreviwe) {		
		if(!this.doParent){
			if (typeof DPreviwe == 'string') {
				this.doParent = document.getElementById(DPreviwe);
			} else {
				this.doParent = DPreviwe;
			}
		}
		var scrollHandle = document.createElement("div");
		var doBtn = new Image();
		var topThis = this;
		doBtn.setAttribute("border", 0);
		doBtn.setAttribute("src", "http://my.poco.cn/items/images/ppc_up.gif?ver=1");
		doBtn.setAttribute("title","上一页");
		doBtn.style.cursor = "pointer";
		doBtn.style.margin = "3px";
		doBtn.onclick = topThis._DonwPreviweOnclick();
		doBtn.style.width = "20px";
		doBtn.style.height = "69px";
		scrollHandle.style.width = "20px";
		scrollHandle.style.height = "69px";
		//try{
		//	doBtn.attachEvent("onclick", function(){window.location.href = "#slideShow";});
		//}catch(e){}
		
		//this.doParent.appendChild(doBtn);
		scrollHandle.appendChild(doBtn);
		this.doParent.appendChild(scrollHandle);
	}
	this._DonwPreviweOnclick = function() {		
		//var countphoto = this.preObjParent.offsetWidth/140;
		//this.pKey = Math.abs(this.iKey)-Math.abs(countphoto.toFixed(0))>0?Math.abs(this.iKey)-Math.abs(countphoto.toFixed(0)):0;

		var topThis = this;
		var pKey = this.iKey;
		//var pKey = this.pKey;
		
		return (topThis.selectPrvImg(pKey,topThis,"pKey"));
	}
	this.UpPreviwe = function(DPreviwe) {		
		if(!this.upParent){
			if (typeof DPreviwe == 'string') {
				this.upParent = document.getElementById(DPreviwe);
			} else {
				this.upParent = DPreviwe;
			}
		}
		var scrollHandle = document.createElement("div");
		var doBtn = new Image();
		var topThis = this;
		doBtn.setAttribute("border", 0);
		doBtn.setAttribute("src", "http://my.poco.cn/items/images/ppc_down.gif?ver=1");
		doBtn.setAttribute("title","下一页");
		doBtn.style.cursor = "pointer";
		doBtn.style.margin = "3px";
		doBtn.onclick = topThis._UpPreviweOnclick();
		doBtn.style.width = "20px";
		doBtn.style.height = "69px";
		scrollHandle.style.width = "20px";
		scrollHandle.style.height = "69px";
		//try{
		//	doBtn.attachEvent("onclick", function(){window.location.href = "#slideShow";});
		//}catch(e){}
		scrollHandle.appendChild(doBtn);
		this.upParent.appendChild(scrollHandle);
	}
	this._UpPreviweOnclick = function() {		
		var topThis = this;
		var uKey = this.iKey;
		//var pKey = this.pKey;
		return (topThis.selectPrvImg(uKey,topThis,"uKey"));
	}
///////////////////////////////////////////////////////////////////////////////////////
	/**
	*	显示图片预览栏(内部调用接口)
	*/
	this._showImgPreviwe = function() {
		
		if(this.photoObjs.length==0) return;
		//if(this.doParent){this.DonwPreviwe();}
		var p_width = 64;
		var p_height = 64;
		var offset = 1000;
		//this.preObjParent.innerHTML = "";
		
		this.prvObj = document.createElement("div");
		this.prvObj.style.overflow = "hidden";
		this.prvObj.style.width = (this.preObjParent.offsetWidth)+"px";
		this.prvObj.style.height = p_height+"px";
		//this.prvObj = document.createElement("div");
		
		if(this.preObjParent.offsetWidth>this.preObjParent.offsetHeight)
		{
			
			/* 以横排方式显示
			with(this.prvObj) {
				style.overflow = "hidden";
				style.width = this.preObjParent.offsetWidth+"px";
				style.height = p_height+"px";
			}
			*/
			var table = document.createElement("table");
			with(table) {
				//width = 2*offset+p_width*this.photoObjs.length;
				height = p_height;
				border = 0;
				//alert(p_height);
				//setAttribute("cellpadding", "0");
				//setAttribute("cellspacing", "0");
				
				cellPadding = "0";
				cellSpacing = "0";
				style.marginLeft = offset+"px";
				style.marginRight = offset+"px";
			}
			tbody = document.createElement("tbody");
			var tr = document.createElement("tr");
			with(tr) {
				align="center";
				valign="middle";
			}	
			var td;
			var imgsrc;
			//td = document.createElement("td");
			//td.width = offset;
			//tr.appendChild(td);
			var totalLen = 0;
			
			
			for(i=0; i<this.photoObjs.length; i++) {
				/*
				this.prvImgs[i] = new Image();
				imgsrc = this.photoObjs[i].getAttribute("url");
				imgsrc = imgsrc.replace(/(.+)\.jpg/ig, "$1_165.jpg");
				this.prvImgs[i].setAttribute("src",  imgsrc);

				this.prvImgs[i].style.cursor = "pointer";
				var topThis = this;
				this.prvImgs[i].onclick = topThis.selectPrvImg(i,topThis) ;
				//if(this.resizeImg)
					//Album.resizeImg(this.prvImgs[i], 100, 100);
				//高度固定为100px
				Album.resizeWidth(this.prvImgs[i], 50);			
				*/
				
				td = document.createElement("td");
				//td.width = p_width;
				td.appendChild(this.prvImgs[i]);
				tr.appendChild(td);
			}
			////td = document.createElement("td");
			//td.width = offset;
			//tr.appendChild(td);
			
			tbody .appendChild(tr);
			table.appendChild(tbody);
			this.prvObj.appendChild(table);
			this.preObjParent.appendChild(this.prvObj);
			//初始化滚动条位置
			var imgOffset = 0;
			for(i=this.photoFlag; i>=0; i--)
			{
				imgOffset += this.prvImgs[i].width+2*(this.prvImgsMargin+this.prvImgsBorder);
			}
			this.prvObj.scrollLeft=offset-this.prvObj.offsetWidth/2+imgOffset-(this.prvImgs[this.photoFlag].width+2*(this.prvImgsMargin+this.prvImgsBorder))/2;
		}
		else
		{
			/*以竖排方式显示*/
			with(this.prvObj) {
				style.overflow = "hidden";
				style.height = this.preObjParent.offsetHeight +"px";
				style.width = p_width+"px";
			}
			var table = document.createElement("table");
			with(table) {
				//width = 2*offset+p_width*this.photoObjs.length;
				width = p_width;
				border = 0;
				cellPadding = "0";
				cellSpacing = "0";
				style.marginTop = offset+"px";
				style.marginBottom = offset+"px";
			}
			tbody = document.createElement("tbody");
			var tr;
			var td;
			var imgsrc;
			var totalLen = 0;
			for(i=0; i<this.photoObjs.length; i++) {
				tr = document.createElement("tr");
				with(tr) {
					align="center";
					valign="middle";
				}		
				td = document.createElement("td");
				//td.width = p_width;
				//td.height = p_height;
				td.appendChild(this.prvImgs[i]);
				tr.appendChild(td);
				tbody .appendChild(tr);
				totalLen += this.prvImgs[i].width+2*(this.prvImgsMargin+this.prvImgsBorder);
			}
			table.appendChild(tbody);
			this.prvObj.appendChild(table);
			this.preObjParent.appendChild(this.prvObj);
			//初始化滚动条位置
			var imgOffset = 0;
			for(i=this.photoFlag; i>=0; i--)
			{
				imgOffset += this.prvImgs[i].height+2*(this.prvImgsMargin+this.prvImgsBorder);
			}	
			this.prvObj.scrollTop=offset-this.prvObj.offsetHeight/2+imgOffset-(this.prvImgs[this.photoFlag].height+2*(this.prvImgsMargin+this.prvImgsBorder))/2;
		}
		//this._UpPreviwe();
		//if(this.upPreviwe){this.UpPreviwe();}

	}
	
	this.selectPrvImg = function(imgKey, topThis , puKey) {
		return function() {
			
			var countphoto = topThis.preObjParent.offsetWidth/160;
			var p_prvImgslength = Math.abs(topThis.prvImgs.length);
			if (puKey == "pKey")
			{
				//imgKey = topThis.iKey + 3>p_prvImgslength?p_prvImgslength-1:topThis.iKey + 3;
				imgKey = (Math.abs(topThis.iKey)-Math.abs(countphoto.toFixed(0)))>0?Math.abs(topThis.iKey)-Math.abs(countphoto.toFixed(0)):0;
			}
			else if(puKey == "uKey")
			{
				//imgKey = topThis.iKey - 3>0?topThis.iKey - 3:0;
				imgKey = (Math.abs(topThis.iKey)+Math.abs(countphoto.toFixed(0)))<p_prvImgslength?Math.abs(topThis.iKey)+Math.abs(countphoto.toFixed(0)):p_prvImgslength-1;
			}
			//else
			//{
				//this.pKey = 0;
				//this.uKey = 4;
			//}			
			
			
			//加载当前张图片
//			if (topThis.photoStore[imgKey].src == '' || topThis.photoStore[imgKey] == null)
//			{
//				topThis.photoStore[imgKey].setAttribute("src", topThis.photoObjs[imgKey].getAttribute("url") );
//				if(this.resizeImg)
//					Album.resizeImg(topThis.photoStore[imgKey], topThis.viewWidth, topThis.viewHeight);
//			}
			
			
			if (topThis.photoStore.length > 9)
			{
				//缓存图片当前图片左右N张图片
				for (x = imgKey - 4; x < topThis.photoObjs.length && (x < imgKey + 6); x++)
				{
					if (x >= 0 && x < topThis.photoObjs.length)
					{
						//缓存图片当前主图的左右N张图片
						if (topThis.photoStore[x].src == '' || topThis.photoStore[x] == null)
						{
							topThis.photoStore[x].setAttribute("src", topThis.photoObjs[x].getAttribute("url") );	
							if(this.resizeImg)
							{
								Album.resizeImg(topThis.photoStore[x], topThis.viewWidth, topThis.viewHeight);
							}
						}
						
						
						//缓存图片当前主图的左右N张图片(预览图)
						if (topThis.prvImgs[x].src == '' || topThis.prvImgs[x] == null)
						{
							imgsrc = topThis.photoObjs[x].getAttribute("url").replace(/(.+)\.jpg/ig, "$1_165.jpg");		//imgsrc = this.photoObjs[i].getAttribute("url");
							topThis.prvImgs[x].setAttribute("src",  imgsrc);					
							
							
							/*
							if(topThis.preObjParent.offsetWidth>topThis.preObjParent.offsetHeight || 1)
							{
								Album.resizeHeight(topThis.prvImgs[x], 50);
								
								//topThis.prvImgs[x].style.width = '50px';
								//topThis.prvImgs[x].style.height = '50px';
								//topThis.prvImgs[x].width = 50;
								topThis.prvImgs[x].style.marginLeft = topThis.prvImgsMargin+"px";
								topThis.prvImgs[x].style.marginRight = topThis.prvImgsMargin+"px";
							}
							else
							{
								Album.resizeWidth(topThis.prvImgs[x], 50);
								//topThis.prvImgs[x].height = 50;
								topThis.prvImgs[x].style.marginTop = topThis.prvImgsMargin+"px";
								topThis.prvImgs[x].style.marginBottom = topThis.prvImgsMargin+"px";
							}
							*/
						}
					}
				}				
			}
			else
			{
				//加载全部图片
				for (i = 0; i < topThis.photoStore.length; i++)
				{
					if (topThis.photoStore[i].src == '' || topThis.photoStore[i] == null)
					{
						topThis.photoStore[i].setAttribute("src", topThis.photoObjs[i].getAttribute("url") );
						if(this.resizeImg)
							Album.resizeImg(topThis.photoStore[i], topThis.viewWidth, topThis.viewHeight);
							
							
						imgsrc = topThis.photoObjs[i].getAttribute("url").replace(/(.+)\.jpg/ig, "$1_165.jpg");		//imgsrc = this.photoObjs[i].getAttribute("url");
						topThis.prvImgs[i].setAttribute("src",  imgsrc);					
						//Album.resizeHeight(topThis.prvImgs[i], 50);
						
						
						
						//写死预览图片大小		不使用预览图ONLOAD事件
						topThis.prvImgs[i].style.marginLeft = topThis.prvImgsMargin+"px";
						topThis.prvImgs[i].style.marginRight = topThis.prvImgsMargin+"px";
						if (document.all)
						{
							topThis.prvImgs[i].height = 50;
							topThis.prvImgs[i].width = 50;	//height*scale;
							topThis.prvImgs[i].style.height = 50+"px";
							topThis.prvImgs[i].style.width = 50+"px";
						}
						else
						{
							topThis.prvImgs[i].setAttribute("height", '50px');
							topThis.prvImgs[i].setAttribute("width", '50px');
							//imgObj.setAttribute("title", parseInt(height*scale) + ',' + height);
						}			
						//写死预览图片大小		不使用预览图ONLOAD事件						
						
						
						//topThis.prvImgs[i].style.marginLeft = topThis.prvImgsMargin+"px";
						//topThis.prvImgs[i].style.marginRight = topThis.prvImgsMargin+"px";							
					}
				}
			}
			
			
			
			

			topThis.iKey = imgKey;
			//alert("topThis.photoFlag = "+topThis.photoFlag);
			if(imgKey==topThis.photoFlag) 
			{
				topThis._showphoto(imgKey);
				return;
			}
			//topThis.photoFlag = imgKey;
			clearInterval(topThis.PrvImgtimer);
			var _prvObjScrollFlag = topThis.prvObj.scrollLeft;
			var offset = 1000;
			var p_width = 64;
			//var newPrvObjScroll = offset-topThis.prvObj.offsetWidth/2+p_width/2+p_width*imgKey;
			var imgOffset = 0;
			var newPrvObjScroll = 0;
			if(topThis.preObjParent.offsetWidth>topThis.preObjParent.offsetHeight)
			{
//				for(i=imgKey; i>=0; i--)
//				{
//					imgOffset += topThis.prvImgs[i].width+2*(topThis.prvImgsMargin+topThis.prvImgsBorder);
//				}
//				newPrvObjScroll = offset-topThis.prvObj.offsetWidth/2+imgOffset-(topThis.prvImgs[imgKey].width+2*(topThis.prvImgsMargin+topThis.prvImgsBorder))/2;
				for(i=imgKey; i>=0; i--)
				{
					imgOffset += 50+2*(topThis.prvImgsMargin+topThis.prvImgsBorder);
				}
				newPrvObjScroll = offset-topThis.prvObj.offsetWidth/2+imgOffset-(50+2*(topThis.prvImgsMargin+topThis.prvImgsBorder))/2;

			}
			else
			{
//				for(i=imgKey; i>=0; i--)
//				{
//					imgOffset += topThis.prvImgs[i].height+2*(topThis.prvImgsMargin+topThis.prvImgsBorder);
//				}
//				newPrvObjScroll = offset-topThis.prvObj.offsetHeight/2+imgOffset-(topThis.prvImgs[imgKey].height+2*(topThis.prvImgsMargin+topThis.prvImgsBorder))/2;
				
				for(i=imgKey; i>=0; i--)
				{
					imgOffset += 50+2*(topThis.prvImgsMargin+topThis.prvImgsBorder);
				}
				newPrvObjScroll = offset-topThis.prvObj.offsetHeight/2+imgOffset-(50+2*(topThis.prvImgsMargin+topThis.prvImgsBorder))/2;
			}
			newPrvObjScroll = parseInt(newPrvObjScroll);
			
			var pauseFlag = false;
			/*
			if(topThis.playStatus == 1) {
				//topThis.pause();
				pauseFlag = true;
			}*/
			clearInterval(topThis.timer);

			topThis.playLock = true; //锁定播放
			topThis.PrvImgtimer = setInterval(
						function(){ 
							var step = (newPrvObjScroll-_prvObjScrollFlag)/32; //平滑移动率
							if(topThis.preObjParent.offsetWidth>topThis.preObjParent.offsetHeight) {
								topThis.prvObj.scrollLeft += step;
								if( (step>0 && topThis.prvObj.scrollLeft>newPrvObjScroll) ||  (step<0 && topThis.prvObj.scrollLeft<newPrvObjScroll) || step==0) {
										topThis.prvObj.scrollLeft = newPrvObjScroll;
										topThis.prvImgs[imgKey].offsetParent.className = "bg_color3";
										topThis.prvImgs[imgKey].style.filter = "";
										//topThis.prvImgs[topThis.photoFlag].style.filter = "alpha(opacity=25)";
										topThis.prvImgs[topThis.photoFlag].style.filter = "Gray(enabled=bEnabled)";
										
										topThis.prvImgs[topThis.photoFlag].offsetParent.className = "";
										clearInterval(topThis.PrvImgtimer);
										topThis.playLock = false; //解锁播放
										topThis._showphoto(imgKey);
										/*
										if(pauseFlag) {
											//topThis.play();	
										}
										*/
										if(topThis.playStatus == 1) {
											topThis.play();
										}
									}
								}else{
									step = (newPrvObjScroll-_prvObjScrollFlag)/125; //平滑移动率
									topThis.prvObj.scrollTop += step;
									if( (step>0 && topThis.prvObj.scrollTop>newPrvObjScroll) ||  (step<0 && topThis.prvObj.scrollTop<newPrvObjScroll) || step==0) {
										topThis.prvObj.scrollTop = newPrvObjScroll;
										topThis.prvImgs[imgKey].offsetParent.className = "bg_color3";
										topThis.prvImgs[imgKey].style.filter = "";
										//topThis.prvImgs[topThis.photoFlag].style.filter = "alpha(opacity=25)";
										topThis.prvImgs[topThis.photoFlag].style.filter ="Gray(enabled=bEnabled)";

										topThis.prvImgs[topThis.photoFlag].offsetParent.className = "";
										clearInterval(topThis.PrvImgtimer);
										topThis.playLock = false; //解锁播放
										topThis._showphoto(imgKey);
										/*
										if(pauseFlag) {
											//topThis.play();	
										}*/
										if(topThis.playStatus == 1) {
											topThis.play();
										}
									}
								}
						},
						1);
		}
	}
	
	
	
	this.showNum = function(numElm) {
		if (typeof numElm == 'string') {
			this.numObj[this.numObj.length] = document.getElementById(numElm);
		} else {
			this.numObj[this.numObj.length] = numElm;
		}
		//this.numObj[this.numObj.length-1].innerHTML = "1/"+this.photoStore.length;
	}
	
	this.payselect = function() {
		var topThis = this;
		//this.selectPrvImg(this.item_set, this);
		return topThis.showPhoto(topThis.item_set);
	}

	this.showTagSelector = function(elm) {
		if (typeof elm == 'string') {
			this.tagSelector = document.getElementById(elm);
		} else {
			this.tagSelector = elm;
		}
		var tagsXmlUrl = "http://"+Album.host+"/items/item_get_user_items.xml.php?b_hidden_user_name=1&item_type[]=album&user_id="+this.user_id;
		this.tagxmlobject.load(tagsXmlUrl);
		var topThis = this;
					
		this.tagxmlobject.onreadystatechange = function() {
			if (topThis.tagxmlobject.readyState==4)
			{
				var albumObj = topThis.tagxmlobject.getElementsByTagName('user_res')[0];
				if(albumObj==null) {
					topThis.tagSelector.innerHTML = "返回数据错误,请稍候再试";
					return;
				}
				topThis.tagSelector.innerHTML = "";
				topThis.photoTags = albumObj.getElementsByTagName("tag");
				var selector = document.createElement("select");
				with(selector.style) {
					marginLeft	= "-3px";
					marginBottom= "4px";
					marginTop	= "-2px";
					width		= "120px";
					fontSize	= "12px";
				}
				var selectorDiv = document.createElement("div");
				selectorDiv.className = "border_color6 font_color1";
				with(selectorDiv.style) {
					borderStyle = "solid";
					borderWidth = "1px";
					width	= "115px";
					height	= "16px";
					overflow= "hidden";
				}

				selector.onchange = function(){
					topThis.changeAlbum(this.value);
				}
				var option;
				option = document.createElement("option");
				if(topThis.showAllPhoto)
				{
					option.innerHTML = "全部相片";
					selector.appendChild(option);
				}
				/*
				else
					option.innerHTML = "最新20张相片";
					*/
				
				for(i=0;i<topThis.photoTags.length;i++) {
					topThis.photoTags[i]
					option = document.createElement("option");
					option.value = topThis.photoTags[i].getAttribute("id");

					
					if(topThis.photoTags[i].getAttribute("id")<1)
					{   
						
						if(topThis.photoTags[i].getAttribute("id")==-1) option.selected=true;
						option.innerHTML = topThis.photoTags[i].getAttribute("name");
						selector.appendChild(option);
					}
					else
					{
						option.innerHTML = topThis.photoTags[i].getAttribute("name")+"("+topThis.photoTags[i].getAttribute("item_count")+")";
						selector.appendChild(option);
					}
				}
				
				selectorDiv.appendChild(selector);
				topThis.tagSelector.appendChild(selectorDiv);
			}
		}
				
	}

	this.showAllPhoto = true;
	this.tagSelector = null;
	this.photoTags = new Array();
	this.photoTitle = new Array();
	this.channel = "album";
	this.prvImgsBorder = 2;
	this.prvImgsMargin = 7;
	this.resizeImg = true;
	this.playLock = true; //自动播放锁,用于点击预览栏时暂时锁定幻光片播放
	this.prvImgs = new Array();
	this.PrvImgtimer = null;
	this.numObj = new Array();
	this.prvObj = null;
	this.preObjParent = null;
	this.imgObj = null;
	this.photoStore = new Array();
	this.cmtObj = null;
	this.aObj = null;
	this.user_id = 0;
	this.photoObjs = Array();
	this.albumObj = null;
	this.loop	  = 0;//是否循环播放
	this.photoFlag = 0;
	this.viewObj	= null;
	this.viewObj2	= null;
	this.timer		= null;
	this.playInterval	= 6000;
	this.viewWidth = 0;
	this.xmlobject =Sarissa.getDomDocument();
	this.tagxmlobject =Sarissa.getDomDocument();
	this.xmlobject.async = true; //采用异步执行方式
	this.playStatus = 0;	//0停止,1正在播放,2暂停
	this.onPlayStatusChange = function(){};
	this.doParent	=null;
	this.upParent	=null;
	this.iKey	=0;
	this.maxPhotoCount	=0;
	this.item_set = 0;
	/*
	var re =/http:\/\/(.+?)\//;
	re.test(window.location.href);
	this.xmlHost = RegExp.$1 ? RegExp.$1 : "my.poco.cn";
	*/
	this.init(); //构造初始化
}