<!--

var message="You can NOT right click here"; // Your no right click message here

// JavaScript by Dave Lauderdale
// Published at: www.digi-dl.com

function IE(e) 
{
     if (navigator.appName == "Microsoft Internet Explorer" && (event.button == "2" || event.button == "3"))
     {
          alert(message);
          return false;
     }
}
function NS(e) 
{
     if (document.layers || (document.getElementById && !document.all))
     {
          if (e.which == "2" || e.which == "3")
          {
               alert(message);
               return false;
          }
     }
}
document.onmousedown=IE;document.onmouseup=NS;document.oncontextmenu=new Function("return false");

function printWindow(strPage)
{
	var url;
	url = "./printpage.asp?printpage=" + strPage;
	//alert(url);
	window.open(url, "Busby", "width=600,height=400,scrollbars=yes,status=no,resizable=no");	
	//window.close("BioElf");
}


function writeMailAddress()
{
	var user = "lawyer";
	var domain = "busbyslaw.co.uk";
	var mail = user + "@" + domain;
	var message = user + "@" + domain;
	document.write("<a href=\"mailto:"+mail+"\">"+ message+"</a>");
}

// whitespace characters
var whitespace = " \t\n\r";

// Check whether string s is empty.
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or whitespace characters only.
function isWhitespace (s)
{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

// Returns true if string s is valid email address
function isEmail (s)
{  
    // is s whitespace?
    if (isWhitespace(s) || isEmpty(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}


function warnInvalid (theField, s)
{   
	theField.focus()
    theField.select()
    alert(s)
    return false
}

function checkInvalid (theField, s)
{   				
	var str;
	theField.focus();
    theField.select();
    str = window.prompt(s,'');
    theField.value = str;
    //return true
}

// Validate the Contact Form - contactform.htm
function checkContactForm(formObj)
{	
	if (isWhitespace(formObj.DL_Name.value)) {
		warnInvalid(formObj.DL_Name, "Name?")
		return false
	}

	if (isWhitespace(formObj.DL_Address.value)) {
		warnInvalid(formObj.DL_Address, "Address?")
		return false
	}
	if (isWhitespace(formObj.DL_City.value)) {
		warnInvalid(formObj.DL_City, "Town / City?")
		return false
	}
	if (isWhitespace(formObj.DL_Postcode.value)) {
		warnInvalid(formObj.DL_Postcode, "Postcode?")
		return false
	}
	if (isWhitespace(formObj.DL_Email.value)) {
		warnInvalid(formObj.DL_Email, "Email?")
		return false
	}
	
	//check valid email address supplied
	if (!isEmail(formObj.DL_Email.value)){
		warnInvalid(formObj.DL_Email, "Invalid email address!")
		return false
	}
	
	//here so everything is OK
	return true	
}


//-->
