_prefix = '/christine-tour/';

$(window).load(function()
{  

	$("a.fancyframe").fancybox({type: 'iframe', 'overlayOpacity': 0.5, 'overlayShow' : true, 'titleShow' : false, 'padding' : 0, width: 470, height: 550});
	$("a.fancybox").fancybox({'overlayOpacity': 0.5, 'overlayShow' : true, 'titleShow' : false, 'padding' : 0});  

	$('#slider').orbit({animation : "horizontal-push"});

	$("#tipOferta,#tara,#tipOferta2,#tara2").sSelect({ddMaxHeight: '200px'});
	
	$("a.tab_filtru").click(function(e){
		var tab = $(this).attr('id');
		if(tab == 'tab_intern')
		{
			$("#turism_switch").attr('class', 'intern');
			$("div#c_extern").css('display', 'none');
			$("div#c_intern").css('display', 'block');
		}
		else
		{
			$("#turism_switch").attr('class', 'extern');
			$("div#c_intern").css('display', 'none');
			$("div#c_extern").css('display', 'block');
		}
	});
	
	$("a.cauta").click(function(e){
		e.preventDefault();
		var form = $(this).attr('rel');
		$("#" + form).submit();
	});
	
	$("#newsletterAdd").click(function(e){
		e.preventDefault();
		$.post(_prefix + 'ajax/addEmail', {email: $("input#newsletterEmail").attr('value')}, function(data){
			eval(data);
		});
	});
	
	$("input#newsletterEmail").watermark("Adresa de e-mail");
	
	$("a#print").click(function(e){
		printPage($(this).attr("rel"));
	});

	$(".separator a").click(function(e){
		e.preventDefault();
		//mai multe +
		if($(".more_offers").css('display') == 'block')
		{
			$(this).html('mai multe oferte');
			$(".more_offers").slideUp("fast");
			$(".separator").css('background','url(images/separator.png) top center no-repeat');
		}
		else
		{
			$(this).html('mai putine oferte');
			$(".more_offers").slideDown("fast");
			$(".separator").css('background','url(images/separator.png) bottom center no-repeat');
		}
				
	});
	
	$('#scroll').totemticker({row_height: '190px', max_items: 1});
	
	$(".valid").validationEngine({inlineValidation: true});
	
	$("#dataintoarcerii,#dataplecarii").datepicker({dateFormat: 'dd.mm.yy'});
	
});

function printPage(id)
{
	var a = window.open(_prefix + '/print_order.php?id=' + id, '', 'width=600,height=600,scrollbars=yes,resizable=yes');
}
