// JavaScript Document


// submission form validation
function isvalid(form) {
	var title = document.submission_form.title.value;
	var description = document.submission_form.description.value;
	var url = document.submission_form.url.value;
	var category = document.submission_form.section.value;
	var category2 = document.submission_form.category.value;
	var category3 = document.submission_form.subcategory.value;
	var meta_description = document.submission_form.meta_description.value;
	var meta_keywords = document.submission_form.meta_keywords.value;
	var owner_name = document.submission_form.owner_name.value;
	var owner_email = document.submission_form.owner_email.value;
	var accept_rules = document.submission_form.accept_rules.checked;

	// category
	if (category < 1) {
		alert("Select Category");
		document.submission_form.section.focus();
		return false;
	}

	// title
	if (title.length < 1) {
		alert("Missing Title");
		document.submission_form.title.focus();
		return false;
	}
	if (title.length < 4) {
		alert("Title is too short.");
		document.submission_form.title.focus();
		return false;
	}
	if (title.length > 50) {
		alert("Title is too long.");
		document.submission_form.title.focus();
		return false;
	}

	// url
	if (url.length < 1) {
		alert("Missing URL");
		document.submission_form.url.focus();
		return false;
	}
	var filter = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	if (!filter.test(url)) {
		alert("Invalid URL");
		document.submission_form.url.focus();
		return false;
	}

	// descripton
	if (description.length < 1) {
		alert("Missing Description");
		document.submission_form.description.focus();
		return false;
	}
	if (description.length < 50) {
		alert("Description is too short.");
		document.submission_form.description.focus();
		return false;
	}
	if (description.length > 800) {
		alert("Description is too long.");
		document.submission_form.description.focus();
		return false;
	}
	
	// meta keywords
	if (meta_keywords.length > 50) {
		alert("Meta Keywords are too long.");
		document.submission_form.meta_keywords.focus();
		return false;
	}

	// meta descripton
	if (meta_description.length > 250) {
		alert("Meta Descripton is too long.");
		document.submission_form.meta_description.focus();
		return false;
	}

	// name
	if (owner_name.length < 1) {
		alert("Missing Name");
		document.submission_form.owner_name.focus();
		return false;
	}
	if (owner_name.length < 4) {
		alert("Description is too short.");
		document.submission_form.owner_name.focus();
		return false;
	}
	if (owner_name.length > 30) {
		alert("Description is too long.");
		document.submission_form.owner_name.focus();
		return false;
	}

	// email
	if (owner_email.length < 1) {
		alert("Missing Email address");
		document.submission_form.owner_email.focus();
		return false;
	}
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(owner_email)) {
		alert("Invalid Email address");
		document.submission_form.owner_email.focus();
		return false;
	}
	
	// accept rules
	if (!accept_rules) {
		alert("You need to accept our terms");
		document.submission_form.accept_rules.focus();
		return false;
	}

	return true;
}


// validate article
function isvalidarticle(form) {
	var title = document.submission_form.title.value;
	var description = document.submission_form.description.value;
	var article = document.submission_form.article.value;
	var category = document.submission_form.section.value;
	var category2 = document.submission_form.category.value;
	var category3 = document.submission_form.subcategory.value;
	var meta_description = document.submission_form.meta_description.value;
	var meta_keywords = document.submission_form.meta_keywords.value;
	var owner_name = document.submission_form.owner_name.value;
	var owner_email = document.submission_form.owner_email.value;
	var security_code = document.submission_form.security_code.value;
	var accept_rules = document.submission_form.accept_rules.checked;
	

	// category
	if (category < 1) {
		alert("Select Category");
		document.submission_form.section.focus();
		return false;
	}

	// title
	if (title.length < 1) {
		alert("Missing Title");
		document.submission_form.title.focus();
		return false;
	}
	if (title.length < 4) {
		alert("Title is too short.");
		document.submission_form.title.focus();
		return false;
	}
	if (title.length > 50) {
		alert("Title is too long.");
		document.submission_form.title.focus();
		return false;
	}

	// descripton
	if (description.length < 1) {
		alert("Missing Description");
		document.submission_form.description.focus();
		return false;
	}
	if (description.length < 50) {
		alert("Description is too short.");
		document.submission_form.description.focus();
		return false;
	}
	if (description.length > 800) {
		alert("Description is too long.");
		document.submission_form.description.focus();
		return false;
	}

	// article
	if (article.length < 1) {
		alert("Missing Article Text.");
		document.submission_form.article.focus();
		return false;
	}
	if (article.length < 500) {
		alert("Article Text is too short.");
		document.submission_form.article.focus();
		return false;
	}
	if (article.length > 3500) {
		alert("Article Text is too long.");
		document.submission_form.article.focus();
		return false;
	}
	
	// meta keywords
	if (meta_keywords.length > 50) {
		alert("Meta Keywords are too long.");
		document.submission_form.meta_keywords.focus();
		return false;
	}

	// meta descripton
	if (meta_description.length > 250) {
		alert("Meta Descripton is too long.");
		document.submission_form.meta_description.focus();
		return false;
	}

	// name
	if (owner_name.length < 1) {
		alert("Missing Name");
		document.submission_form.owner_name.focus();
		return false;
	}
	if (owner_name.length < 4) {
		alert("Description is too short.");
		document.submission_form.owner_name.focus();
		return false;
	}
	if (owner_name.length > 30) {
		alert("Description is too long.");
		document.submission_form.owner_name.focus();
		return false;
	}

	// email
	if (owner_email.length < 1) {
		alert("Missing Email address");
		document.submission_form.owner_email.focus();
		return false;
	}
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(owner_email)) {
		alert("Invalid Email address");
		document.submission_form.owner_email.focus();
		return false;
	}

	// security code
	if (security_code.length < 1) {
		alert("Missing Security Code");
		document.submission_form.security_code.focus();
		return false;
	}
	if (security_code.length != 5) {
		alert("Incorrect Security Code");
		document.submission_form.security_code.focus();
		return false;
	}
	
	// accept rules
	if (!accept_rules) {
		alert("You need to accept our terms");
		document.submission_form.accept_rules.focus();
		return false;
	}

	return true;
}


