/**
$Id: pint_commonDEBUG.js,v 1.15 2003/07/03 17:25:16 cducker Exp $

Description:
	PINT Commonly used JavaScript functions and constants.

Dependencies:
	Inward:
		pint_initcleanup.js
	
	Outward:
		none	
	
Usage:
	n/a		
*/

/* ******** Constants *********************************** */
var rootDirectory = "";
rootDirectory = rootDirectory.concat("http://" ,window.location.hostname);
//rootDirectory = "http://stage.viewsonic.com";
//rootDirectory = "http://www.viewsonic.com";
//rootDirectory = "/clients/viewsonic/site"; 
windowStatus = "";
/* ******** Common Window Settings ********************** */
defaultStatus = "";

/**
 * PINT_GetEventSource()
 * Takes as an argument the first argument to an event handler, and 
 * returns a reference to the object that generated the event
 *
 * @param e - first argument to an event handler
 *
 * @return reference to object that triggered event
 */
function PINT_GetEventSource(e)
{
	return ( //figure out where in the dom events come in on this browser
		(e && e.target) || 
		(window && window.event && window.event.srcElement)
	);	
}

/**
 * PINT_GetElementById()
 * Tries to find an element in the document 
 * by its id or name
 *
 * @param idname - id of element to locate
 */
function PINT_GetElementById(idname)
{
	var handle;

	if (document.getElementById) {
		handle = document.getElementById(idname);
		if (handle) return handle;
	}

	if (document.getElementByName) {
		handle = document.getElementByName(idname)[0];
		if (handle) return handle;
	}

	handle = document[idname];
	if (handle) return handle;

	if (document.all) {
		handle = document.all[idname];
		if (handle) return handle;
	}
	
	if (document.anchors) {
		handle = document.anchors[idname];
		if (handle) return handle;
	}
	
	if (document.links) {
		handle = document.links[idname];
		if (handle) return handle;
	}
	
	if (document.images) {
		handle = document.images[idname];
		if (handle) return handle;
	}
	
	if (document.embeds) {
		handle = document.embeds[idname];
		if (handle) return handle;
	}

	return handle;
}

/**
 * PINT_GetIdByElement()
 * Inverse of PINT_GetElementById, returns the id, 
 * or name, of a given element
 *
 * @param element - object whose id to retrieve
 */
function PINT_GetIdByElement(element)
	{
	if (!(element)) return undefined;
	if (element.id) return element.id;
	if (element.name) return element.name;
	return undefined;
	}

/**
 * PINT_ChangePageTitle()
 * Change title of current page. Use when initial title
 * tag value is optimized for Search Engines, but you 
 * want the title to be more descriptive for the visitor.
 *
 * @param   pageTitle  - new page title
 */	
function PINT_ChangePageTitle( pageTitle )
	{
	if(document.title.readOnly == true) document.title = pageTitle;
	} 	
	
/**
 * PINT_GetCurrentFileName()
 * Get name of current file from path name
 */
function PINT_GetCurrentFileName()
	{
	var URL = unescape( window.location.pathname );
	var start = URL.lastIndexOf( "/" ) + 1;
	var end = ( URL.indexOf( "?" ) > 0 ) ? URL.indexOf( "?" ) : URL.length;
	return( URL.substring( start, end ) );
	}	
/**
 * PINT_GetCurrentFilePath()
 * Get path to current file from path name
 */
function PINT_GetCurrentFilePath()
	{
	var URL = unescape( window.location.pathname );
	var start = URL.lastIndexOf( "/" );
	return( URL.substring( 0, start ) );
	}

/**
 * PINT_GetCurrentDirectory()
 * Get name of current directory from path name
 */			
function PINT_GetCurrentDirectory()
	{
	var filePath = PINT_GetCurrentFilePath();
	var directories = filePath.split("/");
	return directories.length && directories[ directories.length-1 ] != "" ? directories[ directories.length-1 ] : "";
	}
	
/**
 * PINT_ParentFilePath()
 * Get name of parent directory from current path name
 */		
function PINT_ParentFilePath(currentPath)
	{
	var URL = unescape( currentPath );
	var start = URL.lastIndexOf( "/" );
	return( URL.substring( 0, start ) );
	}

/**
 * PINT_GetBaseDirectory()
 * Get name of current directory from path name
 */			
function PINT_GetBaseDirectory()
	{
	var filePath = PINT_GetCurrentFilePath();
	// if rootDirectory starts with a slash, then chop off root directory from the filePath
	if(rootDirectory.substring(0,1) == "/")	filePath = filePath.substring( rootDirectory.length );
	var directories = filePath.split("/");
	return directories.length && directories[ 1 ] != "" ? directories[ 1 ] : "";
	}
	
/**
 * PINT_IsRootDirectory()
 * Determine if specified directory matches root directory
 *
 * @param directory - directory to check
 */
function PINT_IsRootDirectory( directory )
	{
	return directory == rootDirectory ? true : false;
	}
	
function PINT_GetRootDirectory()
	{
	if(typeof(rootDirectory)=='undefined') return "";
	else return rootDirectory;
	}

