/* CLIQUE */
/* Photo Download Blocker Plug-in Javascript
----------------------------------------------------------------------------- */


	(function($) {

	$.fn.photoDownloadBlocker = function(parameters) {

		try { 

			var defaults = {

				image: asset_host + "/clique/patterns/photos/blocker.gif",  
				index: 15,
				top: 0,
				left: 0, 
				opacity: 100

			};

		} catch (error) { 

			alert('Error: Asset Host is not defined'); 

		}

		var parameters = $.extend(defaults, parameters);


/* PRESERVE CHAINING
----------------------------------------------------------------------------- */


		return this.each(function(index) {

			var $this = $(this);


/* DISPLAY MODE
----------------------------------------------------------------------------- */


			if ($this.parents('div').hasClass('widget-photo.display')) {

				var width = $this.width();
				var height = $this.height();

				$this.before('<img class="blocker" src="' + parameters.image + '" width="' + width + '" height="' + height + '" alt="" style="position: absolute; z-index: ' + parameters.index + '; top: ' + parameters.top + '; left: ' + parameters.left + '; margin: 0; padding: 0; opacity: ' + parameters.opacity / 100 + '; filter: alpha(opacity=' + parameters.opacity + ');" />');

				$this.parents('div.widget-photo.display').css('position', 'relative');

			}


/* THUMBNAILS VIEW
----------------------------------------------------------------------------- */


			if ($this.parents('div').hasClass('widget-photo.thumbnails')) {

				var width = $this.width();
				var height = $this.height();

				$this.before('<img class="blocker" src="' + parameters.image + '" width="' + width + '" height="' + height + '" alt="" style="position: absolute; z-index: ' + parameters.index + '; top: ' + parameters.top + '; left: ' + parameters.left + '; margin: 0; padding: 0; opacity: ' + parameters.opacity / 100 + '; filter: alpha(opacity=' + parameters.opacity + ');" />');

				$this.parent('a').css('position', 'relative');

			}


/* GALLERY VIEW
----------------------------------------------------------------------------- */


			if ($this.parents('div:not(.slideshow)').hasClass('widget-photo.gallery')) {

				var width = $this.width();
				var height = $this.height();

				$this.before('<img class="blocker" src="' + parameters.image + '" width="' + width + '" height="' + height + '" alt="" style="position: absolute; z-index: ' + parameters.index + '; top: ' + parameters.top + '; left: ' + parameters.left + '; margin: 0; padding: 0; opacity: ' + parameters.opacity / 100 + '; filter: alpha(opacity=' + parameters.opacity + ');" />');

				$this.parent('a').css('position', 'relative');

			}


/* PHOTO SLIDESHOW
----------------------------------------------------------------------------- */


			if ($this.parents('div').hasClass('widget-photo.slideshow')) {

				var width = $this.parent().parent('div').width();
				var height = $this.parent().parent('div').height();

				$this.before('<img class="blocker" src="' + parameters.image + '" width="' + width + '" height="' + height + '" alt="" style="position: absolute; z-index: ' + parameters.index + '; top: ' + parameters.top + '; left: ' + parameters.left + '; margin: 0; padding: 0; opacity: ' + parameters.opacity / 100 + '; filter: alpha(opacity=' + parameters.opacity + ');" />');

				$this.parent().parent('div').css('position', 'relative');

			}


/* END PLUG-IN
----------------------------------------------------------------------------- */


		});

	};

	})(jQuery);