if (document.images)
{
	// preload nav images for rollover
	logo = new Image();
	logo.src = "/images/logo_off.gif";
	logoover = new Image();
	logoover.src = "/images/logo_on.gif";
	
	products = new Image();
	products.src = "/images/products_off.gif";
	productsover = new Image();
	productsover.src = "/images/products_on.gif";

	press = new Image();
	press.src = "/images/press_off.gif";
	pressover = new Image();
	pressover.src = "/images/press_on.gif";

	orders = new Image();
	orders.src = "/images/orders_off.gif";
	ordersover = new Image();
	ordersover.src = "/images/orders_on.gif";

	/*events = new Image();
	events.src = "/images/events_off.gif";
	eventsover = new Image();
	eventsover.src = "/images/events_on.gif";*/
	
	profiles = new Image();
	profiles.src = "/images/profiles_off.gif";
	profilesover = new Image();
	profilesover.src = "/images/profiles_on.gif";
	
	contacts = new Image();
	contacts.src = "/images/contacts_off.gif";
	contactsover = new Image();
	contactsover.src = "/images/contacts_on.gif";	

	upholstery = new Image();
	upholstery.src = "/images/upholstery_off.gif";
	upholsteryover = new Image();
	upholsteryover.src = "/images/upholstery_on.gif";
		
	lighting = new Image();
	lighting.src = "/images/lighting_off.gif";
	lightingover = new Image();
	lightingover.src = "/images/lighting_on.gif";
	
	artwork = new Image();
	artwork.src = "/images/artwork_off.gif";
	artworkover = new Image();
	artworkover.src = "/images/artwork_on.gif";
	
	accessories = new Image();
	accessories.src = "/images/accessories_off.gif";
	accessoriesover = new Image();
	accessoriesover.src = "/images/accessories_on.gif";
	
	dining = new Image();
	dining.src = "/images/dining_off.gif";
	diningover = new Image();
	diningover.src = "/images/dining_on.gif";
	
	coffeesidetables = new Image();
	coffeesidetables.src = "/images/coffeesidetables_off.gif";
	coffeesidetablesover = new Image();
	coffeesidetablesover.src = "/images/coffeesidetables_on.gif";
	
	homeoffice = new Image();
	homeoffice.src = "/images/homeoffice_off.gif";
	homeofficeover = new Image();
	homeofficeover.src = "/images/homeoffice_on.gif";
	
	bedroom = new Image();
	bedroom.src = "/images/bedroom_off.gif";
	bedroomover = new Image();
	bedroomover.src = "/images/bedroom_on.gif";	  
	
	bookcasescabinets = new Image();
	bookcasescabinets.src = "/images/bookcasescabinets_off.gif";
	bookcasescabinetsover = new Image();
	bookcasescabinetsover.src = "/images/bookcasescabinets_on.gif";	  
	
	benches = new Image();
	benches.src = "/images/benches_off.gif";
	benchesover = new Image();
	benchesover.src = "/images/benches_on.gif";
	
	rugs = new Image();
	rugs.src = "/images/rugs_off.gif";
	rugsover = new Image();
	rugsover.src = "/images/rugs_on.gif";
	
	mobiles = new Image();
	mobiles.src = "/images/mobiles_off.gif";
	mobilesover = new Image();
	mobilesover.src = "/images/mobiles_on.gif"
}

/*
// these versrions of the over() and off() funcitons
// do not use preloaded images.  I wrote them to 
// see if the page load was any faster w/o preloading the images.
// It seems to be about the same, so I'm leaving the original
// functions and the above lines of code that prelaod the images.

function over(name){
	if (document.images) {
		document[name].src = "/images/" + name + "_on.gif";
	}
}

function off(name){
	if (document.images) {
		document[name].src = "/images/" + name + "_off.gif";
	}
}
*/

function over(name){
	if (document.images) {
		document[name].src = eval(name + "over.src");
	}
}

function off(name){
	if (document.images) {
		document[name].src = eval(name + ".src");
	}
}

function getSilhoEmail(who)
{
	var address = who + '@' + 'silhofurniture.com';
	return '<a href="mailto:' + address + '">' + address + '</a>';
}

































//---------------------------------------------------------------------------------
//
// Function: 	popup
//
// Description: This function popups a new window with a specified width
//              and height and brings the focus to the popup window
//
// Parameters:  pagename -  the name of the page to be opened in the popup
//							window
//
//				width - the width of the window to be opened
//
//				height - the height of the window to be opened
//
//				scroll - 'yes' if the window should have scrollbars, 'no' if not
//
//				resizeable - 'yes' if the window should be resizeable, 'no' if not
//
// Programmer:  Happy Tsugawa-Banta
//
// Date: 		2/7/01
//
// Updates:     2/7/01 - added these comments (HT)
//
//--------------------------------------------------------------------------------


