
$(document).ready(function() {
	
	$('.close span, .up span, .down span, .button1 span, .tabs .nav li a span, .lightbox-image span ').css({opacity:'0'})
	$('.tabs .nav .selected a span').css({opacity:'1'})
	
	$('.close, .up, .down, .button1').hover(function(){
		$(this).find('span').stop().animate({opacity:'1'})							
	}, function(){
		$(this).find('span').stop().animate({opacity:'0'})							
	})
	
	$('.lightbox-image').hover(function(){
		$(this).find('span').stop().animate({opacity:'0.4'})							
	}, function(){
		$(this).find('span').stop().animate({opacity:'0'})							
	})
	
	$('.tabs .nav li a').hover(function(){
		$(this).find('span').stop().animate({opacity:'1'})							
	}, function(){
		if (!$(this).parent().hasClass('selected')) {
			$(this).find('span').stop().animate({opacity:'0'})							
		}
	})
	
	//tabs
	tabs.init();
	
	// prettyPhoto
		$("a[data-type^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	
	//bg animate
	$('#bgSlider').bgSlider({
		duration:1200,
		pagination:'.pagination',
		preload:true,
		spinner:'.bg_spinner'
	})
	
	//include news
	var news = new Array();
	news[0] = 'news-01';
	news[1] = 'news-02';
	news[2] = 'news-03';
	news[3] = 'news-04';
	news[4] = 'news-05';
	news[5] = 'news-06';
	news[6] = 'news-07';
	news[7] = 'news-08';
	news[8] = 'news-09';
	news[9] = 'news-10';

	for ( i=0; i<news.length; i++ ) {
		var response =  $.ajax({
			type: "GET",
			dataType:'html',
			async: false,
			cache: true,
			url: 'news/' + news[i] + '.html',
			success: function(html){
				$('#' + news[i] ).html(html);
			}
		}).responseText;
	}
		
 });
 
 //form submission
function submitForm( formName ) {
	
	var name = $('#name').val();
	var email = $('#email').val();
	var message = $('#message').val();
	
	var response =  $.ajax({
		type: "GET",
		dataType:'html',
		async: false,
		cache: true,
		url: 'lib/mailer.php?name=' + name + '&email=' + email + '&message=' + message,
		success: function(html){
			$('#mailresult').html(html);
			$('#name').val('');
			$('#email').val('');
			$('#message').val('');
		}
	}).responseText;
}

