function confirmationpd() { /* Confirm deletion */
	conf = confirm("This will delete the selected item, are you sure you want to continue?");
	if (conf) {
		return true;
	} else {
		return false;
	}
};

function confirmationBasket() { /* Confirm deletion */
	conf = confirm("This will empty your basket, are you sure you want to continue?");
	if (conf) {
		return true;
	} else {
		return false;
	}
};

function roll(img_name, img_src) { /* For rollover, auto looks in rollover dir for swap image - check which called */
	$("#"+img_name).attr("src", img_src);
};

$(function() { /* Also for rollover, check in use */
	$("img.over").hover(function() {
	$(this).attr("src", $(this).attr("src").split(".").join("-over."));
	}, function() {
		$(this).attr("src", $(this).attr("src").split("-over.").join("."));
	});
});

function jumpToAnchor(anchor) {
	window.location.hash=anchor;
};

/* Google Analytics */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3902186-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

var urlobj;
function BrowseServer(obj) {
	urlobj = obj;
	OpenServerBrowser('/javascript/filemanager/index.html',
	screen.width * 0.7,
	screen.height * 0.7 );
}
function OpenServerBrowser( url, width, height ) {
	var iLeft = (screen.width - width) / 2 ;
	var iTop = (screen.height - height) / 2 ;
	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,langCode=en";
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;
	var oWindow = window.open( url, "BrowseWindow", sOptions ) ;
}
function SetUrl( url, width, height, alt ) {
	document.getElementById(urlobj).value = url ;
	oWindow = null;
}

function showContent() { /* Callback function for loader to show content */
	if (!jQuery.browser.msie) { /* Fade disabled for IE due to aliasing bug */
		$("#lrcontent").hide().css({'visibility': "visible"}).fadeIn("slow");
		$("#footer").hide().css({'visibility': "visible"}).fadeIn("slow");
	} else {
		$("#lrcontent").css({'visibility': "visible"});
		$("#footer").css({'visibility': "visible"});
	}
};

$(document).ready(function(){

	if ($(".widget").length > 0) {
		$(".tweet").tweet({
			username: "ghostlightmusic",
			join_text: "auto",
			avatar_size: 32,
			count: 1,
			auto_join_text_default: "",
			auto_join_text_ed: "",
			auto_join_text_ing: "",
			auto_join_text_reply: "",
			auto_join_text_url: "",
			loading_text: "loading tweets..."
		});
	}
	
	$('.date-pick').datePicker({autoFocusNextInput: true});
	$('.date-pick').dpSetStartDate('01/01/2000');
	
	if ($(".widget").length > 0) {
		$('#lrcontent').preloader({loader: '/images/loader.gif',onDone: showContent()});
	} else {
		$("#lrcontent").css({'visibility': "visible"});
		$("#footer").css({'visibility': "visible"});
	}
	
	if ($("a[rel^='prettyPhoto']").prettyPhoto) {
		$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook',slideshow:5000, autoplay_slideshow:false, opacity:0.7, default_width: 660, default_height: 444}); /* Inst gallery, slideshow disabled by default as refreshes infinitely for single images/vids */
	}

});
