var cat;
var subcat;



function populatePodcastCat( formid, catt, subb ) {
	
	cat = catt;
	subcat = subb;

	form = document.getElementById( formid );

	createPodcastCategory( form, 0, 'Arts & Entertainment' );	
	createPodcastCategory( form, 1, 'Audio Blogs' );	
	createPodcastCategory( form, 2, 'Business' );	
	createPodcastCategory( form, 3, 'Comedy' );	
	createPodcastCategory( form, 4, 'Education' );	
	createPodcastCategory( form, 5, 'Family' );	
	createPodcastCategory( form, 6, 'Food' );	
	createPodcastCategory( form, 7, 'Health' );	
	createPodcastCategory( form, 8, 'International' );	
	createPodcastCategory( form, 9, 'Movies & Television' );	
	createPodcastCategory( form, 10, 'Music' );	
	createPodcastCategory( form, 11, 'News' );	
	createPodcastCategory( form, 12, 'Politics' );	
	createPodcastCategory( form, 13, 'Public Radio' );	
	createPodcastCategory( form, 14, 'Religion & Spirituality' );	
	createPodcastCategory( form, 15, 'Science' );	
	createPodcastCategory( form, 16, 'Sports' );	
	createPodcastCategory( form, 17, 'Talk Radio' );	
	createPodcastCategory( form, 18, 'Technology' );	
	createPodcastCategory( form, 19, 'Transportation' );	
	createPodcastCategory( form, 20, 'Travel' );	
	
	populateSubCategories( formid );
}


function populateSubCategories( formid ) {

	
	form = document.getElementById( formid );
	
	category = form.category.options[form.category.selectedIndex].value;

	form.subcategory.options.length = 0;

	if( category == 'Arts & Entertainment' ) {
		podArts( form );
	} else if( category == 'Business' ) {
		podBusiness( form );
	} else if( category == 'Education' ) {
		podEducation( form );
	} else if( category == 'Health' ) {
		podHealth( form );
	} else if( category == 'International' ) {
		podInternational( form );
	} else if( category == 'Religion & Spirituality' ) {
		podReligion( form );
	} else if( category == 'Technology' ) {
		podTech( form );
	} else if( category == 'Transportation' ) {
		podTransportation( form );
	}


}

function podTransportation( form ) {
	
	createPodcastSubCategory( form, 0, 'Automotive', 'Automotive' );	
	createPodcastSubCategory( form, 1, 'Aviation', 'Aviation' );	
	createPodcastSubCategory( form, 2, 'Bicycles', 'Bicycles' );	
	createPodcastSubCategory( form, 3, 'Commuting', 'Commuting' );	
}
function podTech( form ) {

	createPodcastSubCategory( form, 0, 'Computers', 'Computers' );	
	createPodcastSubCategory( form, 1, 'Developers', 'Developers' );	
	createPodcastSubCategory( form, 2, 'Gadgets', 'Gadgets' );	
	createPodcastSubCategory( form, 3, 'Information Technology', 'Information Technology' );	
	createPodcastSubCategory( form, 4, 'News', 'News' );	
	createPodcastSubCategory( form, 5, 'Operating Systems', 'Operating Systems' );	
	createPodcastSubCategory( form, 6, 'Podcasting', 'Podcasting' );	
	createPodcastSubCategory( form, 7, 'Smart Phones', 'Smart Phones' );	
	createPodcastSubCategory( form, 8, 'Text/Speech', 'Text/Speech' );	
}

function podReligion( form ) {
	
	createPodcastSubCategory( form, 0, 'Buddhism', 'Buddhism' );	
	createPodcastSubCategory( form, 1, 'Christianity', 'Christianity' );	
	createPodcastSubCategory( form, 2, 'Islam', 'Islam' );	
	createPodcastSubCategory( form, 3, 'Judaism', 'Judaism' );	
	createPodcastSubCategory( form, 4, 'New Age', 'New Age' );	
	createPodcastSubCategory( form, 5, 'Philosophy', 'Philosophy' );	
	createPodcastSubCategory( form, 6, 'Spirituality', 'Spirituality' );	
}

