	w_openwindow = null;
	function open_window(nurl,windowname,width,height, leftPos, topPos, scrollbars, resizable, newwindow)
	{
		if (typeof leftPos == 'undefined' || leftPos < 0) leftPos = (self.screen.width-width-25)/2;
		if (typeof topPos == 'undefined' || topPos < 0) topPos = (self.screen.height-height-25)/2;
		if (typeof newwindow == 'undefined') newwindow = 0;
		scrollbars = typeof scrollbars == 'undefined' ? 'yes' : 'no';
		resizable = typeof resizable == 'undefined' ? 'yes' : 'no';
		if (newwindow)
		 	window.open(nurl, windowname,'width='+width+',height='+height+',left='+leftPos+',top='+topPos+',directories=no,location=no,menubar=no,scrollbars='+scrollbars+',status=yes,toolbar=no,resizable='+resizable);
		else
			w_openwindow = window.open(nurl, windowname,'width='+width+',height='+height+',left='+leftPos+',top='+topPos+',directories=no,location=no,menubar=no,scrollbars='+scrollbars+',status=yes,toolbar=no,resizable='+resizable);
	}


function openWin(URL,width,height,scroll,resize, status, menubar, toolbar, location, directories, winName) {
	noUrl = false
	if (URL == "" || URL == null) { URL="about:blank"; noUrl=true }
	if (width == "" || width == null ) { width = 640 }
	if (height == "" || height == null ) { height = 480 }
	if (width == "*" ) {
		width = (screen.availWidth * (100/99)) ;
		if (width > 800) width="800"; //since the site isn't wider than 800px, there's no point in opening in fullscreen mode, it just looks silly!
	}
	if (height == "*" ) {
	height =  (screen.availHeight * (100/95));
		if (height > 580) height="580";//since the site isn't taller than 800px, there's no point in opening in fullscreen mode, it just looks silly!
	}
	if (scroll == "" || scroll == null ) { scroll = 1 }
	if (resize == "" || resize == null ) { resize = 1 }
	if (status == "" || status == null ) { status = 1 }
	if (menubar == "" || menubar == null) {menubar=0}
	if (toolbar == "" || toolbar == null) {toolbar=0}
	if (location == "" || location == null) {location=0}
	if (directories == "" || directories == null) {directories=0}
	if (winName == "" || winName == null) {winName="NEW"}

	PARMS = 'toolbar='+toolbar +',location='+location +',directories='+directories +',status='+status +',menubar='+menubar +',scrollbars=' + scroll + ',resizable=' + resize + ',width=' + width + ',height=' + height
  var newWin = window.open(URL,winName,PARMS);
	/* newWin.screenX = 0;
  newWin.screenY = 0; */
	if (noUrl) {
		newWin.document.writeln("<BR><BR><FONT color='red'>It seems like you forgot to put in a value for URL when you called for <I>openWin()</I></FONT>")
		newWin.document.close()
	}
	return;
}

function openWinDefault(URL) {
	noUrl = false;
	PARMS = "";
	if (URL == "" || URL == null) { URL="about:blank"; noUrl=true }

	var newWin = window.open(URL,"NEW",PARMS);

	if (noUrl) {
		newWin.document.writeln("<BR><BR><FONT color='red'>It seems like you forgot to put in a value for URL when you called for <I>openWin()</I></FONT>")
		newWin.document.close()
	}
	return;
}

function openEnhancedSpecs (featureCode, cpart, market, language, modelCode)
{
	PARMS = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=false,resizable=0,width=678,height=356';
	var url = ""

	//cType = modelCode;
	if (modelCode == "95"  ||  modelCode == "95_WAGON")
	{
		url = "/microsites/9-5/95.xml"
		cType = (modelCode == "95") ? "s" : "w";
	}
	else if (modelCode == "93_S")
	{
		url = "/main/" + market + "/" + language + "/93s_enhancements_container.xml"
		cType = "93s";
	}

	if (cType != '')
	{
		var enhancedSpec = window.open (
			url +"?market=" + market
				+ "&language=" + language
				+ "&ctype=" + cType
				+ "&cpart=" + cpart,
			"Saab95",
			PARMS)
	}
}

function openEnhancedSpecsWithID(cpart){
        var triggerID = 0
        var ctype = ''
        for (i=0; i< mappedArray.length; i++) {
                if (cpart == mappedArray[i][0]) {
                        triggerID = mappedArray[i][1]
                        ctype = mappedArray[i][2]
                        }
        }

        cpart = triggerID
        PARMS = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=false,resizable=0,width=678,height=356';
        var url = ""
        if (ctype == "w" || ctype == "s") url = "../../../microsites/9-5/95.xml"
        else if(ctype=="93s") url = "93s_enhancements_container.xml"
        if(ctype!='') {
                var enhancedSpec = window.open(url +"?market="+market+"&language="+language+"&ctype=" + ctype + "&cpart=" + cpart, "Saab95", PARMS)
        }
}

