// Product Suggest v1.2

function displayMoreProductOptions(id, parentOption){
	var selectStartTag = "<select name=\"product\" id=\"product-option-2\" onChange=\"gotoLink('1', this.options[this.selectedIndex].value)\">";
	var selectEndTag = "</select>";
	
	if (document.getElementById){
		obj = document.getElementById(id);
		if (parentOption == "1") {
			selectString = selectStartTag + 
								createSelectOption(0, "Please select an option") +
								createSelectOption(1, "I am a male") +
								createSelectOption(2, "I am a female") +
								createSelectOption(3, "I am a parent/parent to be") +
								createSelectOption(4, "I am a retiree") +
							selectEndTag;
							
			obj.innerHTML = selectString;
		}
		else
		{
			obj.innerHTML = "";
			
			// Passes the option value from the parent select
			gotoLink(0, parentOption);
		}
	}
}

function createSelectOption(value, string) {
	return "<option value=" + value + ">" + string + "</option>";
}

/*
	optionLevel - Specifies the set of <select> currently in used. 0 = root, 1 = child and so on...
	optionValue - The value attribute of the <option> in the <select> specified in the optionLevel
*/
function gotoLink(optionLevel, optionValue) {
	// If is selected from the root select options
	if (optionLevel == 0) {
		switch(optionValue) {
		case "0":		// Please select an option
		case "1":		// Open a savings account (Note: Is to open a second level selection. Will not hit, but here just in case
			break;
		case "2":		// Open an account with cheque book
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_Cur_EasiSave.shtm";
			break;
		case "3": 		// Save for my child
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_Sav_YoungSavers.shtm";
			break;
		case "4":		// Save a fixed sum of money each month
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_MSP.shtm";
			break;
		case "5":		// Save a fixed lump sum for a longer period
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_Tmd_SinDollar.shtm";
			break;
		default:
			break;
		}
	}
	else if (optionLevel == 1) {
		switch(optionValue) {
		case "0":		// Please select an option
			break;
		case "1":		// I am a male
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_Sav_Statement.shtm"
			break;
		case "2":		// I am a female
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_SmartSavings.shtm"
			break;
		case "3":		// I am a parent/parent to be
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_SmartParent.shtm"
			break;
		case "4":		// I am a retiree
			window.location = "http://www.ocbc.com.sg/personal-banking/banking/Bnk_Dep_SmartSenior.shtm"
			break;
		default:
			break;
		}
	}
}

function gotoDirectLink(url)
{
	if (url != 0)
		window.location =  url;
}