$(function(){
	var Values = $("select#regionSelect").html();
	$("form#searchMembers input").change(function(){
		var Input = $(this).val();
	
		if (Input == 'Associate')
		{
			$("select#regionSelect").html("<option value=''>Any Region</option>")
		}
		else
		{
		   $("select#regionSelect").html(Values);
		}
	});
		
	var MemberType  = getUrlVars(window.location.href)["memberType"];
	if (MemberType != null) {
		if (MemberType == 'Associate') {
			$("select#regionSelect").html("<option value=''>Any Region</option>");
		}
	}
	
	$("table.events tr").each(function(){
		$("td:eq(1)",this).css({"width":250});
	});
	
});

function getUrlVars(url)
{
 
	var vars = [], hash;
    var hashes = url.slice(url.indexOf('?') + 1).split('&');
    
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

$(document).ready(function(){
	$(".poll :radio").each(function() {
		var $thisInput = $(this);
		$thisInput.click(function(){
			 $('.poll').load('http://www.demolition-nfdc.com/pollvote.php',{'Answer':(this).value});
		});
	});
});


$(document).ready(function(){
	$('#flyer,#imageGallery').cycle({
    fx:    'fade', 
    speed:1500,
    timeout: 3000
    });
});


/*$(document).ready(function() {
  $('#leftMemberSearch a').click(function() {
	 $('.leftCont').load('http://www.demolition-nfdc.com/a.php', {'term': $(this).attr('rel')});
  		$('.rightCont').load('http://www.demolition-nfdc.com/b.php', {'term': $(this).text()});
  		$('#rightMemberSearch').load('http://www.demolition-nfdc.com/c.php', {'term': $(this).text()});
    return false;
  });
});*/

$(document).ready(function() {
	
	$("input#searchText").blur(function(){
		var SearchText = this.value;
		SearchText = SearchText.replace(/-/,"_");
		this.value = SearchText;
	});
});




$(document).ready(function() {
  $('a.officerdetail').click(function() {
    $('.maincontent').hide().load('officersAJAX.php', {'term': $(this).text()},function () {$(this).fadeIn('slow')});
    return false;
  });
});

/*$(document).ready(function() {
  $('a.officerdetail').click(function() {
    $('.maincontent').hide().load('officersAJAX.php', {'term': 'John Wring','cat':'2'},function () {$(this).fadeIn('slow')});
    return false;
  });
});*/

$(document).ready(function() {
  $('#loading2,#loadingOfficers, #loading').ajaxStart(function() {
    $(this).show();
  }).ajaxStop(function() {
    $(this).hide();
  });
});

$(document).ready(function () {
	$('table.events tr:odd').addClass("odd");
	$('table.events tr:even').addClass("even");
});






