var d = new Date();
var flashTime = d.getTime();
var hName = location.hostname ;
var servicesURL = "";
if( hName != null && hName != "" ) {
var egoIndexIndex = -1 ;
var gypsyCabPathIndex =  -1 ;
var r32Index = -1 ;
var jettaReportIndex = -1 ;
var vdubsRockIndex = -1 ;
var eosBoutiqueIndex = -1 ;
var jettaReportCaIndex = -1 ;
var vwFeaturesIndex = -1 ;
var eosTarotIndex = -1 ;
var vwcertified = -1 ;
var shellElement = "";
var widgetShimOverride = false;
egoIndexIndex = hName.indexOf("egoindex.com") ;
gypsyCabPathIndex = hName.indexOf("gypsycabproject.com") ;
r32Index = hName.indexOf("5000r32.com") ;
jettaReportIndex = hName.indexOf("jettareport.com") ;
vdubsRockIndex = hName.indexOf("vdubsrock.com") ; 
eosBoutiqueIndex = hName.indexOf("eosboutique.com") ; 
jettaReportCaIndex = hName.indexOf("jettareport.ca") ;
vwFeaturesIndex = hName.indexOf("vwfeatures.com") ;
eosTarotIndex = hName.indexOf("eostarot.com") ;
vwCertifiedIndex = hName.indexOf("vwcertified.vw.com") ;
if( (egoIndexIndex > -1) || (vdubsRockIndex > -1)  ) {
window.location = "http://www.vw.com/showroom/en/us" ;
}
else if( gypsyCabPathIndex > -1 ) {
window.location = "http://www.vw.com/vwhype/gypsycabproject/en/us/" ;
}
else if( jettaReportIndex > -1 ) {
window.location = "http://www.vw.com/vwhype/thejettareport/en/us/" ;
}
else if( r32Index > -1 ) {
window.location = "http://www.vw.com/5000r32/en/us/" ;
} 
else if( eosBoutiqueIndex > -1 ) {
window.location = "http://www.vw.com/eosboutique/" ;
}
else if( jettaReportCaIndex > -1 ) {
window.location = "http://www.vw.com/vwhype/thejettareport/en/ca/index.php" ;
}
else if( vwFeaturesIndex > -1 ) {
window.location = "http://vw.com/vwfeatures/gti/en/us/" ;
}
else if( eosTarotIndex > -1 ) {
window.location = "http://www.vw.com/vwhype/eostarot/en/us/" ;
}
else if( vwCertifiedIndex > -1 ) {
window.location = "http://www.vw.com/preloved/en/us/" ;
}
}if(typeof vw =="undefined"){var vw = {};}
vw.hybrid =
{
addWidget : function(id, color, vaddin, vavailableSearches, vdefaultSearchType, external, vdealerPhoneNumbers, vdaatemplate)
{
var addin;
try{
addin = vaddin;
}catch(e){
 addin = false;
}
//var external = "";
if(addin != undefined && (addin == "external" || addin == "externalWHeader" || addin == "externalDealer"))
{
	if((external == undefined) || (external == ""))
	{
		external = "http://www.vw.com";
	}

}
else
{
	external = "";
}
if(vdealerPhoneNumbers == undefined) vdealerPhoneNumbers = "";
var so = new SWFObject(external+"/global/nav/swf/universal_nav.swf", "swf_shell", "100%", "100%", getFlashVersion(), color, false, "high");
var availableSearches = "";
var defaultSearchType = "";
if (vavailableSearches != undefined) {
	availableSearches = vavailableSearches;
}
if (vdefaultSearchType != undefined) {
	defaultSearchType = vdefaultSearchType;
}

if(vdaatemplate != undefined){
	so.addVariable("template", vdaatemplate);
}

if(addin != undefined)
{
if(color=="#000000")
so.addVariable("configXML", external+"/global/nav/data/config.xml");
else
so.addVariable("configXML", external+"/global/nav/data/config.xml");
if(addin == "external" || addin == "externalWHeader")
{
so.addVariable("externalDomain", external);
so.addVariable("livesOnExternalSite", "true");
so.addVariable("externalDomain", external);
so.addVariable("dealerPhoneNumbers", vdealerPhoneNumbers);
so.addVariable("flashTime", flashTime);
so.addVariable("userAgent", util.getBrowser());
so.addParam("allowScriptAccess", "always");
}
}
else
{
if(color=="#000000")
so.addVariable("configXML", "/global/nav/data/config.xml");
else
so.addVariable("configXML", "/global/nav/data/config.xml");
}
so.addVariable("availableSearches", availableSearches);
so.addVariable("defaultSearchType", defaultSearchType);
so.addVariable("dealerPhoneNumbers", vdealerPhoneNumbers);
so.addParam("wmode", "transparent");
so.addVariable("hybrid_page","true");
so.addVariable("black_bg","none");
so.addVariable("flashTime", flashTime);

// Create iPhone URL encoding

var iphoneEncode = "?url=http://";
iphoneEncode += hName;
iphoneEncode += "&service=";

// Extract service phone # from vdealerPhoneNumbers
// First, find the index of "service" in the string using a case-insensitive search
var intServiceLocation = vdealerPhoneNumbers.search(/service/i);
var strService = "";
if (intServiceLocation > 0) {
    var intBegin = intServiceLocation + 9; // "service: " = 9 characters

    // end will be the index of the next semicolon -1 (we don't want the semicolon itself)
    var intEnd = vdealerPhoneNumbers.indexOf(";", intBegin) - 1;
    if (intEnd > 0) {
        strService = vdealerPhoneNumbers.slice(intBegin, intEnd);
    }
}
//if getServicePhone exists, add it to the iPhoneEncode String, else add nothing
try{
	iphoneEncode += getServicePhone();
}
catch(err){
	iphoneEncode = '';
}

//iphoneEncode += strService;
try{
	if(getDealerCookie('dealersession') == 'true'){
		so.addVariable("dealersession", "true");
		so.addVariable("dealerdomain", getDealerCookie('dealerdomain'))
	}
}catch(e){
}

so.setAttribute("redirectUrl", external+"/update/en/us/" + iphoneEncode);
so.write(id);

},
addFooter : function(id, color,vaddin)
{
/*
var addin;
try{
addin = vaddin;
}catch(e){
addin = false;
}
var so = new SWFObject("/global/shell/swf/shell.swf", "swf_footer", "1000", "53", getFlashVersion(), "color", false, "high");
so.addVariable("configXml", "/global/hybrid/data/config_footer_en_us.xml");
so.addParam("wmode", "transparent");
so.addVariable("black_bg","none");
so.addVariable("no_widget","true");
if(addin == "external")
{
so.addVariable("externalDomain", external);
so.addVariable("livesOnExternalSite", "true");
so.addParam("allowScriptAccess", "always");
}
so.write(id);
*/
},
addEmail : function(template, model)
{
util.getNode("container").innerHTML += '<div id="emailMask" onMouseOver="doNothing();"></div><div id="emailDiv"></div>';
var so = new SWFObject("/global/email/swf/email.swf", "swf_email", "100%", "100%", getFlashVersion(), "#ffffff", false, "high");
so.addVariable("hybridEmail", "true");
so.addVariable("email_template_name", template);
so.addVariable("email_car_model", model);
so.addParam("wmode", "transparent");
so.write("emailDiv");
}
}
vw.util =
{
addScript : function(inScript)
{
var script = document.createElement("script");
script.setAttribute("type","text/javascript");
script.setAttribute("src", inScript);
document.getElementsByTagName("head")[0].appendChild(script);
},
addCSS : function(inCSS)
{
	var css = document.createElement("link");
	css.setAttribute("type","text/css");
	css.setAttribute("src", inCSS);
	css.setAttribute("rel", "stylesheet");
	document.getElementsByTagName("head")[0].appendChild(css);
},
getQueryString : function()
{
var qs = top.location.search;
return escape(qs.substring(1, qs.length));
},
getQueryStringValue : function(key)
{
var args = new Object();
var query = location.search.substring(1);
var pairs = query.split("&"); 
var counter = 0;
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('=');
if (pos == -1) continue;
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1); 
if (!args[argname]) {
args[argname] = unescape(value);
}
else {
args[argname] += ("&" + argname + "=" + unescape(value));
}
}
return args[key];
},
getURL : function(uri)
{
window.location = uri;
},
popup : function(uri)
{
window.open(uri);
},
widgetReady : function()
{
    try{
        onWidgetReady();
    }catch(e){
    }
},
widgetLoadComplete : function()
{
try{
    bodyOnLoadComplete();
    getShell();
}catch(e){}
},
print : function(inParams,width,height)
{
if(!width)
width = 600;

if(!height)
height = 600;
var wp = "WIDTH=" + width + ",HEIGHT=" + height + ",screenX=0,screenY=0,LEFT=0,TOP=0,CHANNELMODE=0,DEPENDENT=0,DIRECTORIES=0,FULLSCREEN=0,LOCATION=0,MENUBAR=0,RESIZABLE=1,SCROLLBARS=1,STATUS=0,TOOLBAR=0";
var domain = window.location.href.split("/")[2];
var w = window.open("http://"+domain+inParams, "vwPrint", wp);
// External Interface Addition
function getShell() {
    if (document.getElementById) {
        shellElement = document.getElementById("swf_shell");
    }
}

window.onUnload = function(){
	//alert('unload');
    shellElement.endDealerSession();
}
// End External Interface Addition
if(!w.opener)
w.opener = self;
}
}
vw.tooltip =
{
add : function(inName)
{
try{
var d = util.getNode(inName);
d.onmouseover = function()
{
vw.tooltip.show(inName);
};
d.onmouseout = function()
{
vw.tooltip.hide();
};
}catch(e){}
},
get : function(inName)
{
var tooltip = util.getNode(inName);
if(tooltip == null)
{
util.createNode("body", inName, inName);
pngpong.serve(inName, "/global/images/comingSoon.png");
}
var tooltip = util.getNode(inName);
return tooltip;
},
show : function(inTarget)
{
var tooltip = vw.tooltip.get("comingSoon");
var newX = YAHOO.util.Dom.getX(inTarget)+8;
var newY = YAHOO.util.Dom.getY(inTarget)-20;
YAHOO.util.Dom.setX("comingSoon", newX);
YAHOO.util.Dom.setY("comingSoon", newY);
util.setStyle("comingSoon", "visibility", "visible");
util.setStyle("comingSoon_img", "visibility", "visible");
},
hide : function()
{
util.setStyle("comingSoon", "visibility", "hidden");
util.setStyle("comingSoon_img", "visibility", "hidden");
}
}
if(typeof util=="undefined"){var util=new Object();}
util=
{
GET_DATA : Array(),
addSwf : function(inIdName, inSwf, inSwfId, inW, inH, inWmode, inColor, inVars)
{
try
{
var so;
if(inColor == undefined || inColor == "")
so = new SWFObject(inSwf, inSwfId, inW, inH, getFlashVersion(), "#FFFFFF", false, "high");
else
so = new SWFObject(inSwf, inSwfId, inW, inH, getFlashVersion(), inColor, false, "high");
so.addParam("swliveconnect", "true");
if(inWmode)
so.addParam("wmode", "transparent");
so.addParam("allowScriptAccess", "always");
if(inVars != undefined || inVars != "")
{
}
else
{
var data = this.getNameValuePairObject(inVars);
for(var i in data)
{
so.addVariable(i, data[i]);
}
so.write(inIdName);
}
}
catch(e)
{

}
},
removeSwf : function(inSwfId)
{
try
{
var delNode = this.getNode(inSwfId);
delNode.parentNode.removeChild(delNode);
}
catch(e)
{

}
},
changeElementProp : function(inItemToMove, inItemToPositionBy, inAttribute, posToSetTo, inSuffix)
{
var itemToMove = this.getNode(inItemToMove);
var itemToPositionBy = this.getNode(inItemToPositionBy);
if(posToSetTo == undefined)
posToSetTo = 0;
switch(inAttribute)
{
case "baseline":
var itemToMove_height = itemToMove.offsetHeight;
var itemToPositionBy_height = itemToPositionBy.offsetHeight;
this.setStyle(inItemToMove, "top", itemToPositionBy_height - itemToMove_height + posToSetTo, inSuffix);
break;
default:
this.setStyle(inItemToMove, inAttribute, posToSetTo, inSuffix);
break;
}
},
changeClass : function(inElement, inClass)
{
try{
var element = this.getNode(inElement);
}catch(e){
}
try{
element.className = inClass;
}catch(e){
}
},
setStyle : function(inElement, inAttribute, inValue, inSuffix)
{
var element = this.getNode(inElement);
var value = (inSuffix != undefined)? inValue + inSuffix : inValue;
element.style[inAttribute] = value;
},
setWidgetHeight : function(inValue, disableShim)
{
this.setStyle("flashid", "height", inValue, "px");
/* temp fix for widget over select z-index issue */
var location = window.location.href.split("/");
var affectedPages= "contactadealer quote joyride ownerperks lineup";
if (affectedPages.indexOf(location[3]) != -1 || affectedPages.indexOf(location[4]) != -1 ||  affectedPages.indexOf(location[5]) != -1) {
	if (navigator.userAgent.indexOf("MSIE 6.0")!=-1) {
		var triggerHeight = 350;
		if(location[3].toLowerCase() == "contactadealer" || location[4].toLowerCase() == "contactadealer" || affectedPages.indexOf(location[5]) != -1) {
			triggerHeight=130;
		}
		if(widgetShimOverride == true){
			triggerHeight=130;
		}
		if(inValue > triggerHeight) {
			if(disableShim != true)
				document.all.widgetShim.style.display = "block";
		} else {
			document.all.widgetShim.style.display = "none";
		}
	} 
}
/* end temp fix */
},
createNode : function(inParentElement, inIdName, inClassName)
{
var newElement = document.createElement('div');
newElement.className = inClassName;
newElement.id = inIdName;
var parentElement = this.getNode(inParentElement);
parentElement.appendChild(newElement);
},
getNode : function(inElement)
{
if(window.document[inElement])
{
return window.document[inElement];
}
if(navigator.appName.indexOf("Microsoft Internet")==-1)
{
if(document.embeds && document.embeds[inElement])
{
return document.embeds[inElement];
}
else
{
return document.getElementById(inElement);
}
}
else
{
return document.getElementById(inElement);
}
},
getLocation : function()
{
var loc = new String(window.location);
return loc;
},
getBrowser : function()
{
var appName = navigator.appName;
var userAgent = navigator.userAgent.toLowerCase();
var browser = '';
if((appName.indexOf('Microsoft') != -1) && (userAgent.indexOf('mac') == -1))
{
return 'ie';
}
else if((appName.indexOf('Microsoft') != -1) && (userAgent.indexOf('mac') != -1))
{
return 'other';
}
else if (userAgent.indexOf('safari') != -1)
{
return 'safari';
}
else if (userAgent.indexOf('firefox') != -1)
{
return 'firefox';
}
else
{
return 'other';
}
},
getUrlData : function()
{
var data = new Array();
var getDataString = new String(window.location);
var questionMarkLocation = getDataString.search(/\?/);
var hashLocation = getDataString.search(/\#/);
if (questionMarkLocation!=-1)
{
getDataString = getDataString.substring(questionMarkLocation+1, hashLocation).split(/\&/).join("|");
data = getDataString;
}
else
{
data = "";
}
return escape(data);
},
getUrlData_sc : function()
{
var data = new Array();
var getDataString = new String(window.location);
var questionMarkLocation = getDataString.search(/\?/);
var hashLocation = getDataString.search(/\#/);
if (questionMarkLocation!=-1)
{
getDataString = getDataString.substring(questionMarkLocation+1, hashLocation);//
data = getDataString;
}
else
{
data = "";
}
return data;
},
getUrlHash : function()
{
var data = new Array();
var getDataString = new String(window.location);
var hashLocation = getDataString.search(/\#/);
if (hashLocation!=-1)
{
getDataString = getDataString.substr(hashLocation+1).split(/\&/).join("|");
data = getDataString;
}
else
{
data = "";
}
return escape(data);
},
getNameValuePairObject : function(str)
{
var data = new Array();
var getDataArray = str.split(/&/g);
for (var i=0; i<getDataArray.length; i++)
{
var nameValuePair = getDataArray[i].split(/=/);
data[unescape(nameValuePair[0])] = unescape(nameValuePair[1]);
}
return data;
},
getNameValuePairArray : function(str)
{
var data = new Array();
var getDataArray = str.split(/&/g);
for (var i=0; i<getDataArray.length; i++)
{
var nameValuePair = getDataArray[i].split(/=/);
data[i] = new Array();
var name = (unescape(nameValuePair[0]) == 'undefined')? "" : unescape(nameValuePair[0]);
var value = (unescape(nameValuePair[1]) == 'undefined')? "" : unescape(nameValuePair[1]);
data[i].push(name, value);
}
return data;
},
include_js : function(script_filename)
{
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', script_filename);
html_doc.appendChild(js);
return false;
},
checkIfSafari : function()
{
return (navigator.vendor == "Apple Computer, Inc.");
},
swapDiv : function(inVisible, inHide)
{
util.setStyle(inVisible, "visibility", "visible");
util.setStyle(inHide, "visibility", "hidden");
},
addComma : function(inNum)
{
var tmp = String(inNum).split("");
var output = "";
var counter = 0;
for(var i=tmp.length-1; i>=0; i--)
{
if(counter==3)
{
counter=0;
output = "," + output;
}
counter+=1;
output = tmp[i] + output;
}
return output;
},
writeHtmlComment : function(inItem)
{
document.write('<' + '!--' + inItem + '-' + '->');
}
}
function setFlashWidth(divid, newW){
document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
setFlashWidth(divid, newW);
setFlashHeight(divid, newH);
}
function canResizeFlash(){
var ua = navigator.userAgent.toLowerCase();
var opera = ua.indexOf("opera");
if( document.getElementById ){
if(opera == -1) return true;
else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
}
return false;
}
function returnURL(){
return top.location.toString();
}
function returnDomain(){
var temp = top.location.href.split("/");
var domain = temp[2]; 
return domain.toString();
}
function getUrlType() {
var loc = top.location.toString().toLowerCase();
var cpwPattern = /^http:\/\/(216.64.217.145)/;
var intgPattern = /^http:\/\/(integration.vw.com)/;
var stagingIPPattern = /^http:\/\/(206\.31\.11\.135)/;
var prodIPPattern = /^http:\/\/(206\.31\.11\.136)/;
var developmentPattern = /^http:\/\/(redesign|cpbdev)\.(cpbinteractive|vw)\.com*/;
var stagingPattern = /^http:\/\/(redesign|stage|wwwcdn)\.(cpbinteractive|vw)\.com*/;
var staging08Pattern = /^http:\/\/(stage08.vw.com)/;		
var localhostservicesPattern = /^http:\/\/(localhostservices)/;
var productionPattern = /^http:\/\/(beta\.|www\.|www\d{1,4}\.|\d{1,4}www\.|ownerperks\.)(cpbinteractive|vw)\.com*/;
var productionPattern2 = /^http:\/\/(vw.com)/;
var productionPattern3 = /^https:\/\/(www\.|ownerperks\.)(vw)\.com*/;
if(cpwPattern.test(loc)){
return "cwpdev";
}else if(intgPattern.test(loc)){
return "integration";
}else if(stagingIPPattern.test(loc)){
return "staging-ip";
}else if(prodIPPattern.test(loc)){
return "production-ip";
}else if (developmentPattern.test(loc)) {
return "development";
} else if (stagingPattern.test(loc)) {
return "staging";
} else if (staging08Pattern.test(loc)) {
return "staging08";
} else if (productionPattern.test(loc)) {
return "production";
} else if (productionPattern2.test(loc)) {
return "production";
} else if (productionPattern3.test(loc)) {
return "production";
} else if (localhostservicesPattern.test(loc)) {
return "localhostservices";
} else {
return "development";
}
}
function setServicesURL(url){
	servicesURL = url;
}
function getServicesURL(){
	return servicesURL;
}
function maximizeWindow() {}
function updateFlashHolderSize() {}
function repositionEmail() {
var scrollObj = getScrollXY();
document.getElementById("emailDiv").style.top = scrollObj[1] + 150 + "px";
timeout = setTimeout("repositionEmail()", 10);
}
function getScrollXY() {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}
function getWindowSize() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return [myWidth, myHeight];
}
function showEmail() {
var scrollObj = getScrollXY();
document.getElementById("emailMask").style.visibility = "visible";
document.getElementById("emailMask").style.height = document.body.scrollHeight + 120 + "px";
document.getElementById("emailDiv").style.visibility = "visible";
document.getElementById("emailDiv").style.top = scrollObj[1] + 150 + "px";
repositionEmail();
return false;
}
function hideEmail() {
document.getElementById("emailDiv").style.visibility = "hidden";
document.getElementById("emailMask").style.visibility = "hidden";
clearTimeout(timeout);
return false;
}
function setCookie (name, value) {
 document.cookie = name + '=' + escape(value)+ ";";
}
function getCookie(name) {
if (new RegExp("(?:^|;)"+name+"(?:$|=)([^;]+)").test(document.cookie)) {
	return unescape(RegExp.$1);
return unescape(RegExp.$1);
} else {
return '';
}
}
function doNothing() {	}
function widgetReady() {  }
function openWin(url){
var x = 100, y = 220;
if (document.all) {
x = window.screenTop + 0;
y = window.screenLeft + 180;
}
else if (document.layers) {
x = window.screenX + 0;
y = window.screenY + 180;
}
var wp = "WIDTH=1000,HEIGHT=600,screenX="+x+",screenY="+y+",LEFT="+x+",TOP="+y+",CHANNELMODE=0,DEPENDENT=0,DIRECTORIES=0,FULLSCREEN=0,LOCATION=1,statusbar=1,MENUBAR=1,RESIZABLE=1,SCROLLBARS=1,STATUS=1,TOOLBAR=1";
var w = window.open(url, "VW Search", wp);
}
//vw.util.addScript("/global/js/swfobject.js");
var siteDomain = "";
try{
	siteDomain = (isExternalSite)? "http://www.vw.com" : "";
}catch(e){}

var siteurl = window.location.href;


var dealersession = {};
dealersession.isDealerSession = false;
function dealerSessionReady(sessionObj){
    dealersession = sessionObj;
	try{
		void(jQuery);
		var doc = $(document);
		doc.trigger('session:dealer', [sessionObj]);
	}catch(e){
		//no op
	}
	if(sessionObj.isDealerSession){
		try{
			//replace find a dealer
			var pTag1 = window.document.getElementById("buy_findADealer_img");
			var loc = pTag1.src;
			var imgType = ""
			if(loc.indexOf('.png') != -1){
			    imgType = '.png';
			}else{
			    imgType = '.gif';
			}
		    var locArr = loc.split('/');
			var baseImagePath = "/"
			for(var i = 3; i < locArr.length-1; i++){
				baseImagePath += locArr[i] + "/";
			}
			baseImagePath += "buy_contactDealer_";
		    //var baseImagePath = "/"+locArr[3]+"/"+locArr[4]+"/"+locArr[5]+"/"+locArr[6]+"/"+locArr[7]+"/"+locArr[8]+"/buy_contactDealer_";
		    var basePingPong = "pngpong.util.swapImage('buy_findADealer_img', '";
		    pTag1.src = baseImagePath+"out"+imgType;
		    pTag1.setAttribute("onmouseover", basePingPong+baseImagePath+"over"+imgType+"');");
		    pTag1.setAttribute("onmouseout", basePingPong+baseImagePath+"out"+imgType+"');");
		    pTag1.setAttribute("onmousedown", "window.location='http://"+sessionObj.dealerDomain+"/ContactUsForm'");
		    if(util.getBrowser() == "ie"){
		        pTag1.onmouseover = function(){pTag1.src = baseImagePath+"over"+imgType};
		        pTag1.onmouseout = function(){pTag1.src = baseImagePath+"out"+imgType};
		        pTag1.onmousedown = function(){window.location='http://'+sessionObj.dealerDomain+'/ContactUsForm';};
		    }
		}catch(e){
		    //alert('error found');
		}
	}
}

var daasession = {};
daasession.isDaaSession = false;
function daaSessionReady(sessionObj){
    daasession = sessionObj;
	if(daasession.isDaaSession == true){
		try{
			void(jQuery);
			var doc = $(document);
			doc.trigger('session:daa', [sessionObj]);
		}catch(e){
			//no op
		}
	}
}

function getFlashVersion(){return "9.0.45.0";}
var d = new Date();
var flashTime = d.getTime();

function setDealerCookie(id, external){
	try{
		var loc = window.location.href.split("/");
		//util.getNode('body').innerHTML += '<div id="vdubcookie"></div>';
		//var domainType = getUrlType();
		//var iframeurl = external+'/dealerframe.html?loc='+loc[2];
		//document.getElementById('vdubcookie').innerHTML = '<IFRAME src="'+iframeurl+'" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>';
	}catch(e){
		//alert(e);
	}
}
function getDealerCookie(c_name){
	/*
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	*/
	return "";
}

function getDealerJSONP(id, external, so){
	/*
	var dealersession;
	var dealerdomain;
	try{
		var d = window.location.href.split("/")[2];
		if(d == "www.cmgestore.com" || d == "fakedealer"){
			$.getJSON(external+"/dealerjsonp.php?jsoncallback=?", function(data){
				if(data.dealersession == true || data.dealersession == "true"){
					dealerdomain = data.dealerdomain;
					dealersession = data.dealersession;
					so.addVariable('dealersession', dealersession);
					so.addVariable('dealerdomain', dealerdomain);
					so.write(id);
				}else{
					so.write(id);
				}
			});
		}else{
			so.write(id);
		}
	}catch(e){
		so.write(id);
	}
	*/
}
/*
// make sure jquery has loaded
try{
	var d = window.location.href.split("/")[2];
	var externalDomain = "http://www.vw.com";
	switch(getUrlType()){
		case "development":
			externalDomain = "http://redesign.cpbinteractive.com";
			break;
		case "staging":
			externalDomain = "http://stage.vw.com";
			break;
		case "staging08":
			externalDomain = "http://stage08.vw.com";
			break;
		case "cpwdev":
			externalDomain = "http://216.64.217.145";
			break;
		case "production":
			externalDomain = "http://www.vw.com";
			break;
	}
	externalDomain = "http://www.vw.com";
	if(d.indexOf("cmgestore") != -1 || d.indexOf("fakedealer") != -1){
		var filename = externalDomain+"/global/js/jquery/jquery-1.2.3.pack.js";
		var fileref = document.createElement('script');
		fileref.setAttribute("type","text/javascript");
		fileref.setAttribute("src", filename);
		document.getElementsByTagName("head")[0].appendChild(fileref);
	}
}catch(e){
}
*/


switch(getUrlType()){
	case "development":
		setServicesURL("redesignservices.cpbinteractive.com");
		break;
	case "integration":
		setServicesURL("integration.vw.com");
		break;
	case "staging-ip":
		setServicesURL("206.31.11.135");
		break;
	case "production-ip":
		setServicesURL("206.31.11.136");
		break;
	case "staging":
		setServicesURL("stageservices.vw.com");
		break;
	case 'production':
		setServicesURL("servicesvw.vw.com");
		break;
	default:
		setServicesURL("servicesvw.vw.com");
		break;
}


