$(function() {
	$("a[rel^=Lightbox]").lightBox();
});

$(document).ready(function(){
	$("#Query").focus(function(){
		if($("#Query").attr("value") == "SEARCH") $("#Query").attr("value", "");
	});
	$("#Query").blur(function(){
		if($("#Query").attr("value") == "") $("#Query").attr("value", "SEARCH");
	});
	
	$("#Checkbox_Copy").click(function(){
		if($("#Checkbox_Copy").attr("class") == "Checkbox") {
			$("#Checkbox_Copy").attr("class", "CheckboxChecked");
			$("#Copy").attr("checked", "checked");
		} else {
			$("#Checkbox_Copy").attr("class", "Checkbox");
			$("#Copy").removeAttr("checked", "");
		}
	});
	
	$("#Checkbox_OptIn").click(function(){
		if($("#Checkbox_OptIn").attr("class") == "Checkbox") {
			$("#Checkbox_OptIn").attr("class", "CheckboxChecked");
			$("#OptIn").attr("checked", "checked");
		} else {
			$("#Checkbox_OptIn").attr("class", "Checkbox");
			$("#OptIn").removeAttr("checked", "");
		}
	});
	
	$("#MenuBar").children("div").hover(function(){
		if($(this).children(".SubMenu").size() >= 1) {
			$(this).css("background-color", "#3e3631");
			$(this).children("a").css("color", "#ffffff");
			$(this).children(".SubMenu").css("display", "block");
		} else {
			$(this).children("a").css("color", "#93a8a7");
		}
	}, function(){
		if($(this).children(".SubMenu").size() >= 1) {
			$(this).css("background-color", "transparent");
			$(this).children("a").css("color", "#000000");
			$(this).children(".SubMenu").css("display", "none");
		} else {
			$(this).children("a").css("color", "#000000");
		}
	});
	
	$(".Dropdown").toggle(function(){
		$(this).children(".OptionList").slideDown();
	}, function(){
		$(this).children(".OptionList").slideUp();
	});
	
	$(".Option").hover(function(){
		$(this).css("background-color", "#eeeeee");
	}, function(){
		$(this).css("background-color", "transparent");
	});
	
	$(".Option").click(function(){
		$(this).parent(".OptionList").parent(".Dropdown").children(".Chosen").html($(this).html());
		$(this).parent(".OptionList").slideUp();
		$("#ContactUs > input[name$='" + $(this).parent(".OptionList").parent(".Dropdown").attr("id") + "']").attr("value", $(this).html());
		
		if($(this).parent(".OptionList").parent(".Dropdown").attr("id") == "Country") {
			UpdateStateList($(this).html());
		}
	});
});

SelectThumbnail = function(Image, Title, Summary, URL, LightboxImage) {
	$("#ThumbnailSelected").html("<a href='" + LightboxImage + "' rel='Lightbox' title='" + Title + "'><img src='" + Image + "'></a>");
	if(URL != "") {
		Title = "<a href='" + URL + "' style='color:#000000;'>" + Title + "</a>&nbsp;&nbsp;<a href='" + URL + "'><img src='/Templates/Default/gfx/ThumbnailArrow.gif' width='13' height='13'></a>";
	}
	$("#ThumbnailTitle").html(Title);
	$("#ThumbnailSummary").html(Summary);
	$(function() { $("a[rel^=Lightbox]").lightBox(); });
}

ValidateContactUs = function() {
	if($("#ContactUs").children("input[name$='What']").attr("value") == "") {
	   alert("Please choose what we can do for you");
	   return false;
	} else if($("#ContactUs").children("input[name$='Subject']").attr("value") == "") {
	   alert("Please choose a subject");
	   return false;
	} else if($("#ContactUs").children("input[name$='Industry']").attr("value") == "") {
	   alert("Please choose your industry");
	   return false;
	} else if($("#ContactUs").children("input[name$='Name']").attr("value") == "") {
	   alert("Please enter your name");
	   return false;
	} else if($("#ContactUs").children("input[name$='CompanyName']").attr("value") == "") {
	   alert("Please enter your company name");
	   return false;
	} else if($("#ContactUs").children("input[name$='Country']").attr("value") == "") {
	   alert("Please choose your Country");
	   return false;
	} else if($("#ContactUs").children("input[name$='Address']").attr("value") == "") {
	   alert("Please enter your address");
	   return false;
	} else if($("#ContactUs").children("input[name$='City']").attr("value") == "") {
	   alert("Please enter your City");
	   return false;
	} else if($("#ContactUs").children("input[name$='State']").attr("value") == "") {
	   alert("Please choose your State");
	   return false;
	} else if($("#ContactUs").children("input[name$='Zip']").attr("value") == "") {
	   alert("Please enter your Zip code");
	   return false;
	} else if($("#ContactUs").children("input[name$='Phone']").attr("value") == "") {
	   alert("Please enter your phone number");
	   return false;
	} else if($("#ContactUs").children("input[name$='Email']").attr("value") == "") {
	   alert("Please enter your email address");
	   return false;
	}
	
	return true;
}

