$(document).ready(function() {
	$("a.Btnb").hover(function () {
    	$(this).addClass("BtnbHover", 0.1);
        },function () {
			$(this).fadeIn(3000,function () {
				$(this).removeClass("BtnbHover");
			});
		}
	);
				
	$('input[type="text"]').each(function(){
		this.value = $(this).attr('title');
		$(this).focus(function(){
			if(this.value == $(this).attr('title')) {
				this.value = '';
			}
		}); 
		$(this).blur(function(){
			if(this.value == '') {
				this.value = $(this).attr('title');
			}
		});
	});
				
	$('textarea').each(function(){
		this.value = $(this).attr('title');
		$(this).focus(function(){
			if(this.value == $(this).attr('title')) {
				this.value = '';
			}
		}); 
		$(this).blur(function(){
			if(this.value == '') {
				this.value = $(this).attr('title');
			}
		});
	});
$('#massage').submit(function() {
	var email = $("#email").val();
	var text = $("#text").val();
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	if(email != '' && email != 'E-mail' && text != '' && text != 'Poruka'){
		if(!emailReg.test(email)) {
            alert('Molimo Vas da ispravno unesete E-mail adresu...');
        }else{
			var str = $(this).serialize();
			$.ajax({
				type: "POST",
				url: "/ajax.php",
				data: str,
				success: function(msg){//
					if(msg == 2) alert('Poštovani,\n Obaveštavamo Vas da je Vaša poruka upućena Adminu.\n Hvala.');
				}
			});/**/		
		}
	}else{
		alert('Molimo Vas da ispravno unesete sva polja');
	}
  return false;
});
	
	$("#fbt a>img").fadeTo("slow", 0.6);

	$("#fbt img").hover(function(){//alert(9);
		$(this).fadeTo("slow", 1.0); // This sets the opacity to 100% on hover
	},function(){
   		$(this).fadeTo("slow", 0.6); // This sets the opacity back to 60% on mouseout
	});
	 $("#slide").hide();
	 $("#slide1").hide();
$("#usl").click(function () {
	if($("#slide").is(":hidden")){
		if ($("#slide1").is(":visible")) {
	  		$("#slide1").slideUp();
	} 
  $("#slide").load('/WEB-DIZAJN-USLUGE.php', function() {
	$("#slide").css({ 'border': '1px solid #2292D3'}) 
	$("#slide").slideDown();
	});
	}else{
	  $("#slide").slideUp();
	}
});
	$("#rad").click(function () { 
    if ($("#slide1").is(":hidden")) {
			if ($("#slide").is(":visible")) {
      $("#slide").slideUp();
    } 
	$("#slide1").css({ 'border': '1px solid #EC9D18'});
		$.ajax({
		  url: "/WEB-DIZAJN-RADOVI.php",
		  context: document.body,
		  success: function(msg){
			$("#slide1").slideDown(function (){
				$(this).html(msg);
			})
		  }
		});
	
    }else{
      $("#slide1").slideUp(function (){
		  $(this).hide();
	  });
    }
  });
});
