	var site_url='http://www.criminaldefencelawyers.ca/';
	//var site_url='http://techintl/MATRIX/PROJECTS/CURRENT/criminaldefence/development/';
	

function ContactValidation(thisform)
{ 
	with (thisform)
	{
				
					/*
					var o = arr.value;
					var t = noarr.value;
					var que = que.value;
					var noque = noque.value;
					var chr = chr.value;
					var nochr = nochr.value;
					var conv = conv.value;
					var noconv = noconv.value;
					var she = she.value;
					var noshe = noshe.value;
					var att = att.value;
					var noatt = noatt.value;
		*/
		
					if (emptyvalidation(name,"Please fill in your Name.")==false) 
					{				
					name.focus();
					return false;
					}
					
					
					
					if (emptyvalidation(email,"Please fill in your Email Address.")==false) 
					{				
					email.focus();
					return false;
					}
					
					if(checkMailId(thisform.email.value)==false)
						{		
							//alert("Invalid email address");
							thisform.email.select();
							thisform.email.focus();
							return false;
						}	
						
					if (emptyvalidation(phone,"Please fill in your Phone.")==false) 
					{				
						phone.focus();
						return false;
					}
					
					if (emptyvalidation(city,"Please fill in your City.")==false) 
					{				
						city.focus();
						return false;
					}
					
					if(date.value=='')
					{										
						if ( (arr.checked == true ) || (que.checked == true )  || (chr.checked == true )  || (conv.checked == true ) ||  (she.checked == true ) )
						{	
							alert ( "Please choose Date." );
							thisform.she.focus();
							return false;
						}	
					}
					
					if ( (date.value!='') && (arr.checked == false ) && (noarr.checked == false ) && (que.checked == false ) 
			      && (noque.checked == false ) && (chr.checked == false ) && (nochr.checked == false ) && (conv.checked == false )
				  && (noconv.checked == false ) && (she.checked == false ) && (noshe.checked == false ) )
					{	
						alert ( "Please choose your Previous Cases (Yes/No)." );
						thisform.arrested.focus();
						return false;
					}
					
					
					if (location.value=='') 
					{				
						alert("Please choose Court Location.");
						location.focus();
						return false;
					}
					
					if(location.value=='other' && court_location.value=='')
					{
						alert("Please fill your other place.");
						thisform.court_location.focus();
						return false;
					}
					
					if ( (att.checked == false ))
					{
						alert ( "Please tell us if you are represented by another Attorney (Yes/No)." );
						thisform.location.focus();
						return false;
					}
				
		}

thisform.submit();
} 

function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		while (value.charAt(0) == ' ')
			value = value.substring(1);
		while (value.charAt(value.length - 1) == ' ')
			value = value.substring(0, value.length - 1);
		if (value==null || value=="")
		{
			if (alertbox!="") alert(alertbox);
			return false;
		}
		else return true;
	}
}


function checkMailId(mailids)
{
var arr = new Array('.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro'
,'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
'.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
'.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
'.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
'.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
'.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
'.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
'.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
'.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
'.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
'.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
'.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
'.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
'.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
'.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
'.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
'.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
'.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
'.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
'.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw');

//var mai = mailids;
var sd = mailids;
var ids = sd.split(",");
var val = true;
var beforeat="";
var afterat="";
var afterat2="";

for(var j=0; j<ids.length; j++)
{
var mai = ids[j];

var dot=mai.lastIndexOf(".");
var con=mai.substring(dot, mai.length);
con=con.toLowerCase();
con=con.toString();

var at = mai.indexOf("@"); //newly added
var dom = dot - at;
var sp = mai.indexOf(" ");

if(dom >= 4 && at > 1 && sp == -1)
	{ 
 
 
			for(var i=0;i<(arr.length);i++)
			{
				if(con == arr[i])
				{
					val=true;
					break;
				}
				else
				{
					val=false;
				}
			}
            if(val == false)
				{
					alert("Sorry, you have entered an invalid Email Address.");
					//alert("Your email address "+mai+" is not corrrrect");
					return false;
				}
	}
	else
	{
	alert("Sorry, you have entered an invalid Email Address.");
	 //alert("Your email address "+mai+" is not correct");
	 return false;
	}
	
}




var att=mai.lastIndexOf("@");
beforeat=mai.substring(0,att);
beforeat=beforeat.toLowerCase();
beforeat=beforeat.toString();
var asci1=beforeat.charCodeAt(0);

afterat=mai.substring(att+1, dot);
afterat=afterat.toLowerCase();
afterat=afterat.toString();

afterat2=mai.substring(att+1, mai.length);
afterat2=afterat2.toLowerCase();
afterat2=afterat2.toString();

if(beforeat=="" || afterat=="" || beforeat.length>30)
	val=false;

if(afterat2.length>64 || afterat.length<2)
	val=false;

if((afterat.charCodeAt(0))==45 || (afterat.charCodeAt(afterat.length-1))==45)
	val=false;

if(val==true)
{
	if(asci1 > 47 && asci1 < 58)
		val=false;
		
	if(asci1 < 48 || asci1 > 57)
	{
		for(var i=0; i<=beforeat.length-1; i++)
		{
			var asci2=beforeat.charCodeAt(i);
			if((asci2<=44 || asci2==47) || (asci2>=58 && asci2<=94) || (asci2==96) || (asci2>=123 && asci2<=127))
			{
				val=false;
				break;
			}
		}
		
		for(var j=0; j<=afterat.length-1; j++)
		{
			var asci3=afterat.charCodeAt(j);
			if((asci3<=44) || (asci3==46) || (asci3==47) || (asci3>=58 && asci3<=96) || (asci3>=123 && asci3<=127))
			{
				val=false;
				break;
			}
		}	
	}
}

if(val==false)
{
	alert("Sorry, you have entered an invalid Email Address.");
	//alert("Your email address "+mai+" is not valid");
	return false;
}
else
{
	return true;
}
}
