

function checkForm(){
	n = document.search.n.value.toUpperCase()
	s = document.search.s.value
	t = document.search.t.value
	if (n.indexOf(" AND ") >= 0 && n.indexOf(" OR ") >= 0){
		alert("You cannot perform AND and OR functions in the same search.\nPlease modify your search and try again.")
	}else{
		if (n == "" && s == "" && t == ""){
			alert("Either a \"Member Name\", \"Type of Business\" or \"Location\" must be selected.")
		}else{
			document.search.submit()
		}
	}
}

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_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_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_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 subMenu() { //v3.0
  var i,p,v,obj,args=subMenu.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; }
}
function cat_display(num,state) {
	   var id = 'cat_' + num + '_' + state;

	   document.getElementById('cat_'+num+'_hide').style.display="none";
	   document.getElementById('cat_'+num+'_show').style.display="none";
	   document.getElementById(id).style.display="inline";

	   return false;
	}

// expand/collapse "all categories" list
function allcats_display() {
	if (document.getElementById('allcats').style.display == "inline") {
		document.getElementById('allcats').style.display = "none";
	} else {
		document.getElementById('allcats').style.display = "inline";
	}
	return false;
}
    
   function WM_toggle(id) {

     if (document.all){
       if(document.all[id].style.display == 'none'){
         document.all[id].style.display = '';
       } else {
         document.all[id].style.display = 'none';
       }
     } else if (document.getElementById){
       if(document.getElementById(id).style.display == 'none'){
         document.getElementById(id).style.display = 'block';
       } else {
         document.getElementById(id).style.display = 'none';
       }
     } 
   }

function WM_Multitoggle() {
	var a,i,id;
	
	a = WM_Multitoggle.arguments;
	//alert(a.length)
	
	for(i=0; i<a.length; i++){
		id=a[i];
		if(document.all[id].style.display == 'none'){
		  document.all[id].style.display = '';
		} else {
		  document.all[id].style.display = 'none';
		}
	}
}

function hrefRename(oControl){
	//alert(oControl.innerText)
	if(oControl.innerText == 'Open All'){
	  oControl.innerText = 'Close All';
	} else {
	  oControl.innerText = 'Open All';
	}
}

function clearDrops(formObj,x){
	if (x == 1){
		if (formObj.region_id.selectedIndex != 0){
			formObj.county_id.selectedIndex = 0;
			formObj.city_id.selectedIndex = 0;
			}
	}else if (x == 2){
		if (formObj.county_id.selectedIndex != 0){
			formObj.region_id.selectedIndex = 0;
			formObj.city_id.selectedIndex = 0;
			}
	}else {
		if (formObj.city_id.selectedIndex != 0){
			formObj.region_id.selectedIndex = 0;
			formObj.county_id.selectedIndex = 0;
			}
	}
	
}
function setDates(){
	mm_from= "<%=month(datefrom)%>"
	dd_from= "<%=day(datefrom)%>"
	yy_from= "<%=year(datefrom)%>"
	mm_to= "<%=month(dateto)%>"
	dd_to= "<%=day(dateto)%>"
	yy_to= "<%=year(dateto)%>"
	document.search.region_id.value = '<%=request("region_id")%>'
	document.search.county_id.value = '<%=request("county_id")%>'
	document.search.city_id.value = '<%=request("city_id")%>'
	document.search.keyword.value = '<%=request("keyword")%>'
	document.search.mm_from.value = mm_from
	document.search.dd_from.value = dd_from
	document.search.yy_from.value = yy_from
	document.search.mm_to.value = mm_to
	document.search.dd_to.value = dd_to
	document.search.yy_to.value = yy_to
	datefrom = mm_from +"/"+ dd_from +"/"+ yy_from
	dateto = mm_to +"/"+ dd_to +"/"+ yy_to
	document.search.datefrom.value = datefrom
	document.search.dateto.value = dateto
}
function clearForm(){
	mm_from= "<%=month(clrfrom)%>"
	dd_from= "<%=day(clrfrom)%>"
	yy_from= "<%=year(clrfrom)%>"
	mm_to= "<%=month(clrto)%>"
	dd_to= "<%=day(clrto)%>"
	yy_to= "<%=year(clrto)%>"
	document.search.region_id.value = ''
	document.search.county_id.value = ''
	document.search.city_id.value = ''
	document.search.keyword.value = ''
	document.search.mm_from.value = mm_from
	document.search.dd_from.value = dd_from
	document.search.yy_from.value = yy_from
	document.search.mm_to.value = mm_to
	document.search.dd_to.value = dd_to
	document.search.yy_to.value = yy_to
	datefrom = mm_from +"/"+ dd_from +"/"+ yy_from
	dateto = mm_to +"/"+ dd_to +"/"+ yy_to
	document.search.datefrom.value = datefrom
	document.search.dateto.value = dateto
}
function getDates(formObj){
	chk = true
	mm_from= formObj.mm_from.value
	dd_from= formObj.dd_from.value
	yy_from= formObj.yy_from.value
	mm_to= formObj.mm_to.value
	dd_to= formObj.dd_to.value
	yy_to= formObj.yy_to.value
	datefrom = mm_from +"/"+ dd_from +"/"+ yy_from
	dateto = mm_to +"/"+ dd_to +"/"+ yy_to
	df = new Date(datefrom)
	dt = new Date(dateto)
	formObj.datefrom.value = datefrom
	formObj.dateto.value = dateto
	if (dt < df){
		alert("FROM date must be earlier than TO date.")
		chk = false
	}else{
		checkDate(datefrom)
		if (chk == true){checkDate(dateto)}
	}
	return chk
}
function checkDate(tmp){
	nos=tmp.split("/")
	mm=nos[0];dd=nos[1];yy=nos[2]
	if ((mm==4||mm==6||mm==9||mm==11)&&dd>30){chk = false}
	if (mm==2&&yy%4&&dd>28){chk = false}
	if (mm==2&&dd>29){chk = false}
	if (chk == false){alert("ERROR: Invalid Date\n\n\""+tmp+"\" is not a valid date.")}
	return chk
}

var pix = 0
