$(document).ready(
				function() {

					/* Easy Slider */
					$("#slider").easySlider( {
						controlsBefore : '<p id=\"controls\">',
						controlsAfter : '</p>',
						auto : true,
						continuous : true
					});

					$("#slider2").easySlider( {
						controlsBefore : '<p id=\"controls\">',
						controlsAfter : '</p>',
						prevId : 'prevBtn2',
						nextId : 'nextBtn2'
					});
					/* end Easy Slider */

					/*
					 * if ($("#gallery a") != undefined) { $("#gallery
					 * a").photoSwipe(); }
					 */

					(function(window, $, PhotoSwipe) {

						$('div.gallery-page')
								.live(
										'pageshow',
										function(e) {

											var currentPage = $(e.target), options = {
												backButtonHideEnabled : true,
												allowRotationOnUserZoom : true,
												jQueryMobile : true
											}, photoSwipeInstance = $(
													"div.gallery-item a", e.target)
													.photoSwipe(
															options,
															currentPage
																	.attr('id'));

											return true;
										})

								.live(
										'pagehide',
										function(e) {

											var currentPage = $(e.target), photoSwipeInstance = PhotoSwipe
													.getInstance(currentPage
															.attr('id'));

											if (typeof photoSwipeInstance != "undefined"
													&& photoSwipeInstance != null) {
												PhotoSwipe
														.detatch(photoSwipeInstance);
											}

											return true;
										});

					}(window, window.jQuery, window.Code.PhotoSwipe));

					if ($('#expandable_list_table'))
						expandList();

				});

// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function() {
	log.history = log.history || []; // store logs to an array for reference
	log.history.push(arguments);
	arguments.callee = arguments.callee.caller;
	if (this.console)
		console.log(Array.prototype.slice.call(arguments));
};
// make it safe to use console.log always
(function(b) {
	function c() {
	}
	for ( var d = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn"
			.split(","), a; a = d.pop();)
		b[a] = b[a] || c
})(window.console = window.console || {});

/*
 * Matches : test@test.com | nerdy.one@science.museum | ready&amp;set@go.com.au
 * Non-Matches : .test.@test.com | spammer@[203.12.145.68] | bla@bla
 */
function validateEmail(elementValue) {
	/* var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; */
	var emailPattern = /^([0-9a-zA-Z]+[-._+&amp;])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/;
	return emailPattern.test(elementValue);
}

function showCalendarPopup(inputName, dateValue, anchorName) {
	var cal = new CalendarPopup();
	cal.select(eval(inputName), anchorName, 'dd/MM/yyyy');
	return false;
}

var deleteRow = function(rowID) {

	jRow = $("#" + rowID);
	if (jRow == null)
		return;
	jRow.fadeOut("slow", function() {
		jRow.hide();
	})
}

var showRow = function(rowID) {

	jRow = $("#" + rowID);
	if (jRow == null)
		return;

	jRow.fadeOut("slow", function() {
		jRow.show();
	})
}

/*******************************************************************************
 * Expand List
 ******************************************************************************/
var expandList = function() {

	var table = $('#expandable_list_table');
	var td_isin = table.find('tr:not(.more) td.expandable');

	table.find('tr.more').hide();

	td_isin.click(function() {
		var td = $(this);
		var tr = td.parent();

		tr.toggleClass('open');

		tr.nextAll().each(function() {
			// Pb with IE8 and toggleCLass and jquery 1.3.2 : http:
				// //bugs.jquery.com/ticket/4594
				// if ($(this).hasClass('more')) $(this).toggle();
				if ($(this).hasClass('more')) {
					if (tr.hasClass('open'))
						$(this).show();
					else
						$(this).hide();
				} else {
					return false;
				}
			});
	});

};
/**
 * jQuery.browser.mobile will be true if the browser is a mobile device
 * 
 */


