$(document).ready(function() {		
	// Navigation menu
	function mainmenu(){
		$('ul#navMenu li').hover(function(){
		$(this).find('ul:first').show();
		},function(){
		$(this).find('ul:first').hide();
		});
	}	
	mainmenu();
	
	// Print page
	$('#printPage').click(function() {
		window.print();
	});
		
	// Remove from cart confirm
	$('.removeConfirm').click(function() {
		 var response = confirm('Are you sure you want to remove this item from your cart?');
		 if (response) { return true }
		 else { return false }
	});
	
	// Delete confirm
	$('.deleteConfirm').click(function() {
		 var response = confirm('Are you sure you want to cancel?');
		 if (response) { return true }
		 else { return false }
	});
	
	// Add class to last of list
	$('.postingPreviews li:last-child').addClass('lastItem');
	
	// Zebra stripe tables
	$('table tr:nth-child(odd)').addClass('odd');
	
	// Mobile browser detection for image inline style removal
	var w = $(window).width();
	if (w<=600) {
		$('#mainContent img').removeAttr('style');
	}
	
	// Searchbox
	$('#searchText').focus(function() {
		$(this).val('');
		$(this).removeClass('defaultVal');
	});
	
	// Prevent blank search text
	$('#searchButton').click(function() {
		var sText = $('#searchText').val();
		if (sText == '' || sText == 'Search DPC...') {
			$('#searchText').val('Search DPC...');
			$('#searchText').addClass('defaultVal');
			return false;
		}
		else {
			return true
		}
	});
});
