// ******** FUNCIONES DEL SITIO ******** //
// ************************************* //
// Scripts segun que pagina es: 

var myPageLibrary = {
    homePage : {

        init : function() {
            $(document).ready(function() {
				
				// Banner dinámico slider
				// ******************************	
							
				    $(".home-slider").sudoSlider({
				    	controlsShow:		true,
				        continuous:       	true,
				        auto:				true,
				        pause:				5000,
				        history:           	false,
				        numeric:			true,
				        customLink:        	'a.tablink',
				        updateBefore:     	true,
				        nextHtml:          	'<a href="#" class="nextBtn">Siguiente</a>', 
				        prevHtml:      		'<a href="#" class="prevBtn">Anterior</a>'
				    });
					
					// Controles de PAUSE/PLAY
					var elements = $('<p class="play-pause"><a class="stop" href="#">Stop</a> <a class="play" href="#">play</a></p>');
					$(".home-slider-container").append(elements);
					$(elements).find('a.play').addClass('active');
					
					$(".home-slider-container .play-pause .stop").live('click', function(e){
						$(elements).find('a').removeClass('active');
						$(this).addClass('active');
						$(".home-slider").sudoSlider('stop'); // Stop slideshow
						e.preventDefault();
					});
					
					$(".home-slider-container .play-pause .play").live('click', function(e){
						$(elements).find('a').removeClass('active');
						$(this).addClass('active');
						$(".home-slider").sudoSlider('start'); // Start slideshow
						e.preventDefault();
					});
					
					// Banners animados con 2 instancias
					// **********************************
					BannerFade(".secondary-banners.left");
					
  		    });
        }
    },
    
        
    
    campanaPage : {
        init : function() {
	
		
            if($.browser.msie) {  
		    	$(window).load(function() {
					// Little delay to avoid infinite revisiting
					setTimeout(function() {
					if($('.galleria-image img').length == 0)
						location.reload(); 
						}, 3000);
				});
		    }	
			
			$(document).ready(function(){ 
				// Load theme
		    	Galleria.loadTheme(baseurl+'assets/scripts/galleria/themes/lookbook2/galleria.lookbook2.js');
		    
		
		        $('#galleria').galleria({
		            data_config: function(img) {
		                // will extract and return image captions from the source:
		                return  {
		                    title: $(img).parent().next('strong').html(),
		                    description: $(img).parents('div').find('.info-box').html()
		                };
		            },
		        
		            image_pan: false,
		            image_position: 'top',
		            image_crop: 'height',
		            transition: 'fade', 
		            show_info: true,
		            
		            extend: function(options) {
		                // listen to when an image is shown
	                    	this.bind(Galleria.IMAGE, function(e) {
	                    	number = e.index + 1;
							
						
							// Go to the next imagen when clicking the main image:
							$(e.imageTarget).css({'cursor':'pointer'});
							$(e.imageTarget).click(this.proxy(function() {
			                	this.next(); 
			                }));
							
							
							// Desplegar 
							$('#galleria .galleria-info').find('.info h4 a').click(function(){
							// Abrir el popup
								$(this).toggleClass('active');
								var popup = $(this).parents('div').first().find('.pop');
								if(jQuery.browser.msie) {
									$(popup).toggle();
									//DD_roundies.addRule('.pop', '8px');
								
								} else {
									$(popup).fadeToggle();
								}
								return false;
							});
						
	                        	        		                       		       		                            
	                 });
	               }
		            
		        });
					
				  
			});

        }
    },
	
	
		
	
	// Look book
	 lookbookPage : {
        init : function() {
			
			if($.browser.msie) {  
		    	$(window).load(function() {
					// Little delay to avoid infinite revisiting
					setTimeout(function() {
					if($('.galleria-image img').length == 0)
						location.reload(); 
						}, 3000);
				});
		    }
			
			
	
        	$(document).ready(function(){ 
						
        				// Load theme
        		    	Galleria.loadTheme(baseurl+'assets/scripts/galleria/themes/lookbook2/galleria.lookbook2.js');
        		    	
						
						// Prendido por default
        		        $('#galleria .info').addClass('active');
									
						$('#galleria').galleria({
        		            data_config: function(img) {
        		                // will extract and return image captions from the source:
        		                return  {
        		                    title: $(img).parent().next('strong').html(),
        		                    description: $(img).parents('div').find('.info-box').html()
        		                };
        		            },
        		            thumb_crop: true,
        		           	thumb_fit: true,
        		           	thumb_quality: false,
        		            image_pan: false,
        		            image_position: 'center',
        		            image_crop: 'height',
        		            minScaleRatio: 0.7,
        		            transition: 'slide', 
        		            show_info: true,
        		            thumbnails: true,
        		            
        		            extend: function(options) {
									// Muestra los Thumbs (carga más prolija)
									$(this.get('thumbnails-container')).show();	
																										
									//Galleria.log(this); // the gallery scope
									var gallery = this;
															
	       		                	// listen to when an image is shown
     		                    	this.bind(Galleria.IMAGE, function(e) {
     		                    	number = e.index;
											
									if(e.index == 0 ) {
										// Go to the next imagen when clicking the main image:
										$(e.imageTarget).css({'cursor':'pointer'});
										$(e.imageTarget).click(this.proxy(function() {
						                	this.next(); 
						                }));
									} 
									
												
									// Menu INFO
									var actual = number;
									var info_box_actual = $('#galleria').find('#info-box-'+ actual);
									var pop_actual = $('#galleria').find('#info-box-'+ actual + ' .pop');
									var info_box = $('#galleria .galleria-info');	
									var contenedor = $('#galleria .galleria-container.fullscreen');						
									// Posicion del Menu info
									// *****************************
									function moveit() {
										$(info_box).position({ 
											my: 'center center', 
											at: 'center center', 
											offset: '-250 0',
											of: contenedor 
										});
									}
									$(window).resize(function(){
									   moveit(); 
									});
									
									moveit();
												
												
									// IFRAME buttons
									// *****************************
									var look = $('#galleria p#like_'+actual);
								 	var numero = actual;
									var fb_button = '<iframe src="http://www.facebook.com/plugins/like.php?app_id=188433901195021&amp;href=http%3A%2F%2Fwww.yagmour.com.ar%2Flookbook%2Fver2012%2F'+ numero+'&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>';
									
									if($.browser.msie) {  
										$(look).html(fb_button);
									}
									else {
										$(look).hide();
										$(look).html(fb_button).delay(1000).fadeIn();
									}          
     		                 });
						
     		               }
        		            
        		        });
        		  		  
        	});
        	            
        }
    },
	
	
	localesPage : {
        init : function() {
            $(document).ready(function(){ 
			 	
			     // Mapa flotando
				 $('#sticky_map').stickyfloat({ 
				 	duration: 300, 
				 	offsetY: 50,
				 	lockBottom: true
				 });	
				
				// Tabs //
		
				$(function () {
				    var tabContainers = $('div.info > div');
				    $('div.info .section h3').hide();
				    $('.tabNavigation a').click(function () {
				        tabContainers.hide().filter(this.hash).show();
				        
				        $('.tabNavigation a').removeClass('selected');
				        $(this).addClass('selected');
				        
				        return false;
				    }).filter(':first').click();
				});
			
				
								
				// Google MAPS API 3
				
				    $(function() {
				    
				      var chicago = new google.maps.LatLng(41.924832, -87.697456),
				          pointToMoveTo, 
				          first = true,
				          curMarker = new google.maps.Marker({}),
				          $el;
				      
				      var myOptions = {
				          zoom: 16,
				          draggable: true,
				          center: chicago,
				          disableDefaultUI: true,
				          navigationControl: true,
				          navigationControlOptions: {
				                  style: google.maps.NavigationControlStyle.SMALL,
				                  position: google.maps.ControlPosition.LEFT
				              },
				          mapTypeId: google.maps.MapTypeId.ROADMAP
				        };
				      
				      var map = new google.maps.Map($("#map_canvas")[0], myOptions);
				    	
				    	
				    	
				    if($.browser.msie) {  
				    	var infowindow = new google.maps.InfoWindow();
				    } else {
				     // Custom Infowindow
				    	var ib = new InfoBox();
					}
				
				        
				      				    
				    // On click...
				    $(".locations li").click(function() {
				      
				        $el = $(this);
				                
				        if (!$el.hasClass("hover")) {
				        
				          $(".locations li").removeClass("hover");
				          $el.addClass("hover");
				        
				          if (!first) { 
				         
				            curMarker.setMap(); 
				       
				          }
				          
				         var contentString = $el.find('.infobox').html();	          
				         
				          var latitud = $el.attr("data-geo-lat");		          
				          var longitud = $el.attr("data-geo-long");
				          local = new google.maps.LatLng(latitud, longitud);
				        				       
				        
				          map.setCenter(local);
				                
				        // Add a new icon
				       	var image = new google.maps.MarkerImage(baseurl+'assets/styles/images/marcador_google.png', new google.maps.Size(17, 30));
				          
				        // Add new marker     
				        curMarker = new google.maps.Marker({
				              position: local,
				              map: map,
				              icon: image
				        });
				         
				         
				         
				         // Custom Infowindow: Content
				        if($.browser.msie) {
				        
				        
				        } else {
				        
				        	//var boxText = contentString;
				        	//boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
				        	//boxText.innerHTML = "City Hall, Sechelt<br>British Columbia<br>Canada";
				        	          
				        	var myOptions = {
				        	   content: contentString
				        	  ,disableAutoPan: false
				        	  ,maxWidth: 0
				        	  ,pixelOffset: new google.maps.Size(-125, -130)                     
				        	  ,zIndex: null
				        	  ,boxStyle: { 
				        	     opacity: 1
				        	    ,width: "250px"
				        	   }
				        	  ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
				        	  ,infoBoxClearance: new google.maps.Size(1, 1)
				        	  ,isHidden: false
				        	  ,pane: "floatPane"
				        	  ,enableEventPropagation: false
				        		};
				        		                     
				        		ib.setOptions(myOptions);
				        	
				        } 
				          	 
				        				                  
				                    
				          // On click, zoom map
				          google.maps.event.addListener(curMarker, 'click', function() {
				               //map.setZoom(14);
					           if($.browser.msie) {    
					               infowindow.setContent(contentString); 
					               infowindow.open(map,curMarker);
					               
					            } else {  
					               ib.open(map, curMarker);
					            }   
				          });
				          
				          // Asi se abre solo el infowindow  
				       	  google.maps.event.trigger(curMarker, "click");
				                
				                
				          first = false; 
				          return false;
				        }
				      });
				     
				    // Se selecciona el primer elemento
				    $(".locations li:first").trigger("click");
				  				 				    
				      
				  });
			
			});
        }
    },
	
	
	backstagePage : {
        init : function() {
	
		
        		// Background //
        		$(document).bgStretcher({
        			images: [baseurl+'assets/images/backstage/ver2012-fondo-backstage.jpg'], imageWidth: 1280, imageHeight: 800
        		});
				
				
				// Video //
				/*
				* Simple player embed
				*/
				
				// The video to load.
				var videoID = "QQACqgo_DDQ";
				// Lets Flash from another domain call JavaScript
				var params = { 
					allowScriptAccess: "always",
					allowFullScreen: true
				};
				// The element id of the Flash embed
				var atts = { id: "ytPlayer" };
				// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
				swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&player_embedded&version=3&playerapiid=player1&rel=0&modestbranding=1&autoplay=1&autohide=1&fs=1", "videoDiv", "427", "240", "8", null, null, params, atts);
				
				
				// Posicion absoluta
				// ************************
				
				var caja = $(".floating-box");
				
				
				function moveit() {
					$(caja).css({
						'position': 'absolute'
					});
					$(caja).position({ 
						my: 'center center', 
						at: 'center center', 
						of: window,
						offset: '0 50'
					});
				}
				$(window).resize(function(){
				   moveit(); 
				});
				
				moveit();
				
				
				
				
    			// Modal para video //
    			/*
    			$('#a-video').colorbox({
  		  			transition:'elastic', 
  		  			speed:1000,
  		  			inline:true, 
  		  			close: "Cerrar",
  		  			innerWidth: 853,
  		  			href:"#video .inline",
  		  			innerHeight: 500,
  		  			scrolling: false,
  		  			opacity: 0.5, 
  		  			onComplete:function(){ 
  		  				jwplayer("player").setup({
  		  					flashplayer: baseurl+"assets/video/player.swf", 
  		  					//file: baseurl+"assets/video/backstage_m.flv",
  		  					image: baseurl+"assets/video/video.jpg",
  		  					//skin: baseurl+"assets/video/bekle.zip",  		  					
  		  					height: 480, 
  		  					width: 853,
  		  					levels: [
  					            { bitrate: 600, file: baseurl+"assets/video/backstage_m.flv", width: 853 },
  					            { bitrate: 900, file: baseurl+"assets/video/backstage_l.flv", width: 1280 }
  		  					],
  					        provider: "http",
  					        "http.startparam":"starttime",
  		  					events: { 
  		  						onReady: 
  		  							function() {  }
  		  					},
  		  					plugins: {
  		  						hd: { file: baseurl+"assets/video/backstage_l.flv", fullscreen: true }
  		  					}
  		  				});
  		  			 }
  		  		});
  		  		
  		  		
   			});
   			*/
        }
    },
	
	

	
	beautyPage : {
        init : function() {
            $(document).ready(function(){ 
			
			// Background //
			/*
				$(document).bgStretcher({
					images: [baseurl+'assets/images/backgrounds/ver2012-fondo-beauty.jpg'], imageWidth: 1280, imageHeight: 800
				});
			*/
			
			
			});
        }
    },
    
    energia_positivaPage : {
	    init : function() {
	        $(document).ready(function(){ 
	    	
	    	// Background //
	    		/*
	    			$(document).bgStretcher({
	    				images: [baseurl+'assets/images/backgrounds/ver2012-fondo-beauty.jpg'], imageWidth: 1280, imageHeight: 800
	    			});
	    		*/
	    	
	    	
	    	
	    	});
	    }
    }, 
 
    eauPage : {
        init : function() {
            $(document).ready(function(){ 
				
				
				
			
				// Load theme
				Galleria.loadTheme(baseurl+'assets/scripts/galleria/themes/lookbook2/galleria.lookbook2.js');
				$('#galleria').galleria({
				    image_pan: false,
				    image_position: 'top',
				    image_crop: true,
				    transition: 'fade', 
				    show_info: false,
				    thumbnails: false,
				    showImagenav: false,
				    extend: function(options) {
				    	
				    	// Posicion del Menu info
				    	// *****************************
				    	
				    	var caja = $(".box-content");
				    	var contenedor = $('#galleria .galleria-container.fullscreen');
				    	
				    	function moveit() {
				    		$(caja).position({ 
				    			my: 'center center', 
				    			at: 'center center', 
				    			offset: '-350 0',
				    			of: contenedor 
				    		});
				    	}
				    	$(window).resize(function(){
				    	   moveit(); 
				    	});
				    	
				    	moveit();
				    	
				    
				    }		  		                            
				});
				
			
			
			});
        }
    },

	 fleursPage : {
	        init : function() {
	            $(document).ready(function(){ 
			
					
					// Load theme
					Galleria.loadTheme(baseurl+'assets/scripts/galleria/themes/lookbook2/galleria.lookbook2.js');
					$('#galleria').galleria({
					    image_pan: false,
					    image_position: 'top',
					    image_crop: true,
					    transition: 'fade', 
					    show_info: false,
					    thumbnails: false,
					    showImagenav: false,
					    extend: function(options) {
					    	
					    	// Posicion del Menu info
					    	// *****************************
					    	
					    	var caja = $(".box-content");
					    	var contenedor = $('#galleria .galleria-container.fullscreen');
					    	
					    	function moveit() {
					    		$(caja).position({ 
					    			my: 'center center', 
					    			at: 'center center', 
					    			offset: '-350 0',
					    			of: contenedor 
					    		});
					    	}
					    	$(window).resize(function(){
					    	   moveit(); 
					    	});
					    	
					    	moveit();
					    	
					    
					    }			  		                            
					});
					
					
											
				});
	        }
	    },
	    
	 // RRHH Page
	rrhhPage : {
        init : function() {
            $(document).ready(function(){ 
	
				$('.submitBtn').loading_gif();
				$('.submitBtn').click(function(){
					$(this).find('span').html('Enviando...');
					$(this).attr('disabled', 'true');
				});
				$(document).bgStretcher({
					images: [baseurl+'assets/images/backgrounds/fondo_rrhh.jpg'], imageWidth: 1280, imageHeight: 800
				});
			});
        }
    },
    
    
    // Newsletter Page
    newsletterPage : {
        init : function() {
            $(document).ready(function(){ 
    			
    			// Loading gif
    			$('.submitBtn').loading_gif();
    			$('.submitBtn').click(function(){
					$(this).find('span').html('Enviando...');
			
				});

				/*
    			// Envio del Form Newsletter por AJAX //
    			$('#form-newsletter').ajaxForm({ 
    				beforeSubmit: validateNewsletter,
    				// target identifies the element(s) to update with the server response 
    				target: '#response', 
    					// success identifies the function to invoke when the server response 
    				// has been received; here we apply a fade-in effect to the new content 
    				success: function() { 
    					$('form#form-newsletter').fadeOut('slow');
    					$('#response').fadeIn('slow'); 
    				} 
    			}); 	
    			*/
    			
    					
    			/*
    			$(document).bgStretcher({
    				images: [baseurl+'assets/images/backgrounds/fondo-contacto.jpg'], imageWidth: 1280, imageHeight: 800
    			});
    			*/
    	
    	
    		});
        }
    },
    
	// Contacto Page
	contactoPage : {
        init : function() {
            $(document).ready(function(){ 
				
				// Loading gif
				$('.submitBtn').loading_gif();
				
				// bind form using ajaxForm 
				/*
				$('#form-contacto').ajaxForm({ 
					beforeSubmit: validateContacto,
					// target identifies the element(s) to update with the server response 
					target: '#response', 
					// success identifies the function to invoke when the server response 
					// has been received; here we apply a fade-in effect to the new content 
					success: function() { 
						hidediv('loading');
						$('#response').fadeIn('slow'); 
						$('form').resetForm();
						$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
					} 
	
				});
				*/
				
				// Ajax Submit
				/*
				$('#form_contacto').submit(function(eve){
				        eve.preventDefault();
				        $.ajax({
				        type: 'POST',
				        dataType: 'json',
				        cache: false,
				        url: baseurl+'contacto/process',
				        data: $('#form_contacto').serialize(),
				     	beforeSend: function(){
				     	     $('#form_contacto').append('<h4 class="process"> Processing...</h4>')
				     	},
				     	complete: function(){
				     	     $('#form_contacto .process').remove();       
				     	},
				     	success: function(html){
				     	    
				     	},
				     	error: function(){
				     	         alert('Something major failed');
				     	     }
				   });
				});  
				
				
				$(document).bgStretcher({
					images: [baseurl+'assets/images/backgrounds/fondo-contacto.jpg'], imageWidth: 1280, imageHeight: 800
				});
				*/
				
			});
        }
    },
    
    
    novedadesPage : {
        init : function() {
            $(document).ready(function(){ 
				
				// Youtube videos
				$('#youtubevideos').youTubeChannel({ 
		            userName: 'yagmour', 
		            channel: 'uploads', 
		            hideAuthor: true,
		            numberToDisplay: 3,
		            linksInNewWindow: true,
		            loadingText: "Cargando..."                 
		        });
				
				// Addthis
				/*
				var addThisLoc = (location.href.indexOf('https') == 0 ? 'https://secure.' : 'http://s7') + '.addthis.com/js/250/addthis_widget.js'
				$.ajax({
				   url: addThisLoc,
				   dataType: 'script',
				   success: function(){
				      window.addthis_config = {
				         username: 'yagmour',
				         ui_508_compliant: true,
				         data_track_clickback: true,
				   		 ui_language: "es",
						 ui_open_windows: true,
						 data_ga_property: 'UA-5771494-11'
		  		      };
					  	window.addthis_localize = {
	  					    share_caption: "Compartir",
	  					    email_caption: "Enviar un email a una amiga",
	  					    favorites: "Favoritos", 
	  					    more: "Más..." 
					  };
					  window.addthis_share = {
					    url_transforms : {
					        clean: true
					    }
					  };
					  var articulos = $('.article');
			        	$.each(articulos, function(indice, articulo){
							var noticiaUrl = $(articulo).find('h3 a').attr('href');
							var noticiaTitulo = $(articulo).find('h3 a').text();
							if($(noticiaUrl).length == 0) {
								var noticiaUrl = window.location;								
							}
							var boton = '<div class="addthis_toolbox addthis_default_style" addthis:url="'+ noticiaUrl +'" addthis:title="'+noticiaTitulo+'"><a href="http://addthis.com/bookmark.php?v=250" class="addthis_button_compact">Compartir</a></div>';
						   	$(articulo).find('.share').prepend(boton);
							
							
						});
				   }
				});
   				 */	
				
		  	        			
			});
        }
    },
    
    

	franquiciasPage : {
        init : function() {
            $(document).ready(function(){ 
            
            	// Loading gif
            	$('.submitBtn').loading_gif();
            	
				// bind form using ajaxForm 
				/*
				$('#form-franquicias').ajaxForm({ 
										
					beforeSubmit: validateFranquicias,
					
					// target identifies the element(s) to update with the server response 
					target: '#response', 
			 
					// success identifies the function to invoke when the server response 
					// has been received; here we apply a fade-in effect to the new content 
					success: function() { 
						$('#response').fadeIn('slow'); 
						hidediv('loading');
						$('form').resetForm();
						$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
					} 
				}); 
				
				
				$(document).bgStretcher({
					images: [baseurl+'assets/images/backgrounds/fondo_franquicias.jpg'], imageWidth: 1280, imageHeight: 800
				});
				*/
			});
        }
    },
	
	yagmourPage : {
        init : function() {
        	
        	
        
            $(document).ready(function(){
            					
				
				
				
			});
        }
    },

	facebookBienvenidasPage : {
        init : function() {
        	       
            $(document).ready(function(){
           
					
			});
        }
    },
	
	promosPage : {
	    init : function() {
	    	       
	        $(document).ready(function(){
	        	
	        	var texto = $('.bases p');
	        	var boton = $('#ver-completo');
	        	$('#ver-completo').click(function(){
        			$(texto).toggleClass('cerrado');
        			if ($(this).text() == "Ver texto completo") 
        			{ 
        			   $(this).text("Cerrar"); 
        			} 
        			else 
        			{ 
        			   $(this).text("Ver texto completo"); 
        			}; 
        			return false;
	        	});
	        	
        		
					
			});
	    }
	}
	
}

