/* vim: set ts=2 sw=2 sts=2 et: */

/**
 * Main controller
 */

(function ($) {

Drupal.behaviors.lc3CleanFloatableBox = {
  attach: function (context, settings) {

    // Float button box controller
    $('.floatable-box', context).each(
      function() {
        var elm = $(this);

        // Fix width
        elm.css('width', elm.width() + 'px');

        // Create dump element
        var dump = document.createElement('div');
        dump.className = 'float-box-dump';
        dump = $(dump);
        dump
          .css(
            {
              width: elm.width() + 'px',
              height: elm.height() + 'px'
            }
          )
          .hide();
        elm.after(dump);

        // Calculate limit
        var bottomHeight = elm.height() + 20;
        var topLimit = Math.round(elm.position().top + bottomHeight);

        var scrollHandler = function()
        {
          var showAsFloat = topLimit > ($(document).scrollTop() + $(window).height());

          if ('undefined' == typeof(elm.get(0).showAsFloat) || showAsFloat != elm.get(0).showAsFloat) {

            // State is changed
            elm.get(0).showAsFloat = showAsFloat;

            if (showAsFloat) {

              // Show as float box
              elm
                .css('left', elm.position().left + 'px')
                .addClass('float-box');
              dump.show();

            } else {

              // Show as static box
              elm.removeClass('float-box');
              dump.hide();
            }
          }
        }

        $(document).scroll(scrollHandler);
        scrollHandler();
      }
    );

  }
}

})(jQuery);

;
/* vim: set ts=2 sw=2 sts=2 et: */

/**
 * BlockUI-based popup
 */

// Display a ready-made block element
function lc3_clean_popup_div(id, fade) {
  jQuery.blockUI.defaults.css = {};

  var selector = '#'+id;

  // Disable fade out in Linux versions of Google Chrome because jQuery renders it incorrectly in the browser
  var delay = (lc3_clean_is_linux_chrome() || !fade) ? 0 : 400;

  jQuery.blockUI(
    {
      message: jQuery(selector),
      fadeIn: delay,
      overlayCSS: {
        opacity: 1,
        background: ''
      }
    }
  );

  lc3_clean_postprocess_popup(id);

}

// Display block message
function lc3_clean_popup_message(data, id) {
  jQuery.blockUI.defaults.css = {};

  // Disable fade out in Linux versions of Google Chrome because jQuery renders it incorrectly in the browser
  var delay = lc3_clean_is_linux_chrome() ? 0 : 400;

  jQuery.blockUI(
    {
      message: '<a href="#" class="close-link" onclick="javascript: blockUIPopupClose(); return false;"></a><div class="block-container"><div class="block-subcontainer">' + data + '</div></div>',
      fadeIn: delay,
      overlayCSS: {
        opacity: 0.7
      }
    }
  );

  lc3_clean_postprocess_popup(id);
}


// Close message box
function lc3_clean_close_popup() {

  // Disable fade out in Linux versions of Google Chrome because jQuery renders it incorrectly in the browser
  var delay = lc3_clean_is_linux_chrome() ? 0 : 400;

  jQuery.unblockUI(
    {
      fadeOut: delay
    }
  );
}

// Checks whether it is a Linux Chrome browser
function lc3_clean_is_linux_chrome() {
 return (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) && (navigator.userAgent.toLowerCase().indexOf('linux') > -1);
}



// Postprocess a popup window
function lc3_clean_postprocess_popup(id) {
  // Reposition
  var y = Math.round((jQuery(window).height() - jQuery('.blockMsg').height()) * 3/7);
  var x = Math.round((jQuery(window).width() - jQuery('.blockMsg').width()) / 2);
  if (y<0) {y = 0;}
  if (x<0) {x = 0;}
  jQuery('.blockMsg')
    .css('left', Math.round((jQuery(window).width() - jQuery('.blockMsg').width()) / 2) + 'px')
    .css('top', y+'px')
    .css('z-index', '1200000');

  // Modify overlay
  jQuery('.blockOverlay')
    .attr('title', 'Click to unblock')
    .css('z-index', '1100000')
    .css('cursor', 'pointer')
    .click(lc3_clean_close_popup);

  if (id) {
    var className = 'BlockMsg-' + id;
    jQuery('.blockMsg').addClass(className);
  }
}
;
/* vim: set ts=2 sw=2 sts=2 et: */

