var loop=1;

function change_banner(id_banner,id_thumb,id_curent, stop)
{
	var id_div_curent=($("#bannerdiv .activbanner").attr('id'));


	$("#bannermenu div").removeClass("active");
	$("#"+id_div_curent).removeClass("activbanner");

	/*$('#'+id_div_curent).animate({
	    opacity: 'toggle'
	},450, function(){});*/

	$('#'+id_div_curent).fadeOut("fast");
	$('#'+id_banner).fadeIn("fast");


	$("#"+id_banner).addClass('activbanner');
	$("#"+id_thumb).addClass("active");
	
	$('#textbanner').html($('#bannertext'+id_curent).html());
	$('#bannerright a').attr('href', $('#linkascuns'+id_curent).html());
	
	if (stop==1)
	{
		loop=0;
	}
}

function change_banner_timer(nr_bannere)
{
	var j=1;
	var bannere=parseInt(nr_bannere)-1;

	$(document).everyTime(5000, function(i)
	{
		if (loop==1)
		{
			change_banner('banner'+j,'bannerthumb'+j,j,0);
			if(j==bannere){j=0;}else{j++;}
		}
	});
}

function change_tab(id_link,id_tab)
{
	$("#taburicontent .tabcontent").hide();
	$("#taburi a").removeClass("activtab");

	$("#"+id_link).addClass('activtab');
	$("#"+id_tab).fadeIn();
}

function isValidEmailAddress(emailAddress)
{
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}
