

function addForum() {
	if (document.location.href.indexOf("#")>-1)
 __URL = document.location.href.toString().split('#')[1].toString().replace(/\W/g,'').toLowerCase(); else __URL="home";
			google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);
			google.friendconnect.container.renderWallGadget({ id: 'div-8606906698423702700',  site: '16756703352910678924',  'view-params':{"disableMinMax":"false","scope":"ID","features":"video,comment","docId":__URL,"startMaximized":"true"}
 },  skin);

	pageTracker._trackPageview(__URL);
}

function addMovieClip() {
	var htmlSnippet = '<object width="255" height="200" ><param name="movie" value="http://www.youtube.com/v/K_jMM5UxnjQ&amp;hl=nl_NL&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/K_jMM5UxnjQ&amp;hl=nl_NL&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="255" height="200" ></embed></object>';	
	$("#cinema").html(htmlSnippet);

}

function loadContent(c){
	if (c=="/finding-beans") c="/Finding_Beans";
	if (c.indexOf("wiki")==-1)  u = "/community/wiki/index.php"+c; else u = c;
	$("#maincontent").html("<div style='margin-top:200px;text-align:center;width:100%;height:100%;'>Loading...</div>");
    $.get( u , function(d){
        var i = d.indexOf("firstHeading\">");
		var j = d.substr(i);
		var i2 = j.indexOf("<")
		var tl = j.substr(14,i2-14);
		var s = d.indexOf("<!-- start content -->");
		var e = d.indexOf("<!-- end content -->");
		var d = d.substr(s,e-s);
		if (c=="/Manual") $("#navigation").html(d); else $("#maincontent").html(d);
		$("#homelink").removeClass("active"); 
		$("#blockwrap a").each(function(){
				$(this).removeClass("active");
				if (document.location.href.indexOf($(this).attr("href"))>-1) {
					$(this).addClass("active");
				}
				
				if ($(this).attr("href") && $(this).attr("href").indexOf("#")==-1 && $(this).attr("href").indexOf("http")!==0) {
					
					$(this).attr("href", "#"+$(this).attr("href").replace("community/wiki/index.php/",""));
				}
		});
		if (document.location.href.indexOf("#")==-1) {
			$("#homelink").addClass("active");
		}
		setTimeout(addForum,100);
		$(".editsection").hide();
   });
}



$("document").ready(function(){
	if (document.location.href.indexOf("#/")==-1) {
		loadContent("/Features");
	}
	loadContent("/Manual",1);
	__LOC="";
	setInterval(function(){
		if (document.location.href!=__LOC && document.location.href.indexOf("#/")>-1){
			__LOC = document.location.href;
			loadContent(__LOC.split("#")[1]);
		}
	},200);
	setTimeout(addMovieClip,2000);
});


