var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();




/* ------------FGallery for logos1 ------------------   */

$(document).ready(function() {		
	//Execute the slideShow
	slideShow();
		slideShow1();
		slideShow2();
});

function slideShow() {
	//Set the opacity of all images to 0
	$('#logo a').fadeOut('fast', function() {
    //Get the first image and display it (set it to full opacity)
	$('#logo a:first').fadeIn('slow', function() {
    // Animation complete.
  });
  });	
		
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',2000);	
}

function gallery() {	
	//if no IMGs have the show class, grab the first image
	var current = ($('#logo a.show')?  $('#logo a.show') : $('#logo a:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#logo a:first') :current.next()) : $('#logo a:first'));		

	//Hide the current image
	current.fadeOut('fast', function() {
  //Set the fade in effect for the next image, show class has higher z-index
	next.fadeOut('slow', function() {
    // Animation complete.
  })
	.addClass('show')
	.fadeIn('slow', function() {
    // Animation complete.
  });
  })
	.removeClass('show');	
}

/* ------------FGallery for logos2 ------------------   */

function slideShow1() {
	//Set the opacity of all images to 0
	$('#logo1 a').fadeOut('fast', function() {
    //Get the first image and display it (set it to full opacity)
	$('#logo1 a:first').fadeIn('slow', function() {
    // Animation complete.
  });
  });	
		
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery1()',2000);	
}

function gallery1() {	
	//if no IMGs have the show class, grab the first image
	var current = ($('#logo1 a.show')?  $('#logo1 a.show') : $('#logo1 a:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#logo1 a:first') :current.next()) : $('#logo1 a:first'));		

	//Hide the current image
	current.fadeOut('fast', function() {
  //Set the fade in effect for the next image, show class has higher z-index
	next.fadeOut('slow', function() {
    // Animation complete.
  })
	.addClass('show')
	.fadeIn('slow', function() {
    // Animation complete.
  });
  })
	.removeClass('show');	
}

/* ------------FGallery for logos2 ------------------   */

function slideShow2() {
	//Set the opacity of all images to 0
	$('#logo2 a').fadeOut('fast', function() {
    //Get the first image and display it (set it to full opacity)
	$('#logo2 a:first').fadeIn('slow', function() {
    // Animation complete.
  });
  });	
		
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery2()',2000);	
}

function gallery2() {	
	//if no IMGs have the show class, grab the first image
	var current = ($('#logo2 a.show')?  $('#logo2 a.show') : $('#logo2 a:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#logo2 a:first') :current.next()) : $('#logo2 a:first'));		

	//Hide the current image
	current.fadeOut('fast', function() {
  //Set the fade in effect for the next image, show class has higher z-index
	next.fadeOut('slow', function() {
    // Animation complete.
  })
	.addClass('show')
	.fadeIn('slow', function() {
    // Animation complete.
  });
  })
	.removeClass('show');	
}


