		function MM_findObj(n, d) { 
		  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() { 
		  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; 
			if (v=='hidden'){obj.display='none';}
			if (v!='hidden'){obj.display='';}
			}
		}
		function MM_swapImage() { 
		  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() { 
		  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() { 
		 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 resizeWin(width,height) {
		  if (window.screen) {
		    var aw = screen.availWidth;
		    var ah = screen.availHeight;
			var left = (aw-width)/2;
			if (left < 0) 
				{	left = 0;
					width = aw; }
			var top = (ah-40-height-40)/2;
			if (top < 0)
				{	top = 40;
					height = ah-80; }
		    window.moveTo(left,top);
		    window.resizeTo(width,height);
			  }
			}
		function randomRange(inMin,inMax) {
			var min = 0, max = 0;
			if (inMin) min = inMin;
			if (inMax) max = inMax;
			if (min > max) {
			var swop = min;
				min = max;
				max = swop;
				}
			return min + Math.floor(Math.random() * (max - min + 1));
			} 
		function MM_openBrWindowCtr(theURL,winName,features,height,width,returnWin,autoclose) {
			var inx = winName.indexOf("~");
			if (inx != -1) {
					winName = winName.substring(0,inx);
				var strRand = randomRange(1,24000);
					winName = winName + strRand;
				}
			screenYa = window.screen.availHeight;
			screenXa = window.screen.availWidth;
			leftprop = (screenXa - width) / 2;
			topprop = (screenYa - height) / 2;
			features = features + ",left=" + leftprop;
			features = features + ",top=" + topprop;
			features = features + ",height=" + height;
			features = features + ",width=" + width;
			theWindow = window.open(theURL,winName,features);
			if (autoclose) {
				timer=setTimeout('theWindow.close()',autoclose);
			}
			if (returnWin == "returnWin") { return theWindow; }
		}
		function MM_openBrWindow(theURL,winName,features,returnWin) {
			var findLeft = features.indexOf("left");
			var widthInx = features.indexOf("width");
			var heightInx = features.indexOf("height");
			if (findLeft == -1 && widthInx != 0 && heightInx != 0) {
				height = features.substring(heightInx+7,heightInx+10);
				width = features.substring(widthInx+6,widthInx+9);
				features = features.substring(0,widthInx-1);
				theWindow = MM_openBrWindowCtr(theURL,winName,features,height,width,returnWin);
				if (returnWin == "returnWin") { return theWindow; }
				}
			else {
			var inx = winName.indexOf("~");
			if (inx != 0) {
					winName = winName.substring(0,inx);
				var strRand = randomRange(1,24000);
					winName = winName + strRand;
				}
			  	theWindow = window.open(theURL,winName,features);
				if (returnWin == "returnWin") { return theWindow; }
			  }
			}
		function MM_openBrWindowModal(theURL,winName,features,returnWin) {
			var widthInx = features.indexOf("width");
			var heightInx = features.indexOf("height");
			var inx = winName.indexOf("~");
			if (inx != 0) {
					winName = winName.substring(0,inx);
				var strRand = randomRange(1,24000);
					winName = winName + strRand;
				}
			var browser=navigator.appName;
				heightOffset=0;
				widthOffset=0;
			if (browser!='Netscape') {
				heightOffset=60;
				widthOffset=10;
			}
			if (window.showModalDialog) {
				height = eval(features.substring(heightInx+7,heightInx+10))+heightOffset;
				width = eval(features.substring(widthInx+6,widthInx+9))+widthOffset;
				features="dialogWidth:"+width+"px;dialogHeight:"+height+"px";
				window.showModalDialog(theURL,winName,features); }
			else {
				features=features+',modal=yes';
			  	theWindow = window.open(theURL,winName,features);
				}
			if (returnWin == "returnWin") { return theWindow; }
			}

	// removes all leading and trailing occurrences of a set of characters specified. If no characters are specified it will trim whitespace characters from the beginning or end or both of the string.
	function trim(str, chars) {
		return ltrim(rtrim(str, chars), chars);
		}

	function ltrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
		}

	function rtrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
		}

	function formatPhone (field) {
		field.value = trim(field.value);
	    var ov = field.value;
    	var v = "";
	    var x = -1; 
		if (0 < ov.length && '+' != ov.charAt(0)) {	
		    var n = 0; 
			if ('1' == ov.charAt(0)) {	
				ov = ov.substring(1, ov.length);
			}
		    for (i = 0; i < ov.length; i++) {
		        var ch = ov.charAt(i); 
	    	    if (ch >= '0' && ch <= '9') {
		            if (n == 0) v += "(";
		            else if (n == 3) v += ") ";
	    	        else if (n == 6) v += "-";
	        	    v += ch;
		            n++;
		        } 
		        if (! (ch >= '0' && ch <= '9') && n != 10 && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
	    	        x = i;
	        	    break;
		        }
		    } 
		    if (x >= 0) v += " " + ov.substring(x, ov.length);
	    	if (n == 10 && v.length <= 40) field.value = v; 
		}
    	return true;
		}			
	function toggleMenuItemColor(menuitem,ftcolor,bgcolor) {
		menuitem.style.backgroundColor=bgcolor;
		menuitem.style.color=ftcolor;
		}
	function enlargeImage(imageID,fullWidth,fullHeight,smallWidth,smallHeight) {
		var image=MM_findObj(imageID);
		if (image.width == smallWidth) {
			image.width=fullWidth;
			image.height=fullHeight;
			}
		else {
			image.width=smallWidth;
			image.height=smallHeight;
			}
		}
	function hiliteContainer(container) {
		container.style.borderColor = 'red';
		}
	function unhiliteContainer(container) {
		container.style.borderColor = 'silver';
		}
	function hiliteObject(container) {
		container.style.borderColor = 'blue';
		}
	function unhiliteObject(container) {
		container.style.borderColor = 'silver';
		}
		
	function get_cookie(Name) {
		  var search = Name + "=";
		  var returnvalue = "";
		  if (document.cookie.length > 0) {
		    offset = document.cookie.indexOf(search);
		    if (offset != -1) { 
		      offset += search.length;
		      end = document.cookie.indexOf(";", offset);
		      if (end == -1)
		         end = document.cookie.length;
		      returnvalue=unescape(document.cookie.substring(offset, end));
		      }
		   }
		  return returnvalue;
		}
	function set_cookie(cookieName,cookieValue,nDays) {
		 var today = new Date();
		 var expire = new Date();
			 if (nDays==null || nDays==0) nDays=1;
				 expire.setTime(today.getTime() + 3600000*24*nDays);
					 document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
		}
	function isInteger(string) {
		var valid = '-0123456789'; // define valid characters
    	for (var i=0; i< string.length; i++) {
        if (valid.indexOf(string.charAt(i)) == -1) {
            alert('Please enter an integer number.');
            return false;
        	}
    	}
    	return true;
	}
	function isPositiveInteger(string) {
		var valid = '0123456789'; // define valid characters
    	for (var i=0; i< string.length; i++) {
        if (valid.indexOf(string.charAt(i)) == -1) {
            alert('Please enter a non-negative integer number.');
            return false;
        	}
    	}
    	return true;
	}
	function isNumeric(string) {
		var valid = '-0123456789.'; // define valid characters
    	for (var i=0; i< string.length; i++) {
        if (valid.indexOf(string.charAt(i)) == -1) {
            alert('Please enter a number.');
            return false;
        	}
    	}
    	return true;
	}
	
	// these variables, plus the next three functions, stripCharsInBag, daysInFebruary and DaysArray, are all needed for the isDate function below
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;
	function stripCharsInBag(s, bag){
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++){   
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}
	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}
	function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}
	function isDate(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			alert("The date format should be : mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			alert("Please enter a valid date")
			return false
		}
	return true
	}

	function validateCC(ccNumb) {  // v2.0
		var v = "0123456789";
		var w = "";
		for (i=0; i < ccNumb.length; i++) {
			x = ccNumb.charAt(i);
			if (v.indexOf(x,0) != -1)
			w += x;
			}
		ccNumb=w;
		var valid = "0123456789"  // Valid digits in a credit card number
		var len = ccNumb.length;  // The length of the submitted cc number
		var iCCN = parseInt(ccNumb);  // integer of ccNumb
		var sCCN = ccNumb.toString();  // string of ccNumb
			sCCN = sCCN.replace (/^\s+|\s+$/g,'');  // strip spaces
		var iTotal = 0;  // integer total set at zero
		var bNum = true;  // by default assume it is a number
		var bResult = false;  // by default assume it is NOT a valid cc
		var temp;  // temp variable for parsing string
		var calc;  // used for calculation of each digit

		// Determine if the ccNumb is in fact all numbers
		for (var j=0; j<len; j++) {
		  temp = "" + sCCN.substring(j, j+1);
		  if (valid.indexOf(temp) == "-1"){bNum = false;}
		}

		// if it is NOT a number, you can either alert to the fact, or just pass a failure
		if(!bNum){
		  /*alert("Not a Number");*/bResult = false;
		}

		// Determine if it is the proper length 
		if((len == 0)&&(bResult)){  // nothing, field is blank AND passed above # check
		  bResult = false;
		} else{  // ccNumb is a number and the proper length - let's see if it is a valid card number
		  if(len >= 15){  // 15 or 16 for Amex or V/MC
		    for(var i=len;i>0;i--){  // LOOP throught the digits of the card
		      calc = parseInt(iCCN) % 10;  // right most digit
		      calc = parseInt(calc);  // assure it is an integer
		      iTotal += calc;  // running total of the card number as we loop - Do Nothing to first digit
		      i--;  // decrement the count - move to the next digit in the card
		      iCCN = iCCN / 10;                               // subtracts right most digit from ccNumb
		      calc = parseInt(iCCN) % 10 ;    // NEXT right most digit
		      calc = calc *2;                                 // multiply the digit by two
		      // Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7,
		      // I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple.
		      switch(calc){
		        case 10: calc = 1; break;       //5*2=10 & 1+0 = 1
		        case 12: calc = 3; break;       //6*2=12 & 1+2 = 3
		        case 14: calc = 5; break;       //7*2=14 & 1+4 = 5
		        case 16: calc = 7; break;       //8*2=16 & 1+6 = 7
		        case 18: calc = 9; break;       //9*2=18 & 1+8 = 9
		        default: calc = calc;           //4*2= 8 &   8 = 8  -same for all lower numbers
		      }                                               
		    iCCN = iCCN / 10;  // subtracts right most digit from ccNum
		    iTotal += calc;  // running total of the card number as we loop
		  }  // END OF LOOP
		  if ((iTotal%10)==0){  // check to see if the sum Mod 10 is zero
		    bResult = true;  // This IS (or could be) a valid credit card number.
		  } else {
		    bResult = false;  // This could NOT be a valid credit card number
		    }
		  }
		}
		  return bResult; // Return the results
	}
