$(document).ready(function () {
    $('#Based').hide();
});

function validate()
{
    document.getElementById('ctl00_Content_Label10').innerHTML = '';
    document.getElementById('ctl00_Content_Label12').innerHTML = '';
    document.getElementById('ctl00_Content_Label11').innerHTML = '';
    var valid = true;
    if(!document.getElementById('ctl00_Content_sales1').checked && 
        !document.getElementById('ctl00_Content_sales2').checked && 
        !document.getElementById('ctl00_Content_sales3').checked)
    {
        document.getElementById('ctl00_Content_Label10').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Please select your annual sales';
        valid = false;
    }
    if(!document.getElementById('ctl00_Content_Working1').checked 
        && !document.getElementById('ctl00_Content_Working2').checked)
    {
        document.getElementById('ctl00_Content_Label11').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Please select';
        valid = false;
    }
    if((document.getElementById('ctl00_Content_Working1').checked) 
        && (!document.getElementById('ctl00_Content_WorkingOption1').checked 
        && !document.getElementById('ctl00_Content_WorkingOption2').checked 
        && !document.getElementById('ctl00_Content_WorkingOption3').checked 
        && !document.getElementById('ctl00_Content_WorkingOption4').checked 
        && !document.getElementById('ctl00_Content_WorkingOption5').checked))
    {
        document.getElementById('ctl00_Content_Label12').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Please select';
        valid = false;
    }
    
    return valid;
}

function SendQuickQuestion() {
    if (ValidateQuestion()) {
        $('#formarea').fadeOut("slow", function() {
            $('#sending').fadeIn("slow", function() {
                $.get("/System/Question.ashx?name=" + $('#name').val() + "&email=" + $('#email').val() + "&question=" + $('#question').val(), null,
            function() { $('#sending').fadeOut("slow", function() { $('#sent').fadeIn("slow"); }); });
            });
        });
    }
}

function ValidateQuestion() {
    var valid = true;
    if ($('#name').val() == "") {
        valid = false;
        $('#name').Watermark("* Enter your Name", "#ff0000");
    } 
    if ($('#email').val() == "" || !$('#email').val().match(/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/)) {
        valid = false;
        $('#email').Watermark("* Enter your Email", "#ff0000");
    }
    if ($('#question').val() == "") {
        valid = false;
        $('#question').Watermark("* Enter your Question", "#ff0000");
    } 
    return valid;
   }

   $(function() {
   	$('#AwarenessSourceID').change(function() {
   		var awarenessSourceDetailID = $('#AwarenessSourceID option:selected').attr('AwarenessSourceDetailID');

   		if (awarenessSourceDetailID != undefined)
   			$('#AwarenessSourceDetail').show(500);
   		else
   			$('#AwarenessSourceDetail').hide(500);

   		$('[name^="AwarenessSourceDetail"]').hide();
   		$('[name="AwarenessSourceDetail' + awarenessSourceDetailID + '"]').show();
   	});
   });