// Remove all Option objects from Category
function removecategory (form) {
	for(i=form.category.options.length-1;i>=1;i--) {
		form.category.remove(i);
	}
	form.category.selectedIndex = 0;
}


// Remove all Option objects from Subcategory
function removesubcategory (form) {
	for(i=form.subcategory.options.length-1;i>=1;i--) {
		form.subcategory.remove(i);
	}
	form.subcategory.selectedIndex = 0;

}


// Add Option objects to Category
function addcategory(form, value, text) {

	// Create an Option object        
	var opt = document.createElement("option");

	// Assign text and value to Option object
	opt.text = text;
	opt.value = value;

	// Add an Option object to Drop Down/List Box
	form.category.options.add(opt);
}


// Add Option objects to Subcategory
function addsubcategory(form, value, text) {

	// Create an Option object        
	var opt = document.createElement("option");

	// Assign text and value to Option object
	opt.text = text;
	opt.value = value;

	// Add an Option object to Drop Down/List Box
	form.subcategory.options.add(opt);
}


// Count character numnber and display an alert if excceeds maxlen
function fielscharcount(textField, countField, maxlen,show_alert) {
    if(textField != null && textField.value != null) {
	    if (textField.value.length > maxlen){
            if(show_alert)
               alert('This field cannot exceed ' +  maxlen + ' characters.');
            textField.value = textField.value.substring(0, maxlen);
	    } else {
            countField.value = maxlen - textField.value.length;
	    }
    }
}



