function verify_comment() {
   var themessage = "You are required to complete the following fields: ";
   if (document.f1.username.value=="") {
      themessage = themessage + "\n - Username";
   }
   if (document.f1.city.value=="") {
      themessage = themessage + "\n - City";
   }
   if (document.f1.state.value=="") {
      themessage = themessage + "\n - State";
   }
   if (document.f1.comment.value=="") {
      themessage = themessage + "\n - Comment";
   }
   //alert if fields are empty and cancel form submit
   if (themessage == "You are required to complete the following fields: ") {
      document.f1.submit();
   } else {
      alert(themessage);
      return false;
   }
}


function verify_test() {
   var themessage = "You are required to complete the following fields: ";
   if (document.f1.name.value=="") {
      themessage = themessage + "\n - Name";
   }
   if (document.f1.email.value=="") {
      themessage = themessage + "\n - Email Address";
   }
   if (document.f1.city.value=="") {
      themessage = themessage + "\n - City";
   }
   if (document.f1.state.value=="") {
      themessage = themessage + "\n - State";
   }
   if (themessage == "You are required to complete the following fields: ") {
      document.f1.submit();
   } else {
      alert(themessage);
      return false;
   }
}


function verify_reg() {
   var themessage = "You are required to complete the following fields: ";
   if (document.f1.name.value=="") {
      themessage = themessage + "\n - Name";
   }
   if (document.f1.email.value=="") {
      themessage = themessage + "\n - Email Address";
   }
   if (document.f1.phone.value=="") {
      themessage = themessage + "\n - Phone";
   }
   if (document.f1.company.value=="") {
      themessage = themessage + "\n - Company";
   }
   if (document.f1.address.value=="") {
      themessage = themessage + "\n - Address";
   }
   if (document.f1.city.value=="") {
      themessage = themessage + "\n - City";
   }
   if (document.f1.state.value=="") {
      themessage = themessage + "\n - State";
   }
   if (document.f1.zip.value=="") {
      themessage = themessage + "\n - Zip";
   }

   themessage = checkRadios(themessage);

   if (document.f1.how.value=="") {
      themessage = themessage + "\n - How did you hear about PHEN?";
   }
   if (themessage == "You are required to complete the following fields: ") {
      document.f1.submit();
   } else {
      alert(themessage);
      return false;
   }
}

function verify_rally_reg() {
   var themessage = "You are required to complete the following fields: ";
   if (document.f1.name.value=="") {
      themessage = themessage + "\n - Name";
   }
   if (document.f1.email.value=="") {
      themessage = themessage + "\n - Email Address";
   }
   if (document.f1.phone.value=="") {
      themessage = themessage + "\n - Phone";
   }

   if (document.f1.rallyarea.value=="") {
      themessage = themessage + "\n - Area of Rally";
   }

   themessage = checkRadios(themessage);

   if (themessage == "You are required to complete the following fields: ") {
      document.f1.submit();
   } else {
      alert(themessage);
      return false;
   }
}



function verify_phen_reg() {
   var themessage = "You are required to complete the following fields: ";
   if (document.f1.name.value=="") {
      themessage = themessage + "\n - Name";
   }
   if (document.f1.email.value=="") {
      themessage = themessage + "\n - Email Address";
   }
   if (document.f1.phone.value=="") {
      themessage = themessage + "\n - Phone";
   }
   if (document.f1.city.value=="") {
      themessage = themessage + "\n - City";
   }
   if (document.f1.state.value=="") {
      themessage = themessage + "\n - State";
   }
   if (document.f1.zip.value=="") {
      themessage = themessage + "\n - Zip";
   }

   themessage = checkRadios(themessage);

   if (themessage == "You are required to complete the following fields: ") {
      document.f1.submit();
   } else {
      alert(themessage);
      return false;
   }
}



function checkRadios(themessage) {
 var el = document.f1.elements;
 var field_name = "x";
 for(var i = 0 ; i < el.length ; ++i) {
  if(el[i].type == "radio") {
   var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
	 itemchecked = true;
	 break;
	}
   }
   if(!itemchecked && field_name != el[i].name) {
    themessage = themessage + "\n - "+el[i].name;
    field_name = el[i].name;
   }
  }
 }
	return themessage;
}

function confirmDelete() {
   var agree=confirm("Are you sure you want to Delete the record(s) ?");
   if (agree)
   	return true ;
   else
   	return false ;
   }

function confirmGroupDelete() {
   var agree=confirm("Are you sure you want to permanently Delete this Group and all of its items ?");
   if (agree)
   	return true ;
   else
   	return false ;
   }

function confirmAdDelete() {
   var agree=confirm("Are you sure you want to remove this Ad from this Page ?");
   if (agree)
   	return true ;
   else
   	return false ;
   }

function jumpTo(URL_List){

        var URL

        var CityID = URL_List.options[URL_List.selectedIndex].value;

        //URL="TestOpenCity.php?CityID="+CityID

        URL="OpenCity.php?CityID="+CityID

        document.location = URL;

		}


// Jimco Add-ins Spawn JavaScript
// This script is freely redistributable. //-->

function spawnJimcoPopup(url, name, options, h, w, x, y, scaleType)
{
   var windowOptions;
   if (scaleType == 'percent')
   {
     w = (w * screen.availWidth) / 100;
     h = (h * screen.availHeight) / 100;
   }
   if (x == 'center')
   {
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
   }
   windowOptions = options + ',width=' + w + ',height=' + h + ',left=' + x + ',top=' + y;
   newWindow = window.open(url, name, windowOptions);
   newWindow.focus();
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } }
  doc.$imgSwaps=null; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function checkAll(checkname, exby) {
  for (i = 0; i < checkname.length; i++)
  checkname[i].checked = exby.checked? true:false
}

function checkAllt(theForm,exby){
   var els = theForm.elements;
	for(i=0; i<els.length; i++){
		switch(els[i].type){
			case "checkbox":
				els[i].checked = exby.checked? true:false
				break;
		}
	}
}


