<!--

//--
// Global Variables
//
var	DetailWindow;
var iOpen = 0;

/*********************************************************************************
Name:	FlipImg

Purpose: Get a TS Header Status List

Parameters:
	strDocImage		Name of the IMG tag to change
	strNewImg		the URL of the new src for the IMG

Return Values:
	void

Author: Bart Bartera

Date:	2002-08-03

Revision History:
	Date:		2002-08-03
	UserName:	Bart Bartera

**********************************************************************************/
function FlipImg(strDocImage, strNewImg) {
	document[strDocImage].src = strNewImg;
}

/*********************************************************************************
// Open up a Generic Search Window
//
// 2001-10-02
// Bart Bartera
// Add target document parameter and change the static 
// list of elements to an array?
**********************************************************************************/
function OpenDetailWindow(URL, Width, Height) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'auto');
	DetailWindow	= window.open(URL, 'detail', Param);
	
} // end of function OpenSearchWindow


/*********************************************************************************
// Open up a Generic Search Window with Scrollbar turned on
//
// 2003-02-05
// Li-Wen Hu
**********************************************************************************/
function OpenDetailWindowScroll(URL, Width, Height, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'yes');
	DetailWindow	= window.open(URL, 'detail', Param);
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenDetailWindowScroll


/*********************************************************************************
// Open up a Window with no param
//
// 2003-09-29
// Li-Wen Hu
**********************************************************************************/
function OpenGenericDetailWindow(URL, Width, Height, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

//	Param			= BuildWindowParameters(Width, Height, 'yes');
//	DetailWindow	= window.open(URL, 'detail', Param);
	DetailWindow	= window.open(URL, 'detail');
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenGenericDetailWindow


/*********************************************************************************
Author: Li-Wen Hu
Date:	2003-10-03

Revision History:
	Date:		2003-10-03
	UserName:	Li-Wen Hu
**********************************************************************************/
function openNewWin(URL, winName, params, GetFocus) {

	CloseDetailWindow();	// Close if already open

	DetailWindow = window.open(URL, winName, params);
//	DetailWindow.opener = self;
	if (GetFocus) {
		DetailWindow.focus();
	}
}

/*********************************************************************************
**********************************************************************************/
function OpenProductDetail(strDocImage, strNewImg) {
	document[strDocImage].src = strNewImg;
}


/*********************************************************************************
// Build the configuration of the new window
**********************************************************************************/
function BuildWindowParameters(Width, Height, Scroll) {

	var	Param;
	
	Param		= 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,top=10,left=10';
	Param		+= ',scrollbars=' + Scroll
	Param		+= ',width=' + Width + ',height=' + Height;

	return		Param;
}

/*********************************************************************************
// Close the Detail Window (if it's open)
//
// The "DetailWindow" variable is a window handle set in OpenDetailWindow()
// to the result of a window.open call
**********************************************************************************/
function CloseDetailWindow() {

	if (DetailWindow) {
	
		if (!DetailWindow.closed) {
	
			CloseWindow(DetailWindow);
			DetailWindow = null;
	
		}
	
	}

}

/*********************************************************************************
// Close a Child Window
**********************************************************************************/
function CloseWindow(WindowObj) {

	if (WindowObj != null) {
	
		WindowObj.close();
	
	}

}

/*********************************************************************************
**********************************************************************************/
function OpenAddPopup(URL, Width, Height) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'no');
	DetailWindow	= window.open(URL, 'detail', Param);
	
} // end of function OpenSearchWindow

/*********************************************************************************
**********************************************************************************/
function CloseAddPopup(url) {

	opener.document.location = url;
	
}

/*********************************************************************************
**********************************************************************************/
function MakeSixteen() {

	opener.document.forms['ShipToAddress']['over_sixteen'].value = 'yes';
	opener.document.forms['ShipToAddress'].submit();
}


/*********************************************************************************
**********************************************************************************/
function CheckSixteen(url) {

	if (document.forms['ShipToAddress']['over_sixteen'].value == 'yes') {
		CloseDetailWindow();
		return true;
	}
	else {
		OpenDetailWindow(url, 390, 250);
		return false;
	}
}

/*********************************************************************************
**********************************************************************************/
function popupthingie(sMSCSProfile, sCatalog, sCategory, sProduct, sVariant) {OpenDetailWindow('popupdetail.asp?MSCSProfile=' + sMSCSProfile + '&catalog%5Fname=' + sCatalog + 
	'&category%5Fname=' + sCategory + '&product%5Fid=' + sProduct + '&variant%5Fid=' + sVariant, 370, 430);
}

/*********************************************************************************
**********************************************************************************/
function popupProductDetail(URL, sVariant) {OpenDetailWindow(URL + '&variant%5Fid=' + sVariant, 420, 480);
}

/*********************************************************************************
// navigate to a given url
**********************************************************************************/
function NavigateTo(url) {
	document.location = url;
}
//-->
