// suckerfish drop-down IE compatibility
sfHover = function() {
	var sfEls = document.getElementById("int").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//checkboxes
function checkboxes(formname,checkname,thestate){
var el_collection=eval("document.forms."+formname+"."+checkname)
for (c=0;c<el_collection.length;c++)
el_collection[c].checked=thestate
}

// word count and max words handler
var maxCount = 100;
var limit= new Array(2) 
limit[0]="<font class='required'>Limit Reached!</font>"; 
limit[1]=""; 

function getData(texter) {
var words = document.eventForm.detail.value;
for (var num=1; num<words.length; num++)
words = words.replace("  "," ");
var wordy = words.length;
if (words.substring(wordy-1,wordy) == " ") { words = words.substring(0,wordy-1); }
var data = words.split(' ');
for (i=0; i<data.length; i++) {
texter.value = data.length; }

theval = document.eventForm.detail.value.length
theval = document.eventForm.detail.value.substring(0,document.eventForm.detail.value.length-1)
if (data.length > maxCount) {document.eventForm.detail.value = theval; texter.value=maxCount; 
writeIt(limit[0],'limit');
return;}
if (document.eventForm.detail.value == "") {document.eventForm.count.value = "";}
writeIt(limit[1],'limit');
}

// copy duplicate information into fields
function CopyCommunity()
{
	if (document.eventForm.same.checked == false)
	{ 
	   document.eventForm.same.value = "0";
	   document.eventForm.firstname2.value = "";
	   document.eventForm.lastname2.value = "";
	   document.eventForm.email_add2.value = "";
	   document.eventForm.address2.value = "";
	   document.eventForm.altaddress2.value = "";
	   document.eventForm.city2.value = "Toronto";
	   document.eventForm.province2.value = "Ontario";
	   document.eventForm.postal2.value = "";
	   document.eventForm.phone2.value = "";
	   document.eventForm.fax2.value = "";
	}	else  { 
	   document.eventForm.same.checked == true;
	   document.eventForm.same.value = document.eventForm.name.value;
	   document.eventForm.firstname2.value = document.eventForm.firstname.value;
	   document.eventForm.lastname2.value = document.eventForm.lastname.value;
	   document.eventForm.email_add2.value = document.eventForm.email_add.value;
	   document.eventForm.address2.value = document.eventForm.address.value;
	   document.eventForm.altaddress2.value = document.eventForm.altaddress.value;
	   document.eventForm.city2.value = document.eventForm.city.value;
	   document.eventForm.province2.value = document.eventForm.province.value;
	   document.eventForm.postal2.value = document.eventForm.postal.value;
	   document.eventForm.phone2.value = document.eventForm.phone.value;
	   document.eventForm.fax2.value = document.eventForm.fax.value;
	}		
}

// update duplicate information in the fields
function UpdateCommunity()
{
	if (document.eventForm.same.checked == true)
	{ 
	   document.eventForm.same.value = document.eventForm.name.value;
	   document.eventForm.firstname2.value = document.eventForm.firstname.value;
	   document.eventForm.lastname2.value = document.eventForm.lastname.value;
	   document.eventForm.email_add2.value = document.eventForm.email_add.value;
	   document.eventForm.address2.value = document.eventForm.address.value;
	   document.eventForm.altaddress2.value = document.eventForm.altaddress.value;
	   document.eventForm.city2.value = document.eventForm.city.value;
	   document.eventForm.province2.value = document.eventForm.province.value;
	   document.eventForm.postal2.value = document.eventForm.postal.value;
	   document.eventForm.phone2.value = document.eventForm.phone.value;
	   document.eventForm.fax2.value = document.eventForm.fax.value;
	}		
}

//dynamic divs
function writeIt(text,id){
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = text;
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

// pop-up window control
var imageWin = "";
function launchPage(url,theWidth,theHeight) {

 if(imageWin && !imageWin.closed) {
 imageWin.close();
 }

 imageWin = window.open(url,'imageWindow','width=' + theWidth + ',height=' + theHeight + ',resizable=no,scrollbars=auto,menubar=no,toolbar=no,directories=no,location=no,status=no');
 setTimeout("imageWin.focus()",250);
      
}

// global functions
function MM_displayStatusMsg(msgStr)  { //v3.0
	status=msgStr; document.MM_returnValue = true;
}

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_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 MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i< (args.length-2); i+=3) if ((obj=document.getElementById(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}