/**
 * PINT_FirstFocus()
 * Set cursor focus to first available form field
 * 
 * @param field - optional: reference to form input, otherwise defaults to the first element of the first form on the page
 */				
function PINT_FirstFocus()	
	{
	var elementref;
	var i=0;
	if (!(elementref = PINT_FirstFocus.arguments[0]))
		{
		if (!(document.forms[0])) return false;
		while ((elementref = document.forms[0].elements[i++]) && (elementref.type == 'hidden')) {};
		}
	if (!(elementref)) return false;
	elementref.focus();
	return true;
	}

/**
 * PINT_OnMouseOverHandler()
 * Handler for all onmouseover events. Must be explicitly set as 
 * the function handler.
 * 
 * @param e		event
 * @return		True.
 *
 */
function PINT_OnMouseOverHandler(e) 
	{
	e = (e) ? e : ((window.event) ? window.event : "")
	if (e) 
		{
		var eventsource = PINT_GetEventSource(e);

		/*
		if( eval( 'typeof(VS_ROtriggers)' ) != 'undefined' &&  
		    eval( 'typeof(VS_ROtriggers[eventsource.id])' ) != 'undefined' )
			VS_RORollover(e);
		*/	
		
		if( eval( 'typeof(PINT_MenuTriggers)' ) != 'undefined' && 
		    eval( 'typeof(PINT_MenuTriggers[eventsource.id])' ) != 'undefined' )
			PINT_MenuPopUp(e);

		if( eval( 'typeof(PINT_ROtriggers)' ) != 'undefined' &&  
		    eval( 'typeof(PINT_ROtriggers[eventsource.name])' ) != 'undefined' )
			PINT_RORollover(e);
			
		PINT_SetWindowStatus();	
		}
	return true;	
	}
	
/**
 * PINT_OnMouseOutHandler()
 * Handler for all onmouseout events. Must be explicitly set as 
 * the function handler.
 * 
 * @param e		event
 * @return		True.
 *
 */	
function PINT_OnMouseOutHandler(e) 
	{
	e = (e) ? e : ((window.event) ? window.event : "")
	if (e) 
		{
		var eventsource = PINT_GetEventSource(e);
		
		if( eval( 'typeof(PINT_MenuTriggers)' ) != 'undefined' && 
		    eval( 'typeof(PINT_MenuTriggers[eventsource.id])' ) != 'undefined' )
			PINT_MenuPopDown(e);

		if( eval( 'typeof(PINT_ROtriggers)' ) != 'undefined' &&  
		    eval( 'typeof(PINT_ROtriggers[eventsource.name])' ) != 'undefined' )
			PINT_RORollout(e);
	
		/*
		if( eval( 'typeof(VS_ROtriggers)' ) != 'undefined' &&  
	    	eval( 'typeof(VS_ROtriggers[eventsource.id])' ) != 'undefined' )
			VS_RORollout(e);
		*/	
		}
	return true;
	}

/**
 * PINT_SetWindowStatus()
 * Set status bar message from parameter or global variable.
 * 
 * @param e		event
 * @return		True.
 *
 */	
function PINT_SetWindowStatus()
	{
	// if no arguments are passed, look for global windowStatus varible
	if( PINT_SetWindowStatus.arguments.length == 0 )
		{
		if( typeof(windowStatus) != 'undefined' && windowStatus != "" )
			{
			window.status = windowStatus;
			windowStatus = "";
			}
		}	
	else
		window.status = PINT_SetWindowStatus.arguments[0];
	return true;
	}	
	
/* simple redirect for drop downs */
function redirect(urlobject) 
	{
	var urlint = urlobject.selectedIndex;
	var numurls = urlobject.length;
	if( typeof( urlobject.options[urlint].value ) == 'string' && urlobject.options[urlint].value != "" )
		location = urlobject.options[urlint].value;
	}	
	
// old school popup for projector calculator //

function pop_up(location,width,height) {	
 window.open( location , 'pop_up_window' , eval("'status=no,location=no,menubar=no,toolbar=no,resizable=no,scrollbars=no," + "width=" + width + ",height=" + height + "'"));
}

// 10.31.03 - C. Ducker: added retail store finder functions
function PINT_PopUpFindARetailStore( product )
	{
	var launcherLinkTarget = rootDirectory + "/products/popup_findaretailstore.cfm?product=" + product;
	launcherLinkTarget = launcherLinkTarget.replace( /\+/, "%2b" );
	PINTPW_Pop( launcherLinkTarget, 'findARetailStore', PINTPW_NOCHROME, 350, 175, PINTPW_WINDOWCENTER, 'scrollbars=yes,status=yes' );
	}


// ***************************************
// 			FUNCTIONS FOR GLOSSARY
// ***************************************
	

/**
 * PINT_getElementsByClass(name)
 * Gets all element that belong to a specific class
 * 
 * @param name	string containing name of class
 * @return		array of objects
 *
 */	
