/*
 * imgPreview jQuery plugin
 * Copyright (c) 2009 James Padolsey
 * j@qd9.co.uk | http://james.padolsey.com
 * Dual licensed under MIT and GPL.
 * Updated: 09/02/09
 * @author James Padolsey
 * @version 0.22
 */
/*(function(c){c.expr[':'].linkingToImage=function(a,g,e){return!!(c(a).attr(e[3])&&c(a).attr(e[3]).match(/\.(gif|jpe?g|png|bmp)$/i))};c.fn.imgPreview=function(j){var b=c.extend({imgCSS:{},distanceFromCursor:{top:10,left:10},preloadImages:true,onShow:function(){},onHide:function(){},onLoad:function(){},containerID:'imgPreviewContainer',containerLoadingClass:'loading',thumbPrefix:'',srcAttr:'href'},j),d=c('<div/>').attr('id',b.containerID).append('<img/>').hide().css('position','absolute').appendTo('body'),f=c('img',d).css(b.imgCSS),h=this.filter(':linkingToImage('+b.srcAttr+')');function i(a){return a.replace(/(\/?)([^\/]+)$/,'$1'+b.thumbPrefix+'$2')}if(b.preloadImages){(function(a){var g=new Image(),e=arguments.callee;g.src=i(c(h[a]).attr(b.srcAttr));g.onload=function(){h[a+1]&&e(a+1)}})(0)}h.mousemove(function(a){d.css({top:a.pageY+b.distanceFromCursor.top+'px',left:a.pageX+b.distanceFromCursor.left+'px'})}).hover(function(){var a=this;d.addClass(b.containerLoadingClass).show();f.load(function(){d.removeClass(b.containerLoadingClass);f.show();b.onLoad.call(f[0],a)}).attr('src',i(c(a).attr(b.srcAttr)));b.onShow.call(d[0],a)},function(){d.hide();f.unbind('load').attr('src','').hide();b.onHide.call(d[0],this)});return this}})(jQuery);

*/
// 
/*
 * More usable Forms 
 * Copyright (c) 2009  Oliver Astrologo
 * Dual licensed under MIT and GPL.
 * @author  Oliver Astrologo
 * @version 2.3
 */

jQuery.fn.EasyForms=function(){
this.submit( function() {
			var submitForm = this;
			jQuery(submitForm).find("label").not(".radiolabel").each(function(){
				var current=jQuery(this);
				var targetForm =  jQuery('#'+current.attr("for"));				
				if (targetForm.val() == current.html()){
				targetForm.val('');
				};																			  
			});
		return true;
	});	
	this.find("label").not(".radiolabel").each(function(){
		var current=jQuery(this);		
		var targetForm = jQuery('#'+current.attr("for"));	   
	   if (targetForm.val() == ''){
			targetForm.val(current.html());		
			}	   
	   targetForm.click(function(){		
		if (jQuery(this).val() == current.html()){
			jQuery(this).val('');			
			}
		});
		targetForm.blur(function(){		
		if (jQuery(this).val() == ''){
			jQuery(this).val(current.html());			
			}
		});
		current.hide();	
	});			
}


jQuery.expr[':'].linkingToImage = function(elem, index, match){
        // This will return true if the specified attribute contains a valid link to an image:
        return !! (jQuery(elem).attr(match[3]) && jQuery(elem).attr(match[3]).match(/\.(gif|jpe?g|png|bmp)$/i));
    };





// JavaScript Document
jQuery(function(){     
jQuery('.easy-form').EasyForms();

jQuerycollection = jQuery('.entry a').filter(':linkingToImage(href)');
jQuerycollection.fancybox(); 




/*jQuery('.entry a').imgPreview({
    containerID: 'imgPreviewWithStyles',
    imgCSS: {
        // Limit preview size:
       maxHeight: 400,
	   maxWidth: 600
    },
    // When container is shown:
    onShow: function(link){
        // Animate link:
        jQuery(link).stop().animate({opacity:0.4});
        // Reset image:
        jQuery('img', this).stop().css({opacity:0});
    },
    // When image has loaded:
    onLoad: function(){
        // Animate image
        jQuery(this).animate({opacity:1}, 300);
    },
    // When container hides: 
    onHide: function(link){
        // Animate link:
        jQuery(link).stop().animate({opacity:1});
    }
	});*/
});


