/*
 * parse (relative) image tags to fetch images from the helpsite
 * @author Kurt Van Wynsberge <kurt.vanwynsberge@ugent.be>, Ghent University, Belgium
 * @version may 2011
 */
function repairlinks(){
	$("#help img").each(function(index) {
		if( $(this).attr("src").indexOf("http://")==-1){
	    	lnk = "http://icto.ugent.be/" + $(this).attr("src");
	    	$(this).attr("src",lnk);
		}
	  });
}


/*
 * fetch and display help-information from the help-site (here:http://icto.ugent.be)
 * @author Kurt Van Wynsberge <kurt.vanwynsberge@ugent.be>, Ghent University, Belgium
 * @version may 2011
 * @param page : page for which help-information is requested
 */
function getdoc(page){
	
	if (page!=""){
			// method A: lookup using ajax call
				/*
				$("body").append("<div id='help'></div>");
				$.ajax({
					  url: page,
					  context: document.body,
					  dataType: "html",
					  success: function(data) {
		    				$("#help").html(data);
							if (data==""){
								$("#help").html('<p>We haven\'t found any help-information..</p>');
							}
		    				$("#help").dialog({height:400,width:600});
						  }
					});
				*/
			
			//method B: lookup correct RSS feed article
		$("body").append("<div id='help'></div>");	
		$('#help').rssfeed(page, {snippet:false, limit:5  });  // that was easy!
		$("#help").dialog({height:500,width:880,modal: true});
		setTimeout('repairlinks()',1000);  
	}		
}
