// JavaScript Document
$(document).ready(function(){
	$('#box-4,#box-2,#box-3,#box-5').hide();
	$('.tab-navs a').click(function(event){
		event.preventDefault();
		$('.tab-navs a.selected').removeClass('selected');
		$(this).addClass('selected');
		tab = $(this).attr('href');
		$('.tab-text-block:visible').hide();
		$(tab).show();
	});
	$('#otherLabel').click(function(event){
		$('#radioE').attr("checked", "checked"); 
	});
	$('#formSubmit').click(function(event){
		event.preventDefault();
		//alert($('#pollForm input[name="pollChoice"]:checked').val())	;
		if (!$('#name').val() || !$('#business').val() || !$('#email').val() || !$('#phone').val()) {
			alert('All fields are required.');
			return false;
		}
		$('#hid_name').val($('#name').val());
		$('#hid_business').val($('#business').val());
		$('#hid_email').val($('#email').val());
		$('#hid_phone').val($('#phone').val());
		self.parent.tb_remove();
		$('#pollForm').submit();
	});
	$('#submitPollStep1').click(function(event){
			event.preventDefault();
		var pollChoice = "";
		$('#pollForm input:checkbox:checked').each(function(i){
			pollChoice += $(this).val() + " -- ";
		});
		$('#pollChoice').val(pollChoice);
		if (!$('#pollForm input[name="pollChoice"]').val()) {
			alert('Please answer the poll question.');
		} else if ($('#pollForm #radioE:checked').val() && !$('#pollForm #other').val()){
			alert('Please fill out the "Other" field.');
		} else {
			tb_show('', '#TB_inline?height=225&width=300&inlineId=userInfo&modal=false', false)
		}
	});
	$('#whitePaper.pdf a').hover(
		function(){
			$(this).parents('.pdf').css('background-image','url(assets/images/icon_whitepaper_over.png)');
		}, function(){
			$(this).parents('.pdf').css('background-image','url(assets/images/icon_whitepaper.png)');
		}
	);
	$('#pollForm input:checkbox').change(function(){
		var pollChoice = "";
		$('#pollForm input:checkbox:checked').each(function(i){
			pollChoice += $(this).val() + " -- ";
		});
		$('#pollChoice').val(pollChoice);
	});
});
