
function formCheck(objs, fieldRequired, fieldDescription, f1, f2, error)
{

if(objs == 'formjobs') 
{

	var alertMsg = error+"\n\n";
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++)
	{
		var obj = document.getElementById(fieldRequired[i]);
	
		if (obj)
		{
			if (obj.value == "" || obj.value == null)
			{
				alertMsg += " - " + fieldDescription[i] + "\n";
			}
			
			if(fieldRequired[i] == 'email')
			{
				if(!validateEmail(obj.value))
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
			
		}
	}

	
	
	if (!check_checkbox(objs))
		alertMsg += " - " + f1 +"\n";
	
	if (!check_radio(objs))
		alertMsg += " - "+ f2 +" \n";    
	
	if (alertMsg.length == l_Msg)
	{
		return true;
	}
	
	else
	{
		alert(alertMsg);
		return false;
	}

}

else if(objs == 'formjob') 
{

	var alertMsg = error+"\n\n";
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++)
	{
		var obj = document.getElementById(fieldRequired[i]);
		
		if (obj)
		{
			if (obj.value == "" || obj.value == null)
			{
				alertMsg += " - " + fieldDescription[i] + "\n";
			}
			
			if(fieldRequired[i] == 'email')
			{
				if(!validateEmail(obj.value))
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
			
		}
	}
	
	if (alertMsg.length == l_Msg)
	{
		return true;
	}
	
	else
	{
	alert(alertMsg);
		return false;
	}

}

else aa = 1;

if (aa == 1) return true;


}

function check_checkbox(objs)
{

	blnchecked = 0;
	
	objcheck=document.getElementById(objs).getElementsByTagName('INPUT');
	
	for (var j = 0; j < objcheck.length; j++)
	{
		
		if (objcheck[j].type == 'checkbox')
		{
			names = objcheck[j].name;
			
			if(names.indexOf('availability') == 0)
			{
			
				if (objcheck[j].checked)
				{
					blnchecked = 1;
				}
			}
		}
	}
	
	if (blnchecked == 1)
	return true;
	else
	return false;

}

function check_radio(objs)
{
	blncheckeds = 0;

	objchecks=document.getElementById(objs).getElementsByTagName('INPUT');

	for (var j = 0; j < objchecks.length; j++)
	{
		if (objchecks[j].type == 'radio')
		{
			names = objchecks[j].name;
			if(names.indexOf('exp_common') == 0)
			{
				if (objchecks[j].checked)
				{
					blncheckeds = 1;
				}
			}
		}
	}
	
	if (blncheckeds == 1)
		return true;
	else
		return false;

}

function validateEmail(email)
{
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email))
        return true
    else
        return false;
}