function PINT_getElementsByClass(name) 
	{
	var all = document.all ? document.all : document.getElementsByTagName('*');
	var elements = new Array();
	for (var e = 0; e < all.length; e++)
		{
		if((name != '') && (all[e].className.indexOf(name) >= 0)) elements[elements.length] = all[e];
		}
	return elements;
	}
	
	
/**
 * PINT_GLOSSARY_init()
 * Initializes the page to handle mousing over words in the glossary 
 * 
 */		
var PINT_GLOSSARY_popupElement; // global reference to definition popup
function PINT_GLOSSARY_init()
	{
	// make sure only DOM browsers execute anything
	if(document.getElementById)
		{
		window.status = PINT_GLOSSARY_loadingStatusMessage;
		// get all elements that have the class for glossary display
		PINT_GLOSSARY_popupElement = document.getElementById(PINT_GLOSSARY_popupElementId);
		var elements = PINT_getElementsByClass(PINT_GLOSSARY_glossaryClass);
		PINT_GLOSSARY_rewriteHtml(elements);
		// set up event handler for mouse move
		document.onmousemove = PINT_GLOSSARY_updatePopupCoordinates;
		window.status = '';
		}
	}


/**
 * PINT_GLOSSARY_rewriteHtml(elements)
 * Loops over an array of elements that should be rewritten to contain code 
 * to do the definition popup
 * 
 * @param elements	array of document elements
 * @return		array of objects
 *
 */	
function PINT_GLOSSARY_rewriteHtml(elements)
	{
	var html, id;
	for(var i=0; i<elements.length; i++)
		{
		html = elements[i].innerHTML;
		id = elements[i].id;
		// replace each glossary word with html to display the definition popup
		for(var word in PINT_GLOSSARY_list) html = PINT_GLOSSARY_replaceWord(html, word);
		// rewrite the innerHTML of the element to the new html
		document.getElementById(id).innerHTML = html;
		}
	}

	
/**
 * PINT_GLOSSARY_replaceWord(html, word)
 * wraps occurances of a specific word with html/javascript for displaying the 
 * definition popup for that word. Only replaces words outside of html tags
 * 
 * @param html	string containing html to search on
 * @param word	string containing word to search for
 * @return		string containing rewritten html
 *
 */	
var PINT_GLOSSARY_matchCount = 0; // global var used for assigning unique ids to new tags
function PINT_GLOSSARY_replaceWord(html, word)
	{
	var startTag;
	var token = "%=TOKEN=%";
	var tagIndicator = "!=TAG=!";
	var caseFlag;
	
	var tagRegex   = new RegExp("(<[^>]+>)", "igm");
	
	// decide if match should be case sensitive
	if(PINT_GLOSSARY_caseSensitive) caseFlag = "";
	else caseFlag = "i";
	
	// decide if match should get whole word or not
	if(PINT_GLOSSARY_wholeWord) boundaryString = "(\\b)";
	else boundaryString = "(.?)";
	
	var matchRegex = new RegExp(boundaryString + "(" + word + ")" + boundaryString, caseFlag + "gm");

	// add a split string around all tags so they look like this %=XX=%!=TAG=!<hr>%=XX=%
	html = html.replace(tagRegex, token + tagIndicator + "$1" + token);
	
	// split the html on the token that surrounds tags so that they can be skipped when replacing key words
	var textArray = html.split(token);
	
	// for each piece of the content, do the search
	for(var i=0; i<textArray.length; i++)
		{
		// if this element starts with the tag indicator, just remove the indicator
		if(textArray[i].indexOf(tagIndicator) == 0)
			{
			textArray[i] = textArray[i].replace(tagIndicator, "");
			}
		// otherwise, replace the word we are searching for with the html to display the popup
		else
			{
			startTag = "<span class=\"" + PINT_GLOSSARY_definitionClass + "\" onmouseover=\"PINT_GLOSSARY_displayDefinition('" + word + "');\" onmouseout=\"PINT_GLOSSARY_hideDefinition();\" id=\"definition" + ++PINT_GLOSSARY_matchCount + "\">";
			textArray[i] = textArray[i].replace(matchRegex, "$1" + startTag + "$2</span>$3");
			}
		}
	// join the array and return it
	return textArray.join("");
	}
	
	
/**
 * PINT_GLOSSARY_displayDefinition(word)
 * writes definition of given word to the definition popup element, then makes it visible
 * 
 * @param word	string containing word to display definition for
 *
 */	
var PINT_GLOSSARY_showPopup = false;
function PINT_GLOSSARY_displayDefinition(word)
	{
	// make it ok to move and show the popup
	PINT_GLOSSARY_showPopup = true; 
	// force a move on the popup before it is made visible
	PINT_GLOSSARY_updatePopupCoordinates(document.onmousemove); 
	// change the popup's content
	PINT_GLOSSARY_popupElement.innerHTML = PINT_GLOSSARY_list[word];
	// delay a little bit before showing the popup in case the cursor raced over the word
	setTimeout("PINT_GLOSSARY_displayDefinitionNow()", 50);
	}
	
