//***************************************************************************
// BROWSER CHECK
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6plus = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

IE5plus = IE5 || IE6;
IEMajor = 0;

//***************************************************************************
// JDG:20040827
// the following set of code dynamically determines the host resource location
// from the document url

var sAppResourceLocation = "http://*/ec/";

if( true )
{
	var sUrl = document.location.href;
	var sTemp = sUrl.substr( 7 );
	var sArray = sTemp.split("/");
	sTemp = sArray[0];
	sAppResourceLocation = sAppResourceLocation.replace( "*", sTemp );
}
//***************************************************************************

//***************************************************************************
// JDG:20040824
// the following set of code looks for frameset hi-jacking
// if we are running within a frame, kick ourselves off in a new
// browser window and close the parent framed window

if( window.parent.frames.length > 0 )
{
	window.open( document.URL, "_new" );
	window.parent.close();	
}
//***************************************************************************


if (IE4plus)
{
	var start = navigator.appVersion.indexOf("MSIE");
	var end = navigator.appVersion.indexOf(".",start);
	IEMajor = parseInt(navigator.appVersion.substring(start+5,end));
	IE5plus = (IEMajor>=5) ? true : false;
}

//***************************************************************************

//***************************************************************************
// NS4 window resize bug
if (NS4) {
	window.captureEvents(Event.Resize);
	window.onresize = reLoad;
	window.releaseEvents(Event.Resize);
}

origWidth = window.innerWidth;
origHeight = window.innerHeight;

function reLoad() {
	if (window.innerWidth != origWidth || window.innerHeight != origHeight) 
		location.reload();
}
//***************************************************************************

//***************************************************************************
// Preload rollover images
if (document.images) {
	mainNav1 = new Image(); mainNav1.src = sAppResourceLocation + "site/images/bps/leftNav_search_catalog_on.gif";
	mainNav2 = new Image(); mainNav2.src = sAppResourceLocation + "site/images/bps/leftnav_browse_products_on.gif";
	mainNav3 = new Image(); mainNav3.src = sAppResourceLocation + "site/images/bps/leftNav_quick_samples_on.gif";
	mainNav4 = new Image(); mainNav4.src = sAppResourceLocation + "site/images/bps/leftNav_request_quote_on.gif";
	mainNav5 = new Image(); mainNav5.src = sAppResourceLocation + "site/images/bps/leftNav_sample_basket_on.gif";
	mainNav6 = new Image(); mainNav6.src = sAppResourceLocation + "site/images/bps/leftNav_your_orders_on.gif";
	mainNav7 = new Image(); mainNav7.src = sAppResourceLocation + "site/images/bps/leftNav_project_folders_on.gif";
	mainNav8 = new Image(); mainNav8.src = sAppResourceLocation + "site/images/bps/leftNav_your_profile_on.gif";
	
	utilityNav1 = new Image(); utilityNav1.src = sAppResourceLocation + "site/images/bps/utilityNav_faqs_on.gif";
	utilityNav2 = new Image(); utilityNav2.src = sAppResourceLocation + "site/images/bps/utilityNav_site_map_on.gif";
	utilityNav3 = new Image(); utilityNav3.src = sAppResourceLocation + "site/images/bps/utilityNav_contact_us_on.gif";
	utilityNav4 = new Image(); utilityNav4.src = sAppResourceLocation + "site/images/bps/utilityNav_register_on.gif";
	utilityNav5 = new Image(); utilityNav5.src = sAppResourceLocation + "site/images/bps/utilitynav_rfq_on.gif";
	utilityNav6 = new Image(); utilityNav6.src = sAppResourceLocation + "site/images/bps/utilitynav_home_on.gif"; //1/19/05 SRoy
	utilityNav7 = new Image(); utilityNav7.src = sAppResourceLocation + "site/images/bps/utilityNav_logout_on.gif";	
	
}
//***************************************************************************

//***************************************************************************
// Nav Rollovers
function roll(img_name,img_src) {
	document[img_name].src = img_src;
}
//***************************************************************************

//***************************************************************************
// Select Browser Specific Stye Sheet
if (isMac) {
	document.write("<LINK REL=\"stylesheet\" HREF=\""+ sAppResourceLocation +"site/resources/bps/mac.css\" TYPE=\"text/css\">");
} else if (NS4) {
	document.write("<LINK REL=\"stylesheet\" HREF=\""+ sAppResourceLocation +"site/resources/bps/ns4.css\" TYPE=\"text/css\">");
} else if (NS6plus) {
	document.write("<LINK REL=\"stylesheet\" HREF=\""+ sAppResourceLocation +"site/resources/bps/ns6.css\" TYPE=\"text/css\">");
} else {
	document.write("<LINK REL=\"stylesheet\" HREF=\""+ sAppResourceLocation +"site/resources/bps/ie.css\" TYPE=\"text/css\">");
}
//***************************************************************************

//***************************************************************************
// Date
dayName = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
monthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
now = new Date();
// **************************************************************************

