/******************************************************************************************************************/
// GALLERY FUNCTION
/******************************************************************************************************************/

function handleGallery(){
	$('.gallery A').hover(function(){
		$(this).prepend('<div class="zoom"></div>');
	}, function(){
		$(this).find('.zoom').remove();
	});
}

/******************************************************************************************************************/
// TICKER FUNCTIONS
/******************************************************************************************************************/

function TickerRun(i){
	$('.ticker LI').hide();
	$('.ticker LI:eq('+ i +')').show();
		
	i++;
	if (i == tnum) i = 0;
	TickerTimerId = window.setTimeout('TickerRun('+ i +')', 4000);
}

function TickerInit(){
	tnum = $('.ticker LI').size(); 
	if (tnum > 1) TickerRun(0);
}

/******************************************************************************************************************/
// FORMS FUNCTION
/******************************************************************************************************************/

function handleForms(){
	var act_text = $('#frm-newsletter .frm-text').attr('value');
	
	$('#frm-newsletter .frm-text').focus(function(){
		$('#frm-newsletter').css({ backgroundPosition: '0px -66px'});
		this.value = "";
	});
	
	$('#frm-newsletter .frm-text').blur(function(){
		$('#frm-newsletter').css({ backgroundPosition: '0px 0px'});
		if (this.value == "") this.value = act_text;
	});
	
	$('#frm-contact .fmtext').focus(function(){
		$(this).css({ backgroundPosition: '0px -50px', color: '#ffffff'});
	});
	
	$('#frm-contact .fmtextarea').focus(function(){
		$(this).css({ backgroundPosition: '0px -170px', color: '#ffffff'});
	});
	
	$('#frm-contact .fmtext, #frm-contact .fmtextarea').blur(function(){
		$(this).css({ backgroundPosition: '0px 0px', color: '#331c02'});
	});
}

/******************************************************************************************************************/
// On document load...
/******************************************************************************************************************/

$(function(){
	// Forms
	handleForms();
	
	// Gallery
	 handleGallery();
	
	// Last Comments
	TickerInit();
});