/**
 * Top message controller
 */

var MESSAGE_INFO    = 'status';
var MESSAGE_WARNING = 'warning';
var MESSAGE_ERROR   = 'error';

/**
 * Controller
 */

// Constructor
function TopMessages(container) {
  if (!container) {
    return false;
  }

  this.container = jQuery(container).eq(0);
  if (!this.container.length) {
    return false;
  }

  // Add listeners
  var o = this;

  // Close button
  jQuery('a.close', this.container).click(
    function(event) {
      event.stopPropagation();
      o.clearRecords();

      return false;
    }
  ).hover(
    function() {
      jQuery(this).addClass('close-hover');
    },
    function() {
      jQuery(this).removeClass('close-hover');
    }
  );

  // Global event
  if ('undefined' != typeof(window.core)) {
    core.bind(
      'message',
      function(event, data) {
        return o.messageHandler(data.message, data.type);
      }
    );
  }

  // Remove dump items (W3C compatibility)
  jQuery('li.dump', this.container).remove();

  // Fix position: fixed
  this.msie6 = jQuery.browser.msie && parseInt(jQuery.browser.version) < 7;
  if (this.msie6) {
    this.container.css('position', 'absolute');
    this.container.css('border-style', 'solid');
    jQuery('ul', this.container).css('border-style', 'solid');
  }

  // Initial show
  if (!this.isVisible() && jQuery('li', this.container).length) {
    setTimeout(
      function() {
        o.show();

        // Set initial timers
        jQuery('li.status', o.container).each(
          function() {
            o.setTimer(this);
          }
        );
      },
      1000
    );

  } else {

    // Set initial timers
    jQuery('li.status', this.container).each(
      function() {
        o.setTimer(this);
      }
    );
  }
}

/**
 * Properties
 */
TopMessages.prototype.container = null;
TopMessages.prototype.to = null;

TopMessages.prototype.ttl = 10000;

/**
 * Methods
 */

// Check visibility
TopMessages.prototype.isVisible = function() {
  return this.container.css('display') != 'none';
}

// Show widget
TopMessages.prototype.show = function() {
  this.container.slideDown();
}

// Hide widget
TopMessages.prototype.hide = function() {
  this.container.slideUp();
}

// Add record
TopMessages.prototype.addRecord = function(text, type) {
  if (
    !type
    || (MESSAGE_INFO != type && MESSAGE_WARNING != type && MESSAGE_ERROR != type)
  ) {
    type = MESSAGE_INFO; 
  }

  var li = document.createElement('LI');
  li.innerHTML = text;
  li.className = type;
  li.style.display = 'none';

  jQuery('ul', this.container).append(li);

  if (jQuery('li', this.container).length && !this.isVisible()) {
    this.show();
  }

  jQuery(li).slideDown('fast');

  if (type == MESSAGE_INFO) {
    this.setTimer(li);
  }
}

// Clear record
TopMessages.prototype.hideRecord = function(li) {
  if (jQuery('li:not(.remove)', this.container).length == 1) {
    this.clearRecords();

  } else {
    jQuery(li).addClass('remove').slideUp(
      'fast',
      function() {
        jQuery(this).remove();
      }
    );
  }
}

// Clear all records
TopMessages.prototype.clearRecords = function() {
  this.hide();
  jQuery('li', this.container).remove();
}

// Set record timer
TopMessages.prototype.setTimer = function(li) {
  li = jQuery(li).get(0);

  if (li.timer) {
    clearTimeout(li.timer);
    li.timer = false;
  }

  var o = this;
  li.timer = setTimeout(
    function() {
      o.hideRecord(li);
    },
    this.ttl
  );
}

// onmessage event handler
TopMessages.prototype.messageHandler = function(text, type) {
  this.addRecord(text, type);
}

