<!--
var submitcount=0;

function trimString (str) {str = this != window? this : str;  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');}

function check_email(e) {
	ok = "'+&1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	}
}

function verify(f) {
	var themessage = "Please complete the following fields:\n";
	if (trimString(f.name.value)=="" || trimString(f.name.value)=="NAME") {themessage = themessage + "  -  Name\n";}
	if (trimString(f.email.value)=="" || trimString(f.email.value)=="EMAIL ADDRESS") {themessage = themessage + "  -  email address\n";}	
	if (themessage == "Please complete the following fields:\n"){
		if(!check_email(f.email.value)){
			alert("Invalid email detected.");
			f.email.focus(); 
			if(document.all || document.getElementByID){
				f.email.style.background = "yellow";
			}
			return false;
		}
		if (submitcount == 0) {
			submitcount++; return true;
		}
		else {
			alert("This form has already been submitted."); return false; 
		}
	}
	else {alert(themessage); return false;
	}
}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
/* Cross-browser event handling, by Scott Andrew  */
function addEvent(element, eventType, lamdaFunction, useCapture) {
    if (element.addEventListener) {
        element.addEventListener(eventType, lamdaFunction, useCapture);
        return true;
    } else if (element.attachEvent) {
        var r = element.attachEvent('on' + eventType, lamdaFunction);
        return r;
    } else {
        return false;
    }
}
function init() {
    var formInputs = document.getElementsByTagName('input');
    for (var i = 0; i < formInputs.length; i++) {
        var theInput = formInputs[i];
        if ((theInput.type == 'text' && theInput.className.match(/\bcd\b/)) || (theInput.type == 'text' && theInput.className.match(/\bsearch\b/)) || (theInput.type == 'text' && theInput.className.match(/\bregister\b/))) {  
            /* Add event handlers */          
            addEvent(theInput, 'focus', clearDefaultText, false);
            addEvent(theInput, 'blur', replaceDefaultText, false);
			 /* Save the current value */
            if (theInput.value != '') {
                theInput.defaultText = theInput.value;
            }
        }
    }
}
function clearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == target.defaultText) {
        target.value = '';
    }
}
function replaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    if (target.value == '' && target.defaultText) {
        target.value = target.defaultText;
    }
}

// window.onload = externalLinks;
addEvent(window, 'load', init, false);
addEvent(window, 'load', externalLinks, false);


//-->