function popup(pagename,width,height,scroll,resizable) {
	var popup = window.open(pagename,"popup_window","toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=" + scroll + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",left=0,top=0");

    popup.focus();

}

//---------------------------------------------------------------------------------
//
// Function: 	popupFeature
//
// Description: This function popups a new window with a specified width
//              and height and brings the focus to the popup window
//
// Parameters:  pagename -  the name of the page to be opened in the popup
//							window
//
//				width - the width of the window to be opened
//
//				height - the height of the window to be opened
//
//				scroll - 'yes' if the window should have scrollbars, 'no' if not
//
//				resizeable - 'yes' if the window should be resizeable, 'no' if not
//
// Programmer:  Happy Tsugawa-Banta
//
// Date: 		2/7/01
//
// Updates:     2/7/01 - added these comments (HT)
//
//--------------------------------------------------------------------------------


function popup(pagename) {
	var popup = window.open(pagename,"popup_features","toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=371,height=407,left=0,top=0");

    popup.focus();

}


//---------------------------------------------------------------------------------
//
// Function: 	popupPrint
//
// Description: This function popups a new window with a specified width
//              and height and brings the focus to the popup window and keeps the menu bar
//
// Parameters:  pagename -  the name of the page to be opened in the popup
//							window
//
//				width - the width of the window to be opened
//
//				height - the height of the window to be opened
//
// Programmer:  Happy Tsugawa-Banta
//
// Date: 		9/6/01
//
//
//--------------------------------------------------------------------------------


