 //**************swap image*******************
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];}
}

 //**************image restore*******************
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;
}

 //**************preload images*******************
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];}}
}




 //**************layer swap*******************
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
 //**************end layer swap*******************

 
 
 
//reloads the window if Netscape 4 resized
function MM_reloadPage(init) {  
  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);




 
if (document.images) {
}
function di(id,name){
  if (document.images) {document.images[id].src=eval(name+".src"); }
}

// function that displays status bar message

function dm(msgStr) {
  document.returnValue = false;
  if (document.images) { 
     window.status = msgStr;
     document.returnValue = true;
  }
}
var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
function dmim(msgStr) {
  document.returnValue = false;
  if (showMsg) { 
    window.status = msgStr;
    document.returnValue = true;
  }
}


function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function GembaLinksLink()
{ 
var a = document.GembaLinks.DirectLink.options[document.GembaLinks.DirectLink.selectedIndex].value +"";
if(a != '')
	{ 
	if(parent!=self)
		{ 
		var f = self; 
			while(f!=window.top)
				{ 
				f = f.parent;
				} 
				if(a.indexOf("://")!=-1)
					{ 
					f.body.window.location.href = a;
					}
				else
					{ 
					window.top.location.href = a;
					}
			 	}
	else
		{ 
		window.top.location.href = a;
		} 
document.GembaLinks.DirectLink.selectedIndex=0;
} 
}

function GembaLinksBLink()
{ 
var a = document.GembaLinksB.DirectLinkBB.options[document.GembaLinksB.DirectLinkBB.selectedIndex].value +"";
if(a != '')
	{ 
	if(parent!=self)
		{ 
		var f = self; 
			while(f!=window.top)
				{ 
				f = f.parent;
				} 
				if(a.indexOf("://")!=-1)
					{ 
					f.body.window.location.href = a;
					}
				else
					{ 
					window.top.location.href = a;
					}
			 	}
	else
		{ 
		window.top.location.href = a;
		} 
document.GembaLinksB.DirectLinkBB.selectedIndex=0;
} 
}

function gotoPage()
{
 var list = document.forms[0].urlList
 location = list.options[list.selectedIndex].value 
}

// form functions

function clearEmail(fld) {
	if (fld.value == "Email Address")
		fld.value = "";
}

function checkNewsletterForm(fm) {
	em = fm.email_address;
	em.value = em.value.replace(/^ */g, '').replace(/ *$/g, ''); // trim
	if (em.value == "") {
		alert("Newsletter signup requires an e-mail address.");
		return false;
	} else {
		temp = em.value + " ";
		found = temp.search(/[\w\.-]+@([\w-]+\.){1,3}[a-zA-Z]{2,}\s{1}/);
		if (found != 0) {
			alert("E-mail address must be in the form username@server.com.");
			return false;
		}
	}
	cb = fm.shannon_assoc_client_bulletin;
	wm = fm.sa_kg_advisors_strategic_planning;
	cbv = (cb && ((cb.type == "checkbox" && cb.checked) || cb.type == "hidden") ? cb.value : "0");
	wmv = (wm && ((wm.type == "checkbox" && wm.checked) || wm.type == "hidden") ? wm.value : "0");
	if (cbv != "1" && wmv != "1") {
		alert("Please select at least one newsletter to subscribe to.");
		return false;
	}
	return true;
}


// form handling functions
function trimFormField(fm, fieldname) {
	formfield = eval("fm." + fieldname);
	formfield.value = formfield.value.replace(/^ */g, '').replace(/ *$/g, '');
}
function requiredFormField(fm, fieldname, fielddesc) {
	formfield = eval("fm." + fieldname);
	if (formfield.value == "")
		return fielddesc + " is a required field<br />";
	else return "";
}
function emailField(fm, fieldname, fielddesc, reqd) {
	formfield = eval("fm." + fieldname);	
	if (formfield.value == "" && reqd)
		return fielddesc + " is a required field<br />";
	else if (formfield.value != "") {
		temp = formfield.value + " ";
		found = temp.search(/[\w\.-]+@([\w-]+\.){1,3}[a-zA-Z]{2,}\s{1}/);
		if (found != 0)
			return fielddesc + " must be in the form abc@def.com<br />";
		else return "";
	} else return "";
}
function regexpField(fm, regexp, fieldname, fielddesc, msg, reqd) {
	formfield = eval("fm." + fieldname);
	if (formfield.value != "") {
		temp = formfield.value + " ";
		found = temp.search(regexp);
		if (found != 0)
			return fielddesc + msg + "<br />";
		else return "";
	} else if (reqd) {
		return fielddesc + " is a required field<br />";
	} else return "";
}
function checkSLRegistration(fm) {
	var missing = "";
	trimfields = new Array("name","phone","email","title","business");
	for (i = 0; i < trimfields.length; i++)
		trimFormField(fm, trimfields[i]);
	var datesel = false;
	for (i = 0; i < fm.dateselect.length; i++) {
		if (fm.dateselect[i].checked)
			datesel = true;
	}
	if (! datesel)
		missing += "Date is a required field.<br />";
	missing += requiredFormField(fm, "name", "Name");
	tmp = fm.phone.value + " ";
	if (tmp.search(/\d{10}\s{1}/) == 0)
		fm.phone.value = fm.phone.value.substring(0, 3) + "-" + fm.phone.value.substring(3, 6) + "-" + fm.phone.value.substring(6);
	missing += regexpField(fm, /\d{3}-\d{3}-\d{4}\s{1}/, "phone", "Phone", " must be in the form 000-000-0000", true);
	missing += emailField(fm, "email", "E-mail", true);
	document.getElementById("error").style.display = "none";
	if (missing != "") {
		document.getElementById("error").innerHTML = "<font class=\"req\">" + missing + "</font>";
		document.getElementById("error").style.display = "block";
		return false;
	} else return true;
}

function checkSCRegistration(fm) {
	var missing = "";
	trimfields = new Array("name","phone","email","company");
	for (i = 0; i < trimfields.length; i++)
		trimFormField(fm, trimfields[i]);
	missing += requiredFormField(fm, "company", "Company Name");
	missing += requiredFormField(fm, "name", "Contact Name");
	tmp = fm.phone.value + " ";
	if (tmp.search(/\d{10}\s{1}/) == 0)
		fm.phone.value = fm.phone.value.substring(0, 3) + "-" + fm.phone.value.substring(3, 6) + "-" + fm.phone.value.substring(6);
	missing += regexpField(fm, /\d{3}-\d{3}-\d{4}\s{1}/, "phone", "Phone", " must be in the form 000-000-0000", true);
	missing += emailField(fm, "email", "E-mail", true);
	document.getElementById("error").style.display = "none";
	if (missing != "") {
		document.getElementById("error").innerHTML = "<font class=\"req\">" + missing + "</font>";
		document.getElementById("error").style.display = "block";
		return false;
	} else return true;
}