$(function() { 	
    $(document).pngFix(); 
	$('#slideshow_img').cycle({ 
		fx:    'fade', 
		speed:  3000,
    	timeout:  1000  
    });
	var current_status = $.cookie('slideshow_status');
	if(current_status == '')
	{
		current_status = 'Pause';
	}
	if(current_status == 'Resume')
	{
	  	$('#slideshow_img').cycle('pause');	
	}
	$('#slideshow_buton').text(current_status);
	$("#slideshow_buton").click(function () { 
      var status = $(this).text();
      status = trim(status);
	  if(status == 'Pause')
	  {
	  	$('#slideshow_img').cycle('pause');
		$(this).text('Resume');
		$.cookie('slideshow_status', null);
	    $.cookie('slideshow_status', 'Resume');
	  }
	  else if(status == 'Resume')
	  {
	  	$('#slideshow_img').cycle('resume'); 
		$(this).text('Pause');
		$.cookie('slideshow_status', null);
	    $.cookie('slideshow_status', 'Pause');
	  }
    });
	$('#continut_lege').hide();
	$('.poza').hide();
	$('#loading').fadeIn('slow');
	$('#continut_lege').fadeIn(2000);
	$('.poza').fadeIn(2000);
	$('#loading').fadeOut(1000);
	$(".resize").click(function () {
		$("#poza_actuala").hide();
		$('#loading').fadeIn('slow');
		var new_size = $(this).text();
		new_size = new_size.split('/',1);
		new_size = new_size[0];
		var poza_actuala = $("#poza_actuala").attr('src');
		poza_actuala = poza_actuala.split("/",10);
		poza_actuala = "http://lexignat.ro/imagini/"+poza_actuala[4]+"/"+new_size+"/"+poza_actuala[6];
		var poza_noua = poza_actuala;
		$("#poza_actuala").attr({src:poza_noua});
		$('#loading').fadeOut(2000);
		$("#poza_actuala").fadeIn(1000);
		return false;
	});
	$("#send_email").click(function(){
		var text_nou = 'Se trimite...';
		$(this).attr({value:text_nou});
	});
	$(".camp_text").blur(function(){
		var valoarea_mea = $(this).attr('value');
		var tip_camp = $(this).attr('name');
		var nume_camp = $(this).attr('title');
		var lenght = valoarea_mea.length;
		if(tip_camp == 'email_contact')
		{
			var filter=/^.+@.+\..{2,3}$/
			if (filter.test(valoarea_mea))
			{
					$(this).removeClass('error');
					$(this).addClass('ok');	
					$('#info_form').text('');
			}
				else
			{
					$(this).addClass('error');	
					$('#info_form').text('Campul '+nume_camp+' nu este completat corect');
			}
		}
			else
		{
			if(lenght <= 2)
				{
					$(this).addClass('error');	
					$('#info_form').text('Campul '+nume_camp+' nu este completat corect');
				}
			else
				{
					$(this).removeClass('error');	
					$(this).addClass('ok');	
					$('#info_form').text('');				
				}
		}
	});
   $(".hover").fadeTo("fast", 0.43);
   $(".hover").hover(
      function () {
	  $(this).fadeTo("fast", 1);
	  $("#where_to").text($(this).attr('alt'));
      }, 
      function () {
	  $(this).fadeTo("slow", 0.43);
	  $("#where_to").text('');
      }
    );	
   $("#carte").hover(
      function () {
	  var pic = $(this).attr("src");
	  if(pic == 'http://lexignat.ro/media/lower_bar.jpg')
	  	{
			$(this).attr({src:"http://lexignat.ro/media/lower_bar_new.jpg"});	
		}
      }, 
      function () {
	  var pic_hover = $(this).attr("src");
	  if(pic_hover == 'http://lexignat.ro/media/lower_bar_new.jpg')
	  	{
			$(this).attr({src:"http://lexignat.ro/media/lower_bar.jpg"});	
		}
      }
    );	
	$('#contact_right a').lightBox();
}); 
	function gtp(cabinet,cat,id)
	{
		window.location = 'poza-'+cabinet+'/'+cat+'-'+id+'.html';
	}	
	function keyWhat(e)
{

   	if (navigator.appName == 'Microsoft Internet Explorer')
	{
                 //For shift, ctrl and alt keys
      		if(event.keyCode == 17)
		{
			alert("Butonul este dezactivat");
 	                return false;
                }
   	}else if(navigator.appName == 'Netscape')
	{
		if(e.keyCode == 17)
		{
		
			alert("Butonul este dezactivat");
 	                return false;
		}
	
	}
}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

document.onkeydown=keyWhat;

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
