
// @author Nuno Costa
// @copyright 2004 / 2009/2010 Criaçãoweb.NET (http://criacaoweb.net)
// Rev. 04/01/2010
 

$(document).ready(function() {

          // Autocomplete
		 var define_input_search = ".search-input";
         var define_pach = "tools/autocomplete/?showtemplate=false";  
                      
         $(define_input_search).attr("autocomplete","off");
		 $(define_input_search).keyup(function() {
	     
		 var inputString = $(this).val();
			
			if(inputString.length == 0) {
			
		$("#suggestions").hide();
			}else {
                      	$.post(define_pach, {searchinput: ""+inputString+""}, function(data){
			if(data.length >0) {
                       	$("#suggestions").show();

			$("#autoSuggestionsList").html(data);
			}
			});
			}
			});
			$(define_input_search).blur(function() {
			$(define_input_search).val();
			setTimeout("$('#suggestions').hide();", 200);
			});
		$("#autoSuggestionsList > ul > li").live("click", function(){
			var tmp = $(this).text();
			$(define_input_search).val(tmp);
		});
			function fill(thisValue) {
			alert(thisValue);
			$(define_input_search).val(thisValue);
			setTimeout("$('#suggestions').hide();", 200);
			 }
			 
			 
			// MENU		 
		   $('ul.primary-nav').superfish({ 
            delay:       500,                            
            animation:   {opacity:'off',height:'show'},   
            speed:       'normal',                         
            autoArrows:  false,                           
            dropShadows: false                           
        }); 
		
			//FAQS
			$("dd:not(:first)").hide();
			$("dt a").click(function(){
				$("dd:visible").slideUp("slow");
				$(this).parent().next().slideDown("slow");
				return false;
			});  
		
		  //IMAGES reflect
		$("img.reflect").reflect({
								 height:0.33,
								 opacity:0.2
								 });


          //TOGGLE, OPEN AND CLOSE
		$("a.atoggle").click(function () {
			$(".toggle").toggle("slow");
	         return false;
		   });  


     //TOGGLE, CHANGE THE CLASS TO SIGNAL + VS - 
		$("a.atoggle").click(function () {
			var cw_atoggle =  $("a.atoggle");
			
		if (cw_atoggle.hasClass('more'))
		{
           cw_atoggle.removeClass('more');
		   cw_atoggle.addClass('less');
        } 
		else
		{
          cw_atoggle.addClass('more');
		  cw_atoggle.removeClass('less');
        }
         return false;
		}); 
		
		

});//end ready