 

  $(document).ready(function() {
    $("#datepicker").datepicker();
  });
 	 
	$(function() {
 		// initialize scrollable
		$("#cont-sugestii").scrollable({circular: true, mousewheel: false});
		}); 
		
	$(document).ready(function() { 
	var triggers = $(".autentific ").overlay({ 
	fixed:false });
	$("#autentificare form").submit(function(e) {

 		// close the overlay
		 triggers.eq(0).overlay().close();

		
		});
	
	});
	$(document).ready(function() { 
		$(".raportez").overlay({
			mask: {
				color: '#e6e6e6',
				loadSpeed: 200,
				opacity: 0.8
					},
		});
	});
	$(function() {
	
	$("ul.photo-slider").tabs("div.photo-slide",
	{event:'mouseover',
	rotate:true
	}
	).slideshow({autoplay:true});
		});
	
$(document).ready(function() {
		
			$(".sugestie img").tooltip({
				opacity:0.9,
				position:'bottom center',
				offset:[-30,0],
				relative:true,
				tipClass:'titlu-sugestie',
				delay:5,
				onShow:function(){
					var titlus = $(".titlu-sugestie h4").filter(':visible').text();
					$("#titlusugestii h4").text(titlus);
					
				},
				onHide:function(){
					$("#titlusugestii h4").text('IMMRomania recomanda: ');
				}
					});
		
		}); 
		
		$(document).ready(function() {
			$('textarea#comment-mesaj').autoResize({
			    // On resize:
			    onResize : function() {
			        $(this).css({opacity:0.8});
			    },
			    // After resize:
			    animateCallback : function() {
			        $(this).css({opacity:1});
			    },
			    // Quite slow animation:
			    animateDuration : 300,
			    // More extra space:
			    extraSpace : 10
			});
		}); 
		
		
		$(document).ready(function(){
			$(" #caltip").live("mouseover",function(){
			$(" #caltip").tooltip({
				position:'bottom right',
				offset:[15,-30],
				tipClass:'insemnare-calendar',
				relative:true,
				delay:50,
				effect:'slide',
				
			}).dynamic({right:{direction:'left',effect:'slide', offset:[15,0],delay:50} });
			});
		});
		
