function doLBPopup(file, alt, thumb)	{
	var extension = file.substr(file.lastIndexOf(".") + 1, file.length); 

	switch (extension.toLowerCase())	{

		// ====================   IMAGES     =================================

		case 'jpg': 
		case 'jpeg': 
		case 'png': 
		case 'gif':
			
			$.get('/content/mediaAssets/override/js_imageTPL.asp',	{	file: file, alt: alt	},	function(data){	
				$('#galleryWin').html(data)	
			});

			break;

		// ====================   VIDEOS    =================================

		case 'mp4': 
		case 'flv': 
		case 'm4v': 
			$.get('/content/mediaAssets/override/js_videoTPL.asp',	{	file: file, thumb: thumb	},	function(data){	
				$('#galleryWin').html(data)	
			});
			break;

	}


	$('#galleryWin').jqmShow(); 			
}

function singleVenueMail(venueID)	{
	$('#emailWin').jqm();
	$('#emailWin').jqmShow();
	$('#venueID').val(venueID);
	$('#spnMessageSingle').val('');
	$('#userEmail').val('');
}

function checkFormSingle()	{
	if ($("#singleMail").valid())	{
		$.get(
			"/content/emailVenues.asp", 
			 {	address: $('#userEmail').val(), venueID: $('#venueID').val()	},
			 function(data){	
				// act on the return data
				$("#userEmail").val("");
				$("#spnMessageSingle").html("Your venue has been sent<br /><a href=\"javascript:void(0)\" onclick=\"$('#emailWin').jqmHide();\">Click here to close this window</a>")
			 }
		);
	}	else	{
	}
}

function getCheckArray(arrayName)	{
	var chkArr  = new Array();
	$("input[name='"+arrayName+"']:checked").each(function() {
		chkArr.push($(this).val());
	});
	return chkArr.join(',');
}

function jsEscape(escStr, quoteIt)	{
	escStr = escStr.replace(/'/gi, "\'");
	if (quoteIt)	{	escStr = "'" + escStr + "' "; }
	return escStr;
}

function preLoadImages()	{
	imgStr = '';
	for (imgCnt = 0 ; imgCnt < arrGallery.length ; imgCnt++ )	{
		imgStr += "'" + arrGallery[imgCnt].imgLarge + "',";
	}
	imgStr = imgStr.substring(0, imgStr.length - 1)
	//alert(imgStr);
	jQuery.preLoadImages(imgStr);
}

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)


