$(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);
            }
        }
    });
    
//.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"};
