var category = new Array("Women's", "Men's", "Charities", "Children's | Teen's", "Employment",
			 "Education", "Gay/Lesbian", "Information Technology", "Love & Relationship",
			 "World Organizations", "Magazine | Travel", "Art");

var site_names = new Array(category.length);

site_names[0] = new Array("Beauty Cosmetics", "Beauty Product", "Cosmetic Digest", "Hair Digest",
			  "Natural Beauty Products", "Woman Outlook", "Womens Cosmetics", "Womens Products");
site_names[1] = new Array("Looking Great", "Man Skincare", "Mens Cosmetics", "Men Digest",
			  "Mens Products", "Mens Time");
site_names[2] = new Array("God, Incorporated", "Gods Hope", "Gods Toolbox", "Healing Children",
			  "Shop to Heal Children", "Shop to Educate Children", "Shop to Educate",
			  "Shop to Heal Children.org", "Shop to Love Children", "Shop to Heal");
site_names[3] = new Array("Children Digest", "Education Digest", "Hair Digest", "Healing Children",
			  "Teen Digest", "Teen Products");
site_names[4] = new Array("Management Consulting", "The London Company");
site_names[5] = new Array("Education Digest", "Children Digest", "Invicient", "Teen Digest", "Utopia Chocolate");
site_names[6] = new Array("Gays Digest", "Gay Expressions", "Lesbian Digest");
site_names[7] = new Array("e-Commerce Life", "Invicient", "Searchcrest", "The London Company");
site_names[8] = new Array("Love Digest", "Purrfect Love", "Timeless Love");
site_names[9] = new Array("Center for World Change", "Outlook World", "World Vision Forum");

site_names[10] = new Array("Serendipity Travel", "Tour d' Europa", "e-Commerce Life", "Outlook World");

site_names[11] = new Array("Art genres", "Movement of the Soul", "Impressionists Art");


var site_urls = new Array(category.length);

site_urls[0] = new Array("http://www.beautycosmetics.com", "http://www.beauty-product.com", "http://www.cosmeticdigest.com",
			 "http://www.hairdigest.com", "http://www.naturalbeautyproducts.com", "http://www.womanoutlook.com",
			 "http://www.womenscosmetics.com", "http://www.womensproducts.com");
site_urls[1] = new Array("http://www.lookinggreat.com", "http://www.manskincare.com", "http://www.menscosmetics.com",
			 "http://www.mendigest.com", "http://www.mensproducts.com", "http://www.menstime.com");
site_urls[2] = new Array("http://www.godincorporated.org", "http://www.godshope.org", "http://www.godstoolbox.org",
			 "http://www.healingchildren.com", "http://www.shop2healchildren.com", "http://shop2educatechildren.com",
			 "http://shop2educate.com","http://www.shop2healchildren.org", "http://shop2lovechildren.com",
			 "http://shop2heal.com");
site_urls[3] = new Array("http://www.childrendigest.com", "http://www.educationdigest.com", "http://www.hairdigest.com",
			 "http://www.healingchildren.com", "http://www.teendigest.com", "http://www.teenproducts.com");
site_urls[4] = new Array("http://www.managementconsulting.com", "http://www.thelondonco.com");
site_urls[5] = new Array("http://www.childrendigest.com", "http://www.educationdigest.com", "http://www.invicient.com",
			 "http://www.teendigest.com", "http://utopiachocolate.com");
site_urls[6] = new Array("http://www.gaysdigest.com", "http://www.gayexpressions.com", "http://www.invicient.com");
site_urls[7] = new Array("http://www.e-commercelife.com", "http://www.invicient.com", "http://www.searchcrest.com",
			 "http://www.thelondonco.com");
site_urls[8] = new Array("http://www.lovedigest.com", "http://www.purrfectlove.com", "http://www.timelesslove.com");
site_urls[9] = new Array("http://www.centerforworldchange.com", "http://www.outlookworld.com", "http://www.worldvisionforum.com");

site_urls[10] = new Array("http://serendipitytravel.com", "http://www.tourdeuropa.com", "http://www.e-commercelife.com",
			  "http://www.outlookworld.com");
site_urls[11] = new Array("http://artgenres.com", "http://www.movementofthesoul.com", "http://www.impressionistsart.com");

var catOption;
var siteOption;
var hidField;

function register(cat, site, hid)
{
	catOption = document.getElementById(cat);
	siteOption = document.getElementById(site);
	hidField = document.getElementById(hid);

	catOption.selectedIndex = 0;
	siteOption.selectedIndex = 0;

	catOption.onchange = event_handler;
	siteOption.onchange = event_handler;
	
	getSiteCat();
}

function event_handler()
{
	switch(event.srcElement.id)
	{
	case catOption.id:
	    getSiteNames(event.srcElement.selectedIndex);
	break;
	case siteOption.id:
	    sethidField(event.srcElement.value);
	break;

	default:
	return;
	}
}

function getSiteCat()
{
  var siteStr = "- Category -";

  resetOption(catOption);

  catOption.options.length = 1;
  catOption.options[0] = new Option(siteStr, "");

  for (var i=1; i <= category.length; i++)
  {
	catOption.options[i] = new Option(category[i-1]);
  }

  catOption.disabled = false;
  catOption.focus();
}


function getSiteNames(cat)
{
  var siteStr = "- Site -";

  resetOption(siteOption);

  if (cat <= 0)
  {
  	resetOption(siteOption);
  	return;
  }

  var catIndex = cat-1;

  siteOption.options.length = 1;
  siteOption.options[0] = new Option(siteStr, "");

  for (var i=1; i <= site_names[catIndex].length; i++)
  {
	siteOption.options[i] = new Option (site_names[catIndex][i-1], site_urls[catIndex][i-1]);
  }

  siteOption.disabled = false;
  siteOption.focus();
}

function sethidField(url)
{
	hidField.value = url;
}

function resetOption(anOption)
{
  anOption.options.length = 1;
  anOption.disabled = true;
}