// Set  Category List
function setcategory (form) {
	
	// Remove all Option objects from Category
	removecategory (form);
	removesubcategory (form);

	// Selected Section Item
    var item = form.section.value;

	// Add Options into Category -- Specific for Section
	switch(item) {
	case "1":
		addcategory(form,2,"Art History");
		addcategory(form,3,"Art Weblogs");
		addcategory(form,4,"Artists");
		addcategory(form,5,"Awards");
		addcategory(form,6,"Booksellers");
		addcategory(form,7,"Censorship");
		addcategory(form,8,"Chats and Forums");
		addcategory(form,9,"Crafts");
		addcategory(form,10,"Criticism and Theory");
		addcategory(form,11,"Cultural Policy");
		addcategory(form,12,"Cultures and Groups");
		addcategory(form,13,"Design Arts");
		addcategory(form,14,"Education");
		addcategory(form,15,"Events");
		addcategory(form,16,"Humanities");
		addcategory(form,17,"Institutes");
		addcategory(form,18,"Job and Employment Resources");
		addcategory(form,26,"Local History");
		addcategory(form,19,"Museums, Galleries, and Centers");
		addcategory(form,20,"News and Media");
		addcategory(form,21,"Organizations");
		addcategory(form,22,"Performing Arts");
		addcategory(form,641,"Photography");
		addcategory(form,23,"Reference");
		addcategory(form,24,"Shopping and Services");
		addcategory(form,25,"Visual Arts");
		break;
	case "27":
		addcategory(form,518,"Affiliate Schemes");
		addcategory(form,519,"Buildings and Factories");
		addcategory(form,29,"Business Libraries");
		addcategory(form,28,"Business Resources");
		addcategory(form,30,"Business Schools");
		addcategory(form,36,"Business Training");
		addcategory(form,665,"Charity");
		addcategory(form,31,"Chats and Forums");
		addcategory(form,590,"Chemical Services and Supplies");
		addcategory(form,32,"Classifieds");
		addcategory(form,463,"Consultancy");
		addcategory(form,33,"Cooperatives");
		addcategory(form,34,"Directories of Services");
		addcategory(form,35,"Economics");
		addcategory(form,37,"Employment and Work");
		addcategory(form,38,"Ethics and Responsibility");
		addcategory(form,39,"Finance and Investment");
		addcategory(form,40,"Global Economy");
		addcategory(form,41,"History");
		addcategory(form,522,"ID cards");
		addcategory(form,589,"Industrial Equipment");
		addcategory(form,42,"Intellectual Property");
		addcategory(form,43,"Labor");
		addcategory(form,44,"Law");
		addcategory(form,45,"Marketing and Advertising");
		addcategory(form,46,"News and Media");
		addcategory(form,462,"Opportunities");
		addcategory(form,47,"Organizations");
		addcategory(form,418,"Publishing Industries");
		addcategory(form,456,"Real Estate and Property");
		addcategory(form,524,"Retail Equipment");
		addcategory(form,464,"Security");
		addcategory(form,503,"Services");
		addcategory(form,520,"Storage");
		addcategory(form,48,"Taxes");
		addcategory(form,49,"Trade");
		addcategory(form,619,"Trade Shows");
		addcategory(form,50,"Transportation");
		addcategory(form,523,"Uniforms and Clothing");
		addcategory(form,461,"Work At Home");
		break;
	case "51":
		addcategory(form,542,"Anti-Spyware");
		addcategory(form,541,"Anti-Virus");
		addcategory(form,498,"Article Directories");
		addcategory(form,52,"Communications and Networking");
		addcategory(form,53,"Computer Generated Music");
		addcategory(form,54,"Computer Science");
		addcategory(form,55,"Computers and Technology Weblogs");
		addcategory(form,56,"Contests");
		addcategory(form,57,"Conventions and Trade Shows");
		addcategory(form,58,"Countries, Cultures, and Groups");
		addcategory(form,59,"Cyberculture");
		addcategory(form,595,"Data Backup");
		addcategory(form,60,"Data Formats");
		addcategory(form,411,"Design and Development");
		addcategory(form,532,"Design Services");
		addcategory(form,61,"Desktop Customization");
		addcategory(form,62,"Desktop Publishing");
		addcategory(form,63,"Dictionaries");
		addcategory(form,555,"Discussion Forums");
		addcategory(form,412,"Domain Names");
		addcategory(form,376,"Ebooks and Tutorials");
		addcategory(form,64,"Employment");
		addcategory(form,65,"Ethics");
		addcategory(form,492,"File Hosting");
		addcategory(form,66,"Forensics");
		addcategory(form,67,"Games");
		addcategory(form,68,"Graphics");
		addcategory(form,69,"Hardware");
		addcategory(form,70,"History");
		addcategory(form,71,"Humor");
		addcategory(form,491,"Image Hosting");
		addcategory(form,72,"Industry Information");
		addcategory(form,73,"Information Technology");
		addcategory(form,74,"Internet");
		addcategory(form,75,"Issues");
		addcategory(form,76,"Macintosh");
		addcategory(form,77,"Magazines");
		addcategory(form,78,"Mobile Computing");
		addcategory(form,79,"Multimedia");
		addcategory(form,80,"News and Media");
		addcategory(form,81,"Operating Systems");
		addcategory(form,82,"Organizations");
		addcategory(form,83,"People");
		addcategory(form,85,"Personal Digital Assistants (PDAs)");
		addcategory(form,687,"Podcasts");
		addcategory(form,643,"Printers");
		addcategory(form,84,"Product Information and Reviews");
		addcategory(form,86,"Programming and Development");
		addcategory(form,536,"Script Services");
		addcategory(form,414,"Search Engine Optimization");
		addcategory(form,87,"Security and Encryption");
		addcategory(form,415,"Service Providers (ISP)");
		addcategory(form,88,"Software");
		addcategory(form,89,"Standards");
		addcategory(form,90,"Supercomputing and Parallel Computing");
		addcategory(form,91,"Technical Guides and Support");
		addcategory(form,92,"Telecommunications");
		addcategory(form,475,"Templates");
		addcategory(form,416,"Tools and Resources");
		addcategory(form,93,"Training");
		addcategory(form,624,"URL Services");
		addcategory(form,102,"User Groups");
		addcategory(form,584,"Video Hosting");
		addcategory(form,103,"Virtual Reality");
		addcategory(form,101,"Web Directories");
		addcategory(form,417,"Web Hosting");
		addcategory(form,410,"Webmaster Resources");
		addcategory(form,104,"World Wide Web");
		break;
	case "142":
		addcategory(form,143,"Academic Competitions");
		addcategory(form,144,"Bibliographies");
		addcategory(form,146,"Business to Business");
		addcategory(form,147,"Career and Vocational");
		addcategory(form,148,"Chats and Forums");
		addcategory(form,149,"Conferences");
		addcategory(form,150,"Correctional");
		addcategory(form,151,"Disabilities");
		addcategory(form,661,"Driving Schools");
		addcategory(form,152,"Early Childhood Education");
		addcategory(form,153,"Education Weblogs");
		addcategory(form,154,"Equity");
		addcategory(form,155,"Financial Aid");
		addcategory(form,156,"Government Agencies");
		addcategory(form,157,"Graduation");
		addcategory(form,158,"History");
		addcategory(form,159,"Instructional Technology");
		addcategory(form,160,"Job and Employment Resources");
		addcategory(form,161,"Journals");
		addcategory(form,145,"Languages");
		addcategory(form,162,"Legislation");
		addcategory(form,163,"Literacy");
		addcategory(form,164,"News and Media");
		addcategory(form,175,"Online Courses");
		addcategory(form,165,"Organizations");
		addcategory(form,166,"Policy");
		addcategory(form,167,"Programs");
		addcategory(form,168,"Reform");
		addcategory(form,169,"Shopping and Services");
		addcategory(form,170,"Special Education");
		addcategory(form,171,"Standards and Testing");
		addcategory(form,172,"Statistics");
		addcategory(form,173,"Teaching");
		addcategory(form,174,"Theory and Methods");
		break;
	case "176":
		addcategory(form,177,"Amusement and Theme Parks");
		addcategory(form,178,"Awards");
		addcategory(form,179,"Books and Literature");
		addcategory(form,180,"Chats and Forums");
		addcategory(form,181,"Comedy");
		addcategory(form,183,"Contests, Surveys, and Polls");
		addcategory(form,184,"Ecards");
		addcategory(form,185,"Employment");
		addcategory(form,186,"Entertainment and Media Production");
		addcategory(form,187,"Events");
		addcategory(form,188,"Fanlistings");
		addcategory(form,189,"Food and Drink");
		addcategory(form,191,"Games");
		addcategory(form,192,"Genres");
		addcategory(form,193,"History");
		addcategory(form,194,"Magic");
		addcategory(form,190,"Movies");
		addcategory(form,551,"Music");
		addcategory(form,195,"News and Media");
		addcategory(form,196,"Organizations");
		addcategory(form,197,"Performing Arts");
		addcategory(form,205,"Podcasts");
		addcategory(form,198,"Radio");
		addcategory(form,199,"Randomized Things");
		addcategory(form,200,"Reviews");
		addcategory(form,201,"Shopping and Services");
		addcategory(form,202,"Sports Entertainment");
		addcategory(form,552,"Theatre");
		addcategory(form,203,"Trivia");
		addcategory(form,182,"TV");
		addcategory(form,204,"Villains");
		addcategory(form,206,"Webisodes");
		addcategory(form,207,"Weblogs");
		addcategory(form,208,"X of the Day, Week, etc.");
		break;
	case "419":
		addcategory(form,550,"Blog Hosting");
		addcategory(form,420,"Business");
		addcategory(form,429,"Computer");
		addcategory(form,425,"Eclectic");
		addcategory(form,421,"Education");
		addcategory(form,692,"Home and Garden");
		addcategory(form,430,"Internet");
		addcategory(form,426,"Law");
		addcategory(form,422,"Library");
		addcategory(form,691,"Making Money");
		addcategory(form,466,"Money");
		addcategory(form,664,"Music");
		addcategory(form,431,"News");
		addcategory(form,427,"Personal");
		addcategory(form,423,"Politics");
		addcategory(form,424,"Science");
		addcategory(form,428,"Technology");
		addcategory(form,467,"Webmaster");
		break;
	case "209":
		addcategory(form,210,"Alternative Medicine");
		addcategory(form,211,"Chats and Forums");
		addcategory(form,212,"Children's Health");
		addcategory(form,213,"Conferences");
		addcategory(form,214,"Consumer Products and Services");

		addcategory(form,215,"Dental Health");
		addcategory(form,216,"Disabilities");
		addcategory(form,217,"Diseases and Conditions");
		addcategory(form,218,"Education");
		addcategory(form,219,"Emergency Services");
		addcategory(form,220,"Environmental Health");
		addcategory(form,221,"First Aid");
		addcategory(form,222,"Fitness");
		addcategory(form,223,"General Health");
		addcategory(form,224,"Health Administration");
		addcategory(form,225,"Health and Medicine Weblogs");
		addcategory(form,226,"Health Care");
		addcategory(form,227,"Hospitals and Medical Centers");
		addcategory(form,228,"Hygiene");
		addcategory(form,229,"Institutes");
		addcategory(form,230,"Job and Employment Resources");
		addcategory(form,231,"Long Term Care");
		addcategory(form,232,"Medical Geography");
		addcategory(form,233,"Medicine");
		addcategory(form,234,"Men's Health");
		addcategory(form,235,"Mental Health");
		addcategory(form,236,"Midwifery");
		addcategory(form,237,"News and Media");
		addcategory(form,238,"Nursing");
		addcategory(form,239,"Nutrition");
		addcategory(form,240,"Organizations");
		addcategory(form,241,"Pet Health");
		addcategory(form,242,"Pharmacy");
		addcategory(form,243,"Procedures and Therapies");
		addcategory(form,244,"Professional Supplies and Services");
		addcategory(form,245,"Public Health and Safety");
		addcategory(form,246,"Reference");
		addcategory(form,247,"Reproductive Health");
		addcategory(form,248,"Senior Health");
		addcategory(form,249,"Sexual Health");
		addcategory(form,253,"Societies");
		addcategory(form,603,"Spas");
		addcategory(form,250,"Teen Health");
		addcategory(form,251,"Traditional Medicine");
		addcategory(form,252,"Travel Health and Medicine");
		addcategory(form,254,"Weight Issues");
		addcategory(form,255,"Women's Health");
		addcategory(form,256,"Workplace");
		break;
	case "257":
		addcategory(form,258,"Arts and Humanities");
		addcategory(form,259,"Automotive");
		addcategory(form,260,"Business");
		addcategory(form,261,"College and University");
		addcategory(form,262,"Computers and Internet");
		addcategory(form,263,"Crime");
		addcategory(form,264,"Cultures and Groups");
		addcategory(form,266,"Disabilities");
		addcategory(form,265,"Education");
		addcategory(form,267,"Entertainment");
		addcategory(form,268,"Environment and Nature");
		addcategory(form,269,"Good News");
		addcategory(form,270,"Government");
		addcategory(form,271,"Health");
		addcategory(form,272,"History");
		addcategory(form,273,"Home and Garden");
		addcategory(form,274,"Humor");
		addcategory(form,275,"Law");
		addcategory(form,276,"Literature");
		addcategory(form,277,"News for Kids");
		addcategory(form,278,"Outdoors");
		addcategory(form,279,"Philanthropy");
		addcategory(form,280,"Politics");
		addcategory(form,281,"Real Estate and Property");
		addcategory(form,282,"Religion");
		addcategory(form,283,"Science");
		addcategory(form,284,"Sports");
		addcategory(form,285,"Technology");
		addcategory(form,286,"Traffic and Road Conditions");
		addcategory(form,287,"Transportation");
		addcategory(form,288,"Travel Updates");
		addcategory(form,289,"Weather");
		addcategory(form,290,"Weird News");
		break;
	case "291":
		addcategory(form,292,"Amusement and Theme Parks");
		addcategory(form,293,"Automotive");
		addcategory(form,294,"Aviation");
		addcategory(form,627,"Board Games");
		addcategory(form,295,"Booksellers");
		addcategory(form,296,"Chats and Forums");
		addcategory(form,297,"Cooking");
		addcategory(form,298,"Dance");
		addcategory(form,626,"Dating");
		addcategory(form,299,"Events");
		addcategory(form,567,"Fishing");
		addcategory(form,300,"Fitness");
		addcategory(form,301,"Gambling");
		addcategory(form,302,"Hobbies");
		addcategory(form,303,"Job and Employment Resources");
		addcategory(form,304,"Magazines");
		addcategory(form,543,"Martial Arts");
		addcategory(form,305,"Motorcycles");
		addcategory(form,306,"Outdoors");
		addcategory(form,568,"Sailing");
		addcategory(form,308,"Sports");
		addcategory(form,309,"Television");
		addcategory(form,311,"Theatre");
		addcategory(form,310,"Toys");
		addcategory(form,667,"Travel");
		break;
	case "312":
		addcategory(form,313,"Acronyms and Abbreviations");
		addcategory(form,315,"Almanacs");
		addcategory(form,317,"Arts and Humanities");
		addcategory(form,319,"Ask an Expert");
		addcategory(form,321,"Bibliographies");
		addcategory(form,323,"Biographies");
		addcategory(form,325,"Booksellers");
		addcategory(form,327,"Codes");
		addcategory(form,328,"Country Profiles");
		addcategory(form,329,"Directories");
		addcategory(form,330,"English Language Usage");
		addcategory(form,331,"Environment and Nature");
		addcategory(form,332,"Etiquette");
		addcategory(form,333,"FAQs");
		addcategory(form,334,"Finance and Investment");
		addcategory(form,335,"Flags");
		addcategory(form,314,"General");
		addcategory(form,316,"Geographic Name Servers");
		addcategory(form,318,"Health");
		addcategory(form,320,"Journals");
		addcategory(form,322,"Maps");
		addcategory(form,324,"Measurements and Units");
		addcategory(form,326,"Music");
		addcategory(form,336,"Parliamentary Procedure");
		addcategory(form,337,"Patents");
		addcategory(form,699,"Quotes");
		addcategory(form,338,"Research Papers");
		addcategory(form,339,"Science");
		addcategory(form,340,"Searching the Web");
		addcategory(form,341,"Standards");
		addcategory(form,342,"Statistics");
		addcategory(form,343,"Student Resources");
		addcategory(form,344,"Time");
		addcategory(form,700,"Weather");
		break;
	case "345":
		addcategory(form,346,"Aeronautics and Aerospace");
		addcategory(form,347,"Agriculture");
		addcategory(form,521,"Alternative Energy");
		addcategory(form,348,"Animals, Insects, and Pets");
		addcategory(form,349,"Anthropology and Archaeology");
		addcategory(form,350,"Artificial Life");
		addcategory(form,351,"Astronomy");
		addcategory(form,352,"Biology");
		addcategory(form,375,"Chats and Forums");
		addcategory(form,353,"Chemistry");
		addcategory(form,354,"Cognitive Science");
		addcategory(form,355,"Complex Systems");
		addcategory(form,356,"Computer Science");
		addcategory(form,357,"Earth Sciences");
		addcategory(form,358,"Ecology");
		addcategory(form,359,"Energy");
		addcategory(form,360,"Engineering");
		addcategory(form,361,"Forensics");
		addcategory(form,362,"Geography");
		addcategory(form,363,"Geology and Geophysics");
		addcategory(form,364,"Hydrology");
		addcategory(form,365,"Information Technology");
		addcategory(form,366,"Life Sciences");
		addcategory(form,367,"Mathematics");
		addcategory(form,368,"Medicine");
		addcategory(form,369,"Meteorology");
		addcategory(form,370,"Nanotechnology");
		addcategory(form,371,"Physics");
		addcategory(form,372,"Psychology");
		addcategory(form,374,"Science, Technology, and Society Studies");
		addcategory(form,373,"Space");
		break;
	case "377":
		addcategory(form,378,"Antiques and Collectibles");
		addcategory(form,642,"Auctions");
		addcategory(form,379,"Automotive");
		addcategory(form,382,"Beauty Products");
		addcategory(form,384,"Books");
		addcategory(form,408,"Chemicals");
		addcategory(form,386,"Children");
		addcategory(form,387,"Clothing");
		addcategory(form,663,"Comparison Services");
		addcategory(form,400,"Computer Games");
		addcategory(form,389,"Computers");
		addcategory(form,391,"Consumer Electronics");
		addcategory(form,393,"Crafts");
		addcategory(form,394,"Education");
		addcategory(form,409,"Electronics and Electrical Components");
		addcategory(form,396,"Entertainment");
		addcategory(form,397,"Flowers");
		addcategory(form,674,"Food and Drink");
		addcategory(form,401,"Gifts");
		addcategory(form,404,"Health");
		addcategory(form,380,"Home and Garden");
		addcategory(form,381,"Jewelry");
		addcategory(form,383,"Major Retailers");
		addcategory(form,385,"Music");
		addcategory(form,388,"Office Products");
		addcategory(form,583,"Perfume");
		addcategory(form,390,"Pets");
		addcategory(form,392,"Publications");
		addcategory(form,406,"Seasonal");
		addcategory(form,696,"Shopping Services");
		addcategory(form,395,"Sports");
		addcategory(form,577,"Telecommunications");
		addcategory(form,398,"Tools");
		addcategory(form,399,"Toys and Games");
		addcategory(form,402,"Vehicle Hire");
		addcategory(form,403,"Visual Arts");
		addcategory(form,405,"Weddings");
		addcategory(form,407,"Wholesale");
		break;
	case "432":
		addcategory(form,433,"Activism");
		addcategory(form,434,"Advice");
		addcategory(form,435,"Crime");
		addcategory(form,436,"Death");
		addcategory(form,437,"Disabled");
		addcategory(form,438,"Economics");
		addcategory(form,439,"Ethnicity");
		addcategory(form,441,"Folklore");
		addcategory(form,442,"Future");
		addcategory(form,443,"Genealogy");
		addcategory(form,440,"History");
		addcategory(form,444,"Language and Linguistics");
		addcategory(form,454,"Men");
		addcategory(form,445,"Military");
		addcategory(form,446,"Organizations");
		addcategory(form,447,"People");
		addcategory(form,448,"Religion and Spirituality");
		addcategory(form,449,"Social Sciences");
		addcategory(form,450,"Subcultures");
		addcategory(form,451,"Support Groups");
		addcategory(form,452,"Urban Legends");
		addcategory(form,455,"Women");
		addcategory(form,453,"Work");
		break;
	}
	form.elements['sectionmsg'].value = "Pleace select the most relevant category.";
}

