// JavaScript Document
<!--
function autoSubitForm()
{
document.form.submit() 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,center,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v1.1
  var autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (center && center != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {
      w = screen.availWidth; h = screen.availHeight;}
    var leftPos = (w-popWidth)/2, topPos = (h-popHeight)/2;
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  popupWindow = window.open(theURL,winName,features);
  if (popupWindow.opener == null) popupWindow.opener = self;    
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow.resizeTo(popWidth,popHeight); popupWindow.moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow.setInterval("window.opener.popupWindow.focus();", 50);
    	popupWindow.document.body.onload = function() {popupWindow.setInterval("window.opener.popupWindow.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow.document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow.close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {popupWindow.close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function popUp(url){
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=717,top=10,left=10,height=450');}

<!-- Original:  Tom Khoury (twaks@yahoo.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

function enableEnterKey()
{
if(event.keyCode == 13) return autoSubitForm()
	
}

function EnterKeyUpdatePassword()
{
if(event.keyCode == 13) 
	{
		checkPw(document.form1.currpassworddb.value,document.form1.currpassword.value,document.form1.passwordNew.value,document.form1.passwordVerify.value)
	}
}


function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}

//-->

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function autoSubitFormUpdateDetails()
{
// check form for  minimum length
if (document.form.title.value == "" ) {
alert('Title is a required field. Try again.');

}
if (document.form.FirstName.value == "" ) {
alert('First Name is a required field. Try again.');

}
if (document.form.LastName.value == "" ) {
alert('Last Name is a required field. Try again.');

}
if (document.form.address1.value == "" ) {
alert('Address is a required field. Try again.');

}
if (document.form.City.value == "" ) {
alert('City is a required field. Try again.');

}
if (document.form.state.value == "" ) {
alert('State is a required field. Try again.');

}
if (document.form.postcode.value == "" ) {
alert('Postal Code is a required field. Try again.');

}
if (document.form.Country.value == "" ) {
alert('Country is a required field. Try again.');

}

else document.form.submit();
}//end function 

//Function for Email validation
function checkEmail(em1,em2) 
{
	emailvalid = true;

	if (em1 == "")
	{
		emailvalid = false;
		alert ("You must enter a value in the Email address field. Please re-enter your Email.\n");
		return
	}
	
	// Email Validation. Written by PerlScriptsJavaScripts.com
	var emailcharok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	
	//Email Validation: check for invalid chars
	for(i=0; i < em1.length ;i++)
	{
		if(emailcharok.indexOf(em1.charAt(i))<0)
		{ 
			alert('The email address contains invalid characters. Try again.');
			emailvalid = false;
			return
		}	
	} 
	
	//Email Validation: check for invalid emaail format
	if (document.images)
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!em1.match(re) && em1.match(re_two))
		{
		}
		else
		{ 	
			emailvalid = false;
			alert('This is not a recognised email format. Try again.');
			return
		}
	}
	
	if (em1 != em2)
	{
		emailvalid = false;
		alert ("You did not enter the same new Email twice. Please re-enter your Email.\n");
		return
	}
	
	//If has not returned yet then update email
	alert ("Email Updated");
	autoSubitFormUpdate();
	
}//End function check email


// Check password function
function checkPw(vPasswordOld,vPasswordOldEntered,vPasswordNew,vPasswordNewVerify) 
{

	currPasswordDB = vPasswordOld;
	currPasswordEntered = vPasswordOldEntered;
	pw1 = vPasswordNew;
	pw2 = vPasswordNewVerify;
	var invalid = " "; // Invalid character is a space
	var minLength = 6; // Minimum length
	var maxLength = 12; // Maximum length
	var validalphanumeric = "abcdefghijklmnopqrstuvwxyz0123456789" ;
	var temp;
	var pwdvalid; //is the registration valid???
	pwdvalid = true;
	//alert("this is the current pwd: " + currPasswordDB + "Entered Password: " + currPasswordEntered);
	
	//check if nothing entered in the current password field
	if (currPasswordEntered == "") 
	{
		pwdvalid = false;
		alert("You did not enter your current password.\nPlease enter the current password and  Try again.");
		return
	}
	// check if the entered password same as the current password
	if (currPasswordDB != currPasswordEntered) 
	{
		pwdvalid = false;
		alert("Your current password is not correct.Try again.");
		return
	}
	// check for minimum length
	if (vPasswordNew < minLength) 
	{
		pwdvalid = false;
		alert("Your password must be at least " + minLength + " characters long. Try again.");
		return
		
	}
	
	// check for maximum length
	if (vPasswordNew > maxLength) 
	{
		pwdvalid = false;
		alert("Your password is too long. Your password must be between " + minLength + " and " + maxLength + " characters long. Try again.");
		return
	}
	
	// check for spaces
	if (vPasswordNew.indexOf(invalid) > -1) 
	{
		pwdvalid = false;
		alert("Sorry, spaces are not allowed.");
		return
	}

	//  Check to see that only numbers and characters have been entered -->
	for (var i=0; i<vPasswordNew.length; i++) 
	{
		temp = "" + vPasswordNew.substring(i, i+1);
		if (validalphanumeric.indexOf(temp) == "-1")
		{
			pwdvalid = false;
		}
	}
	
	if (pw1 != pw2) 
	{
		pwdvalid = false;
		alert ("\nYou did not enter the same new password twice. Please re-enter your password.")
		return
	}
	
	// if has not returned yet then update password
	alert("Password Updated")
		autoSubitFormUpdate();
	
	
}// End of check password function

//Auto Submit Update.asp form
function autoSubitFormUpdate()
{
	document.form1.submit() 
}//End of autoSubitFormUpdate

//function for resetting the form
function autoResetForm()
{
document.form1.reset()
}// End of autoResetForm

// Check password function
function checkPwCreate() 
{
	pw1 = document.form1.password2.value;
	pw2 = document.form1.passwordVerify2.value;
	em1 = document.form1.email2.value;
	em2 = document.form1.emailVerify2.value;
	var invalid = " "; // Invalid character is a space
	var minLength = 6; // Minimum length
	var maxLength = 25; // Maximum length
	var validalphanumeric = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789"
	var ok = "yes";
	var temp;
	//variables for validating the username
	var uninvalid = " "; // Invalid character is a space
	var unminLength = 4; // Minimum length
	var unmaxLength = 25; // Maximum length
	var unvalidalphanumeric = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-_"
	var unok = "yes";
	var untemp;
	var emailok;
	var regvalid; //is the registration valid???
	regvalid = true;

	// check form fields for  minimum length
	if (document.form1.FirstName2.value == "" ) 
	{
		alert('First Name is a required field. Try again.');
		regvalid = false;
	}
	
	if (document.form1.LastName2.value == "" ) 
	{
		alert('Last Name is a required field. Try again.');
		regvalid = false;
	}
	
	if (document.form1.address12.value == "" ) 
	{
		alert('Address is a required field. Try again.');
		regvalid = false;
	}
	
	if (document.form1.city2.value == "" ) 
	{
		alert('City is a required field. Try again.');
	}
	
	//if (document.form1.chkTermsAndConditions.value != true)
	//{
	//	alert('You must choose terms and conditions to become a LawCentral member');
	//	regvalid = false;
	//}
	//if (document.form1.state2.value == "" ) 
	//{
		//alert('State is a required field. Try again.');
		//regvalid = false;
	//}
	
//	if (document.form1.postalcode2.value == "" ) 
	//{
		//alert('Postal Code is a required field. Try again.');
		//regvalid = false;
	//}
	
	if (document.form1.Country2.value == "" ) 
	{
		alert('Country is a required field. Try again.');
		regvalid = false;
	}
	
	// check for minimum length
	if (document.form1.password2.value.length < minLength) 
	{
		alert('Your password must be at least ' + minLength + ' characters long. Try again.');
		regvalid = false;
	}
	
	// check for maximum length
	if (document.form1.password2.value.length > maxLength) 
	{
		alert('Your password is too long. Your password must be between ' + minLength + ' and ' + maxLength + ' characters long. Try again.');
		regvalid = false;
	}
	
	// check for spaces
	if (document.form1.password2.value.indexOf(invalid) > -1) 
	{
		alert("Sorry, spaces are not allowed in the password.");
		regvalid = false;
	}

	//  Check to see that only numbers and characters have been entered 
	for (var i=0; i<document.form1.password2.value.length; i++) 
	{
		temp = "" + document.form1.password2.value.substring(i, i+1);
		if (validalphanumeric.indexOf(temp) == "-1") ok = "no";
	}

	if (ok == "no") 
	{
		alert("Sorry, invalid password entry! Only characters and numbers are accepted. Please re-enter your password.");
		regvalid = false;
	}

	// check username for minimum length
	if (document.form1.username2.value.length < unminLength) 
	{
		alert('Your username must be at least ' + unminLength + ' characters long. Try again.');
		regvalid = false;
	}

	// check username for maximum length
	if (document.form1.username2.value.length > unmaxLength) 
	{
		alert('Your username is too long. Your username must be between ' + unminLength + ' and ' + unmaxLength + ' characters long. Try again.');
		regvalid = false;
	}

	// check username for spaces
	if (document.form1.username2.value.indexOf(uninvalid) > -1) 
	{
		alert("Sorry, spaces are not allowed in the username.");
		regvalid = false;
	}

	//  Check username to see that only numbers and characters have been entered 
	for (var i2=0; i2<document.form1.username2.value.length; i2++) 
	{
		untemp = "" + document.form1.username2.value.substring(i2, i2+1);
		if (unvalidalphanumeric.indexOf(untemp) == "-1") unok = "no";
	}

	if (unok == "no") 
	{
		alert("Sorry, invalid username entry!  Only characters , dashes(-), underscores(_) and numbers are accepted. Please re-enter your username.");
		regvalid = false;
	}

	// check password was entered correctly twice
	if (pw1 != pw2) 
	{
		alert ("\nYou did not enter the same Password twice. Please re-enter your password.")
		regvalid = false;
	}

	//check the first email field has something in it
	if (document.form1.email2.value == "" ) 
	{
		alert('Email is a required field. Try again.');
		regvalid = false;	
	}

	// Email Validation.
	var emailcharok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	//Email Validation: check for invalid chars
	for(i=0; i < em1.length ;i++)
	{
		if(emailcharok.indexOf(em1.charAt(i))<0)
		{ 
			alert('The email address contains invalid characters. Try again.');
			regvalid = false;
		}	
	} 

	//Email Validation: check for invalid email format
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!em1.match(re) && em1.match(re_two)) 
		{
			emailok = "yes";		
		}
		else
		{ 
			alert('This is not a recognised email format. Try again.');
			regvalid = false;
		}
	}

	// check email was entered correctly twice
	if (em1 != em2) 
	{
		alert ("\nYou did not enter the same Email twice. Please re-enter your Email.")
		regvalid = false;
	}
	
	//check if the terms and conditions have been accepted
	if (document.form1.OptTermsAndConditions.checked == false)
	{
		alert ("You did not accept the Terms and Conditions. It is mandatory requirement of the site to accept Terms and Conditions.")
		regvalid = false;
	}
	
	//else autoSubitForm();

	if (regvalid == true )
	{
		autoSubitFormCreate();
	}

}//end function checkPwCreate