function podInternational( form ) {

	createPodcastSubCategory( form, 0, 'Australian', 'Australian' );	
	createPodcastSubCategory( form, 1, 'Belgian', 'Belgian' );	
	createPodcastSubCategory( form, 2, 'Brazilian', 'Brazilian' );	
	createPodcastSubCategory( form, 3, 'Canadian', 'Canadian' );	
	createPodcastSubCategory( form, 4, 'Chinese', 'Chinese' );	
	createPodcastSubCategory( form, 5, 'Dutch', 'Dutch' );	
	createPodcastSubCategory( form, 6, 'French', 'French' );	
	createPodcastSubCategory( form, 7, 'German', 'German' );	
	createPodcastSubCategory( form, 8, 'Hebrew', 'Hebrew' );	
	createPodcastSubCategory( form, 9, 'Italian', 'Italian' );	
	createPodcastSubCategory( form, 10, 'Japanese', 'Japanese' );	
	createPodcastSubCategory( form, 11, 'Norwegian', 'Norwegian' );	
	createPodcastSubCategory( form, 12, 'Polish', 'Polish' );	
	createPodcastSubCategory( form, 13, 'Portuguese', 'Portuguese' );	
	createPodcastSubCategory( form, 14, 'Spanish', 'Spanish' );	
	createPodcastSubCategory( form, 15, 'Swedish', 'Swedish' );	
}

function podHealth( form ) {

	createPodcastSubCategory( form, 0, 'Diet & Nutrition', 'Diet & Nutrition' );	
	createPodcastSubCategory( form, 1, 'Fitness', 'Fitness' );	
	createPodcastSubCategory( form, 2, 'Relationships', 'Relationships' );	
	createPodcastSubCategory( form, 3, 'Self-Help', 'Self-Help' );	
	createPodcastSubCategory( form, 4, 'Sexuality', 'Sexuality' );	
}

function podEducation( form ) {
	
	createPodcastSubCategory( form, 0, 'Higher Education', 'Higher Education' );	
	createPodcastSubCategory( form, 1, 'K-12', 'K-12' );	
}

function podBusiness( form ) {
	
	createPodcastSubCategory( form, 0, 'Careers', 'Careers' );	
	createPodcastSubCategory( form, 1, 'Finance', 'Finance' );	
	createPodcastSubCategory( form, 2, 'Investing', 'Investing' );	
	createPodcastSubCategory( form, 3, 'Management', 'Management' );	
	createPodcastSubCategory( form, 4, 'Marketing', 'Marketing' );	
}

function podArts( form ) {

	createPodcastSubCategory( form, 0, 'Architecture', 'Architecture' );	
	createPodcastSubCategory( form, 1, 'Books', 'Books' );	
	createPodcastSubCategory( form, 2, 'Design', 'Design' );	
	createPodcastSubCategory( form, 3, 'Entertainment', 'Entertainment' );	
	createPodcastSubCategory( form, 4, 'Games', 'Games' );	
	createPodcastSubCategory( form, 5, 'Performing Arts', 'Performing Arts' );	
	createPodcastSubCategory( form, 6, 'Photography', 'Photography' );	
	createPodcastSubCategory( form, 7, 'Poetry', 'Poetry' );	
	createPodcastSubCategory( form, 8, 'Science Fiction', 'Science Fiction' );	
}



function createPodcastSubCategory( form, num, text, value ) {
	form.subcategory.options[num] = new Option( text,value );
	if( value == subcat ) {
		form.subcategory.options.selectedIndex = num;
	}
}
function createPodcastCategory( form, num, text ) { 
	form.category.options[num] = new Option( text, text );
	if( text == cat ) {
		form.category.options.selectedIndex = num;
	}
}