// Set Subcategory List
function setsubcategory (form) {
	// Selected Section Item
    var item = form.category.value;
	
	// Add Options into Category -- Specific for Section
	switch(item) {
	case "37":
		addsubcategory(form,37,"None");
		addsubcategory(form,688,"Agencies");
		form.subcategory.style.display = 'block';
		break;
	case "39":
		addsubcategory(form,39,"None");
		addsubcategory(form,517,"Debt Advice");
		addsubcategory(form,514,"Insurance");
		addsubcategory(form,671,"Insurance - Business Insurance");
		addsubcategory(form,669,"Insurance - Car and Motorcycle Insurance");
		addsubcategory(form,670,"Insurance - Home Insurance");
		addsubcategory(form,652,"Insurance - Insurance Brokers");
		addsubcategory(form,673,"Insurance - Life Insurance");
		addsubcategory(form,672,"Insurance - Other Insurance");
		addsubcategory(form,516,"Loans");
		addsubcategory(form,515,"Mortgages");
		addsubcategory(form,645,"Payment Systems");
		addsubcategory(form,686,"Stocks and Shares");
		form.subcategory.style.display = 'block';
		break;
	case "418":
		addsubcategory(form,418,"None");
		addsubcategory(form,628,"Books");
		addsubcategory(form,630,"Business Cards");
		addsubcategory(form,631,"Flyers");
		addsubcategory(form,629,"Merchandise");
		form.subcategory.style.display = 'block';
		break;
	case "456":
		addsubcategory(form,456,"None");
		addsubcategory(form,540,"For Sale");
		addsubcategory(form,650,"Removal Services");
		addsubcategory(form,539,"Rental Properties");
		form.subcategory.style.display = 'block';
		break;
	case "464":
		addsubcategory(form,464,"None");
		addsubcategory(form,569,"CCTV");
		addsubcategory(form,570,"Private Investigation");
		addsubcategory(form,571,"Surveillance");
		form.subcategory.style.display = 'block';
		break;
	case "503":
		addsubcategory(form,503,"None");
		addsubcategory(form,505,"Building and Construction");
		addsubcategory(form,690,"Catering and Food");
		addsubcategory(form,504,"Cleaning");
		addsubcategory(form,675,"Financial");
		addsubcategory(form,676,"Outsourcing");
		addsubcategory(form,582,"Translation");
		addsubcategory(form,656,"Video Editing");
		form.subcategory.style.display = 'block';
		break;
	case "461":
		addsubcategory(form,461,"None");
		addsubcategory(form,575,"Surveys");
		form.subcategory.style.display = 'block';
		break;
	case "498":
		addsubcategory(form,498,"None");
		addsubcategory(form,534,"Business");
		addsubcategory(form,500,"Finance");
		addsubcategory(form,639,"Gambling");
		addsubcategory(form,499,"General");
		addsubcategory(form,501,"Health");
		addsubcategory(form,535,"Property");
		addsubcategory(form,612,"Sport");
		addsubcategory(form,586,"Submission Services");
		addsubcategory(form,533,"Technology");
		addsubcategory(form,502,"Webmastering");
		form.subcategory.style.display = 'block';
		break;
	case "555":
		addsubcategory(form,555,"None");
		addsubcategory(form,695,"Art");
		addsubcategory(form,576,"Automotive");
		addsubcategory(form,561,"Beauty");
		addsubcategory(form,565,"Computers");
		addsubcategory(form,560,"Design");
		addsubcategory(form,566,"Electronics");
		addsubcategory(form,558,"Finance");
		addsubcategory(form,633,"Gambling");
		addsubcategory(form,632,"Gaming");
		addsubcategory(form,694,"History");
		addsubcategory(form,562,"Home &amp; Garden");
		addsubcategory(form,564,"Mobile Phones");
		addsubcategory(form,559,"Movies");
		addsubcategory(form,625,"Music");
		addsubcategory(form,563,"Shopping");
		addsubcategory(form,618,"Sport");
		addsubcategory(form,693,"Teens and Young Adults");
		addsubcategory(form,666,"TV");
		addsubcategory(form,557,"Webmaster");
		form.subcategory.style.display = 'block';
		break;
	case "88":
		addsubcategory(form,88,"None");
		addsubcategory(form,640,"Adware");
		addsubcategory(form,600,"Audio");
		addsubcategory(form,605,"Business");
		addsubcategory(form,606,"Calendar");
		addsubcategory(form,662,"Collaboration");
		addsubcategory(form,602,"Databases");
		addsubcategory(form,598,"Design");
		addsubcategory(form,597,"eCommerce");
		addsubcategory(form,607,"Email");
		addsubcategory(form,615,"Finance");
		addsubcategory(form,601,"Music");
		addsubcategory(form,621,"Networking");
		addsubcategory(form,614,"Privacy");
		addsubcategory(form,596,"Security");
		addsubcategory(form,556,"Software Testing");
		addsubcategory(form,620,"Tools");
		addsubcategory(form,599,"Video");
		addsubcategory(form,608,"Web Browsers");
		form.subcategory.style.display = 'block';
		break;
	case "93":
		addsubcategory(form,93,"None");
		addsubcategory(form,94,"Certification Preparation");
		addsubcategory(form,95,"Communications and Networking");
		addsubcategory(form,96,"Databases");
		addsubcategory(form,97,"Electronics");
		addsubcategory(form,98,"Internet and Web Skills");
		addsubcategory(form,99,"Multimedia");
		addsubcategory(form,100,"Sales Force Automation");
		form.subcategory.style.display = 'block';
		break;
	case "101":
		addsubcategory(form,101,"None");
		addsubcategory(form,460,"Directories of Directories");
		addsubcategory(form,587,"Directory Blogs");
		addsubcategory(form,651,"Directory Templates");
		addsubcategory(form,459,"Free Directories");
		addsubcategory(form,457,"Niche Directories");
		addsubcategory(form,573,"Niche Directories - Animals");
		addsubcategory(form,468,"Niche Directories - Business");
		addsubcategory(form,613,"Niche Directories - Dating");
		addsubcategory(form,472,"Niche Directories - Gambling");
		addsubcategory(form,610,"Niche Directories - Gifts");
		addsubcategory(form,538,"Niche Directories - Health");
		addsubcategory(form,611,"Niche Directories - Internet");
		addsubcategory(form,490,"Niche Directories - Mobile Phones");
		addsubcategory(form,574,"Niche Directories - News");
		addsubcategory(form,531,"Niche Directories - Property");
		addsubcategory(form,635,"Niche Directories - Regional");
		addsubcategory(form,471,"Niche Directories - Security");
		addsubcategory(form,489,"Niche Directories - Services");
		addsubcategory(form,469,"Niche Directories - Shopping");
		addsubcategory(form,537,"Niche Directories - Software");
		addsubcategory(form,604,"Niche Directories - Sport");
		addsubcategory(form,474,"Niche Directories - Templates");
		addsubcategory(form,470,"Niche Directories - Travel");
		addsubcategory(form,473,"Niche Directories - Webmaster");
		addsubcategory(form,458,"Paid Directories");
		addsubcategory(form,588,"Submission Services");
		form.subcategory.style.display = 'block';
		break;
	case "410":
		addsubcategory(form,410,"None");
		addsubcategory(form,634,"Forum Posting Services");
		addsubcategory(form,413,"Guides");
		addsubcategory(form,622,"Link Building");
		addsubcategory(form,623,"Traffic Exchange");
		form.subcategory.style.display = 'block';
		break;
	case "104":
		addsubcategory(form,104,"None");
		addsubcategory(form,105,"ActiveX");
		addsubcategory(form,106,"Beginner's Guides");
		addsubcategory(form,107,"Books");
		addsubcategory(form,108,"Browsers");
		addsubcategory(form,109,"Caching");
		addsubcategory(form,110,"Chat");
		addsubcategory(form,111,"Conferences and Events");
		addsubcategory(form,112,"Cookies");
		addsubcategory(form,113,"Databases and Searching");
		addsubcategory(form,114,"Deep Web");
		addsubcategory(form,115,"Domain Name Registration");
		addsubcategory(form,116,"Evaluation");
		addsubcategory(form,117,"FAQs");
		addsubcategory(form,118,"Forums");
		addsubcategory(form,119,"Gateways");
		addsubcategory(form,120,"History");
		addsubcategory(form,121,"HTML");
		addsubcategory(form,122,"HTTP");
		addsubcategory(form,123,"Imagemaps");
		addsubcategory(form,124,"JavaScript");
		addsubcategory(form,125,"Magazines");
		addsubcategory(form,126,"Organizations");
		addsubcategory(form,127,"Portals");
		addsubcategory(form,128,"Programming");
		addsubcategory(form,129,"Searching the Web");
		addsubcategory(form,130,"Security and Encryption");
		addsubcategory(form,131,"Semantic Web");
		addsubcategory(form,132,"Servers");
		addsubcategory(form,133,"Site Announcement and Promotion");
		addsubcategory(form,134,"Site Development");
		addsubcategory(form,135,"Software");
		addsubcategory(form,136,"Statistics and Demographics");
		addsubcategory(form,137,"URLs - Uniform Resource Locators");
		addsubcategory(form,138,"Usenet");
		addsubcategory(form,139,"Web Services");
		addsubcategory(form,140,"Weblogs");
		addsubcategory(form,141,"XML");
		form.subcategory.style.display = 'block';
		break;
	case "191":
		addsubcategory(form,191,"None");
		addsubcategory(form,638,"Cheats &amp; Hints");
		addsubcategory(form,644,"Flash");
		form.subcategory.style.display = 'block';
		break;
	case "301":
		addsubcategory(form,301,"None");
		addsubcategory(form,572,"Bingo");
		addsubcategory(form,494,"Blackjack");
		addsubcategory(form,495,"Casinos");
		addsubcategory(form,497,"Exchanges");
		addsubcategory(form,649,"Football");
		addsubcategory(form,496,"Horse Racing");
		addsubcategory(form,493,"Poker");
		form.subcategory.style.display = 'block';
		break;
	case "306":
		addsubcategory(form,306,"None");
		addsubcategory(form,593,"Camping");
		addsubcategory(form,609,"National Parks");
		addsubcategory(form,594,"Walking");
		form.subcategory.style.display = 'block';
		break;
	case "308":
		addsubcategory(form,308,"None");
		addsubcategory(form,547,"Baseball");
		addsubcategory(form,616,"Body Boarding");
		addsubcategory(form,546,"Boxing");
		addsubcategory(form,545,"Cricket");
		addsubcategory(form,544,"Football &amp; Soccer");
		addsubcategory(form,592,"Golf");
		addsubcategory(form,549,"Rugby");
		addsubcategory(form,646,"Skiing");
		addsubcategory(form,548,"Snooker and Pool");
		addsubcategory(form,647,"Snowboarding");
		addsubcategory(form,617,"Ultimate Frisbee");
		form.subcategory.style.display = 'block';
		break;
	case "667":
		addsubcategory(form,667,"None");
		addsubcategory(form,530,"Attractions");
		addsubcategory(form,636,"Destinations");
		addsubcategory(form,684,"Destinations - Africa");
		addsubcategory(form,689,"Destinations - Asia");
		addsubcategory(form,677,"Destinations - Australia");
		addsubcategory(form,682,"Destinations - Canada");
		addsubcategory(form,685,"Destinations - Europe");
		addsubcategory(form,679,"Destinations - Hong Kong");
		addsubcategory(form,637,"Destinations - Ireland");
		addsubcategory(form,678,"Destinations - New Zealand");
		addsubcategory(form,681,"Destinations - North America");
		addsubcategory(form,683,"Destinations - South America");
		addsubcategory(form,680,"Destinations - United Kingdom");
		addsubcategory(form,526,"Flights");
		addsubcategory(form,525,"Hotels");
		addsubcategory(form,527,"Packages");
		addsubcategory(form,529,"Tours");
		addsubcategory(form,528,"Travel Guides");
		addsubcategory(form,668,"Villas");
		form.subcategory.style.display = 'block';
		break;
	case "326":
		addsubcategory(form,326,"None");
		addsubcategory(form,553,"Lyrics");
		addsubcategory(form,554,"Sheet Music");
		form.subcategory.style.display = 'block';
		break;
	case "348":
		addsubcategory(form,348,"None");
		addsubcategory(form,506,"Other Animals");
		addsubcategory(form,307,"Pets");
		addsubcategory(form,507,"Pets - Cats");
		addsubcategory(form,508,"Pets - Dogs");
		addsubcategory(form,509,"Pets - Exotic");
		addsubcategory(form,511,"Pets - Horses");
		addsubcategory(form,512,"Pets - Snakes");
		addsubcategory(form,513,"Pets - Spiders");
		addsubcategory(form,510,"Wild Animals");
		form.subcategory.style.display = 'block';
		break;
	case "379":
		addsubcategory(form,379,"None");
		addsubcategory(form,698,"Automotive Parts");
		addsubcategory(form,697,"Breakdown Services");
		form.subcategory.style.display = 'block';
		break;
	case "387":
		addsubcategory(form,387,"None");
		addsubcategory(form,657,"Fancy Dress");
		addsubcategory(form,653,"Glasses");
		addsubcategory(form,655,"Hats");
		addsubcategory(form,654,"Shoes");
		form.subcategory.style.display = 'block';
		break;
	case "380":
		addsubcategory(form,380,"None");
		addsubcategory(form,477,"Bathroom");
		addsubcategory(form,480,"Bedroom");
		addsubcategory(form,478,"Carpets");
		addsubcategory(form,660,"Conservatory");
		addsubcategory(form,648,"DIY");
		addsubcategory(form,659,"Driveways");
		addsubcategory(form,482,"Exterior");
		addsubcategory(form,481,"Garden");
		addsubcategory(form,483,"Interior");
		addsubcategory(form,476,"Kitchen");
		addsubcategory(form,479,"Lounge");
		addsubcategory(form,658,"Trade Services");
		form.subcategory.style.display = 'block';
		break;
	case "385":
		addsubcategory(form,385,"None");
		addsubcategory(form,585,"Instruments");
		form.subcategory.style.display = 'block';
		break;
	case "577":
		addsubcategory(form,577,"None");
		addsubcategory(form,579,"Broadband");
		addsubcategory(form,580,"Cable");
		addsubcategory(form,484,"Calling Cards");
		addsubcategory(form,591,"Internet Access");
		addsubcategory(form,578,"Land Line Services");
		addsubcategory(form,465,"Mobile Phones");
		addsubcategory(form,487,"Mobile Phones - Fascias");
		addsubcategory(form,485,"Mobile Phones - Ringtones");
		addsubcategory(form,486,"Mobile Phones - Sim Cards");
		addsubcategory(form,488,"Mobile Phones - Wallpapers");
		addsubcategory(form,581,"VoIP");
		form.subcategory.style.display = 'block';
		break;
	default:
		form.subcategory.style.display = 'none';
	}
}
