$(document).ready(function() {


    
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});	
    
    // match an image with specific dimension, return it
    //function initAllImages(){
    $('#content img[src*="thumb"]').each(function() {
        if(!$(this).parent('a')){
            if(($(this).parent().attr('id'))!="zoom" && ($(this).parents().eq(3).attr('id'))!="articles"){
                var $this = $(this);
                var src = $this.attr('src').replace("thumb", "content-size");
                var a = $('<a/>').attr('href', src).attr('id', 'zoom');
                $this.wrap(a);
            }
        }
    });
    /*
  	$('a#zoom').hover(
        function() {
            var $this = $(this);
            var src = $this.attr('href').replace("full-size", "content-size");
            var srcFull = $this.attr('href').replace("content-size", "full-size");   
            var img = $('<img/>').attr('src', src).attr('class', 'zoomer');

            
            var a = $('<a/>').attr('href', srcFull).attr('id', 'zoom');

            var object = $this.parent().append($(img));
            
            $('img.zoomer').hover(
                    function() {
                    },
                    function () {
                        var $this = $(this);
                        $this.remove();
                    }
               );
        }
   );
    */
  	
//.wrap('<a href="" id="zoom" title="" />');

 

  	$("a#zoom").fancybox({
		'titlePosition'  : 'over',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	$("#showdetail").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});	      
        
        
        //.filter('thumb');
    $('#cms-guestbook-panel a').click(function() {
      $('#wmd-input').val($('#wmd-input').val()+$(this).attr('title'));
    });
    

        
    //}

});	


wmd_options = {"output": "Markdown"};
