jQuery(function() {

// Home page javascript, this basically just takes the hair link process it
// and 

// Services pages javascript, both for html replacement and menu effects

  //When the customer clicks on the skin menu,
  //make sure to expand the skin menu and show
  //the skin information.
  $('#skin').mouseover(function(e){
      $('#hairmenu').hide();
      $('#skinmenu').toggle();
      $('#services_info').load("services/skin.html");
      return false;
  });

  //When Facials is clicked, load up the facials.html.
  $('#facials').mouseover(function(e){
      $('#services_info').load("services/facials.html");
      return false;
  });

  //When Targeted Facials is clicked, load up the targeted.html.
  $('#targeted').mouseover(function(e){
      $('#services_info').load("services/targeted.html");
      return false;
  });

  //When Targeted Facials is clicked, load up the targeted.html.
  $('#microzone').mouseover(function(e){
      $('#services_info').load("services/microzone.html");
      return false;
  });
  
  $('#hair').mouseover(function(e){
      $('#skinmenu').hide();
      $('#hairmenu').toggle();
      $('#services_info').load("services/hair.html");
      return false;
  });

  $('#hairlink').click(function(e){
      
      $.load("services.html", 
		function(){
			$(response).find('#services_info').load("services/hair.html");
		} 
      );
     $.find('html').load(response);
     return false;
  });

  $('#keratin').mouseover(function(e){
      $('#services_info').load("services/keratin.html");
      return false;
  });

  $('#extensions').mouseover(function(e){
      $('#services_info').load("services/extensions.html");
      return false;
  });

  $('#nails').mouseover(function(e){
      $('#services_info').load("services/nails.html");
      return false;
  });

  $('#bronzing').mouseover(function(e){
      $('#services_info').load("services/bronzing.html");
      return false;
  });

  $('#makeup').mouseover(function(e){
      $('#services_info').load("services/makeup.html");
      return false;
  });

  $('#waxing').mouseover(function(e){
      $('#services_info').load("services/waxing.html");
      return false;
  });

  $('#eyelash').mouseover(function(e){
      $('#services_info').load("services/eyelash.html");
      return false;
  });

  
  $('#comp').mouseover(function(e){
      $('#services_info').load("services/comp.html");
      return false;
  });

// END SERVICES PAGE JAVASCRIPT

// About page Javascript for text replacement

  $('#denise').click(function(e){
    $('#aboutus').load("about/denise.html");
    return false;
  });
  
  $('#denisemakeup').click(function(e){
    $('#aboutus').load("about/denise.html");
    return false;
  });

  $('#kathy').click(function(e){
    $('#aboutus').load("about/kathy.html");
    return false;

  });

  $('#leeann').click(function(e){
    $('#aboutus').load("about/leeann.html");
    return false;
  });

  $('#lyn').click(function(e){
    $('#aboutus').load("about/lyn.html");
    return false;

  });

  $('#lynnails').click(function(e){
    $('#aboutus').load("about/lyn.html");
    return false;

  });

  $('#giannab').click(function(e){
    $('#aboutus').load("about/giannab.html");
    return false;

  });

  $('#lyza').click(function(e){
    $('#aboutus').load("about/lyza.html");
    return false;

  });
  
  $('#cheryl').click(function(e){
    $('#aboutus').load("about/cheryl.html");
    return false;
  });

  $('#giannam').click(function(e){
    $('#aboutus').load("about/giannam.html");
    return false;
  });

  $('#lena').click(function(e){
    $('#aboutus').load("about/lena.html");
    return false;
  });

  $('#brittanymakeup').click(function(e){
    $('#aboutus').load("about/brittany.html");
    return false;
  });

    $('#brittany').click(function(e){
    $('#aboutus').load("about/brittany.html");
    return false;
  });
  $('#amanda').click(function(e){
    $('#aboutus').load("about/amanda.html");
    return false;
  });
  
  $('#amandamakeup').click(function(e){
    $('#aboutus').load("about/amanda.html");
    return false;
  });
  $('#donna').click(function(e){
    $('#aboutus').load("about/donna.html");
    return false;
  });
  
  $('#donnamakeup').click(function(e){
    $('#aboutus').load("about/donna.html");
    return false;
  });
// END ABOUT PAGE JAVASCRIPT

// BRIDAL PAGE HTML REPLACMENT

  $('#hairbridal').click(function(e){
    $('#bridalabout').load("bridal/hair.html");
    $('#change_column').css("padding", "0px 0px 0px 20px");
    return false;
  });

  $('#skinbridal').click(function(e){
    $('#bridalabout').load("bridal/skin.html");
    $('#change_column').css("padding", "0px 0px 0px 60px");
    return false;
  });

  $('#nailsbridal').click(function(e){
    $('#bridalabout').load("bridal/nails.html");
    $('#change_column').css("padding", "0px 0px 0px 60px");
    return false;
  });

  $('#makeupbridal').click(function(e){
    $('#bridalabout').load("bridal/makeup.html");
    $('#change_column').css("padding", "0px 0px 0px 20px");
    return false;
  });
  
// END BRIDAL PAGE JAVASCRIPT

// Products Page JAVASCRIPT
   
  $('#janeiredale').click(function(e){
    $('#productsabout').load("products/janeiredale.html");
    return false;
  });

  $('#dinair').click(function(e){
    $('#productsabout').load("products/dinair.html");
    return false;
  });

  $('#dermalogica').click(function(e){
    $('#productsabout').load("products/dermalogica.html");
    return false;
  });

  $('#keratin').click(function(e){
    $('#productsabout').load("products/keratin.html");
    return false;
  });

  $('#o2cosmetics').click(function(e){
    $('#productsabout').load("products/o2cosmetics.html");
    return false;
  });

  $('#neo').click(function(e){
    $('#productsabout').load("products/neo.html");
    return false;
  });
  
  $('#swancreek').click(function(e){
    $('#productsabout').load("products/swancreek.html");
    return false;
  });
  
// End Products Page Javascript

  $(".fadeInOut").mouseover(function () {
      $(this).fadeOut(200,function(){$(this).fadeIn(200)});
  });


  
});

//START PAGEANT PAGE JAVASCRIPT//

$(document).ready(function() {     
     
    //Execute the slideShow
    slideShow();
 
});
 
function slideShow() {
 
    //Set the opacity of all images to 0
    $('#gallery a').css({opacity: 0.0});
     
    //Get the first image and display it (set it to full opacity)
    $('#gallery a:first').css({opacity: 1.0});
     
    //Set the caption background to semi-transparent
    $('#gallery .caption').css({opacity: 0.7});
 
    //Resize the width of the caption according to the image width
    $('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
     
    //Get the caption of the first image from REL attribute and display it
    $('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
    .animate({opacity: 0.7}, 400);
     
    //Call the gallery function to run the slideshow, 6000 = change to next image after 5 seconds
    setInterval('gallery()',5000);
     
}
 
function gallery() {
     
    //if no IMGs have the show class, grab the first image
    var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery 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'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));  
     
    //Get next image caption
    var caption = next.find('img').attr('rel');
     
    //Set the fade in effect for the next image, show class has higher z-index
    next.css({opacity: 0.0})
    .addClass('show')
    .animate({opacity: 1.0}, 1000);
 
    //Hide the current image
    current.animate({opacity: 0.0}, 1000)
    .removeClass('show');
     
    //Set the opacity to 0 and height to 1px
    $('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });
     
    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
    $('#gallery .caption').animate({opacity: 0.7},40 ).animate({height: '40px'},500 );
     
    //Display the content
    $('#gallery .content').html(caption);
         
}
//END PAGEANT JAVASCRIPT//