jQuery(document).ready(function () {
  new TopMessages(jQuery('#status-messages'));
});
;
/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: mbicocchi@open-lab.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/*
 * Name:jquery.mb.scrollable
 * Version: 1.7.0
 */

(function($) {
	$.mbScrollable= {
		plugin:"mb.scrollable",
		author:"Matteo Bicocchi",
		version:"1.7.0",
		defaults:{
			dir:"horizontal",
			textDir:"ltr",
			width:980,
			elementsInPage:4,
			elementMargin:2,
			shadow:false,
			height:"auto",
			controls:"#controls",
			slideTimer:600,
			autoscroll:false,
			scrollTimer:6000,

			loadCallback:function(){},
			nextCallback:function(){},
			prevCallback:function(){},
			changePageCallback:function(){}
		},

		buildMbScrollable: function(options){
			return this.each (function (){
				this.options = {};
				$.extend (this.options, $.mbScrollable.defaults);
				$.extend (this.options, options);

				var mbScrollable=this;
				mbScrollable.isVertical= mbScrollable.options.dir!="horizontal";
				var controls=$(mbScrollable.options.controls);
				mbScrollable.idx=1;
				mbScrollable.scrollTo=0;
				mbScrollable.elements= $(mbScrollable).children();
				mbScrollable.elements.addClass("scrollEl");
				controls.hide();

				$(mbScrollable).children().each(function(){$(this).wrap("<div class='SECont'></div>");});
				if (mbScrollable.options.shadow){
					$(mbScrollable.elements).css("-moz-box-shadow",mbScrollable.options.shadow);
					$(mbScrollable.elements).css("-webkit-box-shadow",mbScrollable.options.shadow);
				}
				mbScrollable.elements= $(mbScrollable).children();
				var eip= mbScrollable.options.elementsInPage<this.elements.size()?mbScrollable.options.elementsInPage:mbScrollable.elements.size();
				if(mbScrollable.isVertical){
					mbScrollable.singleElDim= Math.floor((mbScrollable.options.height/eip)-mbScrollable.options.elementMargin);
					$(mbScrollable.elements).css({marginBottom:mbScrollable.options.elementMargin, height:mbScrollable.singleElDim, width:mbScrollable.options.width});
				}else{
					mbScrollable.singleElDim= Math.floor((mbScrollable.options.width/eip)-mbScrollable.options.elementMargin);
					$(mbScrollable.elements).css({marginRight:mbScrollable.options.elementMargin, width:mbScrollable.singleElDim, display:"inline-block","float":"left" });
				}
				this.elementsDim= (mbScrollable.singleElDim*mbScrollable.elements.size())+(mbScrollable.options.elementMargin*mbScrollable.elements.size());
				mbScrollable.totalPages= Math.ceil(mbScrollable.elements.size()/mbScrollable.options.elementsInPage);

				if(mbScrollable.isVertical)
					$(mbScrollable).css({overflow:"hidden", height:((mbScrollable.singleElDim+mbScrollable.options.elementMargin)*mbScrollable.options.elementsInPage), paddingRight:5, position:"relative"});
				else
					$(mbScrollable).css({overflow:"hidden", width:((mbScrollable.singleElDim+mbScrollable.options.elementMargin)*mbScrollable.options.elementsInPage),height:mbScrollable.options.height,paddingBottom:5, position:"relative"});

				var mbscrollableStrip=$("<div class='scrollableStrip'/>").css({width:mbScrollable.elementsDim, position:"relative"});
				$(mbScrollable.elements).wrapAll(mbscrollableStrip);
				mbScrollable.mbscrollableStrip=$(mbScrollable).find(".scrollableStrip");
				$(mbScrollable.elements).hover(
						function(){
							//                  console.debug(mbScrollable.autoScrollActive);
							if(mbScrollable.autoScrollActive)
								$(mbScrollable).mbStopAutoscroll();
						},
						function(){
							if(mbScrollable.autoScrollActive)
								$(mbScrollable).mbAutoscroll();
						});
				if(mbScrollable.options.autoscroll && mbScrollable.elements.size()>mbScrollable.options.elementsInPage){
					mbScrollable.autoScrollActive=true;
					$(mbScrollable).mbAutoscroll();
				}
				$(mbScrollable).mbPageIndex();
				$(mbScrollable).mbActivateControls();
				setTimeout(function(){
					$(".scrollEl").fadeIn();
				},1000);
				$(mbScrollable).mbManageControls();
			});
		},

		mbNextPage: function(auto){
			var mbScrollable= $(this).get(0);
			if (!auto) mbScrollable.autoScrollActive=false;

			if(mbScrollable.idx==mbScrollable.totalPages){
				$(mbScrollable).mbManageControls();
				return;
			}
			mbScrollable.idx+=1;
			$(mbScrollable).goToPage(mbScrollable.idx,false);
			if(mbScrollable.options.nextCallback)
				mbScrollable.options.nextCallback(mbScrollable);
		},

		mbPrevPage: function(auto){
			var mbScrollable= $(this).get(0);
			if (!auto) mbScrollable.autoScrollActive=false;

			if(mbScrollable.idx==1){
				$(mbScrollable).mbManageControls();
				return;
			}

			mbScrollable.idx-=1;
			$(mbScrollable).goToPage(mbScrollable.idx,false);
			if(mbScrollable.options.prevCallback)
				mbScrollable.options.prevCallback(mbScrollable);

		},

		mbFirstPage: function(){
			var mbScrollable= $(this).get(0);

			mbScrollable.idx=1;
			$(mbScrollable).goToPage(mbScrollable.idx,false);

		},

		mbLastPage: function(){
			var mbScrollable= $(this).get(0);
			mbScrollable.idx=mbScrollable.totalPages;
			$(mbScrollable).goToPage(mbScrollable.idx,false);
		},

		mbPageIndex: function(){
			var mbScrollable= $(this).get(0);
			var controls=$(mbScrollable.options.controls);
			var pages=controls.find(".pageIndex");
			if (pages){
				var n=0;
				for(var i=1;i<=mbScrollable.totalPages;i++){
					n++;
					var p=$("<span class='page'> "+n+" <\/span>").bind("click",function(){
						mbScrollable.autoScrollActive=false;
						$(mbScrollable).goToPage($(this).html(),false)
					});
					pages.append(p);
				}
			}
		},
		mbAutoscroll:function(){
			var dir= "next";
			var mbScrollable= $(this).get(0);
			mbScrollable.autoScrollActive=true;

			if(mbScrollable.autoscroll) return;
			var timer=mbScrollable.options.scrollTimer+mbScrollable.options.slideTimer;
			mbScrollable.autoscroll = true;
			mbScrollable.auto = setInterval(function(){
				dir= mbScrollable.idx==1?"next":mbScrollable.idx==mbScrollable.totalPages?"prev":dir;
				if(dir=="next")
					$(mbScrollable).mbNextPage(true);
				else
					$(mbScrollable).mbPrevPage(true);
			},timer);
			$(mbScrollable).mbManageControls();
		},

		mbStopAutoscroll: function(){
			var mbScrollable= $(this).get(0);
			mbScrollable.autoscroll = false;
			clearInterval(mbScrollable.auto);
			$(mbScrollable).mbManageControls();

		},

		mbActivateControls: function(){
			var mbScrollable=$(this).get(0);

			if(mbScrollable.options.loadCallback)
				mbScrollable.options.loadCallback(mbScrollable);

			var controls=$(mbScrollable.options.controls);
			controls.find(".first").bind("click",function(){$(mbScrollable).mbFirstPage();});
			controls.find(".prev").bind("click",function(){$(mbScrollable).mbStopAutoscroll();$(mbScrollable).mbPrevPage();});
			controls.find(".next").bind("click",function(){$(mbScrollable).mbStopAutoscroll();$(mbScrollable).mbNextPage();});
			controls.find(".last").bind("click",function(){$(mbScrollable).mbLastPage();});
			controls.find(".start").bind("click",function(){$(mbScrollable).mbAutoscroll();});
			controls.find(".stop").bind("click",function(){$(mbScrollable).mbStopAutoscroll();mbScrollable.autoScrollActive=false;});
		},

		mbManageControls: function(){
			var mbScrollable=$(this).get(0);
			var controls=$(mbScrollable.options.controls);
			if (mbScrollable.elements.size()<=mbScrollable.options.elementsInPage){
				controls.hide();
			}else{
				controls.fadeIn();
			}
			if (mbScrollable.idx==mbScrollable.totalPages){
				controls.find(".last, .next").addClass("disabled");
			}else{
				controls.find(".last, .next").removeClass("disabled");
			}

			if (mbScrollable.idx==1){
				controls.find(".first, .prev").addClass("disabled");
			}else{
				controls.find(".first, .prev").removeClass("disabled");
			}

			if (mbScrollable.autoscroll){
				controls.find(".start").addClass("sel");
				controls.find(".stop").removeClass("sel");
			}else{
				controls.find(".start").removeClass("sel");
				controls.find(".stop").addClass("sel");
			}
			controls.find(".page").removeClass("sel");
			controls.find(".page").eq(mbScrollable.idx-1).addClass("sel");
			controls.find(".idx").html(mbScrollable.idx+" / "+mbScrollable.totalPages);
		},

		goToPage: function(i,noAnim) {
			var mbScrollable= $(this).get(0);
			var anim= noAnim?0:mbScrollable.options.slideTimer;
			if (i>mbScrollable.totalPages) i=mbScrollable.totalPages;
			mbScrollable.scrollTo=-((mbScrollable.singleElDim+mbScrollable.options.elementMargin)*(mbScrollable.options.elementsInPage*(i-1)));
			if(mbScrollable.isVertical){
				if (mbScrollable.scrollTo<-mbScrollable.elementsDim+mbScrollable.options.height)
					mbScrollable.scrollTo=-mbScrollable.elementsDim+mbScrollable.options.height;
				$(mbScrollable.mbscrollableStrip).animate({marginTop:mbScrollable.scrollTo},anim);
			}else{
				if (mbScrollable.scrollTo<-mbScrollable.elementsDim+mbScrollable.options.width)
					mbScrollable.scrollTo=-mbScrollable.elementsDim+mbScrollable.options.width;
				$(mbScrollable.mbscrollableStrip).animate({marginLeft:mbScrollable.scrollTo},anim);
			}
			mbScrollable.idx = Math.floor(i);
			$(mbScrollable).mbManageControls();
			if (!mbScrollable.autoScrollActive)
				$(mbScrollable).mbStopAutoscroll();

			if(mbScrollable.options.changePageCallback)
				mbScrollable.options.changePageCallback(mbScrollable)
		}
	};

	$.fn.mbScrollable=$.mbScrollable.buildMbScrollable;
	$.fn.mbNextPage=$.mbScrollable.mbNextPage;
	$.fn.mbPrevPage=$.mbScrollable.mbPrevPage;
	$.fn.mbFirstPage=$.mbScrollable.mbFirstPage;
	$.fn.mbLastPage=$.mbScrollable.mbLastPage;
	$.fn.mbPageIndex=$.mbScrollable.mbPageIndex;
	$.fn.mbAutoscroll=$.mbScrollable.mbAutoscroll;
	$.fn.mbStopAutoscroll=$.mbScrollable.mbStopAutoscroll;
	$.fn.mbActivateControls=$.mbScrollable.mbActivateControls;
	$.fn.mbManageControls=$.mbScrollable.mbManageControls;
	$.fn.goToPage=$.mbScrollable.goToPage;

})(jQuery);;
//////////////////////////////////////////////////////////////////////////////////
// Cloud Zoom V1.0.2
// (c) 2010 by R Cecco. <http://www.professorcloud.com>
// MIT License
//
// Please retain this copyright header in all versions of the software
//////////////////////////////////////////////////////////////////////////////////
(function($){$(document).ready(function(){$('.cloud-zoom, .cloud-zoom-gallery').CloudZoom()});function format(str){for(var i=1;i<arguments.length;i++){str=str.replace('%'+(i-1),arguments[i])}return str}function CloudZoom(jWin,opts){var sImg=$('img',jWin);var img1;var img2;var zoomDiv=null;var $mouseTrap=null;var lens=null;var $tint=null;var softFocus=null;var $ie6Fix=null;var zoomImage;var controlTimer=0;var cw,ch;var destU=0;var destV=0;var currV=0;var currU=0;var filesLoaded=0;var mx,my;var ctx=this,zw;setTimeout(function(){if($mouseTrap===null){var w=jWin.width();jWin.parent().append(format('<div style="width:%0px;position:absolute;top:75%;left:%1px;text-align:center" class="cloud-zoom-loading" >Loading...</div>',w/3,(w/2)-(w/6))).find(':last').css('opacity',0.5)}},200);var ie6FixRemove=function(){if($ie6Fix!==null){$ie6Fix.remove();$ie6Fix=null}};this.removeBits=function(){if(lens){lens.remove();lens=null}if($tint){$tint.remove();$tint=null}if(softFocus){softFocus.remove();softFocus=null}ie6FixRemove();$('.cloud-zoom-loading',jWin.parent()).remove()};this.destroy=function(){jWin.data('zoom',null);if($mouseTrap){$mouseTrap.unbind();$mouseTrap.remove();$mouseTrap=null}if(zoomDiv){zoomDiv.remove();zoomDiv=null}this.removeBits()};this.fadedOut=function(){if(zoomDiv){zoomDiv.remove();zoomDiv=null}this.removeBits()};this.controlLoop=function(){if(lens){var x=(mx-sImg.offset().left-(cw*0.5))>>0;var y=(my-sImg.offset().top-(ch*0.5))>>0;if(x<0){x=0}else if(x>(sImg.outerWidth()-cw)){x=(sImg.outerWidth()-cw)}if(y<0){y=0}else if(y>(sImg.outerHeight()-ch)){y=(sImg.outerHeight()-ch)}lens.css({left:x,top:y});lens.css('background-position',(-x)+'px '+(-y)+'px');destU=(((x)/sImg.outerWidth())*zoomImage.width)>>0;destV=(((y)/sImg.outerHeight())*zoomImage.height)>>0;currU+=(destU-currU)/opts.smoothMove;currV+=(destV-currV)/opts.smoothMove;zoomDiv.css('background-position',(-(currU>>0)+'px ')+(-(currV>>0)+'px'))}controlTimer=setTimeout(function(){ctx.controlLoop()},30)};this.init2=function(img,id){filesLoaded++;if(id===1){zoomImage=img}if(filesLoaded===2){this.init()}};this.init=function(){$('.cloud-zoom-loading',jWin.parent()).remove();$mouseTrap=jWin.parent().append(format("<div class='mousetrap' style='background-image:url(\".\");z-index:999;position:absolute;width:%0px;height:%1px;left:%2px;top:%3px;\'></div>",sImg.outerWidth(),sImg.outerHeight(),0,0)).find(':last');$mouseTrap.bind('mousemove',this,function(event){mx=event.pageX;my=event.pageY});$mouseTrap.bind('mouseleave',this,function(event){clearTimeout(controlTimer);if(lens){lens.fadeOut(299)}if($tint){$tint.fadeOut(299)}if(softFocus){softFocus.fadeOut(299)}zoomDiv.fadeOut(300,function(){ctx.fadedOut()});return false});$mouseTrap.bind('mouseenter',this,function(event){mx=event.pageX;my=event.pageY;zw=event.data;if(zoomDiv){zoomDiv.stop(true,false);zoomDiv.remove()}var xPos=opts.adjustX,yPos=opts.adjustY;var siw=sImg.outerWidth();var sih=sImg.outerHeight();var w=opts.zoomWidth;var h=opts.zoomHeight;if(opts.zoomWidth=='auto'){w=siw}if(opts.zoomHeight=='auto'){h=sih}var appendTo=jWin.parent();switch(opts.position){case'top':yPos-=h;break;case'right':xPos+=siw;break;case'bottom':yPos+=sih;break;case'left':xPos-=w;break;case'inside':w=siw;h=sih;break;default:appendTo=$('#'+opts.position);if(!appendTo.length){appendTo=jWin;xPos+=siw;yPos+=sih}else{w=appendTo.innerWidth();h=appendTo.innerHeight()}}zoomDiv=appendTo.append(format('<div id="cloud-zoom-big" class="cloud-zoom-big" style="display:none;position:absolute;left:%0px;top:%1px;width:%2px;height:%3px;background-image:url(\'%4\');z-index:99;"></div>',xPos,yPos,w,h,zoomImage.src)).find(':last');if(sImg.attr('title')&&opts.showTitle){zoomDiv.append(format('<div class="cloud-zoom-title">%0</div>',sImg.attr('title'))).find(':last').css('opacity',opts.titleOpacity)}if($.browser.msie&&$.browser.version<7){$ie6Fix=$('<iframe frameborder="0" src="#"></iframe>').css({position:"absolute",left:xPos,top:yPos,zIndex:99,width:w,height:h}).insertBefore(zoomDiv)}zoomDiv.fadeIn(500);if(lens){lens.remove();lens=null}cw=(sImg.outerWidth()/zoomImage.width)*zoomDiv.width();ch=(sImg.outerHeight()/zoomImage.height)*zoomDiv.height();lens=jWin.append(format("<div class = 'cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div>",cw,ch)).find(':last');$mouseTrap.css('cursor',lens.css('cursor'));var noTrans=false;if(opts.tint){lens.css('background','url("'+sImg.attr('src')+'")');$tint=jWin.append(format('<div style="display:none;position:absolute; left:0px; top:0px; width:%0px; height:%1px; background-color:%2;" />',sImg.outerWidth(),sImg.outerHeight(),opts.tint)).find(':last');$tint.css('opacity',opts.tintOpacity);noTrans=true;$tint.fadeIn(500)}if(opts.softFocus){lens.css('background','url("'+sImg.attr('src')+'")');softFocus=jWin.append(format('<div style="position:absolute;display:none;top:2px; left:2px; width:%0px; height:%1px;" />',sImg.outerWidth()-2,sImg.outerHeight()-2,opts.tint)).find(':last');softFocus.css('background','url("'+sImg.attr('src')+'")');softFocus.css('opacity',0.5);noTrans=true;softFocus.fadeIn(500)}if(!noTrans){lens.css('opacity',opts.lensOpacity)}if(opts.position!=='inside'){lens.fadeIn(500)}zw.controlLoop();return})};img1=new Image();$(img1).load(function(){ctx.init2(this,0)});img1.src=sImg.attr('src');img2=new Image();$(img2).load(function(){ctx.init2(this,1)});img2.src=jWin.attr('href')}$.fn.CloudZoom=function(options){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}this.each(function(){var relOpts,opts;eval('var	a = {'+$(this).attr('rel')+'}');relOpts=a;if($(this).is('.cloud-zoom')){$(this).css({'position':'relative','display':'block'});$('img',$(this)).css({'display':'block'});if($(this).parent().attr('id')!='wrap'){$(this).wrap('<div id="wrap" style="top:0px;z-index:9999;position:relative;"></div>')}opts=$.extend({},$.fn.CloudZoom.defaults,options);opts=$.extend({},opts,relOpts);$(this).data('zoom',new CloudZoom($(this),opts))}else if($(this).is('.cloud-zoom-gallery')){opts=$.extend({},relOpts,options);$(this).data('relOpts',opts);$(this).bind('click',$(this),function(event){var data=event.data.data('relOpts');$('#'+data.useZoom).data('zoom').destroy();$('#'+data.useZoom).attr('href',event.data.attr('href'));$('#'+data.useZoom+' img').attr('src',event.data.data('relOpts').smallImage);$('#'+event.data.data('relOpts').useZoom).CloudZoom();return false})}});return this};$.fn.CloudZoom.defaults={zoomWidth:'auto',zoomHeight:'auto',position:'right',tint:false,tintOpacity:0.5,lensOpacity:0.5,softFocus:false,smoothMove:3,showTitle:true,titleOpacity:0.5,adjustX:0,adjustY:0}})(jQuery);;

