$(document).ready(function(){
	//TEXT SIDE
	if ($("#plimsoller_content_hidden .text_page").length > 0) {
		// if ($("#plimsoller_content_hidden .text_page #sites-page-title").length > 0) {
			// $("#plimsoller_page_title").html($("#plimsoller_content_hidden .text_page #sites-page-title").html());
		// } else {
			$("#plimsoller_page_title").remove();
		// }
		$("#plimsoller_content").html($("#plimsoller_content_hidden .text_page .sites-layout-tile").html());
		
	
	}
	
	//GALLERI OVERSIGT
	if ($("#plimsoller_content_hidden .albums").length > 0) {
		$("#plimsoller_content_hidden .albums .album").each(function(){
			a = $("table tr td a:has(img)", this);
			guid = $("div.guid", this).html();
			guid = guid.substr(guid.lastIndexOf('/')+1)
			guid = guid.substr(0, guid.indexOf('?'))
			a.attr('href', '?galleri='+guid);
			var albumname = $("img", this).attr('alt');
			if (albumname.substr(0,1) != '_') {
				a.prependTo($("#plimsoller_content"));
			}
		});
		
		// $("#plimsoller_content_hidden .gallerier .galleri table tr td a:has(img)").prependTo($("#plimsoller_content"));
		ims = $("#plimsoller_content a img");
		ims.css('border', '0px');
		ims.css('margin', '27px');
		// as = $("#plimsoller_content a");
		// $("#plimsoller_content a:has(img)").each(function() { 
			// this.href = '?galleri='+this.href.substr(this.href.lastIndexOf('/')+1)
		// });
	}
	
	//ALBUM
	// alert($("#plimsoller_content .galleri .album_description .padding").html());
	if ($("#plimsoller_content .galleri .album_description .padding").html().length == 0) {
		$("#plimsoller_content .galleri .album_description").remove();
		$("#plimsoller_content .galleri .images").css('width', '100%');
	}
});