ValidateSendUs = function() {
	if($("#SendUs").children("input[name$='Email']").attr("value") == "") {
		alert("Please enter your email address");
		return false;
	}
	
	return true;
}

StateSelected = function(Object) {
	$(Object).parent(".OptionList").parent(".Dropdown").children(".Chosen").html($(Object).html());
	$(Object).parent(".OptionList").slideUp();
	$("#ContactUs > input[name$='" + $(Object).parent(".OptionList").parent(".Dropdown").attr("id") + "']").attr("value", $(Object).html());
}

UpdateStateList = function(Country) {
	if(Country == "United States") {
		$("#State").html(
			"<div class='Chosen'></div>" +
			"<div class='OptionList' style='z-index:300;'>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Alabama</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Alaska</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Arizona</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Arkansas</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>California</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Colorado</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Connecticut</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Delaware</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Florida</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Georgia</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Hawaii</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Idaho</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Illinois</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Indiana</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Iowa</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Kansas</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Kentucky</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Louisiana</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Maine</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Maryland</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Massachusetts</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Michigan</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Minnesota</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Mississippi</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Missouri</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Montana</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Nebraska</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Nevada</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>New Hampshire</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>New Jersey</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>New Mexico</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>New York</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>North Carolina</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>North Dakota</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Ohio</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Oklahoma</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Oregon</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Pennsylvania</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Rhode Island</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>South Carolina</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>South Dakota</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Tennessee</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Texas</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Utah</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Vermont</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Virginia</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Washington</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Washington D.C.</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>West Virginia</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Wisconsin</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Wyoming</div>" + 
			"</div>"
		);
	} else if(Country == "Canada") {
		$("#State").html(
			"<div class='Chosen'></div>" +
			"<div class='OptionList' style='z-index:300;'>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Alberta</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>British Columbia</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Manitoba</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>New Brunswick</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Newfoundland</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Northwest Territory</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Nova Scotia</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Nunavut</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Ontario</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Prince Edward Island</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Quebec</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Saskatchewan</div>" +
				"<div class='Option' onMouseOver=\"this.style.backgroundColor='#eeeeee';\" onMouseOut=\"this.style.backgroundColor='transparent';\" onClick='StateSelected(this);'>Yukon Territory</div>" +
			"</div>"
		);
	} else if(Country == "Mexico") {
		$("#State").html("<div class='Chosen'>N/A</div>");
	} else if(Country == "Puerto Rico") {
		$("#State").html("<div class='Chosen'>N/A</div>");
	} else if(Country == "Other") {
		$("#State").html("<div class='Chosen'>N/A</div>");
	}
}

ToggleCurrentCopy = function(Market) {
	if(Market == "OfficeFurniture") {
		$("#ElectricalSolutionsCopy").html("<p>From state-of-the-art panel furniture systems to cutting edge table and conference electrical solutions and innovative floor-mount power access, we supply the most comprehensive line of power distribution systems to the major office furniture manufacturers in North America.<p><a href='/Data/Files/CapabilitiesElectricalNextConnectPromo.pdf'>NEXT CONNECT Promo</a><p><a href='/Data/Files/CapabilitiesElectricalNextConnecttechbulletin.pdf'>NEXT CONNECT Technical Bulletin</a>");
	} else if(Market == "Lighting") {
		$("#ElectricalSolutionsCopy").html("<p>From suspended ceiling-mounted lighting to under-cabinet task lighting and state-of-the-art desk lamps, let us provide you with the technical know-how and design inspiration to illuminate your company’s workspace.");
	} else if(Market == "TransportationIndustrial") {
		$("#ElectricalSolutionsCopy").html("<p>From high performance marine watercraft to heavy duty trucks, to major farm equipment and the latest hybrid automotive designs, we create strong, long-lasting electrical solutions for leading transportation and industrial companies.");
	} else if(Market == "Appliance") {
		$("#ElectricalSolutionsCopy").html("<p>From the latest in fabric care to the newest small appliance innovations and robust refrigeration, our inspired designs help customers reduce part complexity and improve their throughput velocity, saving time and money while reducing cost of quality.");
	} else if(Market == "Consumer") {
		$("#ElectricalSolutionsCopy").html("<p>From plug-in air fresheners to reed diffuser fragrances and hair care products, we delight creative minds in the consumer products industry with low-cost manufacturing and our ability to meet global agency standards for quality and performance.");
	} else if(Market == "Medical") {
		$("#ElectricalSolutionsCopy").html("<p>From respiratory care components and assemblies to fully assembled medical products, our ISO 13485-approved manufacturing faculties and UL Certificated Technical Center help customers speed to market.");
	}
	$("#ThumbnailPlaceholder").html($("#TC_" + Market).html());
}