// end script


// GLOBALES
// ****************************
// Corre en todo el sitio	
$(document).ready(function() {
 
		
	if($.browser.msie) {  } else {	

		// Hover animado sobre el menu principal
		// ****************************************	
		// X IE 8
		
		
		/*
		function menuHover() {
				var color = '#858585';
				var hoverColour = "#191919";
				
				$('#nav li a:not(.disabled):hover').css('color',color);
				$('#nav li a:not(a.selected):not(.disabled)').hover(function(){
					//fade the colour
						$(this).stop()
						.css({"color": color})
						.animate({"color": hoverColour}, 350);
					},function(){
						
						//fade the colour
						$(this).stop()
						.animate({"color": color}, 350);
					});
			}
			// Menu: efecto fade
			menuHover();	
			*/
			
			// Animación del manu desplegable
			// ******************************************
				// @ IE 8: Lento...	
					function makeTall() {	
						$(this).children('.submenu').slideDown(250);
					}
					
					function makeShort() {
						$(this).children('.submenu').fadeOut('normal', function() {
							$(this).hide();
						});
					}
				
				
				// Menu: desplegables			
				//$('#nav li .submenu').append('<div class="tapar"></div>');
				$('#nav li .submenu').hide();
				$('#nav li .submenu').parent('li').removeClass('hover');
				
				var config = {    
				     over: makeTall, // function = onMouseOver callback (REQUIRED)    
				     sensitivity: 2, // number = milliseconds delay before onMouseOut    
				     out: makeShort // function = onMouseOut callback (REQUIRED)    
				};
				$('#nav li .submenu').parent('li').hoverIntent( config );
					
	}; // if IE 
	
		
		// Links desactivados
		// *****************
		$('#nav a.disabled').click(function(){
			return false;
		});
		
	
		// Links externos
		// ***************	
		
		$("a[rel~='external']").live('click', function() {
		  window.open( $(this).attr('href') );
		  return false;
		});
	
			
		
		
		
		// Valor de los campos x defecto
		// ******************************
		
		// Valor de los campos por defecto //
			$('input[type="text"]#search').addClass("idleField");
       		$('input[type="text"]#search').focus(function() {
       			$(this).removeClass("idleField").addClass("focusField");
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    		});
    		$('input[type="text"]#search').blur(function() {
    			$(this).removeClass("focusField").addClass("idleField");
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});
    		
    		
    	// Menu del catalogo
    	// ******************
    	
    	function LoadMagentoMenu() {
	    	var catalogo_menu = '#catalogo-menu .submenu';
	    	var newMenu;
			
	    	$(catalogo_menu).prepend('<ul class="submenu-catalogo">');
	    	$(catalogo_menu + ' .submenu-catalogo').append('<span class="loading"><img src="'+baseurl+'/assets/styles/images/ajax-loader.gif" alt="Cargando..." id="loading" /></span>');
	    	
	
	    	$.ajax({
	    	    url: baseurl+"catalogo/",
	    	    type: "GET",
	    	    dataType: "html",
	       	    success: function(feedback){
	    	       	filtro = $(feedback).find('#nav2');
	    	       	newMenu = ($(filtro).html());
	    	       	$(catalogo_menu + ' .submenu-catalogo').html(newMenu);
					$(catalogo_menu + ' .submenu-catalogo').append('<li class="level0"><a href="'+ baseurl +'catalogo/lookbook/">Look Book</a></li>');
		   	    }
	    	});	
	
	
		};
		
		// Desactivado //
		//LoadMagentoMenu();
		
		
		// Facebook Like TODO el sitio desde el icono del footer
		// ******************************************************
		$('#fb-like-icon').click(function(){
			$(this).toggleClass('active');
			var slider = $('#fb-like-slider');
			$(slider).toggle();
			$(slider).children('.button').html('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yagmour.com.ar%2F&amp;layout=button_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=lucida+grande&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:124px; height:21px;" allowTransparency="true"></iframe>');
			return false;
		});
	
		
		// Facebook Like box en el footer
		// ******************************
		$('#fb-placeholder').append('<div id="fb-like-box" class="block fb-like"><iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FYAGMOUR%2F134795578346&amp;width=292&amp;colorscheme=light&amp;show_faces=false&amp;stream=false&amp;header=false&amp;height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:218px; height:62px;" allowTransparency="true"></iframe></div>');
		
		
		
		
		
		
});	
	


		 
		 
