// Pop-up Window Script -->
function MM_openWindow(theURL,winName,launchWin,features) { //v1.0
  if (launchWin == ''){
    window.open(theURL,winName,features);
  }
  else{
    var controller = window.open(theURL,winName,features);
    if (controller.opener == null){
      controller.opener = self;
    }
    controller.opener.name = launchWin;
    return controller;
  }
}
// Reloads the window if Nav4 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);

// Preload & Swap Images
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 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];}}
}

// anti spam email script
var doJAVASCRIPT;
var suffix;
function jemail(user, doJAVASCRIPT, suffix){
document.write('<a href="' + 'mailto:' + user + '@' + doJAVASCRIPT + '.' + suffix + '">' + user + '@' + doJAVASCRIPT + '.' + suffix + '</a>');
}

//drop down form - links to special sizing - concantenation
function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) { // process un-named selects
var i,amt,des,obj,pos,val;
  amt = obj1.baseamt.value*1.0;       // base amount
  des = obj1.basedes.value;           // base description
  for (i=0; i<obj1.length; i++) {     // run entire form
    obj = obj1.elements[i];           // a form element
    if (obj.type == "select-one" &&   // just get selects
        obj.name == "") {             // must be un-named
      pos = obj.selectedIndex;        // which option selected
      val = obj.options[pos].value;   // selected value
      pos  = val.indexOf ("@");       // price set?
      if (pos >= 0) amt = val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("+");       // price increment?
      if (pos >= 0) amt = amt + val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("%");       // percent change?
      if (pos >= 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
      if (des.length == 0) des = val;
      else des = des + ", " + val;    // accumulate value
    }
  }
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

function CategoryFunction(SelectBox)
{
 if (SelectBox.options[SelectBox.selectedIndex].value != -1)
 {
  var subCat = SelectBox.options[SelectBox.selectedIndex].value
  var mainCat = SelectBox.name
  location = "goods_listings.asp?mainCat=" + mainCat + "&subCat=" + subCat + "&letter=sponsor"
 }//**** end if ****
}//**** end of Category Fuction ****
function VerifySearch()
{
	var sterm = document.frmSrch.txtSrchTrm.value
	if( sterm == "")
	{
		window.alert("You Must Enter A Search Value");
		return false;
	}
	if(sterm.length < 3)
	{
		window.alert("The Search Term Must Be At Least 3 Characters Long.");
		return false;
	}
	return true;
}//**** end of Verify Search Function ****

function CheckingIt(){
	var dateStr = new String(document.siteTour.month.value + "/" + document.siteTour.day.value + "/" + document.siteTour.year.value)
    var pdate = new Date(dateStr)			
	if (document.siteTour.month.value == "") {
	  alert("Please enter a month.")
	return false
	}
	if (document.siteTour.day.value == "") {
	  alert("Please enter a day.")
	return false
	}
	if (document.siteTour.year.value == "") {
	  alert("Please enter a year.")
	return false
	}
	   //making sure month day and year are numbers
	if (isNaN(document.siteTour.month.value) ||  isNaN(document.siteTour.day.value)  || isNaN(document.siteTour.year.value)) {
		alert("Not acceptable format")
		return false
		}
		var mm = parseInt(document.siteTour.month.value)
	    var dd = parseInt(document.siteTour.day.value)
	    var yyyy = parseInt(document.siteTour.year.value)
	if (mm < 1 || mm > 12) {
		// month value is not 1 thru 12
		alert("Months must be entered between 01 and 12")
		return false	
	}
	
	if (dd < 1 || dd > 31) {
		// month value is not 1 thru 12
	      alert("Days must be entered between 01 and 31")
	      return false
	     }
	if (yyyy < 100) {
		//  validating year value
		if (yyyy >= 30) {
			yyyy += 1900
		} else {
			yyyy += 2000
		}
	}

//	check the entered month for too high a value
	var months = new
	Array("","January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
	if ((mm==4 || mm==6 || mm==9 || mm==11) && dd > 30) {
		alert(months[mm] + " has only 30 days.")
		return false
	} else if (dd > 31) {
		alert(months[mm] + " has only 31 days.")
		return false
	}
//	check the entered February date for too high a value(leap month)
	if(mm==2){
	if (yyyy % 4 > 0 && dd > 28) {
		alert("February of " + yyyy + " has only 28 days.")
		return false
	} else if (dd > 29) {
		alert("February of " + yyyy + " is a leap year and has only 29 days.")
		return false
	}
  }
  	}
