var opc=0;
var soundEmbed=null;
 function soundPlay(which)
    {
    if (!soundEmbed)
        {
        soundEmbed = document.createElement("embed");
        soundEmbed.setAttribute("src", "snd/"+which+".mp3");
        soundEmbed.setAttribute("hidden", true);
        soundEmbed.setAttribute("autostart", true);
        }
    else
        {
        document.body.removeChild(soundEmbed);
        soundEmbed.removed = true;
        soundEmbed = null;
        soundEmbed = document.createElement("embed");
        soundEmbed.setAttribute("src", "snd/"+which+".mp3");
        soundEmbed.setAttribute("hidden", true);
        soundEmbed.setAttribute("autostart", true);
        }
    soundEmbed.removed = false;
    document.body.appendChild(soundEmbed);
    }

 
 $(window).load(function(){
 //intro
 
 
  
 $('body').fadeIn(800);
	$('#nav img').animate({
    opacity: 0,
    width: '0', height:'100%'
  }, 1, slideIn);
		
  $('#nav').css('overflow','visible');
  //
  
  //link hover
  $('#nav li.dir ul li').hover(function(){
//  soundPlay('hover');
	$(this).animate({backgroundColor:'#FFCF40'},100);
  },function(){
	$(this).animate({backgroundColor:'#E5E5E5'},150);
  });
  $('#nav li li').fadeTo('fast','0.94');
  //
  
  
  //image hover
  $('#nav img').hover(function(){
	$(this).fadeTo('fast','0.6').fadeTo('1','1');
	},function(){
	
	$(this).stop().animate({width:'100%', opacity:'1'},'fast');
  });
  
  //
  
  
 });
  
 function slideIn(){
 if(!opc){
  	$("img[alt='Services']").animate({opacity:(++opc)/8,width:'100%'},960);
	$("img[alt='Locations']").animate({opacity:(++opc)/8,width:'100%'},960);
	$("img[alt='Insurance']").animate({opacity:(++opc)/8,width:'100%'},1060);
	$("img[alt='Products']").animate({opacity:(++opc)/8,width:'100%'},1160);
	$("img[alt='About']").animate({opacity:(++opc)/8,width:'100%'},1260);
	$("img[alt='Contact']").animate({opacity:(++opc)/8,width:'100%'},1360);
		}
	$(this).animate({opacity:1},450);return;
	
}