// Check Refer A Friend function
function checkReferAFriend() 
{
	EmailFromName = document.form1.EmailFromName.value;
	EmailFrom = document.form1.EmailFrom.value;
	EmailTo = document.form1.EmailTo.value;
	OptionalMessage = document.form1.OptionalMessage.value;
	var invalid = " "; // Invalid character is a space
	var minLength = 6; // Minimum length
	var maxLength = 25; // Maximum length
	var validalphanumeric = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789"
	var ok = "yes";
	var temp;
	//variables for validating the username
	var uninvalid = " "; // Invalid character is a space
	var unminLength = 4; // Minimum length
	var unmaxLength = 25; // Maximum length
	var unvalidalphanumeric = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-_"
	var unok = "yes";
	var untemp;
	var emailok;
	var regvalid; //is the registration valid???
	regvalid = true;

	// check form fields for  Name
	if (EmailFromName == "" ) 
	{
		alert('Your Name is a required field. Try again.');
		regvalid = false;
	}
	
	//check the first email field has something in it
	if (EmailFrom == "" ) 
	{
		alert('Your Email is a required field. Try again.');
		regvalid = false;	
	}

	// Email Validation.
	var emailcharok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	//Email Validation: check for invalid chars
	for(i=0; i < EmailFrom.length ;i++)
	{
		if(emailcharok.indexOf(EmailFrom.charAt(i))<0)
		{ 
			alert('The email address contains invalid characters. Try again.');
			regvalid = false;
		}	
	} 

	//Email Validation: check for invalid email format
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!EmailFrom.match(re) && EmailFrom.match(re_two)) 
		{
			emailok = "yes";		
		}
		else
		{ 
			alert('This is not a recognised email format. Try again.');
			regvalid = false;
		}
	}

	
	//check the first email field has something in it
	if (EmailTo == "" ) 
	{
		alert('Your Friend`s Email is a required field. Try again.');
		regvalid = false;	
	}
	
	//Email Validation: check for invalid chars
	for(i=0; i < EmailTo.length ;i++)
	{
		if(emailcharok.indexOf(EmailTo.charAt(i))<0)
		{ 
			alert('The email address contains invalid characters. Try again.');
			regvalid = false;
		}	
	} 

	//Email Validation: check for invalid email format
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!EmailTo.match(re) && EmailTo.match(re_two)) 
		{
			emailok = "yes";		
		}
		else
		{ 
			alert('This is not a recognised email format. Try again.');
			regvalid = false;
		}
	}

	//else autoSubitForm();

	if (regvalid == true )
	{
		autoSubitFormCreate();
	}

}//end function checkReferAFriend



