jQuery.noConflict();
(function($) {

	$(document).ready( function(){
		$('.fancy-image-gallery .thumb-link').fancybox();

		$.showGallery = function() {
			$('.fancy-image-gallery .thumb-link:first').trigger('click');
		}
		$('.noScript').attr('style','display:none');

		var escapable = /[\\\"\x00-\x1f\x7f-\uffff]/g,
		meta = {    // table of character substitutions
				'\b': '\\b',
				'\t': '\\t',
				'\n': '\\n',
				'\f': '\\f',
				'\r': '\\r',
				'"' : '\\"',
				'\\': '\\\\'
		};

		function quote(string) {
		// If the string contains no control characters, no quote characters, and no
		// backslash characters, then we can safely slap some quotes around it.
		// Otherwise we must also replace the offending characters with safe escape
		// sequences.

			escapable.lastIndex = 0;
			return escapable.test(string) ?
					string.replace(escapable, function (a) {
						var c = meta[a];
						return typeof c === 'string' ? c :
							'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
					}) :
						string;
		}
		
		$.reloadHTMLPageContent = function(path) {
			path = quote(path);
			path = path.replace('\\u00c4','Ae');
			path = path.replace('\\u00d6','Oe');
			path = path.replace('\\u00dc','Ue');
			path = path.replace('\\u00e4','ae');
			path = path.replace('\\u00f6','oe');
			path = path.replace('\\u00fc','ue');
			
			var completePath = [path,' #no_script_page_content'].join(""); 
			
			$('.noScript').load(completePath, function() {
				$('.fancy-image-gallery .thumb-link').fancybox();
			});
		}
		
		if (window.location.hash) {
			var tempurl = window.location.hash;
			tempurl = tempurl.substring(1,tempurl.length);
			$.reloadHTMLPageContent(tempurl);
		}

		
	});
})(jQuery);