function PINT_GLOSSARY_displayDefinitionNow()
	{
	if(PINT_GLOSSARY_showPopup == true) PINT_GLOSSARY_popupElement.style.visibility = "visible";
	}

/**
 * PINT_GLOSSARY_hideDefinition()
 * hides definition popup element
 * 
 */	
function PINT_GLOSSARY_hideDefinition()
	{
	//setTimeout("PINT_GLOSSARY_hideDefinitionNow()", 1000);
	PINT_GLOSSARY_hideDefinitionNow();
	}

	
/**
 * PINT_GLOSSARY_hideDefinitionNow()
 * hides definition popup element immediately
 * 
 */	
function PINT_GLOSSARY_hideDefinitionNow()
	{
	PINT_GLOSSARY_popupElement.style.visibility = "hidden";
	PINT_GLOSSARY_showPopup = false; // make it not ok to show and move the popup
	}
	
	
/**
 * PINT_GLOSSARY_updatePopupCoordinates(e)
 * moves the determines the mouse coordinates and changes the popup's coordinates accordingly
 * 
 * @param e	event
 *
 */	
function PINT_GLOSSARY_updatePopupCoordinates(e)
	{
	// only update coordinates if the definition popup is visible
	if(PINT_GLOSSARY_showPopup == true)
		{
		// get the mouse coordinates and change the popups coordinates with the appropriate offsets
		var x = (document.all) ? event.x + document.body.scrollLeft + document.documentElement.scrollLeft : e.pageX;
		PINT_GLOSSARY_popupElement.style.left = x + PINT_GLOSSARY_popupOffsetX + "px";
		var y = (document.all) ? event.y + document.body.scrollTop + document.documentElement.scrollTop : e.pageY;
		PINT_GLOSSARY_popupElement.style.top = y + PINT_GLOSSARY_popupOffsetY + "px";
		}
	}
	

/*
$Id: pint_popupwindowDEBUG.js,v 1.4 2003/04/09 01:55:48 cory Exp $

Creator: J. Brock

Description:
	Pop up a new window

Dependancies:
	none

Usage:
	TODO:
*/

/*************************************** global variables *****************************/

var PINTPW_capablePopupWin = true; // assume popup window capable
var PINTPW_popAnchors;
PINTPW_capablePopupWin = ((PINTPW_popAnchors = new Array()) ? true : false );

var PINTPW_featureBasic = 'alwaysLowered=no,alwaysRaised=no,dependent=yes,directories=no,hotkeys=no,'; // features that all popup windows will have
var PINTPW_featureNoChrome = 'location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,'; // features that no chrome popup windows will have

//enumerated constant types for poptype
var PINTPW_FULLCHROME = 5;
var PINTPW_NOCHROME = 6;

//enumerated constant types for positioning
var PINTPW_SCREENCENTER = 10;
var PINTPW_WINDOWCENTER = 11;
var PINTPW_FREE = 12;

/************************************* public methods ****************************/


function PINTPW_InitPopupWinFullChrome(anchorid, newurl, windowname, featurestring)
{
	PINTPW_InitPopupWin(anchorid, newurl, windowname, FULLCHROME, featurestring);
}


/*********************************************************
function PINTPW_InitPopupWin
Initializes an anchor to popup a new browser window onclick. 
To make popup windows re-use themselves, give them all the same name.
Arguments:
	1. name/id of an anchor element
	2. url to open in new browser window
	3. name of new browser window, or '' (null string)
	4. extra feature string as passed to window.open, or '' (null string)
Returns: false, to cancel the anchor href
*/
function PINTPW_InitPopupWin(anchorid, newurl, windowname, poptype, popWidth, popHeight, positioning, featurestring)
{
	if (!(PINTPW_capablePopupWin)) return false;
	if (!(window)) return false;	

	if (PINTPW_popAnchors[anchorid]) return false; // already a popup window attatched to this anchor

	PINTPW_popAnchors[anchorid] = new Array();
	PINTPW_popAnchors[anchorid]['newurl'] = newurl;
	PINTPW_popAnchors[anchorid]['windowname'] = windowname;
	PINTPW_popAnchors[anchorid]['poptype'] = poptype;
	PINTPW_popAnchors[anchorid]['popWidth'] = popWidth;
	PINTPW_popAnchors[anchorid]['popHeight'] = popHeight;
	PINTPW_popAnchors[anchorid]['positioning'] = positioning;
	PINTPW_popAnchors[anchorid]['featurestring'] = featurestring;

	alert( anchorid );
	document.anchors[anchorid].onclick = PINTPW_Pop;
	//document.forms['formname'][anchorid].onclick = PINTPW_PopH;
	return false;
}