function openFullScreenWin(u) {

	var w = screen.availWidth * (99/100);
	var h = screen.availHeight * (99/100);
	var parms = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',top=1,left=1';
	var windowname = 'fullscreenpop';

	var newfullscreenWin = window.open(u,windowname,parms);

	return;

}

function getCleanUrl() {
	URL = document.URL
	myParamStartPos = URL.indexOf("?",0)
	if(myParamStartPos>0){
		URL = document.URL.substr(0,myParamStartPos)
		return URL
	}
	else return URL
}

function getParam(name)
{
	var param;
	var idxStart = document.URL.indexOf('?');

	if (idxStart >= 0) {
		// get the query string, prepend and append & to make searching easier
		idxStart += 1;
		var url = "&"+document.URL.substring(idxStart, document.URL.length)+"&";

		// found the param?
		idxStart = url.indexOf("&"+name+"=");
		if (idxStart >= 0) {
			idxStart += name.length+2;
			var idxEnd = url.indexOf("&", idxStart);
			param = url.substring(idxStart, idxEnd);
		} else debug("Couldn't find param: "+name, "DEBUG");
	}

	debug("getParam('"+name+"') = "+param, "DEBUG");
	return param;
} // getParam(name)


function getDirectoryFromUrl (dirNo)
{
	var i = 0;
	var url = location.href;
	var ret = "";

	if (url.substring (0, 7) == "http://")
		url = url.substring (7);
	else if (url.substring (0, 8) == "https://")
		url = url.substring (8);

	url = url.substring (url.indexOf ("/") + 1)

	while (i < Number (dirNo) - 1  &&  url.indexOf ("/") != -1)
	{
		url = url.substring (url.indexOf ("/") + 1);
		++i;
	}

	if (url.indexOf ("/") != -1)
	{
		ret = url.substring (0, url.indexOf ("/"));
	}

	return ret;
} // getDirectoryFromUrl (dirNo)


function changeUrlParams(params){
	currentCleanUrl = getCleanUrl()
	newUrl = currentCleanUrl + "?" +params
	document.location = newUrl
}

function getServerInfo() {
 return document.location.host
 //alert(document.location.port)
}
//Swaps image
// LAF: this doesn't look netscape compatible, especitially with layers
function swapImage(imgName,imgSrc) {
	document.images[imgName].src=imgSrc
}


// debug level setting for displaying debug messages with the debug() function
// this can be set in any javascript file or block
var DEBUG; // 'DEBUG', 'ERROR', 'WARNING'


// debug message alerts
// uses the global variable DEBUG
// msg = the message to display in the alert
// logLevel = only displays the msg if the current log level, or higher, is being used
// where log levels are: debug, warning, info
// if DEBUG='DEBUG' all messages are shown, i.e. debug, error, and warning messages
// if DEBUG='WARNING' only warning and error messages are shown
// if DEBUG='ERROR' only error messages are shown
function debug(msg, logLevel) {
	//if (!DEBUG) DEBUG = getParam("DEBUG");
	if (!DEBUG || (DEBUG=='')) return; // debugging is turned off
	if (!logLevel) logLevel = 'DEBUG'; // default
	if (DEBUG != 'DEBUG') {
		if ((DEBUG == 'ERROR') && (logLevel != 'ERROR')) return;
		if ((DEBUG == 'WARNING') && (logLevel == 'DEBUG')) return;
	}
	alert('Debug level: '+DEBUG+'\nMessage level: '+logLevel+'\n'+msg);
}

function returnBASE() {
        url = location + "";

        // remove the query string if it exists
        idxQuery = url.indexOf( '?' );
        if ( idxQuery >= 0 ) {
                 url = url.substring( 0, idxQuery );
        }

        // get the BASE
        idxLast = url.lastIndexOf( '/' ) + 1;
        base = url.substring( 0, idxLast );
        return base;
}

function setBase(form) {
        BASE = returnBASE();
        form.BASE.value = BASE;
}


