jQuery.noConflict();


function centerPage(){
	viewportWidth = jQuery(window).width();
	if(viewportWidth < 1198){
		xPosition = (1198 - viewportWidth) / 2;
		if(xPosition > 108) xPosition = 108;
		window.scrollTo(xPosition, 0)	
	}
}
/* Product selector for accesories */

var productURL = new Array("home-productos-0090489999U81ORANGE.png","home-productos-0082659999U17NAVY.png","home-productos-0082629999U17PURPLE.png","home-productos-03240H0898030.png","home-productos-0081559999U17NAVY.png","home-productos-01308H0179030.png","home-productos-0032450800004.png","home-productos-0090479999U81WHITE.png","home-productos-0082699999U17GREY.png","home-productos-0082619999U17FUCSIA.png");
var productName = new Array("TERMO RS21","BOLSO TRAVELER","BOLSO CANDY","RACING BOOT MEN RS21","MORRAL LEONEYE","NEW FRIXION RS21","MILENIUM LADY RS21","TERMO BIG RS21","BOLSO NEW BUSINESS","BOLSO HONEY");
var productBrand = new Array("RS21 PRO","RS21","RS21","RS21","RS21","RS21 PRO","RS21","RS21 PRO","RS21","RS21");
var productLink = new Array("../catalogo/rs21-unisex-termo-rs21-orange-5566.html","../catalogo/rs21-unisex-bolso-traveler-purple-5538.html","../catalogo/rs21-ellas-bolso-candy-black-5523.html","../catalogo/rs21-raicing-boot-men-rs21-navy-7112.html","../catalogo/rs21-unisex-morral-leoneye-orange-5456.html","../catalogo/rs21pro-new-frixion-rs21-navy-6000.html","../catalogo/rs21-molenium-lady-rs21-fucsia-7527.html","../catalogo/rs21-unisex-termo-big-rs21-white-5563.html","../catalogo/rs21-unisex-bolso-new-business-blue-5552.html","../catalogo/rs21-ellas-bolso-honey-purple-5518.html");

jQuery(document).ready(function () {
	centerPage();
	jQuery(window).resize(function() {
		centerPage();				  
	});
	
	jQuery(".ellos").hoverIntent( openMegaMenu1, closeMegaMenu1 );
	jQuery(".ellas").hoverIntent( openMegaMenu2, closeMegaMenu2 );
	jQuery(".kids").hoverIntent( openMegaMenu3, closeMegaMenu3 );
	jQuery(".social").hoverIntent( openMegaMenu4, closeMegaMenu4 );
	
	jQuery("#ProductImage").html('<a href="'+productLink[0]+'"><img src="../skin/frontend/rs21/master/images/'+productURL[0]+'" alt="" /></a>'); 
	jQuery("#ProductLabel").text(productName[0]);
	jQuery("#ProductBrand").text(productBrand[0]);
	currentPos = 0;
	numProducts = productURL.length - 1;
	
	jQuery("#leftArrow").click(function() {
		if((currentPos-1)<0) {
			currentPos=numProducts;
		} else {
			currentPos--;	
		}
		jQuery("#ProductImage").html('<a href="'+productLink[currentPos]+'"><img src="../skin/frontend/rs21/master/images/'+productURL[currentPos]+'" alt="" /></a>').fadeIn(1000); 
		jQuery("#ProductLabel").html(productName[currentPos]);
		jQuery("#ProductBrand").html(productBrand[currentPos]); 
	});
	jQuery("#rightArrow").click(function() {
		if((currentPos+1)>numProducts) {
			currentPos=0;
		} else {
			currentPos++;	
		}
		jQuery("#ProductImage").html('<a href="'+productLink[currentPos]+'"><img src="../skin/frontend/rs21/master/images/'+productURL[currentPos]+'" alt="" /></a>').fadeIn(1000); 
		jQuery("#ProductLabel").html(productName[currentPos]);
		jQuery("#ProductBrand").html(productBrand[currentPos]); 
	});
	
	jQuery('#VideoClose').click(function() {
  		jQuery('#Overlay').fadeOut(400);
		jQuery(".youtubePlayer").attr('src', '');
	});
	
});

jQuery(window).load(function() {
	jQuery('#Hero').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500, //Slide transition speed
		pauseTime:11000,
		startSlide:0, //Set starting Slide (0 index)
		controlNav:false,
		directionNav:false, //Next & Prev
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:false //Stop animation while hovering
	});
});

/* Functions to open and close mega menus */
function openMegaMenu1() {
	jQuery("#Dropdown1").slideDown(400);	
}
function closeMegaMenu1() {
	jQuery("#Dropdown1").slideUp(300);	
}
function openMegaMenu2() {
	jQuery("#Dropdown2").slideDown(400);	
}
function closeMegaMenu2() {
	jQuery("#Dropdown2").slideUp(300);	
}
function openMegaMenu3() {
	jQuery("#Dropdown3").slideDown(400);	
}
function closeMegaMenu3() {
	jQuery("#Dropdown3").slideUp(300);	
}
function openMegaMenu4() {
	jQuery("#Dropdown4").slideDown(400);	
}
function closeMegaMenu4() {
	jQuery("#Dropdown4").slideUp(300);	
}

function showVideo(url){
	jQuery(".youtubePlayer").attr('src', url);
	jQuery("#Overlay").fadeIn(400);	
}


