$(document).ready(function() {

	//click misto pe input & textarea
    $('input[type="text"], textarea').focus(function() {
        if (this.value == this.defaultValue){ 
        	this.value = '';
		}
		if(this.value != this.defaultValue){
	  			this.select();
		}
    });
    $('input[type="text"], textarea').blur(function() {
        if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
    });
	
	//tot ce are rel="external" open in new window
	$("a[rel*=external]").attr({target: "_blank"});
	
	
	//hover-ul pe li de pe home de la speakeri
	$('#home .speakers li').mouseover( function() {
		$(this).addClass('speaker_active');
	});	
	$('#home .speakers li').mouseout( function() {
		$(this).removeClass('speaker_active');
	});
	
	//tab-urile de la program
	$('#program_tabs').tabs();
	
	$('#abonare').click(function() {
		$.ajax( {type:"post", 
			   	url:"http://www.imto.ro/newslettersave.php",
				data:'email=' + $('#newsltr').val(), 
				beforeSend:function()
				{
					//$('#newsletter').html("Please wait...");
				},
				success:function(msg){
				  var obj = JSON.parse(msg);
					if (obj.error==0)
						$('#newsletter').html(obj.msg);
					else
						alert(obj.msg);
				}
			});
	return false;
	});

});
