jQuery(document).ready(function() { 

//videos
	//	Personal Injury Videos
		jQuery(".personal-injury-me-different a").attr({href: "video-what-makes-me-different2.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-recover a").attr({href: "video-what-you-can-recover.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-questions-before-hire a").attr({href: "video-questions-before-hire.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-dirty-trick a").attr({href: "video-insurance-dirty-trick.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-contingency-fee a").attr({href: "video-contingency-fee.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-need-attorney a").attr({href: "video-need-attorney.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-how-to-hire a").attr({href: "video-how-to-hire-attorney.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-no-fee a").attr({href: "video-how-to-hire-no-fee.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-victims-mistakes a").attr({href: "video-personal-injury-victims-mistakes.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-car-accident a").attr({href: "video-car-accident-bills.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-defense-doctor a").attr({href: "video-how-to-check-defense-doctor.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-focus-injury a").attr({href: "video-focus-injury.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".personal-injury-allstate-recovery a").attr({href: "video-allstate-recovery.html?keepThis=true&TB_iframe=true&height=350&width=560"});
	//	Workers Compensation Videos
		jQuery(".workers-comp-compensation-stop a").attr({href: "video-why-compensation-check-stopped.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".workers-comp-trap a").attr({href: "video-workers-compensation-trap.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".workers-comp-sources a").attr({href: "video-workers-sources.html?keepThis=true&TB_iframe=true&height=350&width=560"});
	//	Social Security Videos
		jQuery(".social-security-benefit-differences a").attr({href: "video-social-security-benefit-differences.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".social-security-mistakes a").attr({href: "video-social-security-mistakes.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".social-security-proof a").attr({href: "video-social-security-proof-to-win.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".social-security-app-process a").attr({href: "video-social-security-application-process.html?keepThis=true&TB_iframe=true&height=350&width=560"});
	//	Motorcycle Accidents Videos
		jQuery(".ma-1 a").attr({href: "video-reasons-to-hire-a-motorcycle-attorney.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".ma-2 a").attr({href: "video-the-best-insurance-you-can-buy.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".ma-3 a").attr({href: "video-how-do-you-pick-a-motorcycle-attorney.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".ma-4 a").attr({href: "video-no-helmet-no-recovery-myth.html?keepThis=true&TB_iframe=true&height=350&width=560"});
		jQuery(".ma-5 a").attr({href: "video-how-you-can-afford-a-motorcycle-attorney.html?keepThis=true&TB_iframe=true&height=350&width=560"});



});

function CheckRequiredFields() {

		if (document.miniContact.name.value=='') {
			alert('Your name is required to submit this form.');
			return false;
		}
		
		if (document.miniContact.email.value=='') {
			alert('A valid email address is required to submit this form.');
			return false;
		}
		
		if (document.miniContact.phone.value=='') {
			alert('Your phone number is required to submit this form.');
			return false;
		}
		
		return true;
}



function CheckMainRequiredFields() {

		if (document.mainContact.name.value=='') {
			alert('Your name is required to submit this form.');
			return false;
		}
		
		if (document.mainContact.email.value=='') {
			alert('A valid email address is required to submit this form.');
			return false;
		}
		
		if (document.mainContact.phone.value=='') {
			alert('Your phone number is required to submit this form.');
			return false;
		}
		
		return true;
}




function emailCheck (emailStr) {
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
				alert("Ths username contains invalid characters.");
				return false;
  		}
	}
	
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
				alert("Ths domain name contains invalid characters.");
				return false;
   		}
	}

	if (user.match(userPat)==null) {
		alert("The username doesn't seem to be valid.");
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				return false;
   			}
		}
		return true;
	}
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;

	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid.");
			return false;
  		}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	if (len<2) {
		alert("This address is missing a hostname!");
		return false;
	}

	return true;
}