/***********************************************
	* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
	* Copyright 2002-2007 by Sharon Paine
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/

	/* IMPORTANT: Put script after tooltip div or
		 put tooltip div just before </BODY>. */

	var dom = (document.getElementById) ? true : false;
	var ns5 = (!document.all && dom || window.opera) ? true: false;
	var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
	var ie4 = (document.all && !dom) ? true : false;
	var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

	var origWidth, origHeight;

	// avoid error of passing event object in older browsers
	if (nodyn) { event = "nope" }

	///////////////////////  CUSTOMIZE HERE   ////////////////////
	// settings for tooltip
	// Do you want tip to move when mouse moves over link?
	var tipFollowMouse= true;
	// Be sure to set tipWidth wide enough for widest image
	var tipWidth= 260;
	var offX= 20;	// how far from mouse to show tip
	var offY= 12;
	var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
	var tipFontSize= "8pt";
	// set default text color and background color for tooltip here
	// individual tooltips can have their own (set in messages arrays)
	// but don't have to
	var tipFontColor= "#000000";
	var tipBgColor= "#DDECFF";
	var tipBorderColor= "#FFFFFF";
	var tipBorderWidth= 0;
	var tipBorderStyle= "solid";
	var tipPadding= 0;

	// tooltip content goes here (image, description, optional bgColor, optional textcolor)
	var messages = new Array();
	// multi-dimensional arrays containing:
	// image and text for tooltip
	// optional: bgColor and color to be sent to tooltip

	messages[0] = new Array('./accounts/vitamind/images//alcan.jpg','',"#FFFFFF");
	//messages[0] = new Array('/accounts/vitamind/images//alcan.jpg','','#FFFFFF');

	////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

	// preload images that are to appear in tooltip
	// from arrays above
	if (document.images) {
		var theImgs = new Array();
		for (var i=0; i<messages.length; i++) {
	  	theImgs[i] = new Image();
			theImgs[i].src = messages[i][0];
	  }
	}

	// to layout image and text, 2-row table, image centered in top cell
	// these go in var tip in doTooltip function
	// startStr goes before image, midStr goes between image and text
	var startStr = '<table width="' + tipWidth + '"><tr><td align="left" width="100%"><img src="';
	var midStr = '" border="0"></td></tr><tr><td valign="top">';
	var endStr = '</td></tr></table>';

	var tooltip, tipcss;
	function initTip() {
		if (nodyn) return;
		tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
		tipcss = tooltip.style;
		if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
			tipcss.width = tipWidth+"px";
			tipcss.fontFamily = tipFontFamily;
			tipcss.fontSize = tipFontSize;
			tipcss.color = tipFontColor;
			tipcss.backgroundColor = tipBgColor;
			tipcss.borderColor = tipBorderColor;
			tipcss.borderWidth = tipBorderWidth+"px";
			tipcss.padding = tipPadding+"px";
			tipcss.borderStyle = tipBorderStyle;
		}
		if (tooltip&&tipFollowMouse) {
			document.onmousemove = trackMouse;
		}
	}

	window.onload = initTip;


	var t1,t2;	// for setTimeouts
	var tipOn = false;	// check if over tooltip link
	function doTooltip(evt,num) {
		if (!tooltip) return;
		if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
		tipOn = true;
		// set colors if included in messages array
		if (messages[num][2])	var curBgColor = messages[num][2];
		else curBgColor = tipBgColor;
		if (messages[num][3])	var curFontColor = messages[num][3];
		else curFontColor = tipFontColor;
		if (ie4||ie5||ns5) {
			var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
			tipcss.backgroundColor = curBgColor;
		 	tooltip.innerHTML = tip;
		}
		if (!tipFollowMouse) positionTip(evt);
		else t1=setTimeout("tipcss.visibility='visible'",100);
	}

	var mouseX, mouseY;
	function trackMouse(evt) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
		if (tipOn) positionTip(evt);
	}

	function positionTip(evt) {
		if (!tipFollowMouse) {
			mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
			mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
		}
		// tooltip width and height
		var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
		var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
		// document area in view (subtract scrollbar width for ns)
		var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
		var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
		// check mouse position against tip and window dimensions
		// and position the tooltip
		if ((mouseX+offX+tpWd)>winWd)
			tipcss.left = mouseX-(tpWd+offX)+"px";
		else tipcss.left = mouseX+offX+"px";
		if ((mouseY+offY+tpHt)>winHt)
			tipcss.top = winHt-(tpHt+offY)+"px";
		else tipcss.top = mouseY+offY+"px";
		if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
	}

	function hideTip() {
		if (!tooltip) return;
		t2=setTimeout("tipcss.visibility='hidden'",100);
		tipOn = false;
	}

	document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>');

function moreInfo(infoLayerId, state) {
	grayOut(state);
	if (state == true) {
		document.getElementById('infoLayer_' + infoLayerId).style.zIndex = 100000;
		document.getElementById('infoLayer_' + infoLayerId).style.visibility = 'visible';

	}
	else {
		document.getElementById('infoLayer_' + infoLayerId).style.zIndex = -100000;
		document.getElementById('infoLayer_' + infoLayerId).style.visibility = 'hidden';
	}
}

function closeCartLayer() {
	grayOut(false);
	document.getElementById('cartLayer').style.zIndex = -100000;
	document.getElementById('cartLayer').style.visibility = 'hidden';
}

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {};
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }
	//alert(pageHeight);
	var pageHeight='100%';
	var pageWidth='100%'
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;
    dark.style.MozOpacity=opaque;
    dark.style.filter='alpha(opacity='+opacity+')';
    dark.style.zIndex=zindex;
    dark.style.backgroundColor=bgcolor;
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';
  } else {
     dark.style.display='none';
  }
}