/*************************************************************
PINTPW_InitPopupWinNoChrome
Initializes an anchor element that, onclick, pops up a no-chrome window to specification. 
To make popup windows re-use themselves, give them all the same name.
Arguments:
	1. name/id of an anchor element
	2. url to open in window
	3. name of new browser window, or '' (null string)
	4. horizontal size of new window in pixels
	5. vertical size of new window in pixels
	6. constant indicating the positioning of the new window. Possible values:
		PINTPW_SCREENCENTER	centered in screen
		PINTPW_WINDOWCENTER	centered in parent browser window
		PINTPW_FREE		pops up wherever the client feels like it
Returns: always false
*/
function PINTPW_InitPopupWinNoChrome(anchorid, newurl, windowname, popWidth, popHeight, positioning)
{
	if (!(PINTPW_capablePopupWin)) return false;
	if (!(window)) return false;	

	return PINTPW_InitPopupWin(anchorid, newurl, windowname, PINTPW_NOCHROME, popWidth, popHeight, positioning, '');
}

function PINTPW_Pop(newurl, windowname, poptype, popWidth, popHeight, positioning, featurestring)
	{
	var winLeft, winTop, winWidth, winHeight;
	var newXlocation, newYlocation;
	var allfeature = PINTPW_featureBasic;

	if (popWidth && popHeight)
		{
		allfeature += 
		'innerWidth=' + popWidth + ',' +
		'innerHeight=' + popHeight + ',' +
		'width=' + popWidth + ',' +
		'height=' + popHeight + ',';

		if( positioning == PINTPW_SCREENCENTER )
			{
			if (screen)
				{
				winWidth = screen.availWidth;// only in netscape?
				winHeight = screen.availHeight;
				winLeft = 0;
				winTop = 0;

				if (winWidth)
					{
					newXlocation = Math.floor(((winWidth - popWidth) / 2) + winLeft);
					newYlocation = Math.floor(((winHeight - popHeight) / 2) + winTop);
					allfeature += 'left=' + newXlocation + ','; // for ie
					allfeature += 'top=' + newYlocation + ',';
					allfeature += 'screenx=' + newXlocation + ','; //for netscape
					allfeature += 'screeny=' + newYlocation + ',';
					}					
				}
			}
		else if( positioning ==	PINTPW_WINDOWCENTER )
			{
			if (window.innerWidth)// only netscape can do window centering
				{
				winLeft = (window.screenLeft || window.screenX);
				winTop = (window.screenTop || window.screenY);
				winWidth = (window.innerWidth || window.width ); 
				winHeight = (window.innerHeight || window.height);
				}
			else // so do screen centering instead
				{
				winWidth = screen.availWidth;
				winHeight = screen.availHeight;
				winLeft = 0;
				winTop = 0;
				}

			if (winWidth)
				{
				newXlocation = Math.floor(((winWidth - popWidth) / 2) + winLeft);
				newYlocation = Math.floor(((winHeight - popHeight) / 2) + winTop);
				allfeature += 'left=' + newXlocation + ','; // for ie
				allfeature += 'top=' + newYlocation + ',';
				allfeature += 'screenx=' + newXlocation + ','; //for netscape
				allfeature += 'screeny=' + newYlocation + ',';
				}					
			}
		}
	if (poptype == PINTPW_NOCHROME)
		{
		allfeature += PINTPW_featureNoChrome;
		}
	allfeature += featurestring;
	return window.open(newurl, windowname, allfeature);
	}


/********************************** private methods ****************************/



function PINTPW_PopH(e)
{
	if (!(PINTPW_capablePopupWin)) return false;

	var eventSource;
	if (!(eventSource = PINT_GetEventSource(e))) return false;
//	alert(eventSource.name);
	var anchorname;
	if (!(anchorname = eventSource.name)) return false;

	return (PINTPW_popAnchors[anchorname] ?
		PINTPW_Pop(
			PINTPW_popAnchors[anchorname]['newurl'], 
			PINTPW_popAnchors[anchorname]['windowname'], 
			PINTPW_popAnchors[anchorname]['poptype'], 
			PINTPW_popAnchors[anchorname]['popWidth'], 
			PINTPW_popAnchors[anchorname]['popHeight'], 
			PINTPW_popAnchors[anchorname]['positioning'], 
			PINTPW_popAnchors[anchorname]['featurestring']
		) : false );


/*	if (PINTPW_popAnchors[anchorname])
	{
		alert(PINTPW_popAnchors[anchorname]['featurestring']);
		window.open(PINTPW_popAnchors[anchorname]['newurl'], PINTPW_popAnchors[anchorname]['windowname'], PINTPW_popAnchors[anchorname]['featurestring']);
	}

	return false;*/
}

PINT_FeaturedSitePopUpCapableFlag = true;

function PINT_PopUpProductImage( launcherLinkTarget )
	{
	var width  = 400;
	var height = 370;
	PINTPW_Pop( launcherLinkTarget, 'postmessagewindow', PINTPW_NOCHROME, width, height, PINTPW_WINDOWCENTER, 'scrollbars=no,status=no' );
	return false;
	}
	
	
function PINT_PopUpNewsLetter( launcherLinkTarget )
	{
	var width  = 500;
	var height = 450;
	PINTPW_Pop( launcherLinkTarget, 'newsLetter', PINTPW_NOCHROME, width, height, PINTPW_WINDOWCENTER, 'scrollbars=no,status=no' );
	return false;
	}
	
