$(document).ready(function(){
	
	$.fn.qtip.styles.resultsTip = { 
      width: 430,
      padding: 15, 
      background: '#e0e0e0',
      color: 'black',
      border: {
         width: 4,
         radius: 4,
         color: '#502900'
      },
      name: 'dark' // Inherit the rest of the attributes from the preset dark style
   };
   
   $.fn.qtip.styles.statusTip = { 
	  width: 250,
	  padding: 5,
	  background: '#502900',
	  color: 'white',
	  textAlign: 'center',
	   border: {
		 width: 7,
		 radius: 5,
		 color: '#502900'
	  },
	  tip: 'bottomMiddle',
	  name: 'dark' // Inherit the rest of the attributes from the preset dark style
   };
	
	$('.results li a span img').each(function(){
				  
		$(this).qtip({
			content: { 
				text: $(this).parent().parent().parent().children('.rollOverContent').html() 
			},
			style: 'resultsTip',
			show: {		        
				solo: true 
		    },		
			position: { 
				adjust:{
					screen:true
				},
				corner: {
					target: 'rightTop'
				}
				
			}
			
		});
	});
	
	/*more link show content */
	$('.moreLink').click(function(event){
		$(this).hide();
		$(this).parent().next().children('.more').show('fast');
	});
	
	/* Notify Me */
//	$('#saveSearch').show();
//	$('#saveSearch').click(function(event){
//		$('#saveSearch .form').show();
//		$('#saveSearch').addClass("thankyou");
//	});
	$('#saveSearch .email').click(function(event){
		if($('#saveSearch .email').val() == "Your E-mail address"){
			$('#saveSearch .email').val("");
		}
	});
	

	/*
	$('.saveSearch_notLoggedIn img').qtip({
		content: '<span class="loginTip">Oops, you have not logged in yet. Please <a href="registration.html">log-in</a> or <a href="registration.html">register</a> for a Petango account.</span>',
		style: 'statusTip',
		show: {
			delay:0,
			when:'click',
			effect:{length:50}
		},
		hide: {delay:15000},
		position: {
		adjust:{x:20},
			corner: {
				target: 'middleRight',
				tooltip: 'middleLeft'
			}
		}
	});
	$('.saveSearch_notLoggedIn img').click(function(){return false});
	*/
	
	var registerLink = $('.registerLink a').attr('href');
	var loginLink = $('.loginLink a').attr('href');
	
	$('.addToFavorites_notLoggedIn').qtip({
		content: '<span class="loginTip">Hi, please <a href="'+loginLink+'">log-in</a> or <a href="'+registerLink+'">register</a> so we can add this pet to your list of favorites.</span>',
		style: 'statusTip',
		show: {    
			solo: true },		
		hide: {
			delay:1000
		},
		position: {	
			corner: {
				target: 'topMiddle',
				tooltip: 'bottomMiddle'
			}
		}
	});
	$('.addToFavorites_notLoggedIn').click(function(){return false});

});

