/* ----------------------------------------------------------------------- */
/* name:     utilities.js                                                  */
/* purpose:  javascript utility functions                                  */
/* ----------------------------------------------------------------------- */

function showDetails(thisItem) 
{
	var details = thisItem.options[thisItem.selectedIndex].value;
	var myarray = details.split(",");
	showItem(myarray[0],myarray[1],myarray[2],myarray[3]);
}

function showItem(itemCode, itemName, itemPrice, itemDetail) 
{
	showLayer(itemCode);
  if (document.images) 
  {
    document["product"].src = eval(itemCode + ".src");
  }
	with (document.productDetails) 
	{
		item_number.value = itemCode;
		item_name.value = itemName;
		amount.value = itemPrice;
		detail.value = itemDetail;
	}
}

var oldLayer = "";
function showLayer(thisLayer) 
{
  if (oldLayer == "") 
   {
    toggleDisplay("ProductDisplay");
	} 
	else 
	{
    toggleDisplay(oldLayer + "1");
    toggleDisplay(oldLayer + "2");
    toggleDisplay(oldLayer + "3");

   }
  toggleDisplay(thisLayer + "1");
  toggleDisplay(thisLayer + "2");
  toggleDisplay(thisLayer + "3");

  oldLayer = thisLayer;
}

function toggleDisplay(elementID) 
{
	if (document.getElementById) 
	{
		content = document.getElementById(elementID).style;
		if (content.display == "block") 
		{
			content.display = "none";
		} 
		else 
		{
			content.display = "block";
		}
	}
}



/* ----------------------------------------------------------------------- */
function getPortfolio(selectedObj) 
{
	var URL = selectedObj.options[selectedObj.selectedIndex].value;
	window.location.href = URL;
}
/* ----------------------------------------------------------------------- */
function getOccasion(selectedObj) 
{
	var oCode = selectedObj.options[selectedObj.selectedIndex].value;
	with (document.order_form) 
	{
		occasion.value = oCode;
	}	
}
/* ----------------------------------------------------------------------- */
function popWindow(url, width, height, windowName) 
{
  /* defaults if not passed to function */
  if (!width) { width = 600; }
  if (!height) { height = 450; }
  if (!windowName) { windowName = "SportsPop"; }
  wref = window.open (url, windowName,
        "toolbar=no,location=no,width=" + width + ",height=" + height +
        ",directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
  if (navigator.appName == "Netscape" || navigator.appVersion.substring(0,1) == '5') 
  {
    wref.focus();
  }
}

/* ----------------------------------------------------------------------- */
function slidePrevious() 
{
	if (document.images) 
	{
		slideCurrent -= 1;
		if (slideCurrent < 1) { slideCurrent = slideTotal; }
		document.slideshow.src = eval("slide" + slideCurrent + ".src");
	}
}
function slideNext() 
{
	if (document.images) 
	{
		slideCurrent += 1;
		if (slideCurrent > slideTotal) { slideCurrent = 1; }
		document.slideshow.src = eval("slide" + slideCurrent + ".src");
	}
}
