var allowMenu = 0;
$(document).ready(function(){
		
		$('.btn_home').bind('click',function(){ return false});
		
		$('.splashnav').hover(
					function(){
						var a = $(this);
						var b = a.attr('id');
						if(a.attr('src').indexOf('_on.png') == -1){
							allowMenu = 1;
							a.attr('src',theme+'/images/'+b+'_over.png');
						}else{
							allowMenu = 0;
						}
					},
					function(){
						if(allowMenu == 1){
							var a = $(this);
							var b = a.attr('id');
							a.attr('src',theme+'/images/'+b+'.png');
						}
					}).bind('click',function(){
						allowMenu = 0;
						if(selectedMenu != ''){
							// THIS IS A SECOND CLICK
							var a = $(this);
							var b = a.attr('id');
							
							if(selectedMenu == b){
								window.location = a.metadata().target;
							}else{
								var tmp = selectedMenu.split('_');
								$('#btn_'+tmp[1]).attr('src',theme+'/images/btn_'+tmp[1]+'.png');
								$('.pop_'+tmp[1]).hide('slide',{direction:'up'},500,function(){
																		$('.pop_'+tmp[1]).css({'height':0});
																		selectedMenu = b;
																		a.attr('src',theme+'/images/'+b+'_on.png');
																		var c = b.split('_');
																		$('.pop_'+c[1]).animate({height: 228 },400,'easeOutBounce');
																	});
							}
						}else{
							// THIS IS THE FIRST CLICK ON ANY 
							// OF THE MAIN ITEMS
							var a = $(this);
							var b = a.attr('id');
							selectedMenu = b;
							a.attr('src',theme+'/images/'+b+'_on.png');
							var c = b.split('_');
							$('.pop_'+c[1]).animate({height: 228 },400,'easeOutBounce');
						}
						
						
					}); 
		$('.closeX').bind('click',function(){
													var a = $(this);
													var b = a.attr('id');
													var tmp = selectedMenu.split('_');
													$('.pop_'+tmp[1]).hide('slide',{direction:'up'},500,function(){
																												 $('#btn_'+tmp[1]).attr('src',theme+'/images/btn_'+tmp[1]+'.png');
																												 });
													selectedMenu = '';
													return false
												});
		/*
	
		$('.btn_dropdown').bind('click',function(){
														var num = $(this).metadata().num;
														var a = $('#ddropdown'+num).css('height');
														if(a.indexOf('365') != -1){
															$(this).attr('src',theme+'/images/btn_dropdown.jpg');
															$('#ddropdown'+num).animate({height: 0 },500);
														}else{
															$(this).attr('src',theme+'/images/btn_rollup.gif');
															$('#ddropdown'+num).animate({height: 365 },1000,'easeOutBounce');
														}
													});
		*/
	
});

/* FUNCTION FOR CLOSING THE FOOTER DRWAERS */

	var selectedMenu = '';
			
