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) { //v3.0
  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); 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 submitSearchQuery() {
	if (document.searchQueryForm.searchQuery.value != "") {
		document.searchQueryForm.submit();
	} else {
		alert("You need to enter the keywords you would like to search by in the search box.");
	} // End IF
} // End submitSearchQuery

function submitSearchQueryAgain() {
	if (document.searchQueryFormAgain.searchQuery.value != "") {
		document.searchQueryFormAgain.submit();
	} else {
		alert("You need to enter the keywords you would like to search by in the search box.");
	} // End IF
} // End submitSearchQuery

function openIt(url)
{
   var newWin = window.open(url,"","resizable=yes,menubar=yes,toolbar=yes,width=450,height=300,scrollbars=yes");       
}






function isblank(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}
function verify(f)
{
    var msg;
    var empty_fields = "";
    var errors = "";

    // Loop through the elements of the form, looking for all 
    // text and textarea elements that don't have an "optional" property
    // defined. Then, check for fields that are empty and make a list of them.
    
    
        for(var i = 0; i < f.length; i++) { // begin i for loop
        var e = f.elements[i];
                
                if (e.name == "szAddress2") { // begin address blocker
                    e.optional = true;
                } // end address blocker
                
        if (((e.type == "text") || (e.type == "textarea")) && !e.optional) { // begin text check
            // first check if the field is empty
            if ((e.value == null) || (e.value == "") || isblank(e.value)) { // begin blank check
                empty_fields += "\n          " + clean_name(e.name);
                continue;
            } else { // continue blank check
                // Simple E-mail verification.
                                
                 if(e.name.indexOf('szEmail') > -1) { // begin if inside of email check.
                                var atsign = e.value.indexOf('@');
                                     if (atsign > 0) { // begin if of atsign
                                            var addresssubstr = e.value.substring(atsign, e.value.length - 1);
                                            var dot = addresssubstr.indexOf('.');
                                            if (dot < 0) { // begin if of dot
                           errors += "- Improperly formed e-mail address.\n";
                           continue;                                    
                                             } // end if of dot
                                      } else { // continue if of atsign 
                                        errors += "- Improperly formed e-mail address.\n";
                                        continue;
                                      } // end if of atsign
                            } // end if inside of email check     
                   } // end blank check         
                } else if((e.type == "select-one") && !e.optional) { // continue text check
                              if ((e.options[e.selectedIndex].value == "") || (e.selectedIndex == -1)) { // begin select index check
                                                empty_fields += "\n          " + clean_name(e.name);            
                                  }// end select index check
                        
        } // end text check
    } // end for loop

    // Now, if there were any errors, display the messages, and
    // return false to prevent the form from being submitted. 
    // Otherwise return true.
    if (!empty_fields && !errors) return true;

    msg  = "______________________________________________________\n\n"
    msg += "The form was not submitted because of the following error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
} // end of function

function clean_name(n) {
   var substr = n.substring(2, n.length);
    return substr;
}