( function ( $ ) {
	$.fn.jqueryzoom = function ( galleryName ) {
		var noalt = ''
		$( this ).hover( function () {
			noalt = $( this ).children( 'img' ).attr( 'alt' )
			var bigimage = $( this ).children( 'img' ).attr( 'jqimg' )
			$( this ).children( 'img' ).attr( 'alt', '' )
			if ( $( 'div.zoomdiv' ).get().length == 0 ) {
				$( '#content-column' ).append( '<div class="zoomdiv"><img class="bigimg" src="'+bigimage+'"/></div>' )
			}
			//var top = $( this ).offset().top + $( this ).height() + 20
			//var left = $( '.ajaxGallery' ).offset().left + ( ( $( '.ajaxGallery' ).width() - 288 ) / 2 )

			var top = $( galleryName ).offset().top + ( ( $( galleryName ).height() - 288 ) / 2 )

			if ( galleryName == '.winners' ) {
				top = $( this ).offset().top - ( 288 - ( $( this ).children().height() ) )
			}

			var left = $( this ).offset().left + $( this ).children().width() + 20

			$( 'div.zoomdiv' ).css( { top: top, left: left } )
			$( 'div.zoomdiv' ).show()
		}, function () {
			 $( this ).children( 'img' ).attr( 'alt', noalt )
			 $( 'div.zoomdiv' ).remove()
		})
		var count = 0
		$( 'body' ).append( '<div style="display:none;" class="jqPreload'+count+'"></div>' )
		$( this ).each( function () {
			var imagetopreload = $( this ).children( 'img' ).attr( 'jqimg' )
			var content = jQuery( 'div.jqPreload'+count ).html()
			jQuery( 'div.jqPreload'+count+'' ).html( content+'<img src="'+imagetopreload+'">' )
		})
	}
})( jQuery )