$(document).ready(function(){ 


//---------------------
// THURROCK BUSINESS NET JQUERY SCRIPTS 
//					   
//	pixelwork.com
//	by KevWoo
//
//---------------------
  
  
  //--------------
  // clear fields
  //---------------
  $('.clearField').clearField();
  
  
  //-----------------------------------
  //	PNG FIX FOR THE DREADFUL IE
  //-----------------------------------
  
	$(document).pngFix();
  
  
  
  	//--------------------------
  	//	CONTENT SLIDER BANNER 
  	//--------------------------	
   	
   $("ul.banner").contentSlider({});
  	
  // $("ul.banner").CarouSlide({autoAnim:true,slideTime:200});
  
  
//  $(".highlightsBanner").CarouSlide({
//  			animType:"slide",
//  			animInfinity:true,
//  			showSlideNav:false,
//  			autoAnim:true,
//  			showPauseButton:true,
//  			showBackNext:true,
//  			animTime:1200,
//  			slideTime:6000,
//  			sliderHolder:".banner"
//  		});
//  
  
  
  //----------------------
  //	TOGGLE RIGHT COL
  //----------------------


    
	$("#nav_categories").treeview({
		collapsed: true,
		control: "#treecontrol",
		animated: "fast",
		persist: "location"

	});
	
		
	
	//----------------------
	//	TOGGLE RIGHT COL
	//----------------------
		
	//make viable first!
	$(".hideCol").fadeIn(300);
	
	
	// seta cookie to remmber this fro inside pages
	$(".hideCol").click(function(){
		
		
		//$(body).toggleClass( 'min', switch );
		var bodyId =  $(document.body).attr('id');
		
		//console.log(bodyId);
	
		if(bodyId!=="wide"){
			$(document.body).attr('id', 'wide');
			//$("a.hideCol").text("Show Latest");
			
			$(".hideCol").css("backgroundPosition","5px -493px");
		}else{
			$(document.body).attr('id', 'min');
			//$("a.hideCol").text("Hide Latest");
			
			$(".hideCol").css("backgroundPosition","-28px -493px");
		}
			
	
	});
	
		
	//-----------------------
	//   FAQS - hide & show
	//-----------------------
		
		$(".faq h2").css("cursor","pointer");
		$(".faq h2").css("cursor","hand");
		$(".faq .anwser").hide();
	
	
		// add closed classes
		$(".faq li").addClass("closed");
	
	
	
	//----------------------------
	// OPEN CLOSED FAQS
	//----------------------------
	
	
	//$(".faq h2").click(function(){
	$(".closed h2").click(function(){
					
		
		//$(this).next(".anwser").fadeIn(2000);
		$(this).next(".anwser").slideDown(500);
		//change classes
		$(this).parent().removeClass("closed");
		$(this).parent().addClass("open");
	
		
	});
	
	
	//----------------------------
	// CLOSE OPENED FAQS
	//----------------------------
	$(".faq .open h2").click(function(){
	
		
		//change classes
		$(this).parent().removeClass("open");
		$(this).parent().addClass("closed");
		
		$(this).next(".anwser").stop().slideUp(2000);
	});
	
	
	
	
	
	//--------------------------------------------
	// OPEN  ALL EXTERNAL LINKS IN BLANK WINDOW
	//--------------------------------------------
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");  
	
	
	
	
	//--------------------
	// 	CLEAR FIELDS
	//--------------------
	
	// clear search field when clicked
	$("#keywords").click(function(){
		clearSearch("keywords");
	});
	
	
	// clear search field when clicked
	$("#oududd-oududd").click(function(){
		clearSearch("oududd-oududd");
	});
	
	
		
	//function clearSearch
	function clearSearch(fieldID){
		$("#"+fieldID).attr("value","");
	}
	
	

      
      //------------------------
      // THANKS MESSAGE FADEOUT
      //------------------------

       
       /* DROP MENU */
       
       	$('.horzMainMenu li.has_children').hover(function(){
       		$(this).children('ul').stop().fadeIn();
       	 });
       	
       	
       	$('.horzMainMenu li.has_children').mouseleave(function(){
       		$(this).children('ul').stop().fadeOut();
       	});
       
 
       
       
       
       //------------------------------------------
       //  QUICK MESSAGE THAT FADEOUT eg "thanks"
       //------------------------------------------
    	$(".fadeOut").fadeOut(6000);
       
       
       
      
      //------------
      // TOOL TIPS
      //-------------
     $('.fileList [title]').colorTip({color:'blue',timeout:5});
     $('.download_files [title]').colorTip({color:'blue',timeout:5});
     $('.memberPartnerList [title]').colorTip({color:'blue',timeout:5});

     
     
});
