// Creating Global Namespace for projekt.ch
// requires jQuery 1.3.2.

    $(document).ready(function() {
    
  	$("div#visual ul").reorder();
  	
	
	RandomKarin();
	
	if ($('body').hasClass('category-work')) {
	$('#content h2.date').hide();
	} else {
	$('#content h2.date').show();
	}
	

    
 		
  
  
       
    });
    
      
      RandomKarin = function(){
      /* RANDOM IMG */
      bgImageTotal=3;
 		randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
 		imgPath=('http://www.karinchristen.ch/img/karin_'+randomNumber+'.png');
 		
 		$('#karin').css('background-image', ('url("'+imgPath+'")'));
 		$('#karin').addClass('karin' +randomNumber);
 		
 		if ($('#karin').hasClass('karin1')) {
 		
 			$('#sprechblase').css({'left' : '324px'});
 			
 		
 		} else if ($('#karin').hasClass('karin2')) {
 			
 			$('#sprechblase').css({'left' : '206px'});
 			
 			
 		} else {
 			
 			$('#sprechblase').css({'left' : '24px'});
 				
 			
 		}
 		
 		}
 		
 		
      /* RANDOM UL */
      $.fn.reorder = function() {

	  // random array sort from
	  // http://javascript.about.com/library/blsort2.htm
	  function randOrd() { return(Math.round(Math.random())-0.5); }

	  return($(this).each(function() {
	    var $this = $(this);
	    var $children = $this.children();
	    var childCount = $children.length;

	    if (childCount > 1) {
	      $children.remove();

	      var indices = new Array();
	      for (i=0;i<childCount;i++) { indices[indices.length] = i; }
	      indices = indices.sort(randOrd);
	      $.each(indices,function(j,k) { $this.append($children.eq(k)); });

	    }
	  }));
	}
 



 



