var golf = new Array();
golf[0] = "Algarve Golf Guide";
golf[1] = "Backspin";
golf[2] = "Corporate Golf World";
golf[3] = "Costa del Sol - Golf Guide";
golf[4] = "Dansk Golf";
golf[5] = "English Club Golfer";
golf[6] = "Executive Golfer";
golf[7] = "Fairway Golfing";
golf[8] = "Golf - US";
golf[9] = "Golf & Travel";
golf[10] = "Golf Digest - UK";
golf[11] = "Golf Digest - Portugal";
golf[12] = "Golf Digest - Ireland";
golf[13] = "Golf International";
golf[14] = "Golf Ireland";
golf[15] = "Golf Journal";
golf[16] = "Golf Links";
golf[17] = "Golf Magasinet";
golf[18] = "Golf Monthly";
golf[19] = "Golf News";
golf[20] = "Golf Pages";
golf[21] = "Golf Punk";
golf[22] = "Golf World";
golf[23] = "Golfers Chronicle";
golf[24] = "GUI Ireland";
golf[25] = "Irish Golf Review";
golf[26] = "Irish Golf World";
golf[27] = "Lady Golfer";
golf[28] = "National Club Golfer";
golf[29] = "Norsk Golf";
golf[30] = "Pro Golf";
golf[31] = "Suomen Golflehti";
golf[32] = "Svensk Golf";
golf[33] = "The Player";
golf[34] = "Today's Golfer";
golf[35] = "Travel & Leisure Golf - US";
golf[36] = "Women and Golf";

var magazines = new Array();
magazines[0] = "Busines Plus";
magazines[1] = "Business and Finance";
magazines[2] = "Cash";
magazines[3] = "Clearview Portugal";
magazines[4] = "Conde Nast Traveller";
magazines[5] = "Country Life International";
magazines[6] = "Country Living";
magazines[7] = "Diplomat";
magazines[8] = "Destination Algarve";
magazines[9] = "ES Magazine";
magazines[10] = "Essential Magazines";
magazines[11] = "Financial Advisor";
magazines[12] = "GQ";
magazines[13] = "Harpers Bazare";
magazines[14] = "Inside Magazines";
magazines[15] = "International Homes";
magazines[16] = "Investment Week";
magazines[17] = "Investor Magazine";
magazines[18] = "Investors Chronicle";
magazines[19] = "Irish Property Buyer";
magazines[20] = "Maxmen";
magazines[21] = "Owners Perspective";
magazines[22] = "Signature Magazine";
magazines[23] = "Tatler";
magazines[24] = "The Business";
magazines[25] = "The Players Club";
magazines[26] = "Travel & Leisure - US";
magazines[27] = "Unique Lifestyles";
magazines[28] = "Vicinitee";
magazines[29] = "Vogue";

var inflight = new Array();
inflight[1] = "Cara";
inflight[4] = "Ryanair";

var newspapers = new Array();
newspapers[0] = "Daily Express";
newspapers[1] = "Daily Mail";
newspapers[2] = "Daily Mail Ireland";
newspapers[3] = "Daily Mirror";
newspapers[4] = "Daily Telegraph";
newspapers[5] = "Financial Times";
newspapers[6] = "Get Real Weekly";
newspapers[7] = "Irish Examiner";
newspapers[8] = "Irish Independent";
newspapers[9] = "Irish Times";
newspapers[10] = "Liverpool Daily Echo";
newspapers[11] = "Mail on Sunday";
newspapers[12] = "Manchester Evening News";
newspapers[13] = "Portugal News";
newspapers[14] = "Sunday Independent - IRL";
newspapers[15] = "Sunday Independent - UK";
newspapers[16] = "Sunday Life";
newspapers[17] = "Sunday Times - UK";
newspapers[18] = "Sunday Times - IRL";
newspapers[19] = "Sunday Times Magazine - UK";
newspapers[20] = "Sunday Tribune";
newspapers[21] = "The Algarve Resident";
newspapers[22] = "The Times";
newspapers[23] = "The Sun";

var television = new Array();
television[0] = "TV";
television[1] = "Channel 4";
television[2] = "E4";
television[3] = "ITV";
television[4] = "Paramount";
television[5] = "Real Estate TV";
television[6] = "RTE";
television[7] = "Setanta";
television[8] = "SKY";
television[9] = "TV3";