function popupPrint(pagename,width,height) {
	var popupPrint = window.open(pagename,"popup_print","toolbar=yes,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",left=0,top=0");

    popupPrint.focus();

}


//---------------------------------------------------------------------------------
//
// Function:    over
//
// Description: This function swaps the current image with the "over" state of the
//              graphic
//
// Parameters:  name - the name of the image
//
// Programmer:  Happy Tsugawa-Banta
//
// Date:        2/9/01
//
// Updates:     2/9/01 - added these comments (HT)
//
//--------------------------------------------------------------------------------

function over(name){
	if (document.images) {
		document[name].src = eval(name + "over.src");
	}
}


//---------------------------------------------------------------------------------
//
// Function:    off
//
// Description: This function swaps the current image with the "off" or "original"
//              state of the graphic
//
// Parameters:  name - the name of the image
//
// Programmer:  Happy Tsugawa-Banta
//
// Date:        2/9/01
//
// Updates:     2/9/01 - added these comments (HT)
//
//--------------------------------------------------------------------------------

function off(name){
	if (document.images) {
		document[name].src = eval(name + ".src");
	}
}

//---------------------------------------------------------------------------------
//
// Function:    checkRadio
//
// Description: This validates that at least one Radio button in a group
//              has been selected. If there is a single radio button in the
//              group, and it hasn't been selected, the function selects it.
//
// Parameters:  name - the name of the radio button group
//              message - message to display if no button has been selected
//
// Programmer:  Happy Tsugawa-Banta
//
// Date:        2/9/01
//
// Updates:     6/8/01 - added behavior for single radio button SjG
//
//--------------------------------------------------------------------------------

function checkRadio(name,message){
	var radioChecked = 0;
	for (var j=0; j < name.length; j++){
		if (name[j].checked){
			radioChecked=1;
			return true;
		}
	}
    if (!name.length)
        {
        name.checked=1;
        radioChecked=1;
        }
	if (radioChecked == 1){
		form.submit();
        return true;
	} else {
		alert(message);
		return false;
	}
}

//--------------------------------------------------------------------------
//
// Function:    populateRadio
//
// Description: Iterates through the radio buttons in a group and selects
//              one matching a particular value
//
// Parameters:  buttons - the element representing the buttons
//              value - the value to select
//
// Programmer:  Karl Zilles
//
// Date:        5/16/01
//
// Updates:
//
//--------------------------------------------------------------------------

function populateRadio(buttons, value) {
	for (i=0; i<buttons.length; i++)
		if (buttons[i].value==value)
			buttons[i].checked = true;
}

//--------------------------------------------------------------------------
//
// Function:    countChecked
//
// Description: Iterates through the checkboxes in a group and counts how
//              many have been checked.
//
// Parameters:  element - name of the checkboxes
//
// Programmer:  SjG
//
// Date:        06/07/01
//
// Updates:
//
//--------------------------------------------------------------------------

function countChecked(element)
    {
    count=0;
    for(i=0; i<element.length; i++)
        {
        if (element[i].checked)
            {
            count++;
            }
        }
    return count;
}

//--------------------------------------------------------------------------
//
// Function:    checkAll
//
// Description: Iterates through the check boxes in a group and
//              checks or unchecks them
//
// Parameters:  element - name of the checkboxes
//              val - true for checked, false for unchecked
//
// Programmer:  SjG
//
// Date:        06/07/01
//
// Updates:
//
//--------------------------------------------------------------------------

function checkAll(element, val)
    {
    len = element.length;
    var i=0;
    for( i=0 ; i<len ; i++)
        {
        element[i].checked=val;
        }
    }

//--------------------------------------------------------------------------
//
// Function:    toggleSet
//
// Description: Toggles the state of a single checkbox that controls
//              the state of many checkboxes (i.e., "check here to select
//              all" situations)
//
// Parameters:  primary - name of the controller checkbox
//              children - name of the dependent checkboxes
//
// Programmer:  SjG
//
// Date:        06/07/01
//
// Updates:
//
//--------------------------------------------------------------------------

function toggleSet(primary, children)
    {
    if (primary.checked)
        {
        checkAll(children,true);
        }
    else
        {
        checkAll(children,false);
        }
    }
//--------------------------------------------------------------------------
//
// Function:    populateSelect
//
// Description: Iterates through the select options in a dropdown and selects
//              one matching a particular value
//
// Parameters:  select - the element representing the select
//              value - the value to select
//
// Programmer:  Karl Zilles
//
// Date:        5/16/01
//
// Updates:
//
//--------------------------------------------------------------------------
function populateSelect(select, value) {
	for (i=0; i<select.length; i++)
		if (select.options[i].value==value)
			select.selectedIndex = i;
}



//---------------------------------------------------------------------------------
//
// Function: 	checkDateRange
//
// Description: This function checks to see if any of the start date or end date
//              fields have been selected.  If so, it makes sure all of the fields
//              are selected and makes sure that the start date is earlier than the 
//              end date.
//
// Parameters:  form - the name of the form
//
// Returns:     true if all everything is selected correctly, otherwise false
//
// Programmer:  Happy Tsugawa-Banta
// 
// Date: 		6/06/01
//
//--------------------------------------------------------------------------------

function checkDateRange()
{
	var startmonthvalue = eval(document.form.startmonth.selectedIndex);
	var startyearvalue = eval(document.form.startyear.selectedIndex);
	var endmonthvalue = eval(document.form.endmonth.selectedIndex);
	var endyearvalue = eval(document.form.endyear.selectedIndex);
		
	// Check if any of the start or end fields have been selected
	if ( (( startmonthvalue != "" ) || ( startmonthvalue != -1 )) || (( startyearvalue != "" ) || ( startyearvalue != -1 )) || (( endmonthvalue != "" ) || ( endmonthvalue != -1 )) || (( endyearvalue != "" ) || ( endyearvalue != -1 )) ) 
	{
		// Make sure all date fields have been selected
		if ( (( startmonthvalue == "" ) || ( startmonthvalue == -1 )) || (( startyearvalue == "" ) || ( startyearvalue == -1 )) || (( endmonthvalue == "" ) || ( endmonthvalue == -1 )) || (( endyearvalue == "" ) || ( endyearvalue == -1 )) )
		{
			alert("Please fill out all start and end date fields.");
			return false;
		}
		// Make sure starting dates are before ending dates
		if ( (startyearvalue > endyearvalue) || ( (startyearvalue == endyearvalue) && (startmonthvalue > endmonthvalue) ) )
		{
			alert("Please make sure the starting date is before the ending date.");
			return false;
		}
	}
	return true;
}


//---------------------------------------------------------------------------------
//
// Function: 	deleteCheckUser
//
// Description: This function checks to make sure this is not the only user.  Then
//              it pops up a confirm box to warn that the user is about to delete a user.
//
// Returns:     true if this is not the only user and they choose to go on
//              with the delete, otherwise false
//
// Programmer:  Happy Tsugawa-Banta
// 
// Date: 		6/13/01
//
// Updates:     
//
//--------------------------------------------------------------------------------

function deleteCheckUser()
{
	if (document.form.userid.length == 1)
    { 
        alert("There is only one current user - therefore you cannot delete this user");
        return false;
    }
	
	if (confirm("Are you sure you want to delete this user?"))
	{
		return validate(this.form,fields);
	} else {
		return false;
	}
}



//---------------------------------------------------------------------------------
//
// Function: 	compare
//
// Description: This function checks which item the user selected in the pulldown and
//              goes to the page by using the option value
//
// Programmer:  Happy Tsugawa-Banta
// 
// Date: 		1/31/01
//
// Updates:     
//
//--------------------------------------------------------------------------------

function compare(what) {
   var n = what.selectedIndex;
   filename = what.form.model.options[n].value;
   window.location=filename;
}

























/*write layer styles by browser*/

ns = (document.layers)? true:false
ie = (document.all)? true:false

if (ie) {	
	document.write('<LINK REL="stylesheet" HREF="../css/style_ie.css" TYPE="text/css">');
}