// Load the classic theme
Galleria.loadTheme('css/galleria.classic.js');


if (window.addEventListener) // W3C standard
{
  window.addEventListener('load', function() {
			// Initialize Galleria
			jQuery('#galleria').galleria({
				preload: 3,
				transition: 'fade',
				imageCrop: true,
				showInfo: false,
				showCounter: false,
				showImagenav: false,
				thumbnails: false,
				autoplay: 5000,
				imageCrop: 'width',
				imagePosition: 'top'
			});
	}, false); // NB **not** 'onload'
}else if (window.attachEvent) // Microsoft
{
			  window.attachEvent('onload', function() {
			// Initialize Galleria
			jQuery('#galleria').galleria({
				preload: 3,
				transition: 'fade',
				imageCrop: true,
				showInfo: false,
				showCounter: false,
				showImagenav: false,
				thumbnails: false,
				autoplay: 5000,
				imageCrop: 'width',
				imagePosition: 'top'
			});
	});
}

function showToggle(idNum){
	if (document.getElementById){ 
		obj = document.getElementById(idNum); 
		
		if (obj.style.display == "none"){ 
			obj.style.display = ""; 
		} 
		//nav.click(idNum);
	} 
}
function showToggle2(idNum){
	if (document.getElementById){ 
		obj = document.getElementById(idNum); 
		
		if (obj.style.display == ""){ 
			obj.style.display = "none"; 
		}
		//nav.click(idNum);
	} 
}

function createHoverAnimation(hoverID,containerID,animationUp,animationDown,animationSpeed,outTimeout,inTimeout){
	//reference to the current object, no conflict with jQuery's this.
	var cc = this;
	//cc.i=0;
	cc.data = setTimeout(function(){},50000);
	cc.data1 = setTimeout(function(){},50000);
	cc.inf=false;
	cc.animationSpeed = 350;
	cc.hoverID = hoverID;
	cc.containerID = containerID;
	cc.animationD = 'easeOutSine';
	cc.animationU = 'easeInSine';
	cc.outTimeout = 650;
	cc.inTimeout = 450;
	if(outTimeout != null){cc.outTimeout = outTimeout;}
	if(animationUp != null){cc.animationU = animationUp;}
	if(animationDown != null){cc.animationD = animationDown;}
	if(animationSpeed != null){cc.animationSpeed = animationSpeed;}
	if(inTimeout != null){cc.inTimeout = inTimeout;}

	cc.closeElement = function(){
		if(cc.inf == false){
			jQuery('#'+cc.containerID).slideUp(cc.animationSpeed,cc.animationU, function() {});	
		}
		cc.inf = false;
	};
	
	cc.OpenElement = function(){
		jQuery('#'+cc.containerID).slideDown(cc.animationSpeed,cc.animationD,function() {});
	};
		
		jQuery('#'+cc.hoverID).mouseenter(function() {
			cc.inf = true;
			clearTimeout(cc.data);
			cc.data1=setTimeout(cc.OpenElement,cc.inTimeout);
		});
		
		jQuery('#'+cc.hoverID).mouseleave(function() {
			clearTimeout(cc.data1);
			cc.inf = false;
			cc.data=setTimeout(cc.closeElement,cc.outTimeout);
		});
		
		jQuery('#'+cc.containerID).mouseenter(function() {cc.inf = true;});
		
		jQuery('#'+cc.containerID).mouseleave(function() {
			cc.inf = false;
			cc.data=setTimeout(cc.closeElement,cc.outTimeout);
		});
	}