function PINT_PopUpFindLocally( productId )
	{
	var launcherLinkTarget = rootDirectory + "/products/popup_findlocally.cfm?key=" + productId;
	PINTPW_Pop( launcherLinkTarget, 'findLocally', PINTPW_NOCHROME, 350, 220, PINTPW_WINDOWCENTER, 'scrollbars=yes,status=yes' );
	}	

function PINT_PopUpBuyOnline( skuNumber )
	{
	var launcherLinkTarget = rootDirectory + "/products/popup_buyonline.cfm?key=" + skuNumber;
	PINTPW_Pop( launcherLinkTarget, 'buyonline', PINTPW_NOCHROME, 350, 220, PINTPW_WINDOWCENTER, 'scrollbars=yes,status=yes' );
	}

function PINT_ConfirmReservationDelete( reserveID )
	{
		if (confirm("Are you sure you want to delete this reservation?"))
		{
			// cducker: intentionally removed rootDirectory variable because it wouldn't work on stage
			window.location = "reserve_delete.cfm?key=" + reserveID;
		}
	}	
	
// BEGIN: PINT 	 DETECTION AND DISPLAY =====================================================================
PINT_FlashObject = function(swf, id, w, h, defaultImage, ver, imageMap, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.imageMap = imageMap;
	this.version = ver || 6; // default to 6
	this.align = "middle"; //default middle
	this.codebase = this.version +",0,0,0"; // fix cab download
	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.defaultImage = defaultImage;
	this.altTxt = "Please <a href='http://www.macromedia.com/go/getflashplayer'>upgrade your Flash Player</a>.";
	this.bypassTxt = "";
	this.params = new Object();
	this.variables = new Object();
	if (c) this.color = this.addParam('bgcolor', c);
	this.addParam('quality', 'high'); // default to high
	this.doDetect = getQueryParamValue('detectflash');
}

PINT_FlashObject.prototype.addParam = function(name, value) {
	this.params[name] = value;
}

PINT_FlashObject.prototype.getParams = function() {
    return this.params;
}

PINT_FlashObject.prototype.getParam = function(name) {
    return this.params[name];
}

PINT_FlashObject.prototype.addVariable = function(name, value) {
	this.variables[name] = value;
}
//Kun added for banner position control
PINT_FlashObject.prototype.setAlign = function(value) {
	this.align = value;
}

PINT_FlashObject.prototype.getVariable = function(name) {
    return this.variables[name];
}

PINT_FlashObject.prototype.getVariables = function() {
    return this.variables;
}

PINT_FlashObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
}

PINT_FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ this.codebase +'" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
        if (this.getParamTags() != null) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    else { // Everyone else
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs() != null) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    }
    return flashHTML;	
}


PINT_FlashObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
        variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
        return variablePairs.join("&");
    }
    else {
        return null;
    }
}

PINT_FlashObject.prototype.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') 
		{
		if (elementId) 
			{
			document.getElementById(elementId).innerHTML = this.getHTML();
			}
		else 
			{
			document.write(this.getHTML());
			}
		} 
	else 
		{
		if (this.redirect != "") 
			{
			document.location.replace(this.redirect);
			}
		else if (this.defaultImage != "")
			{
			imageString = "<img src=\"" + this.defaultImage + "\" width=\"" + this.width + "\" height=\"" + this.height + "\" border=\"0\" alt=\"\" align=\""+ this.align +"\"";
			if (eval('typeof(this.imageMap)') != "undefined" && this.imageMap != "")
				imageString += " usemap=\"#" + this.imageMap + "\" ";
			imageString += " class=\"inlineimage\" />";

			document.write (imageString);
			}
		else
			document.write(this.altTxt +""+ this.bypassTxt);
	}		
}

