<!--
function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
var arg = name + "=";  
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 getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}

function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" +  (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  return window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	if (checkIt('mac')&&v=='visible') obj.pixelTop = obj.pixelTop ;
    obj.visibility=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function trim(a) {  //trims whitespace from start/end of string
	return a.replace(/^\s+/,'').replace(/\s+$/,'');
}

function checkIt(string) {
	var detect = navigator.userAgent.toLowerCase();
	return detect.indexOf(string) + 1;
}

function renderStateList() {
	var values = new Array( "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" ) ;
	var captions = new Array( "Alaska", "Alabama", "Arkansas", "Arizona", "California", "Colorado", "Connecticut", "District of Columbia", "Delaware", "Florida", "Georgia", "Hawaii", "Iowa", "Idaho", "Illinois", "Indiana", "Kansas", "Kentucky", "Louisiana", "Massachusetts", "Maryland", "Maine", "Michigan", "Minnesota", "Missouri", "Mississippi", "Montana", "North Carolina", "North Dakota", "Nebraska", "New Hampshire", "New Jersey", "New Mexico", "Nevada", "New York", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Virginia", "Vermont", "Washington", "Wisconsin", "West Virginia", "Wyoming" ) ;
	var buffer = "" ;
	for ( var i = 0 ; i < values.length ; i++ ) {
		buffer += "<option value=\"" + values[ i ] + "\">" + captions[ i ] + "</option>" ;
	}
	return buffer ;
}

function renderFlashTag( Movie, Width, Height, Params ) {
	var buffer = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + Width + '" height="' + Height + '">' ;
	buffer += '<param name="movie" value="' + Movie + '">' ;
	var pairs = Params.split( ';' ) ;
	for ( var i = 0 ; i < pairs.length ; i++ ) {
		var name = pairs[ i ].split( '=' )[ 0 ] ;
		var value = pairs[ i ].split( '=' )[ 1 ] ;
		buffer += '<param name="' + name + '" value="' + value + '">' ;			
	}
	buffer += '<embed src="' + Movie + '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + Width + '" height="' + Height + '" ' ;
	for ( var i = 0 ; i < pairs.length ; i++ ) {
		var name = pairs[ i ].split( '=' )[ 0 ] ;
		var value = pairs[ i ].split( '=' )[ 1 ] ;
		buffer += name + '="' + value + '" ' ;
	}
	buffer += '></embed></object>' ;
	return buffer ;
}

function queryString(keyName)
{
  var keyValue = "";
  keyName = keyName.toUpperCase() + "=";

  if (window.location.href.indexOf("?") != "-1")
  {
	var queryString = window.location.href.substring(window.location.href.indexOf("?")+1);
	var searchString = queryString.toUpperCase();
	if (searchString.indexOf(keyName) != "-1")
	{
	  var keyValueStart = parseInt(searchString.indexOf(keyName))+keyName.length;
	  var keyValueEnd   = searchString.indexOf("&", keyValueStart);
	  var keyValueEnd   = (keyValueEnd != "-1") ? keyValueEnd : searchString.length;
	  keyValue          = queryString.substring(keyValueStart,keyValueEnd);
	}
  }
  return unescape(keyValue.replace(/\+/g," "));
}

function printImg( image ) {
	document.write( '<img src="' + image.src + '" alt="' + image.alt + '" width="' + image.width + '" height="' + image.height + '" border="0">' ) ;
}

function featureZoom( modelKey, featureKey, modelYear ) {
	var params = "width=466,height=314,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,top=20,left=20,screenX=20,screenY=20";
	var url = "featureZoom.jsp?model=" + modelKey + "&feature=" + featureKey + "&year=" + modelYear;
	window.open( url, "featureZoom", params, true );
}

function featureDisclaimer( modelKey, featureKey ) {
	var params = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,top=20,left=20,screenX=20,screenY=20,width=600,height=360";
	var url = "featureDisclaimer.jsp?model=" + modelKey + "&feature=" + featureKey;
	window.open( url, "featureDisclaimer", params, true );
}

function xlrStory() {
	var newWindow=MM_openBrWindow('/Spotlights/XLRStory/index.html','_timeline','width=740,height=420,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function srxExperience() {
	var newWindow=MM_openBrWindow('/Spotlights/SRXExperience/index.html','_timeline','width=772,height=445,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function stsExperience() {
	var newWindow=MM_openBrWindow('/Spotlights/STSExperience/index.html','_timeline','width=772,height=510,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function srxPop(selection)
				{
					var windowprops = "left=30,top=30,width=500,height=405";
					var url = selection;
					preview = window.open(url, "SRX", windowprops);
					preview.focus();
				}
function truckfest() {
	var newWindow=MM_openBrWindow('http://www.gm.com/automotive/vehicle_shopping/currentoffers/truckfest.html','_truckfest','width=790,height=580,toolbar=1,location=1,directories=1,status=1,menuBar=1,scrollBars=1,resizable=1');
	newWindow.focus();
}

function challenge() {
	var newWindow=MM_openBrWindow('http://www.gm.com/automotive/vehicle_shopping/currentoffers/challenge.html','_challenge','width=800,height=600,toolbar=1,location=1,directories=1,status=1,menuBar=1,scrollBars=1,resizable=1');
	newWindow.focus();
}

function escaladeFamily() {
	var newWindow=MM_openBrWindow('/Spotlights/EscaladeFamily/index.html','_timeline','width=700,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function innovations() {
	var newWindow=MM_openBrWindow('/Spotlights/Timeline/index.html','_timeline','width=750,height=350,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function cadillacCollection() {
	var newWindow=MM_openBrWindow('http://www.cadillaccollection.com','_cadillacCollection','');
	newWindow.focus();
}

function gmFleet() {
	var newWindow=MM_openBrWindow('http://www.gmfleet.com','_gmfleet','');
	newWindow.focus();
}

function hotButton() {
	var newWindow=MM_openBrWindow('http://www.gm.com/vc/hotbutton/index.html','_hotbutton','width=800,height=505,toolbar=1,location=1,directories=0,status=0,menuBar=1,scrollBars=1,resizable=1');
	newWindow.focus();
}

function JDPower() {
	var newWindow=MM_openBrWindow('/Spotlights/JDPower/index.html','_JDPower','width=579,height=506,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function onstar2() {
	var newWindow=MM_openBrWindow('http://www.onstargm.com/modules/cadillac.htm','_onstar2','width=560,height=505,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function onstar() {
	var newWindow=MM_openBrWindow('/cadillacjsp/cpo/onstar.jsp','_onstar','width=700,height=565,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
	newWindow.focus();
}

function paXLR() {
	var newWindow=MM_openBrWindow('/cadillacjsp/PersonalAssistant/customer_input.html?model=xlr','_onstar','width=612,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}

function paSRX() {
	var newWindow=MM_openBrWindow('/cadillacjsp/PersonalAssistant/customer_input.html?model=srx','_onstar','width=612,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}
function paCTSV() {
	var newWindow=MM_openBrWindow('/cadillacjsp/PersonalAssistant/customer_input.html?model=ctsv','_onstar','width=612,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}
function paSTS() {
	var newWindow=MM_openBrWindow('/cadillacjsp/PersonalAssistant/customer_input.html?model=sts','_onstar','width=612,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}

function sts2005() {
	var newWindow=MM_openBrWindow('http://cadillacsts.feedroom.com','_stsunveil','width=706,height=425,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}
function sts20052() {
	var newWindow=MM_openBrWindow('http://cadillacsts.feedroom.com','_stsunveil','width=706,height=425,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function financeTools() {
	var newWindow=MM_openBrWindow('/cadillacjsp/financetools/index.jsp','_financetools','width=640,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}

function privacy() {
	var newWindow = MM_openBrWindow( 'http://www.gm.com/privacy', '_privacypolicy', '' );
	newWindow.focus();
}

function ctsvRaceCar() {
	var newWindow=MM_openBrWindow('/ctsv/RacePopup.htm','_CTSVRaceCar','width=580,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}
function ctsvRacing() {
	var newWindow=MM_openBrWindow('/ctsv/CTSVRacing.html','_CTSVRaceCar','width=595,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}

function ctsvVelocity() {
	var newWindow=MM_openBrWindow('/Spotlights/CTSV/default.htm','_CTSVVelocity','width=772,height=430,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function srxCarDriver() {
	var newWindow=MM_openBrWindow('/srx/PopupCarAndDriver.html','_srxCarDriver','width=680,height=470,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	newWindow.focus();
}

function AICcopyright() {
	var newWindow = MM_openBrWindow( '/AICcopyright.html', '_copyright', 'width=610,height=490,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0' );
	newWindow.focus();
}

function copyright() {
	var newWindow = MM_openBrWindow( '/copyright.html', '_copyright', 'width=610,height=490,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
	newWindow.focus();
}

function contactus() {
	var newWindow = MM_openBrWindow( '/ContactUs/', '_contactus', 'width=613,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
	newWindow.focus();
}

function brochure( model ) {
	var newWindow = MM_openBrWindow( '/cadillacjsp/brochure/index.jsp?model='+model, '_brochure', 'width=600,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
	newWindow.focus();
}

function gmsitemenu() {
	var newWindow = MM_openBrWindow( '/GMSiteMenu.html', '_gmsitemenu', 'width=610,height=350,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
	newWindow.focus();
}

function searchHelp() {
	var newWindow = MM_openBrWindow( '/search/SearchServer/wwwtemplates/query/help.html', '_searchelp', 'width=610,height=350,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
	newWindow.focus();
}

function desktopShowcase() {
	var modelKey = queryString("model");
	var newWindow=MM_openBrWindow('/cadillacjsp/models/desktopShowcase.jsp?model=' + modelKey,'_desktopshowcase','width=628,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0');
	newWindow.focus();
}

function cpoSearchInventory(model,year,style) {
	document.location.href = "/cuv/cadillac/uis.jhtml?model=" + model + "&year=" + year + "&style=" + style ;
}

function requestQuote(model) {
	document.location.href = "/locatedealer/cadillac/requestQuote.jsp?model=" + model ;
}

function searchInventory() {
	var url = "http://www.gmbuypower.com/vehicleSearch.bp?&amp;year=2004&amp;makeId=006" ;
	var features = "";
	if ( url != null ) {
		var newWindow = MM_openBrWindow( url, '_searchInventory', features );
		newWindow.focus();
	}
}

function futureRequest(model) {
	var url = null ;
	if ( model == "ctsv" )
		url = "/cadillacjsp/VseriesRequestInfo/customer_input.html?model=cts";
	else if ( model == "esvplat" )
		url = "/cadillacjsp/VseriesRequestInfo/customer_input.html?model=esv";
	else if ( model == "sts" )
		url = "/cadillacjsp/VseriesRequestInfo/customer_input.html?model=sts";
	if ( url != null ) {
		var newWindow = MM_openBrWindow( url, '_futureRequest', 'width=610,height=370,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' );
		newWindow.focus();
	}
}

function buildYourOwn( model ) {
	document.location.href = "/byo/jsp/cadillac/index.jsp?model=" + model ;
}

function competitiveCompare( model ) {
	document.location.href = "/comparator/cadillac/comparevehicle.jsp";
}

/**
 * This method generates the table of probabilites
 * that a number will occur randomly.  The array
 * is the summation of the probabilities up the 
 * current location.  
 * For example P[N-1] = W[0]+W[1] + ... + W[N-2].
 * We also must ensure the last element of the table
 * is 1.
 * @param weights
 * @return double[]
 */
function Table( weights ) {
	var table = new Array() ;
	var p = 0 ;
	table[ 0 ] = 0 ;
	for ( var i = 0 ; i < weights.length ; i++ ) {
		p += weights[ i ] ;
		table[ i + 1 ] = p ;
	}
	table[ table.length - 1 ] = 1 ;
	return table ;
}

/**
 * This method performs a binary search for the value x,
 * and returns the lower bound for the search.
 * @param table
 * @param x
 * @return int
 */
function Locate( table, x ) {
	var lo = 0 ;
	var hi = table.length ;
	while ( hi > lo + 1 ) {
		var mid = Math.floor( lo + ( hi - lo ) / 2 ) ;
		if ( table[ mid ] <= x )
			lo = mid ;
		else
			hi = mid ;	
	}	
	return lo ;
}

/**
 * Returns a random number based on a random value
 * and the weights assigned to the number.  We assume 
 * the set of numbers is continuous and is within the 
 * set 1..N where N is the size of the weight array.
 * @param weights
 * @return int
 */
function getRandomNumber( weights ) {
	var p = Table( weights ) ;
	return Locate( p, Math.random() ) ;	
}

function sts() {
	var newWindow = MM_openBrWindow( '/sts/index.html', '_sts', 'width=595,height=339,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0' );
	newWindow.focus();
}



// remove this section after the subnav updates
if (document.layers) {
        visible = 'show';
        hidden = 'hide';

} else if (document.all || document.getElementById) {
        visible = 'visible';
        hidden = 'hidden';
}

var daLayer = '_topnav_compare_dd';
var daLast = '_topnav_compare_dd';
var onLayer = false;
var subnavTimer = null;
var subnavTimeout = 3000; //milliseconds

function subnavclear() {
	if (onLayer) {
		subnav('subnavnone');
	} else {
		clearTimeout(subnavTimer);
		subnavTimer = setTimeout("subnavclear()", subnavTimeout);
	}
}

function subnav(daLayer){

	//alert("this layer=" + daLayer);
	//alert("last layer=" + daLast);
	
	if ( daLayer == 'subnavnone' ) {
		onLayer = false;
	} else {
		onLayer = true;
	}
	
	clearTimeout(subnavTimer);
	subnavTimer = setTimeout("subnavclear()", subnavTimeout);

	if (daLayer != daLast) {

		if (document.layers) {
			document.layers[daLast].visibility = hidden;

		} else if (document.all) {
			document.all(daLast).style.visibility = hidden;
        
		} else if (document.getElementById) {
			document.getElementById(daLast).style.visibility = hidden;
        
		} daLast = daLayer;

	}

	if (document.layers) {
		document.layers[daLayer].visibility = visible;
        
	} else if (document.all) {
		document.all(daLayer).style.visibility = visible;
        
	} else if (document.getElementById) {
		document.getElementById(daLayer).style.visibility = visible;
        
	}
}

function printWindow(){
	if (window.print){
		window.print()
	}
	else{
		alert("Your browser does not support this function. Please click the Print button in your browser's toolbar.");
	}
}
function textRollOn( eid ) {
	var over=document.getElementById(eid);
	if (over!=null) over.style.color="#336699";
}
function textRollOff( eid ) {
	var over=document.getElementById(eid);
	if (over!=null) over.style.color="#666666";
}
function subnavRoll( inew ) {
	document.images["subnav"].src = eval("subnav" + '_' + inew + '.src');
}
//-->