jQuery(document).ready(function(){

	//Navigation active highlight
	jQuery('li.current_page_item').parents('.nav > li').addClass('current_page_item');
	jQuery('li.current-cat').parents('.nav > li').addClass('current-cat');
	
	//Validate Number Fields
	jQuery('.validate_number').each(function (){
		//when key is pressed in the textbox
		jQuery(this).keypress(function (e) {
			//if the letter is not digit then display error and don't type anything
			if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)) {
				//display error message
				return false;
			}
		});
	});
	
	
	jQuery('#loopedSlider.gallery div.container div.slides div a.thickbox').each(function(){
	
		jQuery(this).mouseenter(function(){
			
			if (jQuery(this).find('div.gallery-hover').length > 0){
				//do nothing
			} else {
				var adddiv = jQuery('<div>').addClass('gallery-hover');
				jQuery(this).append(adddiv);
			}
		});
		
		jQuery(this).mouseleave(function(){
			
			//kill it
			if (jQuery(this).find('div.gallery-hover').length > 0){
				jQuery(this).find('div.gallery-hover').remove();
			} else {
				//do nothing
			}
			
		});
		
		
	});
	
	jQuery('.contact .agent-popup').hide();
		
		
		jQuery('#single-meta .contact span').click(function(){
			
			jQuery('.contact .agent-popup').toggle();
			
		});
	
});