function popUp(URL) {

//create and init accumulators and vars
var confirmText = "";
var accTotal = 0;
var accItemCount = 0;

var theForm = document.getElementById('form1');

	//loop through the collection of every element in the form by index
	for (var i = 0; i < theForm.elements.length; i++)
	{
		var name = theForm.elements[i].id;
		var val  = theForm.elements[i].value;

		//break apart the text name into an array of meaningful elements
		var arr  = name.split("_");

		//IF it's a thing we're looking for (DIM_),
		//AND it's got content,
		//AND that content is an integer, cast and multiply.
		//NOTE: isInt() is expensive, so we short circuit it.'
		if (arr[0] == "DIM" && val.length > 0 && isInt(val))
		{
			var dims = arr[2];
			var desc = theForm.elements[i].title;

			//multiply the dims.  base10 needs to be
			//specified because of the leading 0s
			var tot  = parseInt(dims, 10) * parseInt(val, 10);

			//debug popup
			confirmText += lpad(3, val) + "  " + desc + " @ " + dims + " each = " + tot + "\n";

			//accumulate the item and dim totals
			accTotal += parseInt(tot, 10);
			accItemCount += parseInt(val,10);
		}
	}

	//confirm popup
	confirmText += "\n\nThe item count = " + accItemCount;
	confirmText += "\nThe total cubic feet = " + accTotal;
	confirmText += "\n\nPress 'OK' to see the storage unit size list.\nPress 'Cancel' to change your selections.";

	day = new Date();
	id = day.getTime();

	//build the URL string to pass the dims total in the qString
	var U = URL + "?dims=" + accTotal

	eval("page" + id + " = window.open(U, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=485,left = 600,top = 309');");
}

function rpad(i, s)
{//stock function for padding strings
	while(s.length < i)
	{
		s += " ";
	}

	return s;
}

function lpad(i, s)
{//stock function for padding strings
	while(s.length < i)
	{
		s = "0" + s;
	}

	return s;
}

function isInt(s)
{//stock function for testing ints

	var Chars = "0123456789";
	var IsInt=true;
	var ch;

	for (i = 0; i < s.length && IsInt == true; i++)
	{
		ch = s.charAt(i);
		if (Chars.indexOf(ch) == -1)
		{
			IsInt = false;
		}
	}

	return IsInt;
}

///////////////////////////////////////////////////////////////////
//// 
//// website utilities - njscuba.net / A.R. Galiano ( argaliano@optonline.com )
////
///////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
//// pre-formatted embedded video player or placeholder
//// plays audio: mp3, wav, wma, mid
//// plays video: wmv, mpg, avi, mov

var PlayerCount = 1 ;

function media_player( vurl, options )
  { 
  //// defaults  
  
  var autostart     = 0   ;
  var stretch       = 1   ;
  var showcontrols  = 1   ;
  var loop          = 0   ;
  var aspectratio   = 4/3 ;
  var vwidth        = 320 ; //// 320 native
  var awidth        = 450 ;
  var width               ;
  var height              ;
  var controlheight = 45  ;
  var type          = "unknown/unknown" ;
  var pid           = "" ;
  var fn            = new String( window.location ) ;
  var home          = "/images/" ;

  plid = "Player" + PlayerCount++ ;
  ////alert( plid ) ;

  //// options override defaults
  if( typeof( options ) != "undefined" )
    {
    if ( options.indexOf( "loop"       ) >= 0 ) { loop         = 100000 ; }
    if ( options.indexOf( "autostart"  ) >= 0 ) { autostart    = 1 ; }
    if ( options.indexOf( "stretch"    ) >= 0 ) { autosize     = 1  ; }
    if ( options.indexOf( "widescreen" ) >= 0 ) { aspectratio  = 16/9  ; vwidth = 450 ;}
    if ( options.indexOf( "nocontrols" ) >= 0 ) { showcontrols = 0 ; controlheight = 0 ; }
    if ( options.indexOf( "slideshow"  ) >= 0 ) { showcontrols = 0 ; controlheight = 0 ; autostart = 1 ; loop = 100000 ; }
    if ( options.indexOf( "wide"       ) >= 0 ) { awidth       = 550 ; }
    }

  //// get mime type
  if     ( typeof( vurl ) == "undefined" ) { vurl = "" ; }
  
  if     ( vurl.indexOf( ".mp3"  ) >= 0 )  { type = "audio/mpeg"      ; width = awidth ; height = 0 ; }
  else if( vurl.indexOf( ".wav"  ) >= 0 )  { type = "audio/x-wav"     ; width = awidth ; height = 0 ; }
  else if( vurl.indexOf( ".wma"  ) >= 0 )  { type = "audio/x-ms-wmv"  ; width = awidth ; height = 0 ; }
  else if( vurl.indexOf( ".mid"  ) >= 0 )  { type = "audio/x-midi"    ; width = awidth ; height = 0 ; }

  else if( vurl.indexOf( ".wmv"  ) >= 0 )  { type = "video/x-ms-wmv"  ; width = vwidth ; height = width / aspectratio ; }
  else if( vurl.indexOf( ".mpg"  ) >= 0 )  { type = "video/mpeg"      ; width = vwidth ; height = width / aspectratio ; }
  else if( vurl.indexOf( ".mpeg" ) >= 0 )  { type = "video/mpeg"      ; width = vwidth ; height = width / aspectratio ; }
  else if( vurl.indexOf( ".avi"  ) >= 0 )  { type = "video/avi"       ; width = vwidth ; height = width / aspectratio ; }
  else if( vurl.indexOf( ".mov"  ) >= 0 )  { type = "video/quicktime" ; width = vwidth ; height = width / aspectratio ; }

  vurl = home + vurl ;
  height += controlheight ;

  //document.writeln( '<textarea style="width:500px;height:500px;">' ) ; //// sanity check
  document.writeln( '<object ' ) ;
  document.writeln( 'id="' + plid + '" ' ) ;
  document.writeln( ' type="' + type + '" ' ) ;
  //document.writeln( ' data="' + vurl + '" ' ) ; //// preload! performance impact on slow conxns
  if( navigator.userAgent.indexOf("Firefox") == -1 ) document.writeln( ' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ' ) ;
  document.writeln( ' width="' + width + '" height="' + height + '" ') ;
  document.writeln( ' >' ) ;
  document.writeln( '<param name="src"            value="' + vurl         + '" />' ) ;
  document.writeln( '<param name="autostart"      value="' + autostart    + '" />' ) ;
  document.writeln( '<param name="autoplay"       value="' + autostart    + '" />' ) ;
  document.writeln( '<param name="animationstart" value="' + autostart    + '" />' ) ;
  document.writeln( '<param name="loop"           value="' + loop         + '" />' ) ;
  document.writeln( '<param name="showcontrols"   value="' + showcontrols + '" />' ) ;
  document.writeln( '<param name="controller"     value="' + showcontrols + '" />' ) ;
  document.writeln( '<param name="autosize"       value="' + stretch      + '" />' ) ;
  document.writeln( '<param name="visible"        value="1" />' ) ;
  document.writeln( '<param name="showdisplay"    value="0" />' ) ;
  document.writeln( '<param name="showstatusbar"  value="0" />' ) ;
  document.writeln( '</object>' ) ;
  //// sanity checks:
  //document.writeln( '</textarea>' ) ;
  //alert ( navigator.userAgent ) ;
  //document.writeln( "<p><a href='" + vurl + "'>" + vurl + "</a></p>" ) ; //// debug
  
  }

