/*

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.

*/

/* No need to change anything after this */

            /*var browser = navigator.appName;
            var b_version=navigator.appVersion;
            var version=parseFloat(b_version);
            if ((browser== "Microsoft Internet Explorer") && (version <= 6))
            {
            }
            else
            {*/
                var checkboxHeight = "17";
        var radioHeight = "25";
        var selectWidth = "180";
        var selectWidth2 = "117";
        var selectWidth3 = "66";
        var selectWidth4 = "76";
        var checked = true;

        var style="<style type=\"text/css\">input#ctl00_ContentPlaceHolder1_ctlQuestions_chkEmailMe_b0d54934_cbValue_0, input#ctl00_ContentPlaceHolder1_ctlQuestions_chkTextMe_5b8b8d30_cbValue_0 { display: none; }"
+ "select.styled2 { position: relative; width: " + selectWidth2 + "px; opacity: 0; filter: alpha(opacity=0); z-index: 6; } select.styled, select.error { position: relative; width: " + selectWidth + "px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }"
+ "select.styled3 { position: relative; width: " + selectWidth3 + "px; opacity: 0; filter: alpha(opacity=0); z-index: 7; }"
+ "select.styled4 { position: relative; width: " + selectWidth4 + "px; opacity: 0; filter: alpha(opacity=0); z-index: 8; }"
+ "input#ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_0, input#ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_1, input#ctl00_ContentPlaceHolder1_ctlQuestions_chkAgree_fb499283_cbValue_0 { display: none; }"
+"</style>";
        document.write(style);

