/*!
 * Misc scripts for Irish Design Shop
 */


// Mobile Search (show/hide)
			$(document).ready(function() {
			 // hides the search field as soon as the DOM is ready
			 $('#search').hide();
			  
			   // shows the search and focusses the cursor on clicking the noted link  
			  $('.show-search').click(function() {
			    $('#search').fadeToggle(100, "linear");
			    $('._txt-mobile').focus();
			    return false;
			  });
			  
			   // hides the search on clicking the noted link  
			  $('.search-close').click(function() {
			    $('#search').fadeOut(150, "linear");
			    return false;
			  });
			    
			});
			
			$(document.documentElement).keyup(function (event) {
			  // handle cursor keys
			  if (event.keyCode == 27) {
			    $('#search').fadeOut(150, "linear");
			
			  }
			});




// Product Search Make Value Text Disappear on click
				$(function(){
					$('._txt','#menu-search')
						.bind('click',function(){$(this).val('');})
						.bind('blur',function(){
							var a = $(this);
							if(a.val() == ''){
								a.val('Search Products');
							}
					});
				});




// Mailing List Make Value Text Disappear on click
				$(function(){
					$('._txt','#email_updates')
						.bind('click',function(){$(this).val('');})
						.bind('blur',function(){
							var a = $(this);
							if(a.val() == ''){
								a.val('Join Our Mailing List');
							}
					});
				});
				
				
				
//Smooth Scroll to top of page from footer
var jump=function(e)
{
       //prevent the "normal" behaviour which would be a "hard" jump
       e.preventDefault();
       //Get the target
       var target = $(this).attr("href");
       //perform animated scrolling
       $('html,body').animate(
       {
               //get top-position of target-element and set it as scroll target
               scrollTop: $(target).offset(0).top
       //scrolldelay: 1 seconds
       },500,function()
       {
               //attach the hash (#jumptarget) to the pageurl
               location.hash = target;
       });

}

$(document).ready(function()
{
       $('a[href*=#]').bind("click", jump);
       return false;
});


