
var ajaxFile = "/bolig/DNBO/results_page/ajax.php";

function loadSlideshow(slideshow, id) {

	if(slideshow.imageArray.length==0) {

		var jqxhr = $.get(ajaxFile, { retrieveSlideshow : true, id : id}, function(data) {
		
			images = JSON.parse(data);
			
			// The pictures are added to the slideshow object.   Exchange $property[1] for correct picture names!!!
			// Inserting each slide, after changing each one to the result size one.
			for(i=0;i<images.length;i++) {
				slideshow.addSlide(images[i]);		
			}		
		
		})
	}

}

function saveComment(id) {

	comment = $('#commentTA'+id).val();
	
	if(comment!="") {
	// Store in cookie.
		$.cookie('DNBOComment'+id, comment, { expires: 365 } );
		// Store in db.
		var jqxhr = $.get(ajaxFile, { saveComment : true, id : id, comment : comment});
	} else {
		// Delete cookie.
		$.cookie('DNBOComment'+id, null );
		// Delete from db.
		var jqxhr = $.get(ajaxFile, { saveComment : true, id : id, comment : null});
	}
		
}



