function phantomtext(targetElem, textStr){
	
	elem = document.getElementById( targetElem );
	if(elem.value==textStr)
		elem.value='';
	else if(elem.value=='')
		elem.value=textStr;
	else
		elem.value=elem.value;
}

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'';
}

function hideLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'none':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'none';
}

function showLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'':'';
  vis.display = (vis.display==''||vis.display=='block')?'':'';
}
	
	
function loadContent(id, url) {
	  var req = false;
	  // For Safari, Firefox, and other non-MS browsers
	  if (window.XMLHttpRequest) {
		try {
		  req = new XMLHttpRequest();
		} catch (e) {
		  req = false;
		}
	  } else if (window.ActiveXObject) {
		// For Internet Explorer on Windows
		try {
		  req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (e) {
			req = false;
		  }
		}
	  }
	 var element = document.getElementById(id);
	 if (!element) {
	  alert("Bad id " + id + 
	   " passed to clientSideInclude." +
	   "You need a div or span element " +
	   "with this id in your page.");
	  return;
	 } 
		
	  if (req) {
		// Synchronous request, wait till we have it all
		req.open('GET', url, false);
		req.send(null);
		element.innerHTML = req.responseText;
	  } else {
		element.innerHTML =
	   "Sorry, your browser does not support " +
		  "XMLHTTPRequest objects. This page requires " +
		  "Internet Explorer 5 or better for Windows, " +
		  "or Firefox for any system, or Safari. Other " +
		  "compatible browsers may also exist.";
	  }
}

function getContent(url) {
	  var req = false;
	  // For Safari, Firefox, and other non-MS browsers
	  if (window.XMLHttpRequest) {
		try {
		  req = new XMLHttpRequest();
		} catch (e) {
		  req = false;
		}
	  } else if (window.ActiveXObject) {
		// For Internet Explorer on Windows
		try {
		  req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (e) {
			req = false;
		  }
		}
	  }
	  
	  if (req) {
		// Synchronous request, wait till we have it all
		req.open('GET', url, false);
		req.send(null);
		return(req.responseText);
	  } else {
		return(
	   "Sorry, your browser does not support " +
		  "XMLHTTPRequest objects. This page requires " +
		  "Internet Explorer 5 or better for Windows, " +
		  "or Firefox for any system, or Safari. Other " +
		  "compatible browsers may also exist.");
	  }
}

function swapOptionImg(optionString)
	{
		var optionArray = optionString.split("|");
		document.images.swapimg.src="/images_product/normal/" + optionArray[5];
		document.getElementById("swapimglink").href="/images_product/normal/" + optionArray[5];
	}
	
function swapAddonImg(image, id)
	{
		document.getElementById("addon" + id).src="/images_product/small/" + image;
		document.getElementById("addonlink" + id).href="/images_product/large/" + image;
	}
	
function swapMainImg(url)
	{
		document.images.swapimg.src='/images_product/normal/' + url;
		document.getElementById("swapimglink").href='/images_product/large/' + url;
	}
	
function swapMediaImg(url)
	{
		document.images.swapimg.src='/images_media/normal/' + url;
		document.getElementById("swapimglink").href='/images_media/large/' + url;
	}

function SwapImg(idx, img) 
	{
	   document.images[idx].src = img;
	}
function deptnav(dept) 
	{
	}

function setfocus(element) 
	{
	}
function OpenInvStatus()
	{
	thewindow = window.open('/help_invstatus.lasso', 'invstatus', config='height=400,width=300,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}
	
function OpenSizeInfo()
	{
	thewindow = window.open('/help_sizes.lasso', 'sizes', config='height=400,width=300,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}
	
function OpenHandlingInfo()
	{
	thewindow = window.open('/help_handling.lasso', 'cartinfo', config='height=300,width=300,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}
	
function OpenShippingInfo()
	{
	thewindow = window.open('/help_shipping.lasso', 'cartinfo', config='height=200,width=300,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}

function OpenCardCode()
	{
	thewindow = window.open('/help_cardcode.lasso', 'cartinfo', config='height=200,width=300,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}

function goToPage( id ) {
  var node = document.getElementById( id );
  // Check to see if valid node and if node is a SELECT form control
  
  if( node && node.tagName == "SELECT" ) {

    // Go to web page defined by the VALUE attribute of the OPTION element
    window.location.href = node.options[node.selectedIndex].value;
    
  } // endif  
}

function RKModalElement(element){
	
	$(element).modal();
}

function RKModalURL(url){
	content=getContent(url);
	$.modal(content);
}
