function call_ajax_content(title){
	$("#ajax-content-inner").html("<div style='width:100%;text-align:center'><img src='e107_themes/klarsinn/images/loader.gif' style='margin-top:50px'></div>");
	$.ajax({
        url: "ajax.php",
        data: "pagetitle=Glossar-"+title,
        type: "GET",
        dataType: "html",
        success: function(data) {
            $("#ajax-content-inner").html(data);
		}
    });
	return false;
}
$(document).ready(function(){
	$(".detail-image-link").bind("click", function(){
		$("#form-container-light").show();
		$("#detail-image-container-inner").html("<img src=e107_images/detail-"+this.alt+" />");
		$("#detail-image-container").fadeIn("fast");
	});
	
	$(".caption,.forumheader,.fcaption").bind("click", function(e){
		var offSet = $(this).offset();
		thisLeft = e.pageX-offSet.left;
		thisTop = e.pageY; 
		// $("#ajax-content-container").css("top",thisTop-50+"px");
		$("#ajax-content-container").css("top","150px");
		if ($(this).hasClass("caption")) {
			var newTitle = $(this).text();
			var newTitle = newTitle.replace("...", "");
		}else if($(this).hasClass("forumheader")){
			var newTitle = this.title;
		}else if($(this).hasClass("fcaption")){
			var newTitle = this.title;
		}
		// alert($(this).text());
		$("#ajax-content-inner").html("<div style='width:100%;text-align:center'><img src='e107_themes/klarsinn/images/loader.gif' style='margin-top:50px'></div>");
		$("#ajax-content-container").show();
		$.ajax({
                url: "ajax.php",
                data: "pagetitle=Glossar-"+newTitle,
                type: "POST",
                dataType: "html",
                success: function(data) {
                    $("#ajax-content-inner").html(data);
				}
            });
		$(".pageCover").show();
		return false;
	});
	
	$(".close-link").bind("click", function(){
		$(".open-container").fadeOut("fast");
		$(".pageCover").hide();
		return false;
	});
	$("#left-menu-list-container ul a").each( function(){
		if(document.location.search.match(/\d{2}/)){
			var hrefNum = this.href.match(/\d{2}/);
			var urlNum = document.location.search.match(/\d{2}/);			
		}else{
			var hrefNum = this.href.match(/\d/);
			var urlNum = document.location.search.match(/\d/);		
		}
		if(document.URL.match(/\d{2}/)){
			var hrefNum = this.href.match(/\d{2}/);
			var urlNum = document.URL.match(/\d{2}/);
		}else{
			var hrefNum = this.href.match(/\d/);
			var urlNum = document.URL.match(/\d/);			
		}
		// alert("URL: "+urlNum+" HREF "+hrefNum);
		if (parseInt(hrefNum) == parseInt(urlNum)) {
			$(this).parent().addClass('active');
		}
	});	
	$("#top-menu-container a").each( function(){
		if(document.location.search.match(/\d{2}/)){
			var hrefNum = this.href.match(/\d{2}/);
			var urlNum = document.location.search.match(/\d{2}/);			
		}else{
			var hrefNum = this.href.match(/\d/);
			var urlNum = document.location.search.match(/\d/);		
		}
		if(document.URL.match(/\d{2}/)){
			var hrefNum = this.href.match(/\d{2}/);
			var urlNum = document.URL.match(/\d{2}/);
		}else{
			var hrefNum = this.href.match(/\d/);
			var urlNum = document.URL.match(/\d/);			
		}
		// alert("URL: "+urlNum+" HREF "+hrefNum);
		if ((parseInt(hrefNum) == parseInt(urlNum)) && (this.href != '#')) {
			$(this).addClass('top-menu-active');
		}
	});	
	$(".contact-link").click(function(e){
		var offSet = $(this).offset();
		thisLeft = e.pageX-offSet.left;
		thisTop = e.pageY; 
		$("#contact-form-container").css("top",50);
		$(".pageCover").show();
		$("#contact-form-container").fadeIn("fast");
		return false;
		});


	
	$("#searchbutton").bind("click",function(){
		var searchterm = $("#searchfield").val();
			$.ajax({
                url: "search.php",
                data: "r=0&s=&q="+searchterm,
                type: "GET",
                dataType: "html",
                success: function(data) {
                    $("#globe-container").html(data);
                }
            });
   		return false;		
	});

	$("#back-button").bind("click", function(){
		history.back(1);
		return false;
		});
		
	$("#slider").easySlider({
		auto: true, 
		continuous: true

	});		
});
