function carousel_attachments() { 
 jQuery("#carousel_attachments .carousel-container .jCarouselLite").jCarouselLite
 		({
        btnNext: ".carousel-container .carousel-navigation .next",
        btnPrev: ".carousel-container .carousel-navigation .prev",
        speed: 1500,
		circular:true,
		auto:1,
		visible:1
		});
		
}		
  	

function carousel_attachments_zoom() { 		
  var zoom = 1.7;
  move = -15; 
  jQuery("#carousel_attachments").hover(
              
	 function(){
				
				w = jQuery('#carousel_attachments img').width()
				h = jQuery('#carousel_attachments img').height()
				width  = w * zoom;
				height = h * zoom;
				
				//jQuery('#carousel_attachments .caption').stop(false,true).fadeIn(300);
				//jQuery('#carousel_attachments img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:300});
				},
			    
	 function() {
				//jQuery('#carousel_attachments img').stop(false,true).animate({'width':w, 'height':h, 'top':'0', 'left':'0'}, {duration:300});
				//jQuery('#carousel_attachments .caption').stop(false,true).fadeOut(400);
				}
     );     
}


function postsPerCategory(header,cats,domid,numberpost) {
var strHeader;
var strDomID;
strHeader=header.toString();
strDomID="#"+domid.toString();


jQuery(strDomID).hide();
jQuery('#time').hide();
var strURL = "http://www.afrohorizont.de/wp-content/themes/afromagazin/loop-home-ajax2.php";

jQuery.ajax
 		({
 		url: strURL,
		processData : true,
		data: {categories:cats,numberposts:numberpost},
		dataType: "json",
		cache: true,
		success: function (data, textStatus){
				 parseInfo(data, strHeader, strDomID);
				 },
		error: function(XMLHttpRequest, textStatus, errorThrown) {
		       jQuery('#info').empty();
			   jQuery('#info').html("Ajax-Error: "+XMLHttpRequest.statusText);
        	   jQuery('#info').show();
			   }
		}); 
return true;
}

function parseInfo(data, strHeader,strDomID)
{ 
var i;
var max=0;
var start = new Date().getTime();
var strDisplay="";
strFirst = " first ";
strStart="<!-- Begin Post per Category list-->";
strEnd="<!-- End Post per Category list-->";

if (data.length) {
	  max = data.length;
	  for(i=0; i<max; i++) {
	    strDisplay = strDisplay + showData(data[i]);
        }
}

strDisplay='<H3 class=cat-post-header>'+strHeader+'</H3>'+strDisplay;	
strDisplay=strStart+strDisplay+strEnd;	

jQuery(strDomID).html(strDisplay);
jQuery(strDomID).show();

var elapsed = new Date().getTime() - start;
jQuery("#time").html(elapsed+" ms");
jQuery("#time").show();
}

function showDataTest(obj){
var strOut ="";

   for(var key in obj){
      var attrName = key;
      var attrValue = obj[key];
	  strOut = strOut + attrValue;
   }
   return strOut;
 }
 
 
function showData(obj){
 var output ="";
 
 if (obj.thumb != ""){ 
   output=output+'<li class="post border15'+ strFirst +'"id="catpost_'+obj.ID +'">';
   strFirst = ""; 
 } 
 else{
   output=output+'<li class="post border15" id="catpost_'+obj.ID +'">';
 }
 output=output+'<h6 class="archive-header">'+'<a href="'+obj.permalink+'" rel="bookmark" title="Link zum Artikel auf afro-horizont">'+ obj.title + '</a>' + '</h6>'; 
 
 if ((obj.thumb != "") && (obj.thumb != "undefined")){ 
   output=output+'<div class="thumbcontainer' + strFirst + '">'; 
   output=output+'<a href="'+obj.permalink+'" rel="bookmark" title="Link zum Artikel auf afro-horizont">';
   output=output+ obj.thumb + '</a>'; 
   output=output+'</div>';
 }
 output=output+'<div class="postcaption">';
 output=output+'<p>' + obj.excerpt + '</p>'; 
 output=output+'<span class="postdate">' + obj.date    + '</span>'; 
 output=output+'<span class="divider">' + '&nbsp;|' + '</span>';
 output=output+'<a class="commentlink" href="'+obj.permalink+'#comments" rel="bookmark" title="Link zu den Kommentaren auf afro-horizont">';
 output=output+ obj.comment_count + '&nbsp;Kommentar/e</a>';
 output=output+'<span class="editlink"><a class="post-edit-link" href="/wp-admin/post.php?post='+obj.ID+'&action=edit" title="Artikel bearbeiten">Edit</a></span>';
 output=output+'</div>';
 output=output+'</li>';
 return output;
 }

var geocoder;
var map;
  function initialize() {
  
  if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 1);
        map.setUIToDefault();
        geocoder = new GClientGeocoder();
      }
  }

  function codeAddress() {
 
    var address = document.getElementById("address").value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }
  

