function clearSearchField(){    
	if (document.getElementById("keywords").value == 'Search') {
		document.getElementById("keywords").value = '';
		}
	}

function myInit() {
	
	$("#commentForm").submit(function() {		
		$('#commentForm').attr('method','post');		
		});
	
	if ($("#rightColumn").height() < $("#middleColumn").height()) {
		$("#rightColumn").height($("#middleColumn").height());
		}
	
	$("#commentForm").validate({
		 ignoreTitle:true,
		 rules: {
			name:{required: true},
			email:{required: true,email: true},
			comment:{required: true}			
			}
		});	
	
	$("#compForm").submit(function() {		
		
		//var answer = $("input[name='answer']:checked").val();
		var answer = $("input[name='answer']").val();
		var name = $("input[name='Name']").val();
		var comp = $("input[name='Company']").val();
		var email = $("input[name='Email']").val();
		var errors = "";
		if (!answer) {
			//errors += "Your answer\n";
			}
		if (!name) {
			errors += "Your name\n";
			}
		if (!comp) {
			//errors += "Please select an answer\n";
			}
		if (!email) {
			errors += "Your email address\n";
			}
		if (errors) {
			alert("Please enter the following required fields:\n\n"+errors);
			return false;
			}
			
		$.ajax({
			type: "POST",
			url: "/comp.php",
			data: "answer="+answer+"&name="+name+"&comp="+comp+"&email="+email,
			success: function(returned){					
				$("#compForm").hide();
				$("#thanks").show().html('Thank you! Your entry has been registered.');
				}
			});				
		return false;	
		
	   });	
	
		
	$("#pollForm").submit(function() {		
		
		var answer = $("input[name='poll']:checked").val();
		var errors = "";
		if (!answer) {
			alert("Please select from the available options");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/poll.php",
			data: "answer="+answer,
			success: function(returned){					
				getPollVotes();
				}
			});				
		return false;	
		
	   });	
	
	
	$("#pollForm2").submit(function() {		
		
		var answer = $("input[name='poll']:checked").val();
		var errors = "";
		if (!answer) {
			alert("Please select from the available options");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/poll2.php",
			data: "answer="+answer,
			success: function(returned){					
				getPollVotes2();
				}
			});				
		return false;	
		
	   });	
	
	$("#pollVoteForm").submit(function() {		
		
		var answer = $("input[name='poll']:checked").val();
		var errors = "";
		if (!answer) {
			alert("Please select from the available options");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/pollResult.php",
			data: "answer="+answer,
			success: function(returned){					
				getPollResults();
				}
			});				
		return false;	
		
	   });	
}


function getPollResults() {
	
	$.ajax({
		type: "POST",
		url: "/pollResult.php",
		data: "",
		success: function(returned){					
			$('#pollVoteForm').fadeOut("fast", function() {
				$('#pollResults').html(returned).fadeIn("fast");
				});
			
			}
		});		
	}


function getPollVotes() {
	
	$.ajax({
		type: "POST",
		url: "/poll.php",
		data: "",
		success: function(returned){					
			$('#pollForm').fadeOut("fast", function() {
				$('#pollResults').html(returned).fadeIn("fast");
				});
			
			}
		});		
	}

function getPollVotes2() {
	
	$.ajax({
		type: "POST",
		url: "/poll2.php",
		data: "",
		success: function(returned){					
			$('#pollForm2').fadeOut("fast", function() {
				$('#pollResults').html(returned).fadeIn("fast");
				});
			
			}
		});		
	}