/*******************************************************************************
* +--------------------------[ File Revision Info ]--------------------------+ *
* | $Revision::                                                           $: | *
* | $Date::                                                               $: | *
* | $Author::                                                             $: | *
* +--------------------------------------------------------------------------+ *
* | $Id::                                                                 $: | *
* +--------------------------------------------------------------------------+ *
*******************************************************************************/

/************************* JQUERY ONLOAD ACTIONS ****************************/
var $jQ = jQuery.noConflict();

jQuery(document).ready(function() {

	var bindFilterBehaviors = function(scope) {
	    
	    $jQ('#sortByIssue').click(function(){
	        clearInterestList();
	        $jQ('#interestIssueForm').fadeIn('fast');
	    });
	    
	    $jQ('#sortByRegion').click(function(){
	        alert("addRegionFilter");
	    });
	    
	    $jQ('#sortByState').click(function(){
	        $jQ('#stateMap').fadeIn('fast');
	    });
	    
	    $jQ('#closeStateMap').click(function(){
	        $jQ('#stateMap').fadeOut('fast');
	    });
	
	    $jQ('#sortByZip').click(function(){
	        $jQ('#zipForm').fadeIn('fast');
	    });
	};
	
	var bindFilterPopupBehaviors = function(scope) {
		$jQ("#issueSubmit").click(function(){
			$jQ('#interestIssueForm').fadeOut('fast');
			
			window.location.href="?issues=" + getIssueIDs();
		});
		
		$jQ("#issueCancel").click(function() {
			$jQ('#interestIssueForm').fadeOut('fast');
			clearInterestList();
			return false;
		});
	};
	
	// Now bind the Events
	bindFilterBehaviors();
	bindFilterPopupBehaviors();
});

function clearInterestList(){
    $jQ('.interestTag').attr("checked", false);
}