﻿function valfrm()
{
	if (carrfrm.name.value=="")	
	{
		alert("Please enter your name.");
		carrfrm.name.focus();
		return false;
	}
	var goodEmail = carrfrm.email.value.match(/\b(^(\S+@).+((\.om)|(\.gov.om)|(\.com)|(\.net)|(\.edu)|(\.mil)|(\.biz)|(\.gov)|(\.org)|(\.co.in)|(\.aero)|(\..{2,2}))$)\b/gi);
	if (carrfrm.email.value!="")
	{
	  	if (goodEmail) 
	   	{good = true;}
		else
		{
			alert("Email address is invalid.");
			carrfrm.email.focus();
			return false;
		}
	}
	else
	{
	   	alert("Please enter Email Address");
	   	carrfrm.email.focus();
	   	return false;
	}
	
	if (carrfrm.filename.value=="")
	{
		alert("Please attach Resume");
	   	carrfrm.filename.focus();
	   	uploadicon();
	   	return false;
	}
}	

function uploadicon(){
	window.open('uploadicon.asp','uploader','width=420,height=125,left=400,top=300', true);
}

//validation for arabic pages
function avalfrm()
{
	if (carrfrm.name.value=="")	
	{
		alert("يرجى إدخال إسمك");
		carrfrm.name.focus();
		return false;
	}
	var goodEmail = carrfrm.email.value.match(/\b(^(\S+@).+((\.om)|(\.gov.om)|(\.com)|(\.net)|(\.edu)|(\.mil)|(\.biz)|(\.gov)|(\.org)|(\.co.in)|(\.aero)|(\..{2,2}))$)\b/gi);
	if (carrfrm.email.value!="")
	{
	  	if (goodEmail) 
	   	{good = true;}
		else
		{
			alert("عنوان البريد الإلكتروني غير صالح");
			carrfrm.email.focus();
			return false;
		}
	}
	else
	{
	   	alert("يرجى إدخال البريد الإلكتروني");
	   	carrfrm.email.focus();
	   	return false;
	}
	
	if (carrfrm.filename.value=="")
	{
		alert("يرجى إرفاق السيرة الذاتية");
	   	carrfrm.filename.focus();
	   	uploadicon();
	   	return false;
	}
}	

function auploadicon(){
	window.open('uploadicon.asp','uploader','width=420,height=125,left=400,top=300', true);
}
//Contactus form validation
function valcfrm()
{
	var goodEmail = cntfrm.EmailID.value.match(/\b(^(\S+@).+((\.om)|(\.gov.om)|(\.com)|(\.net)|(\.edu)|(\.mil)|(\.biz)|(\.gov)|(\.org)|(\.co.in)|(\.aero)|(\..{2,2}))$)\b/gi);
	if (cntfrm.Name.value=="")
	{
		alert("Please enter your Name.");
		cntfrm.Name.focus();
		return false;
	}
	if (cntfrm.ContactNo.value<=0)
	{
		alert("Please enter your Contact No.");
		cntfrm.ContactNo.focus();
		return false;
	}
	if (cntfrm.ContactNo.value!="")
	{
		if (isNaN(cntfrm.ContactNo.value))
		{
			alert("Please enter valid Contact No.");
			cntfrm.ContactNo.focus();
			cntfrm.ContactNo.select();
			return false;
		}
	}
	if (cntfrm.EmailID.value!="")
    {
    	if (goodEmail) 
    	{good = true;}
 		else
 		{
			alert("Email Address is invalid.");
			cntfrm.EmailID.focus();
			return false;
 		}
	}
	else
	{
    	alert("Please enter your Email Address");
    	cntfrm.EmailID.focus();
    	return false;
    }

	if (cntfrm.Comments.value=="")
	{
		alert("Please enter your Comments.");
		cntfrm.Comments.focus();
		return false;
	}
}

//for arabic
function avalcfrm()
{
	
	if (cntfrm.Name.value=="")
	{
		alert("يرجى إدخال إسمك");
		cntfrm.Name.focus();
		return false;
	}
	if (cntfrm.ContactNo.value<=0)
	{
		alert("يرجى إدخال رقم الإتصال ");
		cntfrm.ContactNo.focus();
		return false;
	}
	if (cntfrm.ContactNo.value!="")
	{
		if (isNaN(cntfrm.ContactNo.value))
		{
			alert("يرجى إدخال رقم صالح للإستخدام ");
			cntfrm.ContactNo.focus();
			cntfrm.ContactNo.select();
			return false;
		}
	}
	
	var goodEmail = cntfrm.EmailID.value.match(/\b(^(\S+@).+((\.om)|(\.gov.om)|(\.com)|(\.net)|(\.edu)|(\.mil)|(\.biz)|(\.gov)|(\.org)|(\.co.in)|(\.aero)|(\..{2,2}))$)\b/gi);
	if (cntfrm.EmailID.value!="")
    {
    	if (goodEmail) 
    	{good = true;}
 		else
 		{
			alert("عنوان البريد الإلكتروني غير صالح");
			carrfrm.email.focus();
			return false;
		}
	}
	else
	{
	   	alert("يرجى إدخال البريد الإلكتروني");
    	cntfrm.EmailID.focus();
    	return false;
    }

	if (cntfrm.Comments.value=="")
	{
		alert("يرجى إدخال ملاحظاتك ");
		cntfrm.Comments.focus();
		return false;
	}
}
