// plugin settings

// Colorbox

jQuery(document).ready(function(a){a("img").each(function(b,c){$classValue=a(c).attr("class");if(!$classValue){a(c).attr("class","colorbox-manual")}if(!$classValue.match("colorbox")){$classValue+=" colorbox-manual";a(c).attr("class",$classValue)}})});

jQuery(document).ready(function($) {
		$("a:has(img):not(.colorbox-off)").each(function(index, obj) {
				if ($(obj).attr("href").match(/\.(?:jpe?g|gif|png|bmp)/i)) {
						var $nestedElement = $(obj).children(0);
			if ($nestedElement.is("img")) {
				var $nestedElementClassAttribute = $nestedElement.attr("class");
								var $groupId = $nestedElementClassAttribute.match('colorbox-[0-9]+') || $nestedElementClassAttribute.match('colorbox-manual');
								if ($groupId && !$nestedElementClassAttribute.match('colorbox-off')) {
										$groupId = $groupId.toString();
										if ($groupId == "colorbox-manual") {
						$groupId = "nofollow";
					}
										$(obj).colorbox({
						rel:$groupId,
						title:$nestedElement.attr("title"),
						height:"90%",slideshowAuto:false,preloading:false,                            opacity:"0.85",
						transition:"elastic",
						speed:350,
						slideshowSpeed:2500,
						close:"close",
						next:"next",
						previous:"previous",
						slideshowStart:"start slideshow",
						slideshowStop:"stop slideshow",
						current:"{current} of {total} images"
					});
				}
			}
		}
	});
});
   
// Colorbox

// main nav slider
$(function() {
		$("#menu-main").lavaLamp({
			fx: "backout", 
			speed: 700
		});
	});
	
// homepage portfolio sliders
$().ready(function() {
	$('.jimgMenu ul').kwicks({max: 310, duration: 300, easing: 'easeOutQuad'});
	});
// homepage portfolio sliders
	
	
$(document).ready(function(){

	/* nudge links */
	$('.widget_rrm_recent_posts li a').nudge();
	
	// for lightbox
	//$(".flickr_badge_image a").colorbox({height:"80%", width:"80%", iframe:"true"});
	$("a[rel='popup_page']").colorbox({height:"80%", width:"80%", iframe:"true"});
	$("a[rel='popup']").colorbox();


});

// shutter

$(document).ready(function(){

	var container = $('#shutter'),
		li = container.find('li');

	// Using the tzShutter plugin. We are giving the path
	// to he shutter.png image in the plugin folder and two
	// callback functions.

	container.tzShutter({
		imgSrc: 'http://www.merlinvicki.in/wp-content/themes/merlinvicki/js/shutter.png',
		closeCallback: function(){

			// Cycling the visibility of the li items to
			// create a simple slideshow.

			li.filter(':visible:first').hide();
			
			if(li.filter(':visible').length == 0){
				li.show();
			}
			
			// Scheduling a shutter open in 0.1 seconds:
			setTimeout(function(){container.trigger('shutterOpen')},100);
		},
		loadCompleteCallback:function(){
			setInterval(function(){
				container.trigger('shutterClose');
			},4000);
			
			container.trigger('shutterClose');
		}
	});
	
});
