//

//

// This is the code to launch the Showroom. It is placed here

// in the api.js file so it can be referenced by any page on the site

//

//



var showroom = null



function launchShowroom()

{   if (showroom == null)

    {   launchWindow()

    }

    else if (showroom.closed)

    {   launchWindow()

    }

    else

    {   showroom.focus()

    }

}



function launchWindow()

{   x = (screen.availWidth - 630) / 2

    y = ((screen.availHeight - 380) / 2 ) - 30



    attribs = "width=630,height=380,left=" + x + ",top=" + y + ",scrollbars=no,toolbar=1"

    showroom = window.open("/resshowroomna/showroom.html","showroomWindow",attribs)

    showroom.focus();

}





//

//

// This file contains miscellaneous Dynamic HTML routines

// that takes into account different browsers and platforms

//

//





function getObj(obj)

{   if (dom1)

    {   compLayr = document.getElementById(obj).style

    }

    else if (is.nav4)

    {   compLayr = document.layers[obj]

    }

    else

    {   compLayr = document.all[obj].style

    }

    return compLayr

}



function show(layr)

{   obj = getObj(layr)

    obj.visibility = "visible"

}



function hide(layr)

{   obj = getObj(layr)

    obj.visibility = "hidden"

}



function setZindex(layr,num)

{   obj = getObj(layr)

    obj.zIndex = num

}



function setTop(layr,num)

{   obj = getObj(layr)

    obj.top = num

}



function setLeft(layr,num)

{   obj = getObj(layr)

    obj.left = num

}



function incTop(layr,num)

{   obj = getObj(layr)

    obj.top = getTop(layr) + num

}



function incLeft(layr,num)

{   obj = getObj(layr)

    obj.left = getLeft(layr) + num

}



function getTop(layr)

{   obj = getObj(layr)

    if (dom1)

    {   return (document.getElementById(layr).offsetTop)

    }

    else if (is.nav4)

    {   return (obj.top)

    }

    else

    {   return (obj.posTop)

    }

}



function getLeft(layr)

{   obj = getObj(layr)

    if (dom1)

    {   return (document.getElementById(layr).offsetLeft)

    }

    else if (is.nav4)

    {   return (obj.left)

    }

    else

    {   return (obj.posLeft)

    }

}



function getWidth(layr)

{   if ((dom1) && (!is.opera5up))

    {   return (document.getElementById(layr).offsetWidth)

    }

    else if (is.opera5up)

    {   return (document.getElementById(layr).style.pixelWidth)

    }

    else if (is.nav4)

    {   return eval("document." + layr + ".document.width")

    }

    else

    {   return (document.all[layr].scrollWidth)

    }

}



function getHeight(layr)

{   if ((dom1) && (!is.opera5up))

    {   return (document.getElementById(layr).offsetHeight)

    }

    else if (is.opera5up)

    {   return (document.getElementById(layr).style.pixelHeight)

    }

    else if (is.nav4)

    {   return eval("document." + layr + ".document.height")

    }

    else

    {   return (document.all[layr].scrollHeight)

    }

}



function layerClip(layr,topA,rightA,bottomA,leftA)

{   obj = getObj(layr)

    if (dom1 || (is.ie4 && !is.mac))

    {   obj.clip = "rect(" + topA + " " + rightA + " " + bottomA + " " + leftA + ")"

    }

    else if (is.nav4)

    {   obj.clip.top = topA

        obj.clip.left = leftA

        obj.clip.bottom = bottomA

        obj.clip.right = rightA

    }

    else if (is.ie4 && is.mac)

    {   obj.clip = "rect(0 100% 100% 0)"

    }

}



function browserWidth()

{   if (is.nav)

    {   return (window.innerWidth)

    }

    else

    {   return (document.body.clientWidth)

    }

}



function browserHeight()

{   if (is.nav)

    {   return (window.innerHeight)

    }

    else

    {   return (document.body.clientHeight)

    }

}



var s_linkTrackEvents;

function addLinkTrackEvents(newEvent){

	if(s_linkTrackEvents==null ||s_linkTrackEvents=="")

		s_linkTrackEvents=newEvent;

	else

		s_linkTrackEvents+=","+newEvent;

}



/* globals */

var flashInstalled = false;

var flashMajorVersion = 0;



/* detect if flash is installed and if so what the major version is */

function detectFlash() {
  var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if (plugin)
  {
	flashInstalled = true;
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
	  if (isNaN(parseInt(words[i])))
	  continue;
	  flashMajorVersion = words[i];
	}
  }
  else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1))
  {
          // test for at least version 7
	  var version;
	  var axo;
	  var e;
	  try {
 	    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
	    version = axo.GetVariable("$version");
	  } catch (e) {
	    version = -1;  // user does not have at least version 7
	  }

    	  if (version == -1 ) {
	    flashInstalled = false;
	  } else if (version != 0) {
            // user has at least version 7 - split the version string to determine
 	    var tempArray         = version.split(" ");
	    var tempString        = tempArray[1];
	    var versionArray      = tempString.split(",");
            flashMajorVersion     = versionArray[0];
	    flashInstalled = true;

          }
  }
}













function embedFlash( flashContainerId, pathToFlashFile, swfWidth, swfHeight, requiredVersion, paramString) {

    // THIS WRITES THE CODE TO DISPLAY FLASH FILE OR ALTERNATE



    if ( flashInstalled && flashMajorVersion>=requiredVersion ) {

      var flashText = '';

      flashText = flashText + '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';

      flashText = flashText + '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ';

      flashText = flashText + ' ID="Main" WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '" ALIGN="">';

      flashText = flashText + ' <PARAM NAME=movie VALUE="' + pathToFlashFile + paramString + '"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  <PARAM NAME=wmode VALUE=transparent>';

      flashText = flashText + ' <EMBED src="' + pathToFlashFile + paramString + '" loop=false menu=false quality=high bgcolor=#FFFFFF  ';

      flashText = flashText + ' swLiveConnect=TRUE WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '" WMODE=transparent NAME="Main" ALIGN=""';

      flashText = flashText + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';

      flashText = flashText + ' </EMBED>';

      flashText = flashText + ' </OBJECT>';

      document.getElementById(flashContainerId).innerHTML = flashText;

    }



}



function clearSearch(thefield){
	thefield.value = ""
}