function DoPoll(type,ip,poll_id)
{
	$.ajax({
			type: "POST",
			url: baseUrl+"do_poll.php",
			data: "mode=poll&type="+type+"&ip="+ip+"&poll_Id="+poll_id,
			async: false,
			success: function(html)
			{ 	
				if(html=='0'){
					alert("You have already voted for this poll.");
				}else
				{
					alert("Thanks for your vote.");
					document.location.href= baseUrl+"index.php";
				}
				

			}
		  });
	
}

var j="0";
function showDesc()
{

	if(j=="0"){
		$("#poll_detail").slideDown("slow");
		j = "1";
	}else{
		$("#poll_detail").slideUp("slow");
		j = "0";
	}
}

function validateform()
{
	var email = $("#email").val();
	var name = $("#name").val();
	var comment = $("#comment").val();

	var errorEmail ='0';
	var errorName ='0';
	var errorComment ='0';
	

	if(email=='')
	{
		$("#email").addClass("redborder");
		$("#blankemail").slideDown("slow");
		errorEmail ='1';
	}
	else
	{
		$("#email").removeClass("redborder");
		$("#blankemail").slideUp("slow");
		errorEmail ='0';	
	}

	if(email!='')
	{
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(reg.test(email) == false) 
		{
			$("#blankemail").slideDown("slow");
			errorEmail ='1';
		}
	}
	
	if(name=='')
	{
		$("#name").addClass("redborder");
		$("#blankname").slideDown("slow");
		errorName ='1';
	}
	else
	{
		$("#name").removeClass("redborder");
		$("#blankname").slideUp("slow");
		errorName ='0';	
	}
	if(comment=='')
	{
		$("#comment").addClass("redborder");
		$("#blankcomment").slideDown("slow");
		errorComment ='1';
	}
	else
	{
		$("#comment").removeClass("redborder");
		$("#blankcomment").slideUp("slow");
		errorComment ='0';	
	}

	if(errorEmail =='0' && errorName =='0' && errorComment =='0')
	{
		document.contactform.action="contactus.php?m=send";
		document.contactform.submit();
	}
}
