function valid_email(){

	if(document.login_form.login_email.value=="" || !validEmail(document.login_form.login_email.value)){
		window.alert('please fill your email correctly first.');
		return false;
	}

	if(document.login_form.login_password.value==""){
		window.alert('please fill your password first.');
		return false;
	}

	document.login_form.submit();
}


function Do_validation()
{
	if(document.clientlogin.cl_name.value==''){
		window.alert('Please fill the User name first.');
		return false;
	}

	if(document.clientlogin.cl_password.value==''){
		window.alert('Please fill the password.');
		return false;
	}

	else {document.clientlogin.submit();}
}

function valedateCreatePoll()
{

	if(document.createPoll.qText.value==''){
		window.alert('Please fill the question first');
		return false;
	}
	else if(document.createPoll.type[0].checked || document.createPoll.type[1].checked) {
		var type = $("#hiddenType").val();
		type = type.toLowerCase();
		if ($('#'+type+'t1').val() == '' || $('#'+type+'t2').val() == ''){
			alert('Please fill 2 options at least');
			return false;
		}
		else{
			document.createPoll.submit();
		}
	}
	else{
		document.createPoll.submit();
	}
}

function pollValedate(type)
{
	if (type == 'M'){
		var selector_checked = $("input[@type=checkbox]:checked").length;
		if (selector_checked == 0)
		{
			alert('You have to select one answer at least');
			return false;
		}
		else
		{
			document.answerPoll.submit();
		}
	}
	else if (type == 'S'){
		var selector_checked = $("input[@type=radio]:checked").length;
		if (selector_checked == 0)
		{
			alert('You have to select an answer');
			return false;
		}
		else
		{
			document.answerPoll.submit();
		}
	}
	else if(type == 'O'){

		if ($("#answ").val() == ''){
			alert('please enter an answer');
			return false;
		}
		else{
			document.answerPoll.submit();
		}
	}


}

function redeemValedate(type)
{

	var val = $("#redPoints").val();
	if (val == '')
	{
		alert('You have to enter the points amount');
		return false;
	}

	else if (parseInt(val) > parseInt($('#totalPoints').val()))
	{
		alert('You are over the limit');
		return false;
	}
	else if (parseInt(val) < 250)
	{
		alert('The minimum amounts of points to be redeemed is 500 points ');
		return false;
	}
	else if (parseInt(val) % 50 != 0)
	{
		alert('Please enter amount in 50 multiples');
		return false;
	}
	else{
		document.redeemForm.submit();
	}

}

function valedateCreateDisc()
{


	if(document.createDisc.title.value==''){
		window.alert('Please fill the title');
		return false;

	}
	//else if(document.createDisc.text.value==''){
	//	window.alert('Please fill the text');
	//	return false;
	//}
	else if(document.createDisc.type.options[document.createDisc.type.selectedIndex].value == "P" && $("input:checked[@checked]").size() < 1){
		window.alert('You have to invite one friend at least');
		return false;
	}

	else{
		document.createDisc.submit();
	}
}

function valedateFeeds()
{



	if(document.addFeed.text.value==''){
		window.alert('Please fill the text');
		return false;
	}

	else{
		document.addFeed.submit();
	}
}

function SimpleSearchVali()
{



	if(document.searchForm.name.value=='' && document.searchForm.email.value==''){
		window.alert('You have to fill one field at least');
		return false;
	}

	else{
		return true;
	}
}
function checkSearch()
{



	if(document.adSearchForm.name.value=='' && document.adSearchForm.email.value=='' && document.adSearchForm.country.value==0 && document.adSearchForm.survey_p_lang.value==0 && document.adSearchForm.gender.value==0 && document.adSearchForm.aFrom.value=='' && document.adSearchForm.aTo.value==''){
		window.alert('You have to fill one field at least');
		return false;
	}

	else{
		document.adSearchForm.submit();
		
	}
}



