/* This file is the proprietary property and trade secret of
 * SPECTRA Software, Inc. Auburn, WA 98002
 *--------------------------------------------------------------*
 * This script written and © 2004 Christine Jamison             *
 * ALL RIGHTS RESERVED.                                         *
 * Created on : 08-Aug-06                                       *
 * Mail : support@spectrasw.com                                 *
 * v 1.0 - Original Release                                     *
 *--------------------------------------------------------------*
 */

/*
 *  Purpose: The following 3 functions allow setting of the available
 *	     JavaScript/CSS attributes of a cell / div / span.
 *	     There is no return value, the screen should just change,
 *	     per the new CSS class attrbutes.
 *
 *  Arguments:	object: defining what object will have it's class change;
 *              usually, we pass "this";
 *		selectedRow: if this is part of a "radio-button" arrangement,
 *              then this is the radio button identifier.
 *
 *  Variables:
 *	None.
 */

  var selected;

  function cellSelectEffect(object, selectedRow)
    { if (!selected)
        { if (document.getElementById)
            { selected = document.getElementById('defaultSelected');
            }
       else { selected = document.all['defaultSelected'];
            }
        }
      if (selected) selected.className = 'buttonSelect';
      object.className = 'button';
      selected = object;

// one button is not an array
//      if (document.checkout_address.shipping[0])
//        { document.checkout_address.shipping[selectedRow].checked=true;
//        }
//   else { document.checkout_address.shipping.checked=true;
//        }
    }

  function cellOverEffect(object)
    { if (object.className == 'button') object.className = 'buttonOver';
    }

  function cellOutEffect(object)
    { if (object.className == 'buttonOver') object.className = 'button';
    }

/*
 *  Purpose: Act like an "anchor" HTML element, sending the browser to a new
 *	     URL.
 *	     There is no return value, the browser is just redirected.
 *
 *  Arguments:	location: the new URL to go to.
 *
 *  Variables:
 *	None.
 */

  function goto_url(location)
    { if (location == '')
        {work1='/index.shtml';}
   else {work1=location;}
      window.location.href=work1;
    }

/*
 *  Purpose: Change the shape of the cursor to the selected shape; note
 *	     that Netscape Navigator does not support the standard "hand"
 *	     shape very well.
 *	     There is no return value, the cursor shape just changes.
 *
 *  Arguments:	shape: the name of the new curson shape.
 *
 *  Variables:
 *	None.
 */

  function cursor_change(shape)
    { if (shape == '')
        {work1='default';}
   else {work1=shape;}
      if (shape == 'hand' && browser == 'NS')
        {work1='e-resize';}
      document.body.style.cursor=work1;
//      alert("Cursor Change ["+usr_agent+"/"+browser+"]...");
    }

/*
 *  Purpose: Open a "pop-up" window, suitable for general use.
 *	     There is no return value, the window just appears, assigned the
 *	     values provided. Note that once a window is established, many
 *	     of the available attributes are not changeable.
 *
 *  Arguments:	pURL: the URL to load into the new window;
 *		pName: the name of the new window;
 *		pHeight: the height of the new window;
 *		pWidth: the width of the new window;
 *		pTop: the top screen position of the new window;
 *		pLeft: the left screen position of the new window;
 *		pAttrib: the attributes of the new window;
 *
 *  Variables:
 *	None.
 */

  function openPopup(pURL, pName, pHeight, pWidth, pTop, pLeft, pAttrib)
    { var url;
      var name;
      var attrib;
      var newWindow;
      ua=navigator.userAgent;
      isMSIE=(ua != null && ua.indexOf("MSIE") != -1);

      if (pURL == '')
        {url=window.location.href;}
   else {url=pURL;}
      name=pName;
// IE *requires* this...
      if (isMSIE)
        {name='newMail';}
      if (pAttrib == '')
        { attrib='scrollbars=no,toolbar=no,location=no,menubar=no,status=no,resizable=no';
          attrib=attrib+',directories=false,statusbar=false,locationbar=false,ontop=true';
        }
// location=no
// copyhistory=no';
// dependent
   else {attrib=pAttrib;}
      if (pTop != '')
        {attrib='top='+pTop+','+attrib;}
//   else {attrib='top=100,'+attrib;}
      if (pLeft == '')
        {attrib='left='+pLeft+','+attrib;}
//   else {attrib='left=100,'+attrib;}
      if (pHeight == '')
        {attrib='height=500,'+attrib;}
   else {attrib='height='+pHeight+','+attrib;}
      if (pWidth == '')
        {attrib='width=300,'+attrib;}
   else {attrib='width='+pWidth+','+attrib;}

      newWindow=window.open(url, name, attrib);
      if (newWindow.focus) {newWindow.focus();}
    }

/*
 *  Purpose: Return a numeric value formatted as dollars & cents
 *
 *  Arguments:	pricex: the numeric value.
 *
 *  Variables:
 *	None.
 */

  function display_price(pricex)
    { var result, work1;
      result=' '+Math.round(pricex*100)/100;
      work1=result.indexOf(".");
      if (work1 == -1)
        { result=result+'.00'; }
   else { while (work1+3 > result.length)
	    { result=result+'0';
	    }
        }
      return result;
    }

