PaintingView = {
	overlay: "",
	inner: "",
	page: "",
	hidden: true,
	query: "",
	
	init: function(){
		this.overlay = new HTMLobj("overlay");
		this.inner = new HTMLobj("overlay_frame");
	},
	
	paint: function(page,query){
		this.query = query;
		if(!document.getElementById("overlay_inner"))
			return;
			
		document.getElementById("overlay_inner").innerHTML = "";
		Loading.paint(document.getElementById("overlay_inner"),600,600);
		
		if(document.getElementById("painting_status"))
			document.getElementById("painting_status").value == "working";
		
		var link = "";
		if(page == "slideshow")
			link = 'slideshow.php'+query;
		else if(page == "maleri")
			link = 'maleri.php?id='+query;
		else
			link = 'maleri_stor.php?id='+query;

		
		this.init();
		
		window.onscroll = function(){PaintingView.move()};
		
		this.move();
		this.inner.moveTo(0,0);
		this.inner.setScrollTop(0);
		
		this.inner.displayShow();
		this.overlay.setOpacity(80);
		this.overlay.displayShow();
		this.page = page;
		YAHOO.util.Connect.asyncGetRequest(link,'overlay_inner','',function(){PaintingView.wait()});
	},
	
	hide: function(){
		this.inner.displayHide();
		this.overlay.displayHide();
		window.onscroll = "";
	},
	
	wait: function(){
		if(PaintingView.page=="slideshow")
			SlideshowLoader.load(PaintingView.query);
		if(PaintingView.page == "maleri"){
			document.getElementById("painting_carpet").style.visibility = "visible";
			ImageSlide.move();	
		}
		else{
			document.getElementById("painting_carpet").style.visibility = "visible";
			ColorPicker.init();
		}
	},
	
	move: function(){
		var topPos = this.overlay.getScrollTop();
		var windowHeight = this.overlay.getWindowHeight();
		if((windowHeight+topPos)>this.overlay.getHeight())
			this.overlay._css.height = (windowHeight+topPos)+"px";
	},
	
	setBackground: function(color){
		this.overlay._css.backgroundColor = "rgb("+color+")";
	}
}
