		
	$(document).ready(function() {
	
		
		// Preload all rollovers
		$("#nav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.jpg$/ig,"_over.jpg");
			$("<img>").attr("src", rollON);
		});
		
		$("#header_contacts img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.jpg$/ig,"_over.jpg");
			$("<img>").attr("src", rollON);
		});
		
		$("#events_nav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		});

		$("img.pdfbutton").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_over.png");
			$("<img>").attr("src", rollON);
		});
		
		$("img.submit").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_over.png");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#nav a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.jpg$/ig,"_over.jpg"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#nav a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// Events Navigation rollovers
		$("#events_nav a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#events_nav a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});

		// submit rollover
		$("#contact_form a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_over.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});

		$("#contact_form a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// submit rollover
		$("#header_contacts a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.jpg$/ig,"_over.jpg"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});

		$("#header_contacts a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// pdf rollover
		$("a.pdfbutton").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_over.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("a.pdfbutton").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		
		//// events nav
		
		$('#events_nav').hide();
			
		// toggles the slickbox on clicking the noted link  
		$('a#show-events').click(function() {
			$('#events_nav').toggleFade(400);
		 	return false;
		});


		var pathname = window.location;
		//alert(window.location);
		//var domain = 'http://bychristopher.local/';
//		var domain = 'http://72.167.142.190/~canape/';
		var domain = 'http://www.bychristopher.com/';
		if (pathname == domain + 'private.php' || pathname == domain + 'weddings.php' || pathname == domain + 'corporate.php' || pathname == domain + 'blick.php') {
			$('#events_nav').show();
		}

		
	});
