function checkFormJoin()
{
	if (!checkValue('strFullName') || !checkValue('strPhone') || !checkValue('intProject') )
	{
		return false;
	}
	displaySubmit(-1);
	return true;
}

function checkFormContact(id)
{
	if (!checkValue('strFullnameContact') || !checkValue('strEmail') )
	{
		return false;
	}
	if ( !isEmail('strEmail') )
	{
		$('#errEmail').show();
		return false;
	}
	if (!checkValue('strPhoneContact') || !checkValue('strContent') )
	{
		return false;
	}
	displaySubmit(-1);
	return true;
}

function displaySubmit(value)
{
	var arr = document.getElementsByTagName('input');
	var n = arr.length;
	for(i=0; i<n; i++)
	{
		var eType = arr[i].getAttribute('type') ;
		if (eType=='submit' || eType=='button')
		{
			arr[i].disabled = false ;
			if (value==-1)
			{
				arr[i].disabled = true ;
			}
		}
	}
}

function checkValue(id)
{
	var e = document.getElementById(id);
	if (e)
	{
		if (e.value){ return true; }  
		e.focus();
		e.style.border = '1px solid #FF0000';
	}
	return false;
} 

function isEmail(id) 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var e = document.getElementById(id);
   if (e && e.value)
   {
		if( reg.test(e.value) )
		{
			return true;
		}
		e.focus();
		e.style.border = '1px solid #FF0000';
   }
   return false;
}

function countChar(id, idCount, maxLength)
{
	var e = document.getElementById(id);
	if (e)
	{
		var n = e.value.length;
		n = (n<=maxLength) ? maxLength-n : 0;
		$('#'+idCount).html(n);
	}
}
function checkLengthContent(id, maxlength)
{
	var e = document.getElementById(id);
	var content = e.value;
	if (content.length<=maxlength){
		return true;
	}
	return false;
}
function subContentByLength(id, maxlength)
{
	var e = document.getElementById(id);
	if (e)
	{
		e.value = e.value.substring(0, maxlength);
	}
}