function isEmpty(str)
{
	if(null == str || "" == str)
	{
		return true;
	}
return false;
}

function checkEmail(str)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str))
	{
		return false;
	}
return true;
}

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}

function downloadForm()
{
	var inq,cName,yName,sphone,sid,desigt,webS,ag1,ag2,ag3,ag4;
	
	with(window.document.form2)
	{
		
		cName = company;
		yName = yname;
		desigt = desig;
		webS = web;
		sphone = cno;
		sid = email;
		inq = inquiry;
		ag1 = agree1;
		ag2 = agree2;
		ag3 = agree3;
		ag4 = agree4;
	}

	if(isEmpty(cName.value))
	{
		cName.style.background="Yellow";
		window.alert("Please enter your company name");
		cName.focus();
		return false;
	}
	
	else if(isEmpty(yName.value))
	{
		yName.style.background="Yellow";
		window.alert("Please enter your name");
		yName.focus();
		return false;
	}
	
	else if(desigt.value == 'select')
	{
		desigt.style.background="Yellow";
		window.alert("Please select your designation");
		desigt.focus();
		return false;
	}
	
	else if(isEmpty(webS.value))
	{
		webS.style.background="Yellow";
		window.alert("Please enter your website url");
		webS.focus();
		return false;
	}
		
	else if(isEmpty(sphone.value))
	{
		sphone.style.background="Yellow";
		window.alert("Please enter contact number");
		sphone.focus();
		return false;
	}
	else if(isNaN(parseInt(sphone.value)))
	{
		sphone.style.background="Orange";
		window.alert("Please enter a valid contact number");
		sphone.focus();
		return false;
	}

	
	else if(isEmpty(sid.value))
	{
		sid.style.background="Yellow";
		window.alert("Please enter email id");
		sid.focus();
		return false;
	}
	else if(checkEmail(sid.value))
	{
		sid.style.background="Orange";
		window.alert("Please enter a valid email");
		sid.focus();
		return false;
	}

	else if(ag2.value == 'select')
	{
		ag2.style.background="Yellow";
		window.alert("Please select interested in our training");
		ag2.focus();
		return false;
	}
	
	else if(ag3.value == 'select')
	{
		ag3.style.background="Yellow";
		window.alert("Please select interested in our support programs");
		ag3.focus();
		return false;
	}
	else if(ag4.value == 'select')
	{
		ag4.style.background="Yellow";
		window.alert("Please select support programs");
		ag4.focus();
		return false;
	}
	
	return true;
}

