var finder_path;

$(document).ready(function() {

	if ($('#path').val() == "")
			finder_path = ""; 
	else if (document.URL.indexOf("mobile") != -1){
		finder_path = "../";
	}	
	else
		finder_path = "kulifinder/";

});

// vorherige Seite anzeigen
function prevPage()
{
	displayPens("prev");
}

// nächste Seite anzeigen
function nextPage()
{
	displayPens("next");
}

// nächste Seite anzeigen
function gotoPage(gotoNr)
{
	displayPens(gotoNr);
}

function setBookmarks()
{
	function bookmark(object){

	

	  document.getElementById(object.attr("id")).innerHTML = "<span>Merkliste</span> <img src='" + finder_path + "gfx/mark.jpg' style='position: relative; top: 5px; left: 5px;'> ";
	 
      //object.attr("src","kulifinder/gfx/mark.jpg");
      //object.innerHTML = "nicht merken";
      object.attr("class","unbookmark");
      object.unbind('click');
      object.click(function() {unbookmark(object)});

      id = object.attr("id");

       $.get(finder_path + 'bookmark.php', { id : id}, function(text){
		 	//alert(text);
       });
	}

	function unbookmark(object){

	

		document.getElementById(object.attr("id")).innerHTML = "<span>Merkliste</span> <img src='" + finder_path + "gfx/mark_grey.jpg' style='position: relative; top: 5px; left: 5px;'> ";
		
        //object.attr("src","kulifinder/gfx/mark_grey.jpg");
        //object.innerHTML = "merken";
        object.attr("class","bookmark");
        object.unbind('click');
        object.click(function() {bookmark(object)});

		id = object.attr("id");

       	$.get(finder_path + 'unbookmark.php', { id : id}, function(text){
		 	//alert(text);
       });
	}

	$(document).ready(function() {

        $('.bookmark').click(function() { bookmark($(this))});

        $('.unbookmark').click(function() {unbookmark($(this))});
        
       
        
      

	});
}