///////////////////////////////////////////////////////////////////
//// simple form validator

/*

USAGE:

This validator mis-uses the css class attribute to specify validation requirements.
The class attribute is both "safe" to use in WordPress, and easily accessible in JS.

Sample syntax:

--------------------------------------------------------

<form id="form-id" ... >
<input type="text"     class="valid-required" ... />
<input type="text"     class="valid-email" ... />
<input type="text"     class="valid-phone" ... />
<input type="textarea" class="valid-required" ... ></textarea>
<input type="select"   class="valid-required" ... >
<input type="submit"   onclick="validate('form-id')"... />
</form>

------------------------------------------------------------

The "classes" trigger validation as follows:

valid-required: non-null text value or selection
valid-email:    valid email address
valid-phone:    text min length 10 characters

If none of these classes is specified for a field, the validator simply skips it. These names
will hopefully not collide with any real css classes that may be in use.

The validate function has the form id as a parameter, allowing multiple forms on a page. This is a simple
text string. The function knows nothing about the fields, nor does it need to. All set-up is done in the
html, no programming is required. Error messages are generic, the user is guided with color highlighting.

*/

function validate( frm )
{
emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i ;

theform = document.forms[frm] ;

if ( typeof theform  == "undefined" )
  {  
  alert( "Error - form not found" ) ;
  return false ;
  }

for( i=0 ; i<theform.length ; i++ )
  {
  thefield = theform.elements[i] ;
  ////alert( thefield.type ) ;

  if ( thefield.type == "text" && thefield.className == "valid-required" && thefield.value.length < 1 )
    {
    thefield.focus();
    thefield.style.background = "yellow" ;
    alert( "Please enter a value" ) ;
    return false ;
    } else { thefield.style.background = "white" ; }

  if ( thefield.type == "text" && thefield.className == "valid-phone" && thefield.value.length < 10 )
    {
    thefield.focus();
    thefield.style.background = "yellow" ;
    alert( "Please enter a valid phone number" ) ;
    return false ;
    } else { thefield.style.background = "white" ; }

  if ( thefield.type == "text" && thefield.className == "valid-email" && ! emailfilter.test(thefield.value) )
    {
    thefield.focus();
    thefield.style.background = "yellow" ;
    alert( "Please enter a valid email address" ) ;
    return false ;
    } else { thefield.style.background = "white" ; }

  if( thefield.type == "textarea" && thefield.className == "valid-required" && thefield.value.length < 1 )
    {
    thefield.focus();
    thefield.style.background = "yellow" ;
    alert( "Please enter a value" ) ;
    return false;
    } else { thefield.style.background = "white" ; }

  if( thefield.type == "select-one" && thefield.className == "valid-required" && thefield.selectedIndex == 0 )
    {
    thefield.focus();
    thefield.style.background = "yellow" ;
    alert( "Please make a selection" ) ;
    return false;
    } else { thefield.style.background = "white" ; }

  if( thefield.type == "radio" && thefield.className == "valid-required" )
    {
    //// tricky, maybe someday
    }

  }

return true ;
}