/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only thing you need to change in this file is the following
variables: checkboxHeight, radioHeight and selectWidth.

Replace the first two numbers with the height of the checkbox and
radio button. The actual height of both the checkbox and radio
images should be 4 times the height of these two variables. The
selectWidth value should be the width of your select list image.

You may need to adjust your images a bit if there is a slight
vertical movement during the different stages of the button
activation.

Visit http://ryanfait.com/ for more information.

*/

var indexCombo1 = "169";
var indexCombo2 = "145";
var rechargeCombo1 = "101";
var registerCombo1 = "74";
var registerCombo2 = "74";
var registerCombo3 = "55";
var registerCombo3Error = "55";
var registerCombo4 = "60";
var registerCombo4Error = "60";
var registerCombo5 = "76";
var registerCombo5Error = "76";
var registerCombo6 = "215";
var mobilephoneCombo1 = "93";
var findstoreCombo = "152";
var personalDetailsCombo1 = "74";
var personalDetailsDateCombo = "55";
var personalDetailsMonthCombo = "60";
var personalDetailsYearCombo = "76";
var personalDetailsStreetTypeCombo = "215";

/* No need to change anything after this */
/*
document.write('<style type="text/css"> select.index_combo1 { position: relative; width: ' + indexCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.index_combo2 { position: relative; width: ' + indexCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.recharge_dropdown { position: relative; width: ' + rechargeCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo1 { position: relative; width: ' + registerCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo2 { position: relative; width: ' + registerCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3 { position: relative; width: ' + registerCombo3 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3_error { position: relative; width: ' + registerCombo3Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3 { position: relative; width: ' + registerCombo4 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3Error { position: relative; width: ' + registerCombo4Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4 { position: relative; width: ' + registerCombo5 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4Error { position: relative; width: ' + registerCombo5Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_5 { position: relative; width: ' + registerCombo6 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.mobilePhone_combo1 { position: relative; width: ' + mobilephoneCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.findstore_combo { position: relative; width: ' + findstoreCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_combo { position: relative; width: ' + personalDetailsCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Datecombo { position: relative; width: ' + personalDetailsDateCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Monthcombo { position: relative; width: ' + personalDetailsMonthCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Yearcombo { position: relative; width: ' + personalDetailsYearCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_streetTypecombo { position: relative; width: ' + personalDetailsStreetTypeCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } </style>');
*/


$().ready(function() {
//$("body").append('<style type="text/css"> select.index_combo1 { position: relative; width: ' + indexCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.index_combo2 { position: relative; width: ' + indexCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.recharge_dropdown { position: relative; width: ' + rechargeCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo1 { position: relative; width: ' + registerCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo2 { position: relative; width: ' + registerCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3 { position: relative; width: ' + registerCombo3 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3_error { position: relative; width: ' + registerCombo3Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3 { position: relative; width: ' + registerCombo4 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3Error { position: relative; width: ' + registerCombo4Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4 { position: relative; width: ' + registerCombo5 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4Error { position: relative; width: ' + registerCombo5Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_5 { position: relative; width: ' + registerCombo6 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.mobilePhone_combo1 { position: relative; width: ' + mobilephoneCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.findstore_combo { position: relative; width: ' + findstoreCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_combo { position: relative; width: ' + personalDetailsCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Datecombo { position: relative; width: ' + personalDetailsDateCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Monthcombo { position: relative; width: ' + personalDetailsMonthCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Yearcombo { position: relative; width: ' + personalDetailsYearCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_streetTypecombo { position: relative; width: ' + personalDetailsStreetTypeCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } </style>');
$("body").append('<style type="text/css"> select.index_combo1 { position: relative; width: ' + indexCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.index_combo2 { position: relative; width: ' + indexCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.recharge_dropdown { position: relative; width: ' + rechargeCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo1 { position: relative; width: ' + registerCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo2 { position: relative; width: ' + registerCombo2 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3 { position: relative; width: ' + registerCombo3 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo3_error { position: relative; width: ' + registerCombo3Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3 { position: relative; width: ' + registerCombo4 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_3Error { position: relative; width: ' + registerCombo4Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4 { position: relative; width: ' + registerCombo5 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_4Error { position: relative; width: ' + registerCombo5Error + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.register_combo_5 { position: relative; width: ' + registerCombo6 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.mobilePhone_combo1 { position: relative; width: ' + mobilephoneCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.findstore_combo { position: relative; width: ' + findstoreCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_combo { position: relative; width: ' + personalDetailsCombo1 + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Datecombo { position: relative; width: ' + personalDetailsDateCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Monthcombo { position: relative; width: ' + personalDetailsMonthCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_Yearcombo { position: relative; width: ' + personalDetailsYearCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } select.personnalDetails_streetTypecombo { position: relative; width: ' + personalDetailsStreetTypeCombo + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } </style>');

});


var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("select"), span = Array(), textnode, option, active;
		
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].type == "select") {
				span[a] = document.createElement("span");
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "index_combo1") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "index_combo1";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "index_combo2") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "index_combo2";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "recharge_dropdown") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "recharge_dropdown";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo1") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo1";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo2") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo2";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo3") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo3";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo3_error") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo3_error";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo_3") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo_3";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo_3Error") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo_3Error";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo_4") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo_4";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo_4Error") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo_4Error";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "register_combo_5") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "register_combo_5";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "mobilePhone_combo1") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "mobilePhone_combo1";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "findstore_combo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "findstore_combo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "personnalDetails_combo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "personnalDetails_combo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "personnalDetails_Datecombo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "personnalDetails_Datecombo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "personnalDetails_Monthcombo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "personnalDetails_Monthcombo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "personnalDetails_Yearcombo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "personnalDetails_Yearcombo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
			if(inputs[a].className == "personnalDetails_streetTypecombo") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "personnalDetails_streetTypecombo";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
			
		}
	},
	

	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;
