$(document).ready(function(){

/*
	$('.loading_ajax').ajaxStart(function(){
		$(this).show();
	});
	$('.loading_ajax').ajaxStop(function(){
		$(this).hide();
	});
*/

    $('#search').keypress(function(e) {
        if(e.which == 13) {
            $('#frm_search').submit();
        }
    });


	$("img[title]").poshytip({
		className: 'tip-twitter',
		showTimeout: 1,
		alignTo: 'target',
		alignX: 'center',
		offsetY: 5,
		allowTipHover: false,
		fade: false,
		slide: false
	});

	var $jqma=$('#dialog-box').jqm({
		overlayColor: '#fff',
		overlay: 65,
		modal:false,
		closebtn:true,
		closebtnimg:$.adresa_site+'images/closebox.png'
		});

	$("#gotop").click(function(){
		$('html, body').animate({ scrollTop: 0 }, 'slow');
		return false;
	})

	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook', deeplinking:false, slideshow:5000, autoplay_slideshow:true, social_tools: false, show_title: false, overlay_gallery: false});
	$("a[rel^='prettyPhotoNoAutoPlay']").prettyPhoto({theme: 'facebook', deeplinking:false, autoplay_slideshow:false, social_tools: false, show_title: false, overlay_gallery: false});
	$("#search").defaultValues();
	$("#btn_abonare_newsletter").defaultValues();


    $('#btn_abonare_newsletter').keypress(function(e) {
        if(e.which == 13) {
       		adresa=$.adresa_site+"pages/ajax/abonare_newsletter.php";
			$.ajax({
				type: "POST",
				url: adresa,
				data: "btn=abonare_newsletter&email="+$('#btn_abonare_newsletter').val(),
				cache: false,
				dataType:"xml",
				success: function(xml){
						 var mesaj = $(xml).find('mesaj').text();
						 var success = $(xml).find('success').text();
					if (success=='ok')
					{
						$('.footer_abonare_newsletter_result').html(mesaj);
						$('.footer_abonare_newsletter_result').show();
					}
					else
					{
						alert(success);
					}
				}
			});
			return false;
        }
    });


	$('a.btn_abonare_newsletter').live('click', function() {
		adresa=$.adresa_site+"pages/ajax/abonare_newsletter.php";
		$.ajax({
			type: "POST",
			url: adresa,
			data: "btn=abonare_newsletter&email="+$('#btn_abonare_newsletter').val(),
			cache: false,
			dataType:"xml",
			success: function(xml){
					 var mesaj = $(xml).find('mesaj').text();
					 var success = $(xml).find('success').text();
				if (success=='ok')
				{
					$('.footer_abonare_newsletter_result').html(mesaj);
					$('.footer_abonare_newsletter_result').show();
				}
				else
				{
					alert(success);
				}
			}
		});
	return false;
	});


});


