$(document).ready( function() {
	$('.show_all').each(function(){
		$(this).bind("click", function(event){
			event.returnValue = false;
			if(event.preventDefault) event.preventDefault();
			if( $(this).parent().siblings('.hide').css('display') == 'none'){
				// show hidden, show both toggles
				$(this).parent().siblings('.hide').show();
				$(this).parent().parent().children('.t-1').show();
				$(this).parent().parent().children('.t-1, .t-2').children('a').html('Collapse news items..');
			} else {
				$(this).parent().siblings('.hide').hide();
				$(this).parent().parent().children('.t-1').hide();
				$(this).parent().parent().children('.t-1, .t-2').children('a').html('Expand all news items..');
			}
			
		});
	});
	
	$('#primaryNav ul li ul').each(function(){
		$(this).children().each(function(){ 
			$(this).css({'display':'none'});
		});
		
		parent_link = $(this).prev();
		$(parent_link).attr({'visible':0});
		parent_link.click(function(event){
			event.returnValue = false;
			if(event.preventDefault) event.preventDefault();
			if( $(this).attr('visible') == 0){
				$(this).attr({'visible':1});
				$(this).next().children().css({'display':'block'});
			} else {
				$(this).attr({'visible':0});
				$(this).next().children().css({'display':'none'});
			}
		});
	});
});


function getResult()
{
	
	var max1 = 63;
	var max2 = 50;
	var max3 = 69;
	var max4 = 27;
	
	index1 = Math.round(Math.random() * max1);	
	index2 = Math.round(Math.random() * max2);	
	index3 = Math.round(Math.random() * max3);	
	index4 = Math.round(Math.random() * max4);	
	
	array1 = new Array("San Francisco", "North Beach", "Marina", "Chinatown", "Castro", "Mission", "Tenderloin", "Downtown", "Golden Gate", "Presidio", "Richmond", "Sunset", "Twin Peaks", "OMI", "Excelsior", "Bayview", "Hunters Point", "Cow Hollow", "Pacific Heights", "Nob Hill", "Russian Hill", "Telegraph Hill", "SoMa", "South Park", "China Basin", "Maritime", "Fisherman's Wharf", "Union Square", "Market Street", "Northern California", "Haight", "Cole Valley", "Panhandle", "Hayes Valley", "Western Addition", "Fillmore", "Diamond Heights", "Noe Valley", "District 1", "District 2", "District 3", "District 4", "District 5", "District 6", "District 7", "District 8", "District 9", "District 10", "District 11", "Northeast", "Southwest", "Southeast", "Northwest", "Farallones Islands", "Fort Point", "Fort Mason", "Rincon Hill", "Urban", "Glen Park", "Central City", "Lower Pac Heights", "Tendernob", "Lands End", "West of Twin Peaks");
	
	array2 = new Array("African-American", "Latino", "Area", "Retired", "Asian", "Chinese", "Japanese", "Vietnamese", "Korean", "Filipino", "Russian", "Irish", "Mexican", "Armenian", "Iranian", "Middle Eastern", "French", "Italian", "Indian", "Native American", "German", "Eastern European", "Pan-Asian", "Plus-Sized", "HIV+", "Handicapped", "Christian", "Jewish", "Arab", "Muslim", "Taoist", "Buddhist", "Orthodox", "Catholic", "Mormon", "Canadian", "African", "Greek", "Senior", "Young", "Multi-Racial", "Anarchist", "Proletariat", "Freemason", "Shriner", "Atheist", "Universalist", "Norwegian", "Non-Profit", "Austrian");
	
	array3 = new Array("Homeless", "Poverty", "LGBT", "Community", "Lesbian", "Gay", "Bicycle", "Late-Night", "Neighborhood", "Women's", "Children's", "Seniors", "Citizens", "Taxpayers", "Merchants", "Restaurant", "Parks", "Homeowners", "Small Property Owners", "Renters", "Tenants", "Small Business Owners", "Artists", "Neighbors", "Musicians", "Political", "Awareness", "Immigrants", "Workers", "Employers", "Democratic", "Republican", "Green", "Youth", "Socialist", "Cultural", "Betterment", "Improvement", "Rights", "Equality", "Teachers", "Laborers", "Service Employees", "Police Officers", "Firefighters", "Technology", "Plumbers", "Planning", "Parking", "Rehabilitation", "Drug Treatment", "Pharmacists", "Doctors", "Dentists", "Trial Lawyers", "Victims Rights", "Rape Prevention", "Anti-Violence", "Environmental", "Action", "Hospitality", "Muni Rider", "Smart Growth", "Correctional", "Harm-Reduction", "Suicide Prevention", "Libertarian", "Dog Advocates", "Plant And Tree", "Drinking");
	
	array4 = new Array("Club", "League", "Project", "Organization", "Association", "Alliance", "Coalition", "Group", "Committee", "Society", "Union", "Commission", "Party", "Institute", "Foundation", "Consortium", "Affinity Group", "Support Group", "Dance Troupe", "Sewing Circle", "Gathering", "Dining Club", "Endorsement Committee", "PAC", "Ninja School", "Cell", "Collective");

	index1 = Math.round(Math.random() * max1);	
	index2 = Math.round(Math.random() * max2);	
	index3 = Math.round(Math.random() * max3);
	index4 = Math.round(Math.random() * max4);		

	document.frmTest.txtTest.value = array1[index1] + " " + array2[index2] + " " + array3[index3] + " " + array4[index4];	
	
}
