/** * jQuery jqGalScroll Plugin * Examples and documentation at: http://benjaminsterling.com/jquery-jqgalscroll-photo-gallery/ * * @author: Benjamin Sterling * @version: 2.1 * @copyright (c) 2007 Benjamin Sterling, KenzoMedia * @extendThanks Koesmanto Bong http://www.koesbong.com/ *		Koes put a fire under my butt to improve this plugin *		and when I took too long he took what I had and added *		the horizontal scroll and in turn I ripped it from his *		hands and made it better :) * * 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 v1.2.1 or later * @optional jQuery Easing v1.2 * * @name jqGalScroll * @example jQuery('ul').jqGalScroll(); *  * @Semantic requirements: * 				The structure fairly simple; the structure should consist * 				of a ul > li > img structure. *  * 	<ul> *		<li><img src="common/img/dsc_0003.thumbnail.JPG"/></li> *		<li><img src="common/img/dsc_0012.thumbnail.JPG"/></li> *	</ul> * * @param String ease *					refer to http://gsgd.co.uk/sandbox/jquery.easing.php for values *  * @example jQuery('#gallery').jqGalScroll({speed:1000});  * @param String speed * 					fast, slow, 1000, ext.. *  * @example jQuery('#gallery').jqGalScroll({speed:1000}); *  * @param String height * 					the default height of your wrapper *  * @example jQuery('#gallery').jqGalScroll({height:490}); *  * @param String titleOpacity * 					the opacity of your title bar (if present) *  * @example jQuery('#gallery').jqGalScroll({titleOpacity:.70}); *  * @param String direction  *					vertical horizontal diagonal *  * @example jQuery('#gallery').jqGalScroll({direction:'vertical'}); * 			 */(function(jQuery) {	jQuery.fn.jqGalScroll = function(options){		return this.each(function(i){			var el = this			el.curImage = 0;			el.jqthis = jQuery(this).css({position:'relative'});			el.jqchildren = el.jqthis.children();			el.opts = jQuery.extend({}, jqGalScroll, options);			el.index = i;			el.totalChildren = el.jqchildren.size();			var width,height;						switch(el.opts.direction){				case 'horizontal':					width = el.totalChildren *el.opts.width;					height = el.opts.height;					break;				case 'vertical':					width = el.opts.width;					height = el.totalChildren *el.opts.height;					break;				default:					width = el.totalChildren *el.opts.width;					height = el.totalChildren *el.opts.height;					break;			};						el.container = jQuery('<div id="jqGS'+i+'" class="jqGSContainer" >').css({position:'relative'});			el.ImgContainer = jQuery('<div id="visor" class="jqGSImgContainer" style="height:'+el.opts.height+'px;position:relative;overflow:hidden;background:url(../img/galeria_home/cargando.gif) norepeat center center !important">')								.css({height:el.opts.height,width:el.opts.width,position:'relative',overflow:'hidden'});			el.jqthis.css({height:height,width:width});						el.jqthis.wrap(el.container);			el.jqthis.wrap(el.ImgContainer);			el.pagination = jQuery('<div class="jqGSPagination">');			el.jqthis.parent().parent().append(el.pagination);			var jqul = jQuery('<ul>').appendTo(el.pagination);			var pos = {x:0,y:0};						el.jqchildren			.each(function(j){				var selected = '';				if(j == 0) selected = 'selected';								var jQuerya = jQuery('<a href="#'+(j)+'" class="'+selected+'">'+(j+1)+'</a>').click(function(){					var href = this.index;//href.replace(/^.*#/, '');					el.pagination.find('.selected').removeClass('selected');					jQuery(this).addClass('selected');					var params = {};					if( el.opts.direction == 'diagonal'){						params = {right:(el.opts.width*href),bottom:(el.opts.height*href)}					}					else if( el.opts.direction == 'vertical'){						//params = {bottom:(el.opts.height*href)}						params = {bottom:(((jQuery('#visor').width()*3)/4)*href)}											}					else if( el.opts.direction == 'horizontal'){						params = {right:(el.opts.width*href)}					};										el.jqthis.stop().animate(params,el.opts.speed, el.opts.ease);					index = href;					return false;				});				var n = jQuerya.get(0);				n.index = j;				jQuery('<li>').appendTo(jqul).append(jQuerya);				if( el.opts.direction == 'diagonal'){					pos.x = j * el.opts.width;					pos.y = j * el.opts.height;				}				else if( el.opts.direction == 'horizontal'){					//pos.x = j * el.opts.width;				}				else if( el.opts.direction == 'vertical'){					//pos.y = j * el.opts.height;					pos.y = j * ((jQuery('#visor').width()*3)/4);				};								var jqchild = jQuery(this).css({height:el.opts.height,width:'100%',position:'absolute',left:pos.x, top:pos.y});				var jqimg = jqchild.find('img').hide()								if(jqimg.parent().is('a')){					var p = jqimg.parent();					jqimg.get(0).linkHref = p.attr('href');					p.remove();					jqimg.appendTo(jqchild);				};				jqimg.click(function(){					var next = n.index + 1;					if((n.index + 1) == el.totalChildren ){						el.pagination.find('[hrefjQuery=#0]').click();					}					else{						el.pagination.find('[hrefjQuery=#'+next+']').click();					}				});				var jQueryloader = jQuery('<div class="jqGSLoader">').appendTo(jqchild);				var jQuerytitleHolder = "";//jQuery('<div class="jqGSTitle">').appendTo(jqchild).css({opacity:el.opts.titleOpacity}).hide();				var image = new Image();				image.onload = function(){					image.onload = null;					jQueryloader.fadeOut();					jqimg.css({position:'absolute',left:'0',top:'0'}).fadeIn();					var alt = jqimg.attr('alt');					if(typeof alt != 'undefined'){						//jQuerytitleHolder.text(alt).fadeIn();					}				};				image.src = jqimg.attr('src');				//alert(jQuery('#visor').width());				if(jQuery('#visor').width()>0){					jQuery('#visor').height((jQuery('#visor').width()*3)/4);				}else{					jQuery('#visor').height((250*3)/4);								}			});					}); // end : this.each(function()	};  // end : jQuery.fn.jqGalScroll	jqGalScroll = {		ease: null,		speed:0,		height: 250,		titleOpacity : .0,		direction : 'horontal' // vertical horizontal diagonal	};})(jQuery); function initMenu() { jQuery('ul.menu ul').hide(); //jQuery('ul.menu li#current ul').show(); if ((jQuery('li#current').parent().is('ul.menu'))) {	jQuery('li#current ul').show(); }else{	 jQuery('li#current').parent().show(); } jQuery('ul.menu li a').click( function() { var checkElement = jQuery(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { jQuery('ul.menu ul:visible').slideUp('normal'); //jQuery('li#current').parent().slideDown('normal');  //jQuery('li#current').parent().show(); checkElement.slideDown('normal'); return false; } } );  jQuery('ul.menuextras ul').hide(); //jQuery('ul.menu li#current ul').show(); if ((jQuery('li#current').parent().is('ul.menuextras'))) {	jQuery('li#current ul').show(); }else{	 jQuery('li#current').parent().show(); } jQuery('ul.menuextras li a').click( function() { var checkElement = jQuery(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { jQuery('ul.menuextras ul:visible').slideUp('normal'); //jQuery('li#current').parent().slideDown('normal');  //jQuery('li#current').parent().show(); checkElement.slideDown('normal'); return false; } } );}