$(document).ready(function(){
        $("#categorybtn").click(function(){
            if ($("#category-options").is(':hidden')) {
				$("#category-options").slideDown('slow');
				
				if ($('#toate-categoriile').is(':checked')){
					
					checkAll();
				}
				 
			}
			else {
				
					$('#category-options').slideUp('slow');
				
			
			}
            return false;
        });


        $('#category-options').click(function(e) {
            e.stopPropagation();
        });
		
        $(document).click(function() {
        		
					$('#category-options').slideUp('slow');
				
			
        });
  	  }); 
	  

	
	

	function getCatStat(){
		var status=true;
		if   ($('.category-option input:checked').length == 0) {
				status=true;
				
			}else{
				if ($('.category-option input:checked').length <$('.category-option input').length) {
				status=false;
				
				}else{
					status=true;
					}
			}
		
	return status;
		}
		

	
	function checkAll(){
		
			$(".categorie").each(function(){
				$(this).attr("checked",true);
			
			});
			$("#toate-categoriile").attr("checked",true);
			
			$('#toate-categoriile').focus();
		
	}
	function uncheckAll(){
		
			$(".categorie").each(function(){
				$(this).attr("checked",false);
			
			});
			$("#toate-categoriile").attr("checked",false);
			
			$('#toate-categoriile').focus();
		
	}
	function ReverseCheck(){
		
		$(".categorie").each(function(){
		if ($('#toate-categoriile').is('!:checked')){
				if($(this).is(':checked'))
				{
					$(this).attr("checked",false);
				}else{
					$(this).attr("checked",true);
				}
			}
			});
	}
	
	
	   $(document).ready(function(){
	  	$(".category-option input ").click( function(){
			
			ReverseCheck();
			$("#toate-categoriile").attr("checked",getCatStat());
			
			if ($('#toate-categoriile').is(':checked')){
					
					checkAll();
				}
						
		});
	  });
	  
	  
	 $(document).ready(function(){
	 	$("#toate-categoriile").click(function(){
			if ($('#toate-categoriile').is(':checked')){
					
					checkAll();
				}else{
					uncheckAll();
				}
		})
	 })
	 
	 
	 
	 
	 
	 $(document).ready(function(){
	 	$("#search").focusin(function(){
			
			if ($(this).attr("value") == 'Cautare...') {
				$(this).attr("value","");
			}
			
		});
		$("#search").focusout(function(){
			if ($(this).attr("value") == '') {
				$(this).attr("value", "Cautare...");
			}
		});
	 });	
	 
	  
	 $(document).ready(function(){
		$("#gallery-img").scrollable({clickable:false}).find("img").each(function(){
		});
	    $("#gallery-final").scrollable();
	 });
	 
	 
	  $(document).ready(function(){
         $("#link-calendar").click(function(){
            $("#search").focus();
            $("#calendare1").queue(function(){
                $(this).css("background-color","#999999");
                
                $(this).dequeue();
            });
            $("#calendare1").animate({opacity:0.4},800);
            $("#calendare1").animate({opacity:1},800);
            $("#calendare1").animate({opacity:0.4},800);
            $("#calendare1").animate({opacity:1},800);
            $("#calendare1").queue(function () {
                $(this).css("background-color","#efefef");
            
                  $(this).dequeue();
              });
    
            return false;                        
            });
     	
     });
	 
	 $(document).ready(function(){
		 if ($.cookie('notificat') === null) {
				$.cookie("notificat", "0",{expires:'365',path:'/'});
				$("#notify-top").slideDown('slow');
			}else{
				if ($.cookie('notificat') === '0') {
					$("#notify-top").slideDown('slow');
				}
			}
			$("#notify-close").click(function(){
				$("#notify-top").slideUp('slow');
				$.cookie("notificat","1",{expires:'365',path:'/'});
			});	 
	 });
	 
	 $(document).ready(function(){
		$("#cautare-a").click(function(){
			if($("#avansata").is(":hidden"))
			{
				$("#avansata").slideDown("slow");
				$("#cautare-a").text("- Cautare avansata");
				
			}else{
				$("#avansata").slideUp("slow");
				$("#cautare-a").text("+ Cautare avansata");
				
			}
			
		});
	});
	$(document).ready(function(){
		if($("#tara").val()==85) {$("#judet-select").attr("disabled",false);}
		else {$("#judet-select").attr("disabled",true);}
		
		$("#tara").change(function(){
			if ($(this).val()==85){
				$("#judet-select").attr("disabled",false);
				 
			}else{
				$("#judet-select").attr("disabled",true);
				 
			
				
			}
			
		});
	});
	
	 
	 
 
  $(document).ready(function() {
    $(".tabLink").each(function(){
      $(this).click(function(){
        tabeId = $(this).attr('id');
        $(".tabLink").removeClass("activeLink");
        $(this).addClass("activeLink");
        $(".tabcontent").addClass("hide");
        $("#"+tabeId+"-1").removeClass("hide")   
        return false;	  
      });
    });  
  });
 
  $(document).ready(function() {

	webPath= document.location.href;
	webPathSplit=webPath.split("#");
	webPathName= webPathSplit[1]+ "1"; /* Hack for check its blank or not */

	if(webPathName=='undefined1') {
	}else{
		openTab=webPathSplit[1];
        $(".tabLink").removeClass("activeLink");
        $("#"+openTab).addClass("activeLink");
        $(".tabcontent").addClass("hide");
        $("#"+openTab+"-1").removeClass("hide")   
	}

    $(".tabLink").each(function(){
      $(this).click(function(){
        tabeId = $(this).attr('id');
        $(".tabLink").removeClass("activeLink");
        $(this).addClass("activeLink");
        $(".tabcontent").addClass("hide");
        $("#"+tabeId+"-1").removeClass("hide")   
        //return false;	  
      });
    });  
  });
 
  $(document).ready(function() {
    $(".tabLink1").each(function(){
      $(this).click(function(){
        tabeId = $(this).attr('id');
        $(".tabLink1").removeClass("activeLink1");
        $(this).addClass("activeLink1");
        $(".tabcontent1").addClass("hide");
        $("#"+tabeId+"-1").removeClass("hide")   
        return false;	  
      });
    });  
  });
 
  $(document).ready(function() {

	webPath= document.location.href;
	webPathSplit=webPath.split("#");
	webPathName= webPathSplit[1]+ "1"; /* Hack for check its blank or not */

	if(webPathName=='undefined1') {
	}else{
		openTab=webPathSplit[1];
        $(".tabLink1").removeClass("activeLink1");
        $("#"+openTab).addClass("activeLink1");
        $(".tabcontent1").addClass("hide");
        $("#"+openTab+"-1").removeClass("hide")   
	}

    $(".tabLink1").each(function(){
      $(this).click(function(){
        tabeId = $(this).attr('id');
        $(".tabLink1").removeClass("activeLink1");
        $(this).addClass("activeLink1");
        $(".tabcontent1").addClass("hide");
        $("#"+tabeId+"-1").removeClass("hide")   
        //return false;	  
      });
    });  
  });
 