function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.plugins.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x){
			if (x.description) {
				var y = x.description;
	   			flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}

function detectFlash(ver) {	
	if (getFlashVersion() >= ver) {
		return true;
	} else {
		return false;
	}
}

// get value of querystring param
function getQueryParamValue(param) {
	var q = document.location.search;
	var detectIndex = q.indexOf(param);
	if(q.length > 1 && detectIndex != -1) {
		return q.substring(q.indexOf("=", detectIndex)+1, q.indexOf("&", detectIndex));
	} else {
		return true;
	}
}
// END: PINT FLASH DETECTION AND DISPLAY =======================================================================

/**************************************************************************************************
  Begin Manticore Technology Code
  Copyright 2000-2004, Manticore Technology Corporation.  All rights reserved.  Patent pending. 
  Consumer Privacy Statement available at www.ManticoreTechnology.com/ConsumerPrivacy.asp
  www.ManticoreTechnology.com
****************************************************************************************************/

var MTCli;var MTCx151s="031104";var MTCx150s="stats.manticoretechnology.com";var MTCx100b=false;var sTMTag="";var MTCip="";var MTCpc="";var MTCaf="";var MTCo_pce="30";var MTCo_pcsl=0;var MTCci;var MTCpn;var MTCpt;var MTCrp;var MTCbv;var MTCsr;var MTCcd;var MTCje;var MTCbt;var MTCtz;var MTCon="";var MTCii="";var MTCea="";var MTCcp="";var MTCepci="";var MTCvd="";function mtc4300s(){var MTCx402d=new Date();var MTCx401s="";MTCx401s=((location.protocol=='http:')?'http:':'https:') + "//" + MTCx150s + "/LogVisit.asp?" + TMIdentity;MTCx401s+=mtc4400s("ra", MTCx402d.getTime());MTCx401s+=mtc4400s("pn", MTCpn);MTCx401s+=mtc4400s("rp", MTCrp);MTCx401s+=mtc4400s("sr", MTCsr);MTCx401s+=mtc4400s("cd", MTCcd);MTCx401s+=mtc4400s("tz", MTCtz);MTCx401s+=mtc4400s("ci", MTCci);MTCx401s+=mtc4400s("je", MTCje);MTCx401s+=mtc4400s("cc", sTMContentCategory);MTCx401s+=mtc4400s("sg", sTMServerGroup);MTCx401s+=mtc4400s("ip", MTCip);MTCx401s+=mtc4400s("pc", MTCpc);MTCx401s+=mtc4400s("pt", MTCpt);MTCx401s+=mtc4400s("af", MTCaf);MTCx401s+=mtc4400s("on", MTCon);MTCx401s+=mtc4400s("ii", MTCii);MTCx401s+=mtc4400s("ea", MTCea);MTCx401s+=mtc4400s("cp", MTCcp);MTCx401s+=mtc4400s("epci", MTCepci);MTCx401s+=mtc4400s("vd", MTCvd);MTCx401s+=mtc4400s("o_pce", MTCo_pce);MTCx401s+=mtc4400s("o_pcsl", MTCo_pcsl);return MTCx401s;}function mtc4400s(MTCx401s, MTCx402s){return "&"+MTCx401s+"="+escape(MTCx402s);}function mtc4401(MTCx100s, MTCx101s) {document.cookie = MTCx100s + "=" + escape (MTCx101s) + ";";}function mtc4402s (MTCx100s) {var arg = MTCx100s + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen;if (document.cookie.substring(i, j) == arg){return mtc4403s (j);}i = document.cookie.indexOf(" ", i) + 1;if (i == 0) break;} return null;}function mtc4403s (MTCx100n) {var endstr = document.cookie.indexOf (";", MTCx100n);if (("" + endstr) == "" || endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(MTCx100n, endstr));}function mtc4201(){sTMTag="<img src=\"" + mtc4300s() + "\" hspace=0 vspace=0 height=1 width=1 visibility=hide suppress=true>";}function mtc4200(){mtc4201();sImageTag=sTMTag;}function mtc7201(){mtcSetVTSCampaignAID(mtc6400("vtsaid"));mtcSetVTSCampaignAID(mtc6400("mtcCampaign"));}function mtc6400(MTCx400s){var sCP="", s;s=location.search;i=s.toUpperCase().lastIndexOf(MTCx400s.toUpperCase() + "=");if (i>=0){sCP=s.substring(i + 1 + MTCx400s.length);i=sCP.indexOf("&");if (i>=0){sCP=sCP.substring(0, i);}}return sCP;}function mtcGO(){MTCli=new Image();MTCli.src=mtc4300s();}function mtcGoCritical(){window.onunload = mtc8200; var MTCli=new Image();MTCli.src=mtc4300s();MTCli.onload=mtc8100;}function mtcConfig(sOption, sValue){if (sOption=="MTC_PROMO_EXP")MTCo_pce=sValue;else if (sOption=="MTC_PROMO_SETLAST")MTCo_pcsl=sValue;}function mtc8200(){if (MTCx100b==false)return false;mtc8201();}var mtc8201;if (document.body)mtc8201=document.body.onunload;function mtc8100(){MTCx100b=true;}function mtcSetOrderNumber(sOrderNumber){if (sOrderNumber!=""){MTCon=sOrderNumber;mtc4200();}}function vcmSetOrderNumber(sOrderNumber){mtcSetOrderNumber(sOrderNumber);}function vcmSetPageName(sPageName){MTCpn=sPageName;mtc4200();}function mtcAddOrderItem(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity){mtc500100(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity, 0);}function vcmAddOrderItem(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity){mtcAddOrderItem(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity);}function mtcRemoveCartItem(sItemID){mtc500100(sItemID, "", "", 0.00, 0, 2);}function mtcEmptyCart(){mtc500100("", "", "", 0.00, 0, 3);}function mtcSetCartItem(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity){mtc500100(sItemID, sItemName, sItemCategory, fUnitPrice, nQuantity, 4);}function mtcCommitCart(){mtc500100("", "", "", 0.00, 0, 5);}function mtcProductView(sItemID, sItemName, sItemCategory){mtc500100(sItemID, sItemName, sItemCategory, 0.00, 0, 6);}function mtc500100(MTCx401s, MTCx402s, MTCx403s, MTCx404f, MTCx405n, MTCx406n){MTCii+="<i><d>" + escape(MTCx401s) + "</d><n>" + escape(MTCx402s) + "</n><c>" + escape(MTCx403s) + "</c><p>" + escape(MTCx404f) + "</p><q>" + escape(MTCx405n) + "</q><a>" + escape(MTCx406n) + "</a></i>";mtc4200();}function vtmSetPageName(sPageName){mtcSetPageName(sPageName);mtcSetPageTitle(sPageName);}function vtmSetAbsolutePageName(sPageName){mtcSetAbsolutePageName(sPageName);}function mtcSetPageName(sPageName){var np, i;mtc7201();MTCpn=location.hostname;i=location.pathname.lastIndexOf("/");if (i<0)i=location.pathname.lastIndexOf("\\");if (i>=0){np=location.pathname.substring(0, i);}MTCpn+= np + "/" + sPageName;}function mtcSetAbsolutePageName(sPageName){mtc7201();sPageName="ABS:" + sPageName;MTCpn=sPageName;}function mtcSetPageTitle(sPageTitle){mtc7201();sPageTitle="ABS:" + sPageTitle;MTCpt=sPageTitle;}function mtcMonitorFlash(sPageTitle, sPageName){sPageTitle=sPageTitle.replace(" ", "");if (sPageTitle.length>0){mtcSetPageTitle(sPageTitle);}mtcSetAbsolutePageName(sPageName);mtcGO();}function mtcPopup(nW, nH, sURL){var MTCx401w;if (navigator.appName=="Netscape"){                   var x1 = this.screenX + (this.outerWidth  - nW)/2;var y1 = this.screenY + (this.outerHeight - nH)/2;MTCx401w=window.open(sURL, "mtcPopup",'screenX='+ x1 + ',screenY=' + y1 + ',width=' + nW + ',height=' + nH + ',resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,zorder=1');}if (navigator.appName=="Microsoft Internet Explorer"){var x1 =  (screen.width  - nW)/2;var y1 =  (screen.height - nH)/2;MTCx401w=window.open(sURL, "mtcPopup",'screenX='+ x1 + ',screenY=' + y1 + ',left='+ x1 + ',top='+ y1 + ',width=' + nW + ',height=' + nH + ',resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,zorder=1');}MTCx401w.focus();}function vtmDownload(sFileName){MTCon="";MTCii="";MTCrp=MTCpn;var np, i;MTCpn=location.hostname;i=location.pathname.lastIndexOf("/");if (i<0)i=location.pathname.lastIndexOf("\\");if (i>=0){np=location.pathname.substring(0, i);}MTCpt=sFileName;MTCpn+= np + "/" + sPageName;mtc4200();MTCpn="http://" + MTCpn;document.location=mtc4300s() + "&rd=1";}function mtcDownload(sURL, sPageTitle){var i;MTCrp=MTCpn;MTCon="";MTCii="";MTCpt=sPageTitle;i=sURL.indexOf("http");if (i==0){MTCpn=sURL;}else{MTCpn="http://" + sURL;}document.location=mtc4300s() + "&rd=1";}function mtcSetVTSEAID(sEAID){MTCea=sEAID;}function mtcSetVTSCampaignAID(sCampaignAID){MTCcp=sCampaignAID;}function mtcSetVTSEntryPageCampaignAID(sCampaignAID){MTCepci=sCampaignAID;}function mtcSetPromotion(sPromotionCode){MTCpc=sPromotionCode;}function mtcSetContentCategory(sContentCategory){sTMContentCategory=sContentCategory;}function mtcSetServerGroup(sServerGroup){sTMServerGroup=sServerGroup;}function mtcSetVisitorID(sVisitorID){MTCvd="L3:" + sVisitorID;}var mtc8301;function mtc8300(){MTCip="1";mtcGO();MTCip=""; if (mtc8301) mtc8301();}if(navigator.userAgent.toLowerCase().indexOf("msie")>=0){mtc8301=window.onafterprint;window.onafterprint=mtc8300;}MTCci="0";if (mtc4402s("MTCCK")!="1")mtc4401("MTCCK", "1");if (mtc4402s("MTCCK")=="1")MTCci="1";MTCpc=mtc6400("mtcPromotion");MTCaf=mtc6400("mtcAffiliate");MTCpn=unescape(window.location.href);MTCpt=unescape(document.title);MTCrp=unescape(document.referrer);MTCbv=parseFloat(navigator.appVersion);MTCsr=screen.width + 'x' + screen.height;MTCcd=screen.colorDepth;MTCje=navigator.javaEnabled() ? "1":"0";MTCbt=navigator.appName;var today=new Date();MTCtz=today.getHours();mtc4200();

	var sTMTag="";
	var sTMServerGroup="";
	var sTMContentCategory="";
	var TMIdentity="ID=1347&UserID=02EA4D44-E849-4D18-AB0E-D352AB0BB3DC";


/*************Begin Optional Configuration*******************
	Implement site specific/e-commerce functionality here.
**************End Optional Configuration*********************/

	mtcGO();

/*******************End Manticore Technology Code****************/	