﻿$(document).ready(function() {  
     //sliders       
    $(".slide_slider").each(function(){
       $(this).attr("rel",$(this).children(".inner_con").height()+20);
       $(this).animate({ height: "80px" }, 50);
    });  
            
    $("#slider01").css("background-image","url('images/winter_feature_reduced_top.jpg')");
    $("#slider02").css("background-image","url('images/summer_feature_reduced_top.jpg')");
    $("#slider03").css("background-image","url('images/alps_feature_reduced_top.jpg')");
    $("#slider01 .inner_con p").css("display","none");
    $("#slider02 .inner_con p").css("display","none");
    $("#slider03 .inner_con p").css("display","none");
    
    $(".slide_slider").mouseenter(function() {
        $(this).animate({ height: $(this).attr("rel") + "px" }, 250);
    }
   );

    $(".slide_slider").mouseleave(function() {
        $(this).animate({ height: "80px" }, 250);
    }
   );
   
   //conditions blog (retreive feed)
   $.get("blogFeed.asp",function(d){ 
       $("#conditions_blog_top").children(0).before(d);
   });
    
   //testimonials
   $("#quote_box_top").children(0).before("<ul><li><a id=\"prev\" href=\"JavaScript:void(0);\">Prev</a></li><li><a id=\"next\" href=\"JavaScript:void(0);\">Next</a></li></ul>");
   $("#prev").live("click",function(){
        $("#hotscot_quote").fadeOut(500,function(){
             $.get("randomTestimonial.asp?dir=prev&cache=" + Math.random(),function(d){ 
             $("#hotscot_quote").html(d);
             $("#hotscot_quote").fadeIn(500);                     
        });
       });
   });
   $("#next").live("click",function(){
        $("#hotscot_quote").fadeOut(500,function(){
             $.get("randomTestimonial.asp?dir=next&cache=" + Math.random(),function(d){ 
             $("#hotscot_quote").html(d);
             $("#hotscot_quote").fadeIn(500);                     
        });
       });
   });
   $("#hotscot_quote_wraper").mouseenter(function(){
        $(this).children("#hotscot_quote").children("p").attr("rel",$(this).children("#hotscot_quote").html());
        $(this).children("#hotscot_quote").children("p").html($(this).children("#hotscot_quote").children("p").attr("title"));
        $(this).animate({height:$(this).children("#hotscot_quote").children("p").height()  + "px"},250);
    });
    
    $("#hotscot_quote_wraper").mouseleave(function(){
        $(this).children("#hotscot_quote").html($(this).children("#hotscot_quote").children("p").attr("rel"));
        $(this).animate({height:"150px"},250);
    });

   //add alt title about this picture box
   $("#header_overlay").append("<div id=\"about_this_photo\"><a href=\"JavaScript:showImgAbout();\">^ About this Photo</a></div>");
   
   //lightbox plugin initiate picture popups
   if($("a.hotscotPop").length>0){
   $("a.hotscotPop").lightBox();
   }
});

function showImgAbout(){
    if($("#about_this_photo a").html()!="^ About this Photo"){
        $("#about_this_photo p").remove();
        $("#about_this_photo").removeClass("about_this_photo");
        $("#about_this_photo a").html("^ About this Photo");
    }else{
        $("#about_this_photo").addClass("about_this_photo");
        $("#about_this_photo").append("<p>" + $("#header_overlay").next("img").attr("title") + "</p>");
        $("#about_this_photo a").html("<img src=\"images/aboutBoxClose.png\" border=\"0\" />"); 
    }
}