/*
 * jQuery Slider Plugin (with Transition Definitions)
 * Demo at: http://hennzo.metroflash.ca/sources/slideView/
 * Copyright (c) 2010 M. Hennzo
 * Version: 1.0 (24-JAN-2010)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jquery.tools 1.1.2 or later
 */
 
(function(k){
		  
	/* function slideView450 */
	k.fn.slideView=function(parameters){
		var defaults = {
			box_width: 475,
			box_height: 300,
			
			image_width: 475,
			image_height: 300,
			clickable: 'yes',
			
			imageMini_width: 90,
			imageMini_height: 72,
			clickableMini: 'yes',//  A click on this image make it active in the main box
			
			intro_width: 465,
			intro_height: 95,
			intro_visible: 'yes',
			
			speedv: 1000, //The speed option defines the number of milliseconds it will take to transition from one slide to the next
			
			effect: 'cover',
			/*  EFFECTS : 
				You can choose from any of the following named effects:	
				* blindX		
				* blindY		
				* blindZ		
				* cover	
				* uncover	
				* curtainX
				* curtainY		
				* fade		
				* fadeZoom		
				* growX
				* growY
				* scrollUp
				* scrollDown
				* scrollLeft
				* scrollRight
				* scrollHorz
				* scrollVert		
				* shuffle
				* slideX
				* slideY
				* toss
				* turnUp
				* turnDown
				* turnLeft
				* turnRight
				* wipe
				* zoom	
			*/
			pausev: 1    // The pause option causes the slideshow to pause when the mouse hovers over the slide
			
			/* OPTIONNEL (If effect='custom', you need to use one of these attributs) 
			 ,diagonal:	"cssBefore:{float:'left',top:0,left: 0,width:0,height: 0,zIndex: 1},"+
							"animIn:{width:"+image_width+",height:"+image_height+"},"+
							"animOut:{top:"+image_height+",left:"+image_width+",width: 0, height: 0},"+
							"cssAfter:{ float:'left', zIndex: 0 }",*/
		}; 
		var params = k.extend(defaults,parameters); 						   
		k(this).attr({ style: "width:"+params.box_width+"px; height:"+params.box_height+"px;"});
		var lenTotal = k(".page").length*parseInt(params.image_width);
		k("#laUne").attr({ style: "width:"+lenTotal+"px; height:"+params.image_height+"px;"});
		k(".image").attr({ style: "width:"+params.image_width+"px; height:"+params.image_height+"px;"});
		k(".image img").attr({ style: "width:"+params.image_width+"px; height:"+params.image_height+"px;"});
		k(".intro").attr({ style: "width:"+params.intro_width+"px; height:"+params.intro_height+"px; margin-top:-"+params.intro_height+"px;"}); 
		if(params.intro_visible == 'no'){
			k(".intro").hide();
		}
		if(params.clickable == 'no'){
			k(".page a").removeAttr("href");
		}
		k(".imageMini").attr({ style: "width:"+params.imageMini_width+"px; height:"+params.imageMini_height+"px;"}); 			
		k("#nav li").css({width:(params.imageMini_width+20)+"px",height:(params.imageMini_height+3)+"px"}); 
		//k("#nav li a").wrap("<center></center>");
		
		if( params.clickableMini == 'yes' ){
			k("#laUne").cycle({ fx:	params.effect, 
								speed:	params.speedv, 
								pause:	params.pausev,
								pager:  "#nav", 
								pagerAnchorBuilder: function(idx, slide) { 
									// return selector string for existing anchor 
									return "#nav li:eq(" + idx + ") a"; 
								}
							  });
		}else{
			k("#laUne").cycle({ fx:	params.effect, 
								speed:	params.speedv, 
								pause:	params.pausev
							  });
		}
		
		return this;
	}
})(jQuery);

