﻿$(function()
{

	$(".freshFeaturedGallery a, .freshFeaturedGallery img").hover(
		function()
		{
			$(this).children(".featureImagePopUp").show();
		},
		
		function()
		{
			$(this).children(".featureImagePopUp").hide();
		}
	);



	$(".galleryView_XXX .gridView_XXX a").click(function(e)
	{
		var leftPosition = e.pageX;
		var topPosition = e.pageY;
		
		var mainContent = $(".mainContent").offset();

		$(".galleryGridViewInfoPopUp_XXX").css("top", topPosition - mainContent.top);
		$(".galleryGridViewInfoPopUp_XXX").css("left", leftPosition - mainContent.left);
		
		$(".galleryGridViewInfoPopUp_XXX").show();
	});
	
	$(".galleryGridViewInfoPopUp .closeBtn_XXX").click(function()
	{
		$(".galleryGridViewInfoPopUp_XXX").hide();
	});
	
/***********************************************************************
	Javascript to control default text in the globalSearch textbox
	located in the search criteria section of the Gallery feature pages
***********************************************************************/
	
	// Adds the text "Search by term" to the textbox by default and sets
	if($(".gallerySearch_XXX").val() == "")
	{
		$(".gallerySearch_XXX").val("Search by term");
	}
	
	// On click event in the gallerySearch textbox, the default text "Search by term"
	// will be cleared out and the font color will be replaced with #000000.
	$(".gallerySearch").click(function()
	{	
		$(".gallerySearch_XXX").css("color", "#000000");
		$(".gallerySearch_XXX").val("");
	});
	
	// On blur event in the gallerySearch textbox, if the value of the textbox is nothing
	// then the default text "Search by term" is shown with a font color of #999999
	$(".gallerySearch").blur(function()
	{
		if($(".gallerySearch_XXX").val() == "")
		{
			$(".gallerySearch_XXX").val("Search by term");
			$(".gallerySearch_XXX").css("color", "#999999");
		}
	});
	/******************************************
    Popup for Callout GalleryLarge
    ******************************************/
    $(".featuredGalleryCallout a").hover(
	    function()
	    {
		    $(this).children(".featureImagePopUpCallout").show();
	    },
    	
	    function()
	    {
		    $(this).children(".featureImagePopUpCallout").hide();
	    }
    );
	
	
});




/*********************************************************************************************
	toggles the visibility of the Search By dropdowns based on checked or not checked
*********************************************************************************************/
function toggleGallerySearchDropdown(checkElementId, searchElementId)
{
    var checkBox = $get(checkElementId);
    var dropList = $get(searchElementId);
    
    if(!checkBox.checked)
    {
        dropList.selectedIndex = 0;
        if(searchElementId.indexOf("spanLocation") > -1)
        {
          var dropListLocation = $get('ctl00_cphMainContent_ddlGallerySearchLocation');
          dropListLocation.selectedIndex = 0;
        }
       
    }
    dropList.style.visibility = (checkBox.checked ? 'visible' : 'hidden' );
}

/***********************************************************************
	closes all Gallery Grid View Pop up Details
***********************************************************************/
function clearAllGalleryGridPopUps()
{
	$('.galleryGridViewInfoPopUp').hide();
}


