(function(){
	sitebox = {
		Dom : YAHOO.util.Dom
		,initEvent: null
		,wasinit : false
		,links : null
		,images : null
		,titles : null
		,bigimages : null
		,conainer: null
		,panelconfig: {
			visible:false
			//,fixedcenter:true
			,underlay: "shadow"
			,modal: true
			,context: [document.body]
			,constraintoviewport: true
			,effect: {effect:YAHOO.widget.ContainerEffect.FADE,duration:2}
		}
	 	,init : function() {
			if(this.wasinit) return;
			this.wasinit = true;
			this.links = this.Dom.getElementsByClassName("sitebox");
			this.images = new Array();
			this.titles = new Array();
			this.bigimages = new Array();
			var pivotimage;
			for(var i=0;i<this.links.length;i++) {
				pivotimage = this.Dom.getFirstChild(this.links[i]);
				this.images.push( pivotimage );
				this.titles.push( this.Dom.getAttribute(pivotimage,"title") );
				this.bigimages.push(this.links[i].href);
				this.links[i].onclick = (function(j) {
					return function() {
						return sitebox.show(j);
					}
				})(i);
			}
		}
			
		//,show: function(i) {
		//	var objImage = new Image();
		//	objImage.onLoad = (function(j) {
		//		return function() {
		//			return sitebox.showAfterload(j);
		//		}
		//	})(i);
		//	objImage.src = this.bigimages[i];
		//	return false;
		//}

		,show : function(i) {
			this.container = new YAHOO.widget.Panel(this.Dom.generateId(),this.panelconfig);
			this.container.setHeader(this.titles[i]);
			this.container.setBody("<a href='#' onclick='sitebox.container.destroy();'><img class='playerbig' src='"+this.bigimages[i]+"'></a>");
			//this.container.setFooter(this.titles[i]);
			this.container.render(document.body);
			this.container.show();
			return false;
		}
	};

	YAHOO.util.Event.onDOMReady(function () {
		sitebox.init();
	});

})();
