/**
* Copyright: PolarCode Oy
*/

function Gallery(){
	
	this.change_image = function(nodeIDX,galleryIDX,bComments){
		$j("#imagecontainer"+galleryIDX).load("index.php?name=Gallery&method=get_image&nodeIDX="+nodeIDX+"&" + $j("#gtype").val() + "="+galleryIDX+"&blocks=ah");
		
		if(bComments)
			$j("#galleryCommentContainer"+galleryIDX).load("index.php?name=Gallery&method=get_image_comments&nodeIDX="+nodeIDX+"&blocks=ah");
	}
	
	this.rate_image = function(nodeIDX,galleryIDX,number){
		$j("#ratingcontainer"+galleryIDX).html("<img src='images/common/ajax-loader.gif' />");
		$j.ajax({
			type: "GET", 
			url: "index.php?name=Gallery&method=rate_image&nodeIDX="+nodeIDX+"&galleryIDX="+galleryIDX+"&number="+number+"&blocks=ah",  
			success: function(html){
				$j("#imagecontainer"+galleryIDX).load("index.php?name=Gallery&method=get_image&nodeIDX="+nodeIDX+"&galleryIDX="+galleryIDX+"&blocks=ah");
			} 
		});
	}
	
}

var Gallery = new Gallery;
