$(document).ready(function() {
	
	
	
	if ($("#country").val() == 'United States') {
		 $('#state_div').show();
				    $('#county_div').hide();
	} else{
		$('#state_div').hide();
				    $('#county_div').show();
		
	}
   
   $('#country').change(function() {

               if ($("#country").val() == 'United States'){
                   $('#state_div').show();
				    $('#county_div').hide();
               }
                else{
                  $('#state_div').hide();
				    $('#county_div').show();
                }
  });
  
    jQuery('#mycarousel').jcarousel();
	
	
	$('.date-pick').datePicker(
		{autoFocusNextInput: true,
		startDate: '01/01/1970',
		endDate: (new Date()).asString()}
	);
	$('#custom-offset').dpSetOffset(-100, 300);
	
	//$(".popup").fancybox(); 

$(".popup").fancybox({
            'overlayShow': false,
            'frameWidth' : 480,
            'frameHeight' : 400
            });


$("#btn_basic_search").click(function(event){
    $("#expanded_search").hide();
	$("#advanced_search").hide();
	$("#btn_basic_search").addClass('inactive');
	$("#btn_expanded_search").removeClass('inactive');
	$("#btn_advanced_search").removeClass('inactive');
	$.ajax({
  url: "/helpers/ajax_search.cfm?type=b",
  cache: false
});

 });
 
 $("#btn_expanded_search").click(function(event){
    $("#expanded_search").show();
	$("#advanced_search").hide();
	$("#btn_basic_search").removeClass('inactive');
	$("#btn_expanded_search").addClass('inactive');
	$("#btn_advanced_search").removeClass('inactive');
	$.ajax({
  url: "/helpers/ajax_search.cfm?type=e",
  cache: false
});
});
   
 $("#btn_advanced_search").click(function(event){
    $("#expanded_search").show();
	$("#advanced_search").show();
	$("#btn_basic_search").removeClass('inactive');
	$("#btn_expanded_search").removeClass('inactive');
	$("#btn_advanced_search").addClass('inactive');
	$.ajax({
  url: "/helpers/ajax_search.cfm?type=a",
  cache: false
});
 });
  
   $('a.cluetip').cluetip({
  cluetipClass: 'rounded', 
  dropShadow: false, 
  positionBy: 'mouse',
  clickThrough: true 
});

$('#search_agency').focus(function() { 
   $(this).empty(); 
   $.get('/helpers/ajax_forms.cfm',function(data) { 
     $('#search_agency').append(data); 
   }); 
  });
  
  
  
  $('.clearinput').one("focus", function() {
  $(this).val("");
});



});




function toggleInlinePlayer() {
   
        flashplayer = document.getElementById('mediaplayer');
	flashplayer.sendEvent('PLAY', 'false');
   /* if (typeof window.flashplayer.sendEvent != "undefined") {
        pauseCounter ++;
        
        if (pauseCounter < 7) {
            setTimer(toggleInlinePlayer, 1000);
        } else {
            pauseCounter = 0;
        }
    } else {
        setTimer(toggleInlinePlayer, 1000);
    }*/
}