var internet = new Array();
internet[0] = "FAI.ie";
internet[1] = "Flybe.com";
internet[2] = "Fractionalife.com";
internet[3] = "Globaledge.co.uk";
internet[4] = "hotproperty.co.uk";
internet[5] = "Ireland.com";
internet[6] = "Newskys.co.uk";
internet[7] = "oceanicoresorts.com";
internet[8] = "oceanicogolf.com";
internet[9] = "oresidenceclub.com";
internet[10] = "ownersperpective.com";
internet[11] = "Search Engine - Google";
internet[12] = "Search Engine - MSN";
internet[13] = "Search Engine Other";
internet[14] = "Search Engine - Yahoo";
internet[15] = "Sharewatch.ie";
internet[16] = "Skysports.ie";
internet[17] = "Times.co.uk";
internet[18] = "Toptenproperties.net";
internet[19] = "Whattodowiththekids.com";

var radio = new Array();
radio[0] = "NewsTalk";
radio[1] = "Northern Ireland Regional Radio Station";
radio[2] = "Radio 1";
radio[3] = "Today FM";

var other = new Array();
other[0] = "e-letter";
other[1] = "Free Map Advertisement";
other[2] = "I've enquired before";
other[3] = "Newsletter";
other[4] = "Refferal";
other[5] = "Repeat Client";

var exhibition = new Array();
exhibition[0] = "Buying Properties Abroad 09";
exhibition[1] = "Fractional Life Expo 09";
exhibition[2] = "London Roadshow 09";
exhibition[3] = "Second Home International 09";

var sport = new Array();
sport[0] = "FAI";

var billboard = new Array();
billboard[0] = "Lisbon";
billboard[1] = "Faro";
billboard[2] = "Alcantarilha";

var eshot = new Array();
eshot[0] = "Developments E-shot";
eshot[1] = "Developments Newsletter";
eshot[2] = "Golf E-shot";
eshot[3] = "Golf Newsletter";
eshot[4] = "OPRC E-shot";
eshot[5] = "OPRC Newsletter";
eshot[6] = "Resorts E-shot";
eshot[7] = "Resorts Newsletter";

function where1Change(id_1, id_2)
{
	if (id_1 == null)
	{
		id_1 = "where1";
	}
	
	if (id_2 == null)
	{
		id_2 = "where2";
	}
	

	var where1 = document.getElementById(id_1);
	var where2 = document.getElementById(id_2);
	for(var i=where2.options.length-1; i>0; i--)
		where2.options[i] = null;
	if(where1.selectedIndex > 0)
	{
		var array;
		if(where1.options[where1.selectedIndex].value == "airport")
			array = airport;
		else if(where1.options[where1.selectedIndex].value  == "golf")
			array = golf;
		else if(where1.options[where1.selectedIndex].value  == "magazines")
			array = magazines;
		else if(where1.options[where1.selectedIndex].value  == "inflight")
			array = inflight;
		else if(where1.options[where1.selectedIndex].value  == "newspapers")
			array = newspapers;
		else if(where1.options[where1.selectedIndex].value  == "television")
			array = television;
		else if(where1.options[where1.selectedIndex].value  == "internet")
			array = internet;
		else if(where1.options[where1.selectedIndex].value  == "radio")
			array = radio;
		else if(where1.options[where1.selectedIndex].value  == "other")
			array = other;
		else if(where1.options[where1.selectedIndex].value  == "exhibition")
			array = exhibition;
		else if(where1.options[where1.selectedIndex].value  == "sport")
			array = sport;
		else if(where1.options[where1.selectedIndex].value  == "billboard")
			array = billboard;
		else if(where1.options[where1.selectedIndex].value  == "Newsletters/E-shots")
			array = eshot;
			
		for(var i=0; i<array.length; i++)
			where2.options[i+1] = new Option(array[i], array[i], false, false);
	}

}

function where2Change(id_2, id_hidden)
{
	if (id_2 == null)
	{
		id_2 = "where2";
	}
	
	if (id_hidden == null)
	{
		id_hidden = "where";
	}

	if (document.getElementById(id_hidden) != null)
	{
		document.getElementById(id_hidden).value = document.getElementById(id_2).value;
	}
	else
	{
		document.getElementsByName(id_hidden)[0].value = document.getElementById(id_2).value;
	}
}


var oceanico_rules = {
	'#fg-where1' : function (element)
	{
		element.onchange = function ()
		{
			where1Change('fg-where1', 'fg-where2');
		}
	},
	
	'#fg-where2' : function (element)
	{
		element.onchange = function ()
		{
			where2Change('fg-where2');
		}
	}
};

Behaviour.register(oceanico_rules);