var Custom = {
	BirthdayControl: null,
	init: function()
	{
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, selectedoption, active;
		for (a = 0; a < inputs.length; a++)
		{
			if ((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkEmailMe_b0d54934_cbValue_0")
			{
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if (inputs[a].checked == true)
				{
					if (inputs[a].type == "checkbox")
					{
						position = "0 -" + (checkboxHeight * 1) + "px";
						span[a].style.backgroundPosition = position;
					} else
					{
						position = "0 -" + (radioHeight * 2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}

			if ((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkTextMe_5b8b8d30_cbValue_0")
			{
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if (inputs[a].checked == true)
				{
					if (inputs[a].type == "checkbox")
					{
						position = "0 -" + (checkboxHeight * 1) + "px";
						span[a].style.backgroundPosition = position;
					} else
					{
						position = "0 -" + (radioHeight * 2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}

			if ((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_0")
			{
				span[a] = document.createElement("span");
				span[a].className = "checkbox2";

				if (inputs[a].checked == true)
				{
					if (inputs[a].type == "checkbox")
					{
						position = "0 -" + (checkboxHeight * 1) + "px";
						span[a].style.backgroundPosition = position;
					} else
					{
						position = "0 -" + (radioHeight * 2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}

			if ((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_1")
			{
				span[a] = document.createElement("span");
				span[a].className = "checkbox2";

				if (inputs[a].checked == true)
				{
					if (inputs[a].type == "checkbox")
					{
						position = "0 -" + (checkboxHeight * 1) + "px";
						span[a].style.backgroundPosition = position;
					} else
					{
						position = "0 -" + (radioHeight * 2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
			if ((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkAgree_fb499283_cbValue_0")
			{
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if (inputs[a].checked == true)
				{
					if (inputs[a].type == "checkbox")
					{
						position = "0 -" + (checkboxHeight * 1) + "px";
						span[a].style.backgroundPosition = position;
					} else
					{
						position = "0 -" + (radioHeight * 2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for (a = 0; a < inputs.length; a++)
		{
			if (inputs[a].className == "styled")
			{
				selectedoption = inputs[a].getElementsByTagName("option");
				active = selectedoption[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for (b = 0; b < selectedoption.length; b++)
				{
					if (selectedoption[b].selected == true)
					{
						textnode = document.createTextNode(selectedoption[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				//span[a].id = inputs[a].id;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}

			if (inputs[a].className == "styled2")
			{
				selectedoption = inputs[a].getElementsByTagName("option");
				active = selectedoption[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for (b = 0; b < selectedoption.length; b++)
				{
					if (selectedoption[b].selected == true)
					{
						textnode = document.createTextNode(selectedoption[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select2";
			    span[a].id = "select" + inputs[a].name;
				//span[a].id = inputs[a].id;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose2;
			}

			if (inputs[a].className == "styled3")
			{
				selectedoption = inputs[a].getElementsByTagName("option");
				active = selectedoption[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for (b = 0; b < selectedoption.length; b++)
				{
					if (selectedoption[b].selected == true)
					{
						textnode = document.createTextNode(selectedoption[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select3";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose3;
			}

			if (inputs[a].className == "styled4")
			{
				selectedoption = inputs[a].getElementsByTagName("option");
				active = selectedoption[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for (b = 0; b < selectedoption.length; b++)
				{
					if (selectedoption[b].selected == true)
					{
						textnode = document.createTextNode(selectedoption[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select4";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose4;
			}
		}

		/*if (PrizeLogic !== null && PrizeLogic.IsPostBack)
		{
			Custom.choose();
			Custom.choose2();
			Custom.choose3();
			Custom.choose4();
		}*/
	},
	pushed: function()
	{
		element = this.nextSibling;
		if (element.checked == true && element.type == "checkbox")
		{
			this.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
		} else if (element.checked == true && element.type == "radio")
		{
			this.style.backgroundPosition = "0 -" + radioHeight * 3 + "px";
		} else if (element.checked != true && element.type == "checkbox")
		{
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else
		{
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function()
	{
		element = this.nextSibling;
		if (element.checked == true && element.type == "checkbox")
		{
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else
		{
			if (element.type == "checkbox")
			{
				this.style.backgroundPosition = "0 -" + checkboxHeight * 2 + "px";
				var currentid = element.parentNode.id;

				if ((currentid === 'chkYes10' || currentid === 'chkNo10') && (checked))
				{
					var id = (currentid === 'chkYes10') ? 'chkNo10' : 'chkYes10';
					
					checked = false;
					
					var check = document.getElementById(currentid).firstChild.nextSibling.checked = true;
					
					var unCheck = document.getElementById(id).firstChild;
					unCheck.nextSibling.checked = true;
					unCheck.onmouseup();
				}
			} else
			{
				this.style.backgroundPosition = "0 -" + radioHeight * 2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for (a = 0; a < inputs.length; a++)
				{
					if (inputs[a].name == group && inputs[a] != this.nextSibling)
					{
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}

			if (checked)
			{
				element.checked = true;
			}

			checked = true;
		}
	},
	clear: function()
	{
		inputs = document.getElementsByTagName("input");
		for (var b = 0; b < inputs.length; b++)
		{
			if (inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkEmailMe_b0d54934_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
			} else if (inputs[b].type == "checkbox" && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkEmailMe_b0d54934_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if (inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight * 2 + "px";
			} else if (inputs[b].type == "radio" && inputs[b].className == "styled")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
			else if (inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkTextMe_5b8b8d30_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
			} else if (inputs[b].type == "checkbox" && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkTextMe_3eeb9e64_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
			else if (inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
			} else if (inputs[b].type == "checkbox" && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
			else if (inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_1")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
			} else if (inputs[b].type == "checkbox" && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chklgender_e2f3e871_cbValue_1")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
			else if (inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkAgree_fb499283_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight * 1 + "px";
			} else if (inputs[b].type == "checkbox" && inputs[b].id == "ctl00_ContentPlaceHolder1_ctlQuestions_chkAgree_fb499283_cbValue_0")
			{
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function()
	{
		//selectedoption = this.getElementsByTagName("option");
		selectedoption = jQuery('#ctl00_ContentPlaceHolder1_ctlQuestions_ddlState_81e13545_ddValue');
		document.getElementById("selectctl00$ContentPlaceHolder1$ctlQuestions$ddlState_81e13545$ddValue").childNodes[0].nodeValue = selectedoption[0].options[selectedoption[0].selectedIndex].text;
//		for (d = 0; d < selectedoption.length; d++)
//		{
//			if (selectedoption[d].selected == true)
//			{
//				document.getElementById("select" + "ctl00$ContentPlaceHolder2$ctlQuestions$ddlState_81e13545$ddValue").childNodes[0].nodeValue = selectedoption[d].childNodes[0].nodeValue;
//			}
//		}
	},
	choose2: function()
	{
		selectedoption = document.getElementById(Custom.BirthdayControl.ddlMonthId);
		//document.getElementById("select" + "ddlMonth_ctl00_ContentPlaceHolder1_ctlQuestions_lbldateOfBirth_53d460e9").childNodes[0].nodeValue = selectedoption.selectedoptions[selectedoption.selectedIndex].text;
		//Custom.BirthdayControl.AddDaysToDropDown(selectedoption);

		for (d = 0; d < selectedoption.length; d++)
		{
			if (selectedoption[d].selected == true)
			{
				document.getElementById("selectddlMonth_ctl00_ContentPlaceHolder1_ctlQuestions_lbldateOfBirth_53d460e9").childNodes[0].nodeValue = selectedoption[d].text;
			}
		}
		Custom.BirthdayControl.AddDaysToDropDown(selectedoption);
	},
	choose3: function()
	{
		selectedoption = document.getElementById(Custom.BirthdayControl.ddlDayId);
		//document.getElementById("select" + "ddlDay_ctl00_ContentPlaceHolder1_ctlQuestions_lbldateOfBirth_53d460e9").childNodes[0].nodeValue = selectedoption.selectedoptions[selectedoption.selectedIndex].text;
		//Custom.BirthdayControl.AddYearsToDropDown(selectedoption);

		for (d = 0; d < selectedoption.length; d++)
		{
			if (selectedoption[d].selected == true)
			{
				document.getElementById("selectddlDay_ctl00_ContentPlaceHolder1_ctlQuestions_lbldateOfBirth_53d460e9").childNodes[0].nodeValue = selectedoption[d].text;
			}
		}
		Custom.BirthdayControl.AddYearsToDropDown(0,18);
	},
	choose4: function()
	{
		selectedoption = document.getElementById(Custom.BirthdayControl.ddlYearId);
		document.getElementById("select" + "ddlYear_ctl00_ContentPlaceHolder1_ctlQuestions_lbldateOfBirth_53d460e9").childNodes[0].nodeValue = selectedoption.options[selectedoption.selectedIndex].text;
		Custom.BirthdayControl.SetHiddenField('/');

		//		for (d = 0; d < selectedoption.length; d++)
		//		{
		//			if (selectedoption[d].selected == true)
		//			{
		//				document.getElementById("select" + this.name).childNodes[0].nodeValue = selectedoption[d].childNodes[0].nodeValue;
		//				Custom.BirthdayControl.AddDaysToDropDown(document.getElementById(Custom.BirthdayControl.ddlMonthId));
		//			}
		//		}
	},
	postback: function()
	{
	    return;
	}
}