$(document).ready(function() {
$("select#searchCat").change(function(){
              $.getJSON("/cfc/owservice.cfc",{id : $(this).val(), method : 'GetRoles', returnformat : 'json', queryformat : 'column' }, function(j){
                var options = '';
					options += '<option value="">--- All Roles ---</option>';				  
				for (var i=0; i<j.ROWCOUNT; i++) {
					options += '<option value="' + j.DATA.ID[i] + '">' + j.DATA.LABEL[i] + '</option>';				  
				}
                
                $("select#searchRoles").html(options);
                $("option:first", "select#searchRoles").attr("selected","selected");
            });                
    });
$("select#alertCat").change(function(){
              $.getJSON("/cfc/owservice2.cfc",{id : $(this).val(), method : 'GetAlertRoles', returnformat : 'json', queryformat : 'column' }, function(j){
                var options = '';
				options += '<option value="">--- All Roles ---</option>';
				for (var i=0; i<j.ROWCOUNT; i++) {
					options += '<option value="' + j.DATA.ID[i] + '">' + j.DATA.LABEL[i] + '</option>';				  
				}
                
                $("select#alertRoles").html(options);
                $("option:first", "select#searchRoles").attr("selected","selected");
            });                
    });
    
		
	// initialize scrollable 
	$("div.scrollable").scrollable({
			
		size: 2,
		// items are auto-scrolled in 2 secnod interval
		interval: 3000,
		vertical: true,
		easing: 'linear',
		
		// when last item is encountered go back to first item
		loop: true, 
		
		// make animation a little slower than the default
		speed: 1000			
	});	
	
	
	$("div.tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$("div.tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		window.location.hash = '#sample';
		$(activeTab).fadeIn(500); //Fade in the active ID content
		return false;
	});
		
});