$.bgimg = {}

$(document).ready(function(){
	bgimage = $('body').css('background-image').replace(/[,"]+/g, "");
	
	var http_host = FULLBASE.replace(BASE, "");
	bgimgsrc = bgimage.substring(bgimage.indexOf(http_host), bgimage.indexOf(")")).replace(http_host, '');
	
	$.bgimg.src = bgimgsrc;
	processBGimage();
	
	// Fade effect applied for OMMF left side top images
	$('.slideshow img').css('display', 'block');
	$('.slideshow').cycle({
		fx: 'fade' 
	});
});

function subscribe()
{
	var email = $('#newsLetterEmail').val();
	
	$.ajax({
		type: "POST",
		url: BASE + '/ajax/subscribe',
		data: 'email=' + email,
		beforeSend: function()
		{
			$('#submit_button').hide();
			$('#newsletter_loading').show();
		},
		success: function(msg)
		{
			alert(msg);
			$('#submit_button').show();
			$('#newsletter_loading').hide();
		}
	});
}

function processBGimage()
{
	w = $(window).width();
	h = $(window).height();
	r = BASE + HTTP_THUMB + $.bgimg.src + '&w=' + w + '&h=' + h + '&zc=1';
	
	$('body').css('background-image', 'url('+ r + ')');
}