// JavaScript Document
var album = function() {
	//判断浏览器的类型
	var moz = (typeof document.implementation != 'undefined')
	&&(typeof document.implementation.createDocument != 'undefined');
	var ie = (typeof window.ActiveXObject != 'undefined');
	var unit = "px";//单位
	var cnt = -1;
	
	instances = [];
	var tmp_id = 0;
	var errnum = 0;
	
	function AnalysisParameter(strParameter, strGap) {
		var arrParameter = new Array();
		var numStart = 0;
		
		if(strParameter == null) return arrParameter;
		
		strParameter += strGap;
		while (strParameter.indexOf(strGap, numStart) != -1) {
			var i = strParameter.indexOf(strGap, numStart);
			var nv = strParameter.substring(numStart, i);
			numStart = i;
			numStart++;
			if(nv.length == 0) continue;
			arrParameter = arrParameter.concat(nv);
		}
		return arrParameter;
	}
	
	function mStrLen(str) { 
		var len;var i;len=0; 
		for (i=0;i<str.length;i++){ 
			if (str.charCodeAt(i)>255) len+=2; else len++; 
		} 
		return len; 
	} 
	
	function mSubstr(str,slen) { 
		var tmp = 0;
		var len = 0;
		var okLen = 0;
		
		for(var i=0;i<slen;i++) {
			if(str.charCodeAt(i)>255) {
				tmp += 2;
			} else {
				len += 1;
			}
			okLen += 1;
			
			if(tmp + len == slen){
				return (str.substring(0,okLen));
				break;
			}
			if(tmp + len > slen) {
				return (str.substring(0,okLen - 1)); 
				break;
			}
		}
	}
	
	
	function addEvent (o, e, f) {
		if (window.addEventListener) o.addEventListener(e, f, false);
		else if (window.attachEvent) r = o.attachEvent('on' + e, f);
	}
	
	function QueryURL(item) {
		var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
		return svalue ? svalue[1] : svalue;
	}
	
	//放在相册中的相片
	Stand = function(p, s, w, h,mw,mh) {
		this.p = p;
		this.mw = mw;
		this.mh = mh;
		
		this.img         = document.createElement('img');
		this.img.src     = s;
		this.img.p       = this;
		this.img.style.display = "none";
		this.img.onclick = function(){this.p.p.next();}
		this.oimg = this.p.p.oPhotoStandArea.appendChild(this.img);
		
		if(this.mw==0){
				var img_ne = new Image(); 
				img_ne.onload = function() {	
				}
				img_ne.src = this.img.src;
				if(img_ne.width >0){
					if(this.nw<=480 && this.nh<=480){
					this.oimg.style.width = img_ne.width + unit;
					this.oimg.style.height = img_ne.height + unit;
					}else{
						if(img_ne.height > img_ne.width){
							this.oimg.style.height = 480 + unit;
							this.oimg.style.width=Math.floor(img_ne.width * (480/img_ne.height));
						}else{
							this.oimg.style.width = 480 + unit;
							this.oimg.style.height=Math.floor(img_ne.height * (480/img_ne.width));
						}
					}
				}
			}
	}
	Stand.prototype = {
		show : function() {
			this.oimg.style.display = "";
		},
		hide : function() {
			this.oimg.style.display = "none";
		},
		resize : function() {
			if(this.mw==0){
				var img_m = new Image(); 
				img_m.onload = function() {	
				}
				img_m.src = this.img.src;
				this.nw = img_m.width;
				this.nh = img_m.height;
				if(this.nw >0){
					if(this.nw<=480 && this.nh<=480){
					this.oimg.style.width = this.nw + unit;
					this.oimg.style.height = this.nh + unit;
					flag = 1;
					}else{
						if(this.nh > this.nw){
							this.oimg.style.height = 480 + unit;
							this.oimg.style.width=Math.floor(this.nw * (480/this.nh));
							flag = 1;
						}else{
							this.oimg.style.width = 480 + unit;
							this.oimg.style.height=Math.floor(this.nh * (480/this.nw));
							flag = 1;
						}
					}
				}
			}
			if(this.nw == 28 && this.nh==30 ){
				if(this.mw/this.mh<1.23){
					if(this.mw<480 && this.mh<480){
						this.nw = this.mw;
						this.nh = this.mh;
					}else if(this.mh >480){
						this.nh = 480;
						this.nw = Math.floor(this.mw * (480/this.mh));
					}
				}
			}
		}
	}
	
	//相框对象
	function PhotoStand(p,count_id) {
		this.p = p;
		if(count_id==0)
		{
			this.AreaHeight = 0; //相册显示区域高度
			this.AreaWidth = 0;
			this.ButtonSpace = 10;
			this.TitleHeight = 60;
			//处理照片
			this.photos = [];
			for (var i = 0; i < this.p.oPhoto.length && i<30; i++) {
				this.photos.push(new Stand(this, this.p.oPhoto[i].mpic,"","",this.p.oPhoto[i].width, this.p.oPhoto[i].height));
			}
		}
		if(count_id==0)
		{
			this.p.oForward.p = this.p.oNext.p  = this;
			this.p.oForward.onclick = function () {this.p.forward();}
			this.p.oNext.onclick = function() {this.p.next();}
		}
	}
	
	PhotoStand.prototype = {
		forward : function() {
			this.p.oNavigation.forward();
		},
		next : function() {
			this.p.oNavigation.next();
		},
		show : function(id) {
			if(id < 0 || id >= this.photos.length) return;
			this.photos[this.p.nowID].hide();
			this.photos[id].show();
			this.photos[id].w = this.photos[id].oimg.width;
			this.photos[id].h = this.photos[id].oimg.height;	
			this.p.nowID = id;
			this.p.resize();
			
			var ni = this.p.oPhoto[id];
			var ti = "<b>" + ni.title + "</b><br>";
			ti += "<span>";
			if(ni.author.length != 0) ti += "作者：<b>" + ni.author + "</b>";
			if(ni.width != 0) ti += " [分辨率:" + ni.width + "×" + ni.height + "px]";
			ti += "<img src=/space/imgs\/ico-download.gif alt=\"下载\" width=\"14\" height=\"16\" /><a href=\"" +
			ni.mpic + "\" target=\"_blank\">下载</a>";
			ti += "</span>";
			this.p.oTitle.innerHTML = ti;
		},
		resize : function() {
			this.AreaHeight = this.p.ScreenHeight - this.p.TitleHeight - this.p.NavHeight - this.TitleHeight;
			this.AreaHeight -= (this.oAlbumnum == 0) ? 0:this.p.OAHeight;
			this.AreaWidth = this.p.ScreenWidth;
			for (var i = 0; i < this.photos.length; i++) {
				this.photos[i].resize();
			}
			/*外框的尺寸*/
			if(this.p.nowID < this.photos.length && !(this.p.nowID < 0)) w = this.photos[this.p.nowID].nw;
			t = this.p.TitleHeight;
			l = Math.floor((this.p.ScreenWidth / 2) - 480 / 2);
			
			
			this.p.oViewArea.style.width = 480 + unit;
			this.p.oViewArea.style.marginTop  = t + unit;
			this.p.oViewArea.style.marginLeft = l + unit;
			
			this.photos[this.p.nowID].resize();
		
		},
		getHeight : function() {
			return this.AreaHeight + this.TitleHeight;
		},
		push_method : function(count_id) {
			for (var i = count_id; i < this.p.oPhoto.length && i<count_id+30; i++) {
				this.photos.push(new Stand(this, this.p.oPhoto[i].mpic,"",""));
			}
		}
	}
	

	function photos (id, title, author,
	width, height, spic, mpic) {
		this.id          = id;
		this.title       = title;
		this.author      = author;
		this.width       = width;
		this.height      = height;
		this.spic        = spic;
		this.mpic        = mpic;
	}
	
	function NavImg(id, p, s,mw) {
		this.id = id;
		this.p = p;
		this.h = 55;
		this.w = 55;
		this.s = 5;  //图片间距
		this.lw = 2; //边线的宽度
		this.l = 0;  //这个元素的位置
		this.img         = document.createElement('img');
		this.w = 0; //照片的宽度。
		
		this.img.p       = this;
		this.img.style.display = "";
		this.img.onclick = function(){this.p.click();}
		this.img.onmouseover = function(){this.p.mouseover();}
		this.img.onmouseout = function(){this.p.mouseout();}
		this.oimg = this.p.ONavArea.appendChild(this.img);
		this.img.onload = function() {
			var img_new = new Image(); 
			img_new.src = s;
			this.width = img_new.width;
			if(img_new.width == 0){
				this.width = 50;
			}
			if(img_new.height > 55){
				this.width = Math.floor(this.width * ( this.height /img_new.height));
			}
			if(this.width > 180) this.width = 100;
			this.p.w = this.width + this.p.lw * 2 ;
		}
		this.img.src     = s;
	}
	NavImg.prototype = {
		click : function(){
			this.p.select(this.id);
		},
		mouseover : function() {
			if(this.id != this.p.p.nowID)
				this.oimg.style.borderColor = "#0033FF";
		},
		mouseout : function() {
			if(this.id != this.p.p.nowID)
				this.oimg.style.borderColor = "#FFF";
		},
		show : function() {
			this.oimg.style.borderColor = "#990000";
		}
	}
	
	function Navigation(p,count_id) {
		this.p = p;
		this.ONavArea = this.p.ONavArea;
		if(count_id==0)
		{
			this.NavTop = 0;
			this.NavLeft = 0;
			this.NavWidth = 0;
			this.bj = 10; //按钮边距
			this.bw = 59;
			this.nl = 0; //向后按钮左距离
			this.sp = 10; //导航边空
			
			this.aw = 0; //当前显示区域宽度
			this.cw = 0; //导航区域内容宽度
			this.cl = 0; //当前横向条的位置
			this.photos = [];
			for (var i = 0; i < this.p.oPhoto.length && i<30; i++) {
				this.photos.push(new NavImg(i, this, this.p.oPhoto[i].spic,this.p.oPhoto[i].width));
			}
		}
		if(count_id==0)
		{
			this.p.oNavForward.p = this.p.oNavNext.p = this;
			this.p.oNavForward.onclick = function() {this.p.forward();}
			this.p.oNavNext.onclick = function() {this.p.next();}
		}
	}
	Navigation.prototype = {
		resize : function() {
			var oNav = this.p.oNavigationArea;
			var oAr = this.p.ONavZone;
			var nw = this.p.ScreenWidth - this.sp * 2;//导航的宽度
			
			if(this.p.ScreenWidth>1003)
				var nw = 1003 - this.sp * 2;//导航的宽度
			
			oNav.style.marginTop = 608 + unit;
			oNav.style.marginLeft = this.sp + unit;
			oNav.style.width = nw + unit;
			this.p.oNavForward.style.marginLeft = this.bj + unit;
			this.p.oNavNext.style.marginLeft = nw - this.bj - this.bw + unit;
			oAr.style.marginLeft = this.bj + this.bw + unit;
			this.aw = nw - this.bj * 2 - this.bw * 2;
			oAr.style.width = this.aw  + unit
		},
		show : function(nowID) {
			this.resize();
			this.photos[nowID].show();
			this.p.oNavigationArea.style.display = "";//显示内容
		},
		select : function(id) {
			if(id < 0 || id >= this.photos.length) return;
			this.photos[this.p.nowID].oimg.style.borderColor = "#FFF";
			this.photos[id].show();
			this.p.oPhotoStand.show(id);
			this.p.nowID = id;
			this.scroll(id);//调整导航图片的位置
			if((id+1)%30==0 && tmp_id<id)
			{
				tmp_id = id;
				count_id = id+1;
				if(instances[0].PhotoSum > count_id)
				{
					instances[0].showNavigation(count_id);
					instances[0].showPhotoStand(count_id);
				}
			}
		},
		forward : function() {
			this.select(this.p.nowID - 1);
		},
		next : function() {
			this.select(this.p.nowID + 1);
		},
		push_method : function(count_id) {
			for (var i = count_id; i < this.p.oPhoto.length && i<count_id+30; i++) {
				this.photos.push(new NavImg(i, this, this.p.oPhoto[i].spic));
			}
		},
		scroll : function (id) {
			this.cw = 0;
			for (var i = 0; i < this.photos.length; i++){
				var dyw = this.photos[i].w + this.photos[i].s;
				this.photos[i].l = this.cw + dyw;
				this.cw += dyw;		
			}
			var no = this.photos[id];
			
			var lw = this.photos[id].l - this.photos[id].w - this.photos[id].s - this.cl;
			var rw = this.aw - this.photos[id].l - this.cl;
			if (this.photos.length - 1 == id) {    		
				this.p.ONavZone.scrollLeft = (this.cw - this.aw > 0) ? this.cw - this.aw : 0;
				return;
			}
			if (id == 0) {
				this.p.ONavZone.scrollLeft = 0;
				return;
			}
			if (rw < 0) {
				this.p.ONavZone.scrollLeft = (-rw) + this.photos[id + 1].w + this.photos[id + 1].s;   		
				return;
			}
			
			if (lw > 0) {
				this.p.ONavZone.scrollLeft -= this.photos[id - 1].w + this.photos[id - 1].s
			}
		}
	}
	
	//推荐相册的图片
	function oAlbum(id, title, author, spic, mpic) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.spic = spic;
		this.mpic = mpic;
		this.onselect = true;
		
		this.width = 106;	  
		this.oDOM;
	
	}
	
	
	//推荐相册
	function OtherAlbum(p) {
		this.p = p;
		this.width = 620;
		this.height = 107;
		this.top = 0;
		this.left = 0;
		this.space = 7;
		this.LeftSpace = 40;
		this.isHide = false;
		
		this.oAlbums = this.p.oAlbumArray;
		this.oAlbumArea = this.p.oAlbumArea;
	
	}
	
	OtherAlbum.prototype = {
		hide : function() {
			this.oAlbumArea.style.display = "none";
			this.isHide = true;
			this.p.OAHeight = 0;
			this.p.resize();
		},
		init : function() {
			var space = this.LeftSpace;
			for (var i = 0; i < this.oAlbums.length; i++) {
				var div1 = document.createElement('div');
				div1.p = this;
				div1.i = i;
				div1.id = "oa-list";
				div1.onclick = function(i) {
					var u = "";
					u += "../"+this.p.oAlbums[this.i].id;
					u += "/1";
					location.href = u;
				}
				div1.title = this.oAlbums[i].title;
				div1.style.marginLeft = space + unit;
				space += this.space + this.oAlbums[i].width;
				
				var div11 = div1.appendChild(document.createElement('div'));
				div11.className = "oa-photo";
				var img = div11.appendChild(document.createElement('img'));
				img.src = this.oAlbums[i].spic;
				img.p = this;
				var div12 = div1.appendChild(document.createElement('div'));
				div12.className = "oa-bind";
				var div13 = div1.appendChild(document.createElement('div'));
				div13.className = "oa-title";
				div13.innerHTML = mSubstr(this.oAlbums[i].title, 12);
				this.oAlbums[i].oDOM = this.oAlbumArea.appendChild(div1);
			}
			var CloseDiv = document.createElement('div');
			CloseDiv.id = "oa-close";
			CloseDiv.p = this;
			this.oAlbumArea.appendChild(CloseDiv);
		},
		show : function() {
			if(this.p.oAlbumArray.length == 0) return;
			this.init();
			this.oAlbumArea.style.height = this.height + unit;
			this.oAlbumArea.style.width = this.width + unit;
			this.resize();
			this.oAlbumArea.style.display = "block";
		},
		resize : function() {
			if(this.p.oAlbumArray.length == 0) return;
			this.oAlbumArea.style.marginLeft = 
			Math.floor(this.p.ScreenWidth / 2 -  this.width /2) + unit;
			this.oAlbumArea.style.marginTop = 691 + unit;
		}
	}
	
	function scene(PhotoXML, AlbumXML) {
		this.PhotoXML = PhotoXML; //XML数据源
		this.AlbumXML = AlbumXML;
		this.AlbumName = "";
		this.AllAlbumURL = ""
		this.AllAlbumTitle = ""
		this.PhotoSum = 0; //图片数量
		this.AlbumSum = 0;
		
		this.ScreenWidth = 0;
		this.ScreenHeight = 0;
		this.resize();//取到当前的显示区域尺寸。
		
		this.nowID = 0;
		
		//栏目标题
		this.TitleHeight = 0;
		this.showTitle = function(o, u ,t) {
			this.AllAlbumURL = u;
			this.AllAlbumTitle = o + "的相册";
			this.AlbumName = t;
			var oTitleArea = document.getElementById("logo-title");
			var TitleAreaTop = 18;
			var TitleAreaLeft = 210;
			oTitleArea.style.marginTop = TitleAreaTop + unit;
			oTitleArea.style.marginLeft = TitleAreaLeft + unit;
			if(document.documentElement.clientWidth>1010)
					oTitleArea.style.width = 850 + unit;
			
			var t = ((this.AllAlbumURL == null || this.AllAlbumURL.length == 0 ) && o != null) ? this.AllAlbumTitle:
			"<a href=/" + ig + ">" + this.AllAlbumTitle + "</a>";
			t += " &gt; <b>" + this.AlbumName + "</b>（共" + this.PhotoSum + "张）";
			t +="<span class=\"font14\" style=\"display:block;margin-left:500px;margin-top:-18px\"><a href=\""+baseUrl+
			"\" style=\"color:#0000FF;\" class=\"margin40\">列表显示</a>&nbsp;&nbsp;&nbsp;&nbsp;幻灯片显示</span>";
			oTitleArea.innerHTML = t;
			this.TitleHeight = TitleAreaTop + oTitleArea.clientHeight;
		}
		
		//处理相框
		this.oPhotoStand = null;
		this.blw = "155px"; //下一张按钮边距
		
		this.oViewArea = document.getElementById("img-view");
		this.oPhotoStandArea = document.getElementById("img-vision");  //显示大图片的区域
		this.oForward = document.getElementById("bt-forward");
		this.oNext = document.getElementById("bt-next");
		this.oTitle = document.getElementById("img-all-title");
		this.oProperty = document.getElementById("img-property");
		
		this.showPhotoStand = function(count_id) {
			
			if(this.oPhotoStand){
				this.oPhotoStand.push_method(count_id);
			}else{
				this.oPhotoStand = new PhotoStand(this,count_id);
			}
		}
		
		//处理导航
		this.NavHeight = 85;
		this.oNavigationArea = document.getElementById("img-list");
		this.oNavForward = document.getElementById("img-list-forward");
		this.ONavArea = document.getElementById("img-list-all");
		this.ONavZone = document.getElementById("img-list-zone");
		this.oNavNext = document.getElementById("img-list-next");
		this.showNavigation = function (count_id) {
			if(this.oNavigation){
				this.oNavigation.push_method(count_id);
			}else{
				this.oNavigation = new Navigation(this,count_id);
			}
		}
		this.loadPhotos = function() {
			this.oNavigation.show(this.nowID);
			this.oPhotoStand.show(this.nowID);
			this.oPhotoStand.resize();
		}
		
		//相册推荐
		this.oAlbumArea = document.getElementById("other-album");
		this.OAHeight = 117;
		this.showOtherAlbum = function() {
			this.oOtherAlbum = new OtherAlbum(this);
			this.oOtherAlbum.show();
		}
		
		//外部数据载入
		this.oPhoto = []; //存放所有照片
		this.oAlbumArray = []; //存放相册
		this.oSelectAlbum = AnalysisParameter(QueryURL("os"), ":");
		this.oAlbumnum = otheralbumnum;
		
		this.loadAlbumData = function() {
			var getIeNode = function(doc, xpath) {
				var retval = "";
				var value = doc.selectSingleNode(xpath);
				if (value) retval = value.text;    
				return retval;
			}
			
			var getFfNode = function(doc, xpath) {
				return doc.getElementsByTagName(xpath)[0].childNodes[0].nodeValue;
			}
			
			var oXML;
			if (moz) {
				oXML = document.implementation.createDocument("", "doc", null);
				oXML.async = false; 
			} else if (ie){
				oXML = new ActiveXObject("MSXML2.DOMDocument.3.0");   
				oXML.async = false
				while( oXML.readyState != 4) {}; 
			}
			try{
				oXML.loadXML(this.AlbumXML);
			}catch(e){
				var oParser=new DOMParser();
				oXML=oParser.parseFromString(this.AlbumXML,"text/xml");
			}
			this.isSelect = function(s) {
				var r = false;
				for(var i = 0; i < this.oSelectAlbum.length; i++) {
					if(s == this.oSelectAlbum[i]){
						r = true;
						break;
					}
				}
				return r;
			}
			
			if (moz) {
				var od = oXML.getElementsByTagName("item");
				for(var i = 0; i < od.length; i++) {
					this.oAlbumArray.push(new oAlbum(
					getFfNode(od[i], "id"),
					getFfNode(od[i], "title"),
					getFfNode(od[i], "author"),
					getFfNode(od[i], "spic"),
					getFfNode(od[i], "mpic")));
				}
			} else if (ie){
				var od = oXML.selectNodes("/root/item");
				for (var i = 0; i < od.length; i++) {
					this.oAlbumArray.push(new oAlbum(
					getIeNode(oXML, "/root/item[" + i + "]/id"),
					getIeNode(oXML, "/root/item[" + i + "]/title/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/author/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/spic/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/mpic/cdata()")));
				}
			}
			this.AlbumSum = this.oAlbumArray.length;
		}
		this.loadPhotoData = function() {
			var getIeNode = function(doc, xpath) {
				var retval = "";
				var value = doc.selectSingleNode(xpath);
				if (value) retval = value.text;    
				return retval;
			}
			
			var getFfNode = function(doc, xpath) {
				return doc.getElementsByTagName(xpath)[0].childNodes[0].nodeValue;
			}
			
			var oXML;
			if (moz) {
				oXML = document.implementation.createDocument("", "doc", null);
				oXML.async = false; 
			} else if (ie){
				oXML = new ActiveXObject("MSXML2.DOMDocument.3.0");   
				oXML.async = false
				while( oXML.readyState != 4) {}; 
			}
			try{
				oXML.loadXML(this.PhotoXML);
			}catch(e){
				var oParser=new DOMParser();
				oXML=oParser.parseFromString(this.PhotoXML,"text/xml");
			}
			
			if (moz) {
				var od = oXML.getElementsByTagName("item");
				for(var i = 0; i < od.length; i++) {
					info = getFfNode(od[i], "mpic");
					this.oPhoto.push(new photos(
					getFfNode(od[i], "id"),
					getFfNode(od[i], "title"),
					getFfNode(od[i], "author"),
					getFfNode(od[i], "width"),
					getFfNode(od[i], "height"),
					getFfNode(od[i], "spic"),
					getFfNode(od[i], "mpic")));
				}
			} else if (ie){
				var od = oXML.selectNodes("/root/item");
				for (var i = 0; i < od.length; i++) {
					this.oPhoto.push(new photos(
					getIeNode(oXML, "/root/item[" + i + "]/id"),
					getIeNode(oXML, "/root/item[" + i + "]/title/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/author/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/width"),
					getIeNode(oXML, "/root/item[" + i + "]/height"),
					getIeNode(oXML, "/root/item[" + i + "]/spic/cdata()"),
					getIeNode(oXML, "/root/item[" + i + "]/mpic/cdata()")));
				}
			}
			this.PhotoSum = this.oPhoto.length;
		}
	}
	scene.prototype = {
		/* ==== 窗口尺寸变了 ==== */
		resize : function () {
			this.ScreenWidth = document.documentElement.clientWidth;
			if(this.ScreenWidth>1003)
				this.ScreenWidth = 1003;
			this.ScreenHeight=620;
			//同时调整尺寸
			if(this.oPhotoStand) this.oPhotoStand.resize();
			if(this.oNavigation) this.oNavigation.resize();
			if(this.oOtherAlbum) this.oOtherAlbum.resize();
		}
	}
	/*方法*/
	return {
		init : function() {
			var load = function() {
				var loaded = false;
				var i = instances.length;
				
				var PhotoXML = "";
				PhotoXML = xmlstr;
				
				var AlbumXML = "";
				AlbumXML = oalbum;
				
				while (i--) if (instances[i].url == url) loaded = true;
				if (!loaded) {
				
					instances.push(new scene(PhotoXML, AlbumXML));
					instances[0].loadPhotoData();
					if (instances[0].PhotoSum == 0) instances[0].loadPhotoData();
					if (instances[0].PhotoSum >= 0) {
						instances[0].showTitle(titinfo,"http://i.zhongsou.com",bname);
						instances[0].showNavigation(0);
						instances[0].showPhotoStand(0);
						instances[0].loadPhotos();
						instances[0].loadAlbumData();
						instances[0].showOtherAlbum();
					}else {
						err = '';
						err += '<div style="font-size:12px; color:#333;line-height: 24px; padding:20px 0 0 60px;"><b style="color:#900;">请刷新页面或稍后重试，系统可能出现了以下状况：</b><br>';
						err += '1、您当前访问相册没有任何相片<br>';
						err += '2、系统故障或网络原因造成数据读取失败！<br>'
						err += '3、浏览器不兼容，请使用：IG 1+、IE6/7/8、Firefox 2+</div>';
						document.getElementById("bd").innerHTML = err;
					}
					
					if (!album.initialized) {
						album.initialized = true;
						addEvent(window, "resize", function (e) {
							var i = instances.length;
							while (i--) 
							{
								instances[i].resize();
							}
						});
					}
				}
			}
			addEvent(window, 'load', function(){load();});
		}
	}  
}();

try {
	album.init();
} catch(err) {
    document.writeln("出错了！请刷新页面或稍后重试。");
    document.writeln("Error name: " + err.name + "");
    document.writeln("Error message: " + err.message);
}
