﻿//jquery      
$(document).ready(function() {

    // hides the slickbox as soon as the DOM is ready
    $('#searchoptions').hide();
        
    // hides the slickbox on clicking the noted link
    $('a#hide').click(function() {
    $('#searchoptions').hide(400);
    $('#Search_Options').attr("src", "images/btn_search_options.png") 
    $('#ctl00_Search_txtSearchOptions').val("") 
    $('#ctl00_ctl00_Search_txtSearchOptions').val("") 


    return false;
    });
    
    // toggles the slickbox on clicking the noted link
    $('a#show').click(function() {
    $('#searchoptions').show(400);
    $('#Search_Options').attr("src", "images/btn_search_options_on.png") 
    $('#ctl00_Search_txtSearchOptions').val("true") 
    $('#ctl00_ctl00_Search_txtSearchOptions').val("true") 

    return false;
    });
          
  

    //toggles slickbox on the photo_closeup enhancelicense help div
    $('h3.PhotoCloseupShowEnhancedLicenseHelp').click(function() {

    if( $('img.PhotoCloseupShowEnhancedBul').attr("src") == "Images/bul_green.gif"){
        $('h3.PhotoCloseupShowEnhancedLicenseHelp').removeClass('helpHidden').addClass('helpShown');
        $('img.PhotoCloseupShowEnhancedBul').attr("src", "Images/bul_white_on.gif");
    }
    else{
        $('h3.PhotoCloseupShowEnhancedLicenseHelp').removeClass('helpShown').addClass('helpHidden')
        $('img.PhotoCloseupShowEnhancedBul').attr("src", "Images/bul_green.gif");
    } 
                    
    $('#Photo_CloseUpEnhancedLicenseHelp').toggle('fast');
    return false;
    }); 
    
//the listed code

        
$(".rollover").hover(
	function(){
		if($(this).attr("src").indexOf("-hover") == -1) {
			var newSrc = $(this).attr("src").replace(".png","-hover.png#hover");
			$(this).attr("src",newSrc);
		}
	},
	function(){
		if($(this).attr("src").indexOf("-hover.png#hover") != -1) {
			var oldSrc = $(this).attr("src").replace("-hover.png#hover",".png");
			$(this).attr("src",oldSrc);
		}
	}
);

    
  
});
      
//Searchbor size picker
function selectsize(size, control) {
    var myArray = getElementsByClassName(document, 'img', 'imgSizes');
    for ( var i=myArray.length-1; i>=0; --i ){
      myArray[i].style.border = "solid 2px #FFF";
    }
    if (document.getElementById("ctl00_Search_txtOrientation")) {     
        document.getElementById("ctl00_Search_txtOrientation").value = size;
    }
    if (document.getElementById("ctl00_ctl00_Search_txtOrientation")) {     
        document.getElementById("ctl00_ctl00_Search_txtOrientation").value = size;
    }
    document.getElementById(control).style.border = "solid 2px #000";
}

//Searchbar colorpicker
function selectcolor(col, control) {
    var myArray = getElementsByClassName(document, 'td', 'swatch');
    for ( var i=myArray.length-1; i>=0; --i ){
      myArray[i].style.border = "solid 1px #d9d9d9";
      //myArray[i].style.border = "none";
    }
    
    if (document.getElementById("ctl00_Search_txtColor")) {     
        document.getElementById("ctl00_Search_txtColor").value = col;
    }
    if (document.getElementById("ctl00_ctl00_Search_txtColor")) {     
        document.getElementById("ctl00_ctl00_Search_txtColor").value = col;
    }
    document.getElementById(control).style.border = "solid 1px #000";
}