//Auto Submit Create.asp form
function autoSubitFormCreate()
{
	document.form1.submit() 
}//End of autoSubitFormCreate


function enableEnterKeyCreate()
{
if(event.keyCode == 13) return checkPwCreate()
}//end function enableEnterKeyCreate

//Auto Submit Contact.asp form
function autoSubitFormContact()
{
document.form1.mail.value = "true"
autoSubitFormCreate() 
}//End of autoSubitFormContact

//check legal brief to validate value in the text box
function CheckLegalBrief()
{
if (document.form1.PreparedFor.value == "" ) {
alert('Full Name is a required field. Try again.');
return false
}
}
//check fields in featured product to validate value in the text box
function CheckFeaturedProductOrder()
{
if (document.form1.txtCustomerName.value == "" ) {
alert('Customer Name is a required field. Try again.');
return false
}
if (document.form1.txtCustomerAddress1.value == "" ) {
alert('Address1 is a required field. Try again.');
return false
}
if (document.form1.txtCustomerAddress2.value == "" ) {
alert('Address 2 is a required field. Try again.');
return false
}
}

/* Include the Nifty Corners JS File*/
document.write('<script language="javascript" src="/Include/Nifty/niftycube.js"></script>');
function LoadRoundedEdges(){
/*	Nifty("Div", "top");*/
	Nifty("Div#Welcome", "top");
	Nifty("Div#LatestReleases", "top");
	Nifty("Div#TopMovers", "top");
	Nifty("Div#MonthlySpecials", "top");
	Nifty("Div#Search");
	Nifty("Div#Search_Documents");
	Nifty("Div#Search_Bulletin");
	Nifty("Div#Testimonial");
	Nifty("Div#Advert", "top");
}

if (window.addEventListener) {
      window.addEventListener("load", LoadRoundedEdges, false);
} else if (window.attachEvent) {
      window.attachEvent("onload", LoadRoundedEdges);
} else {
      window.onload = LoadRoundedEdges;
}