if (typeof vcc != "object")
	vcc = new Object();

vcc.userAgent = navigator.userAgent.toLowerCase();
vcc.win = (vcc.userAgent.indexOf("win") > -1);
vcc.mac = (vcc.userAgent.indexOf("mac") > -1);
vcc.ie = (vcc.userAgent.indexOf("msie") > -1);
vcc.w3c = (document.getElementById && !vcc.ie);
vcc.opera = (vcc.userAgent.indexOf("opera") > -1);
vcc.safari = (vcc.userAgent.indexOf("safari") > -1);
vcc.ns6 = (vcc.userAgent.indexOf("netscape6") > -1);
vcc.version = (vcc.ie) ? parseFloat(navigator.appVersion.match(/MSIE\s(\d+\.\d+)/)[1]) : null;

vcc.getObj = function(strLayer) {
	if(typeof(strLayer) == "object") return strLayer;
	var elmLayer = document.getElementById(strLayer);
	if (!elmLayer)
		elmLayer = document.getElementsByName(strLayer)[0];
	return elmLayer;
}

vcc.show = function() {
	for (var i=0; i<vcc.show.arguments.length; i++) {
		if ((elmLayer=vcc.getObj(vcc.show.arguments[i])))
			elmLayer.style.visibility = "visible";
	}
}

vcc.hide = function() {
	for (var i=0; i<vcc.hide.arguments.length; i++) {
		if ((elmLayer=vcc.getObj(vcc.hide.arguments[i])))
			elmLayer.style.visibility = "hidden";
	}
}

vcc.setDisplay = function(strLayer,strValue) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	elmLayer.style.display = strValue;
}

vcc.getX = function(strLayer,blnGlobal) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	var currentX = elmLayer.offsetLeft;
	if (blnGlobal) {
		while (elmLayer.offsetParent) {
			elmLayer = elmLayer.offsetParent;
			currentX += elmLayer.offsetLeft;
		}
	}
	return currentX;
}

vcc.getY = function(strLayer,blnGlobal) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	var currentY = elmLayer.offsetTop;
	if (blnGlobal) {
		while (elmLayer.offsetParent) {
			elmLayer = elmLayer.offsetParent;
			currentY += elmLayer.offsetTop;
		}
	}
	return currentY;
}

vcc.getW = function(strLayer) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	if (window.getComputedStyle) {
		var style=getComputedStyle(elmLayer, null);
		return parseInt(style.getPropertyValue('width'));
	}
	else if (elmLayer.style.pixelWidth)
		return elmLayer.style.pixelWidth;
	else if(elmLayer.offsetWidth)
		return elmLayer.offsetWidth;
}

vcc.getH = function(strLayer) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	if (window.getComputedStyle) {
		var style=getComputedStyle(elmLayer, null);
		return parseInt(style.getPropertyValue('height'));
	}
	else if (elmLayer.style.pixelHeight)
		return elmLayer.style.pixelHeight;
	else if(elmLayer.offsetHeight)
		return elmLayer.offsetHeight;
}

/*
vcc.getScrollW = function(strLayer) {
	if (!(elmLayer=vcc.getObj(strLayer))) return false;
	if (vcc.ie)
		return (vcc.mac) ? elmLayer.offsetWidth : elmLayer.scrollWidth;
	else if(vcc.w3c)
		return elmLayer.offsetWidth;
}*/

vcc.moveTo = function(strLayer, x, y, bRight) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	if (bRight) {
		if (x || x==0) elmLayer.style.right = x + "px";
	} 
	else {
		if (x || x==0) elmLayer.style.left = x + "px";
	}
	if (y || y==0) elmLayer.style.top = y + "px";
}

vcc.moveBy = function(strLayer, x, y, bRight) {
	vcc.moveTo(strLayer, vcc.getX(strLayer) + x, vcc.getY(strLayer) + y, bRight);
}

vcc.clip = function(strLayer,t,r,b,l) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	elmLayer.style.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}

/*
vcc.clipBy = function(strLayer,dt,dr,db,dl){
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	var c=elmLayer.currentStyle.clip.substr(5);
	c=c.substr(0,c.length-3).split("p");
	c[1] = c[1].substr(2);
	c[2] = c[2].substr(2);
	c[3] = c[3].substr(2);
	var t=dt+(c[0]*1);
	var r=dr+(c[1]*1)+dl;
	var b=db+(c[2]*1)+dt;
	var l=dl+(c[3]*1);
	elmLayer.style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}*/

vcc.preload = function(strName, strSrc, blnDoNotPreload) {
	if(blnDoNotPreload) eval(strName + " = new Object();");
	else eval(strName + " = new Image();");
	eval(strName+".src = '"+strSrc+"';");
}

/*
vcc.swapImage = function(strTarget, strNewPic, urlNewPic){
	var objImage=vcc.getObj(strTarget);
	if(objImage){
		if(strNewPic && eval("typeof(" + strNewPic +  ")") == "object")
			objImage.src=eval(strNewPic+".src");
		else if (urlNewPic)
			objImage.src = urlNewPic;
	}
}*/

vcc.setOpacity = function(strLayer, intValue) {
	if (!(objLayer=vcc.getObj(strLayer)))
		return false;
	if (vcc.ie)
		objLayer.style.filter = "alpha(opacity=" + intValue + ")";
	else if (vcc.w3c) {
		objLayer.style.MozOpacity = intValue/100;
	}
}

vcc.getDocumentWidth = function(blnContent) {
	var w;
	if (window.innerWidth) // Mozilla
		w = (blnContent) ? document.documentElement.offsetWidth : window.innerWidth
	else { // IE
		if (document.compatMode && document.compatMode != "BackCompat")
			w = (blnContent) ? document.documentElement.scrollWidth : document.documentElement.clientWidth;
		else
			w = (blnContent) ? document.body.scrollWidth : document.body.clientWidth;
	}
	return w;
}

vcc.getDocumentHeight = function(blnContent) {
	var h;
	if (window.innerHeight) // Mozilla
		h = (blnContent) ? document.documentElement.offsetHeight : window.innerHeight;
	else { // IE
		if (document.compatMode && document.compatMode != "BackCompat")
			h = (blnContent) ? document.documentElement.scrollHeight : document.documentElement.clientHeight;
		else
			h = (blnContent) ? document.body.scrollHeight : document.body.clientHeight;
	}
	return h;
}

vcc.addEvent = function(strLayer, strEvent, strFunction, bRemove) {
	if (!(elmLayer=vcc.getObj(strLayer)))
		return false;
	if (bRemove) {
		if (elmLayer.removeEventListener) {
			elmLayer.removeEventListener(strEvent, eval(strFunction), false);
		} else if (elmLayer.detachEvent) {
			elmLayer.detachEvent("on" + strEvent, eval(strFunction));
		}
	}
	else {
		if (elmLayer.addEventListener) {
			elmLayer.addEventListener(strEvent, eval(strFunction), false);
		} else if (elmLayer.attachEvent) {
			elmLayer.attachEvent("on" + strEvent, eval(strFunction));
		} else { // For browsers that don't have any of the addEventListener or attachEvent methods, we create a attachEvent method (NN4.x and IE 5.x on Mac)
			if (!eval("elmLayer.addedEventFunctions_" + strEvent))
				eval("elmLayer.addedEventFunctions_" + strEvent + " = ''");
			eval("elmLayer.addedEventFunctions_" + strEvent + " += '" + strFunction + "(); '");
			eval("elmLayer.on" + strEvent + " = new Function('" + eval("elmLayer.addedEventFunctions_" + strEvent) + "')");
		}
	}
}

vcc.getElementsByAttribute = function (strAttribute, strSearchValue, elmLayer, strTagName, bParentAxis, bPartialMatch) {
	strTagName = strTagName || "*";
	elmLayer = vcc.getObj(elmLayer) || document;
	var arElements = [];	
	if (bParentAxis) {
		// Look for parents
		while ((elmLayer = elmLayer.parentNode)) {
			var sAttrValue = elmLayer.getAttribute(strAttribute);
			if ((!strTagName || elmLayer.nodeName == strTagName) && 
				((strAttribute == "class" && (elmLayer.className == strSearchValue || (bPartialMatch && elmLayer.className.indexOf(strSearchValue) > -1))) ||
				(strSearchValue && (elmLayer.getAttribute(strAttribute) == strSearchValue || (bPartialMatch && sAttrValue && sAttrValue.indexOf(strSearchValue) > -1))) || 
				(!strSearchValue && sAttrValue))) {
					arElements.push(elmLayer);
			}
		}
	}
	else {
		// Look for children
		var arAllElements = elmLayer.getElementsByTagName(strTagName);
		var arElements = [];
		for (var i=0; i<arAllElements.length; i++) {
			var sAttrValue = arAllElements[i].getAttribute(strAttribute);
			if ((strAttribute == "class" && (arAllElements[i].className == strSearchValue || (bPartialMatch && arAllElements[i].className.indexOf(strSearchValue) > -1))) || 
				(strSearchValue && (sAttrValue == strSearchValue || (sAttrValue && sAttrValue.indexOf(strSearchValue) > -1))) ||
				(!strSearchValue && sAttrValue)) {
					arElements.push(arAllElements[i]);
			}
		}
	}
	return arElements.slice(0);
}

vcc.elementGetElementsByName = function (strName, strTagName, elmLayer) {
	strTagName = strTagName || "*";
	elmLayer = elmLayer || document;
	var arAllElements = elmLayer.getElementsByTagName(strTagName);
	var arElements = [];
	for (var i=0; i<arAllElements.length; i++) {
		if (arAllElements[i].name == strName)
			arElements[arElements.length] = arAllElements[i];
	}
	return arElements.slice(0);
}

vcc.openWindow = function(strURL,strName,strOptions,bDoNotReturnWindow) {
	if (!strOptions) strOptions = "location=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,";
	else {
		//parse the strOptions variable to get width and height
		var arWidth = strOptions.match(/width=[0-9]+/i);
		var arHeight = strOptions.match(/height=[0-9]+/i);
		if (arWidth != null) {
			//Center window horizontally
			var intWidth = arWidth[0].substring(arWidth[0].lastIndexOf("=") + 1);
			var x = (screen.width - intWidth) / 2;
			x = (x<0) ? 0 : x
			strOptions += ",left=" + x;
		}
		if (arHeight != null) {
			//Center window vertically
			var intHeight = arHeight[0].substring(arHeight[0].lastIndexOf("=") + 1);
			var y = (screen.height - intHeight) / 2;
			y = (y<0) ? 0 : y
			strOptions += ",top=" + y;
		}
	}
	var popup = window.open(strURL,strName,strOptions);
	if (!bDoNotReturnWindow)
		return popup;
}

vcc.getQS = function(strWhich){
	var re = new RegExp( "[&\?]"+strWhich+"=([^&]*)&?", "i" );
	re.exec(window.location.href);
	return RegExp.$1;
}

vcc.setCookie = function(strName, strValue, objExpires, strPath) {
	var strCookie = strName + "=" + escape(strValue)
	if(objExpires) strCookie += ";expires=" + objExpires.toGMTString()
	if(strPath) strCookie += ";path=" + strPath
	document.cookie = strCookie
}

vcc.getCookie = function(strName) {
	var t=document.cookie.match(new RegExp(strName + "=([^;]*)"))
	return (t)?unescape(t[1]):t
}

vcc.delCookie = function(strName) {
	if (vcc.getCookie(strName)) document.cookie = strName + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"
}

if(!Array.prototype.push || [0].push(true)==true) {
	Array.prototype.push = function() {
		for(var i=0;i<arguments.length;i++){
			this[this.length]=arguments[i]
		};
		return this.length;
	}
}

String.prototype.trim = function(blnLeft, blnRight) {
	if(blnLeft) return this.replace(/^\s*/,'')
	else if(blnRight) return this.replace(/\s*$/,'')
	else return this.match(/^\s*([^\s]*)\s*$/)[1]
}

/// <summary>
/// Returns the first parent element with the specified nodeName
/// </summary>
/// <param name="strLayer">Id of the element whose parent you want to find.</param>
/// <param name="strParentNodeName">Name of the parent node.</param>
/// <param name="iDepth">Integer specifying number of levels to iterate before "giving up". Optional, default:15</param>
/// <returns>A HTML element</returns>
vcc.getParentNode = function(strLayer, strParentNodeName, iDepth) {
	var elmLayer = vcc.getObj(strLayer);
	if (!elmLayer)
		return;
	iDepth = iDepth || 15;
	elmTmpParent = elmLayer.parentNode;
	if (!elmTmpParent)
		return;
	for (var i=0; i<iDepth; i++) {
		if (elmTmpParent.nodeName == strParentNodeName.toUpperCase())
			return elmTmpParent;
		else
			elmTmpParent = elmTmpParent.parentNode;
	}
	return false;
}

/// <summary>
/// Searches through the document for an element with an id that contains a certian string. If there is a hit, the element is returned.
/// </summary>
/// <param name="strId">The partial id that should be used for the search</param>
/// <param name="strNodeName">If specified, only elements with this nodename is searched. (optional)</param>
/// <returns>An element.</returns>
vcc.getElementByIdFragment = function (strId, strNodeName) {
	strNodeName = strNodeName || "*";
	var arElements = document.getElementsByTagName(strNodeName);
	for (var i=0; i<arElements.length; i++) {
		if (arElements[i].id && arElements[i].id.indexOf(strId) > -1)
			return(arElements[i]);
	}
	return null;
}

vcc.printPage = function(objTargetFrame){
	if(window.print || (vcc.ie && vcc.win)){
		if(!objTargetFrame){
			if(window.print) window.print()
			else if(vcc.ie && !vcc.mac) vbPrintPage()
		}
		else{
			if(window.print && vcc.ie){
				objTargetFrame.focus()
				window.print()
			} 
			else if(window.print) objTargetFrame.print()
			else if(vcc.ie && !vcc.mac){
				objTargetFrame.focus()
				setTimeout("vbPrintPage()", 100)
			} 
		}
	}
}

if(vcc.ie && !window.print && !vcc.mac){
	with(document){
		writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>')
		writeln('<' + 'SCRIPT LANGUAGE="VBScript">')
		writeln('Sub window_onunload')
		writeln('  On Error Resume Next')
		writeln('  Set WB = nothing')
		writeln('End Sub')
		writeln('Sub vbPrintPage')
		writeln('  On Error Resume Next')
		writeln('  WB.ExecWB 6, 1')
		writeln('End Sub')
		writeln('<' + '/SCRIPT>')
	}
}

vcc.fixIePng = function() {
	if (vcc.ie && vcc.win && vcc.version > 5 && vcc.version < 7) {
		//Images
		for(var i=0; i<document.images.length; i++) {
			var oImg = document.images[i];
			var sUrl = oImg.src.toLowerCase();
			if (sUrl.substring(sUrl.length-3, sUrl.length) == "png") {
				var w = oImg.width;
				var h = oImg.height;
				oImg.src = "/Volvocars.web.sites/Images/1x1.gif";
				oImg.style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + sUrl + "', sizingMethod='scale')";
			}
		}
		// Background-images
		if (vcc.pngBgsToFix) {
			var arAll = document.getElementsByTagName("*");
			for (var i=0; i<arAll.length; i++) {
				if (arAll[i] && arAll[i].currentStyle && arAll[i].currentStyle.backgroundImage && arAll[i].currentStyle.backgroundImage.indexOf("url(") > -1) {
					var sUrl = arAll[i].currentStyle.backgroundImage.substring(5, arAll[i].currentStyle.backgroundImage.length - 2);
					if (sUrl.substring(sUrl.length-3, sUrl.length) == "png") {
						for (var j=0; j<vcc.pngBgsToFix.length; j++) {
							if (sUrl.indexOf(vcc.pngBgsToFix[j]) > -1) {
								arAll[i].style.backgroundImage = "none";
								arAll[i].style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + sUrl + "', sizingMethod='scale')";
							}
						}
					}
				}
			}
		}
	}
}

vcc.getStyle = function (strLayer, sStyle) {
	if (!(elmLayer=vcc.getObj(strLayer))) return false;
	if (elmLayer.currentStyle)
		return elmLayer.currentStyle[sStyle];
	else if (document.defaultView && document.defaultView.getComputedStyle) {
		var oCss = document.defaultView.getComputedStyle(elmLayer, "");
		if (oCss)
			return document.defaultView.getComputedStyle(elmLayer, "").getPropertyValue(sStyle);
	}
	else if (window.getComputedStyle)
		return getComputedStyle(elmLayer, "").getPropertyValue(sStyle);
	else if (elmLayer.style)
		return elmLayer.style[sStyle];
}

vcc.getDocScroll = function() {
	if (typeof window.pageXOffset != "undefined")
		return {x:window.pageXOffset, y:window.pageYOffset}
	else if (typeof window.scrollX != "undefined")
		return {x:window.scrollX, y:window.scrollY};
	else if (vcc.ie) {
		if (document.compatMode && document.compatMode == "CSS1Compat")
			return {x:document.body.parentNode.scrollLeft, y:document.body.parentNode.scrollTop};
		else
			return {x:document.body.scrollLeft, y:document.body.scrollTop};
	}
	return {x:0, y:0};
}

vcc.addCssRule = function(sSelector, sProperty) {
	if (!(vcc.ie && vcc.win)) {
		var arStyles = document.getElementsByTagName("style");
		if (arStyles && arStyles.length > 0 && document.createTextNode) {
			var oLastStyle = arStyles[arStyles.length - 1];
			var oRule = document.createTextNode(sSelector + " {" + sProperty + ";}");
			oLastStyle.appendChild(oRule);
		}
	}
	else if (document.styleSheets && document.styleSheets.length > 0) {
		var oLastStyle = document.styleSheets[document.styleSheets.length - 1];
		if (typeof oLastStyle.addRule == "object"){
			oLastStyle.addRule(sSelector, sProperty);
		}
	}
}

if (vcc.getQS("showerrors") == "true")
	vcc.setCookie("showerrors", "true", null, "/");
else if (vcc.getQS("showerrors") == "false")
	vcc.setCookie("showerrors", "false", null, "/");

vcc.showError = function(sError) {
	if (vcc.getCookie("showerrors") == "true" || vcc.getObj("controlpanel")) {
		var elmErrors = vcc.getObj("errors");
		if (!elmErrors) {
			elmErrors = document.createElement("div");
			document.body.appendChild(elmErrors);
			elmErrors.id = "errors";
			vcc.iErrors = 0;
		}
		elmErrors.innerHTML = "#" + vcc.iErrors + " " + sError + "<br/><br/>" + elmErrors.innerHTML;
		elmErrors.style.display = "block";
		vcc.setOpacity(elmErrors, 80);
		vcc.iErrors++;
	}
}

vcc.showBrowserTooOld = function(sLoadingDiv, sBrowserTooOld) {
	vcc.hide(sLoadingDiv);
	var elmOld = vcc.getObj("browserTooOld");
	elmOld.innerHTML = sBrowserTooOld;
	elmOld.style.display = "block";
}

// ---------- Flash stuff ------------------------------------------------------------------------------------------

vcc.sFlashExpressInstall = "/VolvoCars.Web.Sites/include/swf/expressinstall.swf";
vcc.sDefaultFlashVersion = "8";

if (vcc.ie && !vcc.mac) {
	var sVb = '<SCR' + 'IPT LANGUAGE=VBScript\> \n'+
		'Function VBGetSwfVer(i)\n' +
		'on error resume next\n' +
		'Dim swControl, swVersion\n' +
		'swVersion = 0\n' +
		'set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))\n' +
		'if (IsObject(swControl)) then\n' +
		'swVersion = swControl.GetVariable("$version")\n' +
		'end if\n' +
		'VBGetSwfVer = swVersion\n' +
		'End Function\n' +
		'</SCR' + 'IPT\> \n'
	document.write(sVb);
}

// These functions are copied from Macromedia Flash Detection Kit. They are kept untouched for easy upgrading

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}

vcc.resizeFlash = function() {
	var arFlash = vcc.getElementsByAttribute("vccIsFullScreen", "true", document);
	for (var i=0; i<arFlash.length; i++) {
		try {
			arFlash[i].width = vcc.getDocumentWidth();
			arFlash[i].height = vcc.getDocumentHeight();
		}
		catch(e) {}
	}
}

vcc.writeFlash = function(sUrl, sId, bDocumentWrite, w, h, sTransparency, sAltHtml, sDetectionMethod, sRedirectUrl, sRequiredVersion, sFlashVars, bFullScreen) {
	if (bFullScreen) {
		if (!isNaN(vcc.getDocumentWidth()))
			w = vcc.getDocumentWidth();
		if (!isNaN(vcc.getDocumentHeight()))
			h = vcc.getDocumentHeight();
		vcc.addEvent(window, "resize", "vcc.resizeFlash");
	}
	
	sRequiredVersion = (sRequiredVersion.length > 0) ? sRequiredVersion : "" + vcc.sDefaultFlashVersion;
	var arVersion = sRequiredVersion.split(",");
	var requiredMajorVersion = arVersion[0] || vcc.sDefaultFlashVersion;
	var requiredMinorVersion = arVersion[1] || 0;
	var requiredRevision = arVersion[2] || 0;
	
	// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
	var hasProductInstall = DetectFlashVer(6, 0, 65);

	// Version check based upon the values entered above in "Globals"
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	// Location visited after installation is complete if installation is required
	var MMredirectURL = escape(window.location);

	var sFlashVarsAttr = sFlashVars ? ' FlashVars="' + sFlashVars + '" ' : '';
	var sFlashVarsParam = sFlashVars ? '<param name="FlashVars" value="' + sFlashVars + '">' : '';
	var sHtml = "";
	if (hasReqestedVersion || vcc.getQS("flashConfig") == "forceFlash") {
		// Print out the object tag.
		var sFullScreen = bFullScreen ? " vccIsFullScreen=\"true\" " : "";
		// There's no ID, because there's a nasty bug in IE6 (at least) that generates JavaScript errors if ExternalInterface is used from the flash, when the object tag has an ID
		sHtml = "<object name=\"flashObject_" + sId + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " + sFullScreen +
			"width=\"" + w + "\" height=\"" + h + "\"> " +
			sFlashVarsParam +
			"<param name=\"movie\" value=\"" + sUrl + "\" /> " +
			"<param name=\"quality\" value=\"high\" /> " +
			"<param name=\"wmode\" value=\"" + sTransparency + "\" /> " +
			"<param name=\"AllowScriptAccess\" value=\"always\" /> " +
			"<embed name=\"flashEmbed_" + sId + "\" " + sFullScreen + "wmode=\"" + sTransparency + "\" src=\"" + sUrl + "\" " + sFlashVarsAttr + "quality=\"high\" width=\"" + w + "\" height=\"" + h + "\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\"></embed>" +
			"</object>";
	}
	else {
		if (vcc.getQS("flashConfig") == "forceAlt")
			sHtml = sAltHtml;
		else if (hasProductInstall && sDetectionMethod.indexOf("expressInstall") > -1) {
			// Stored value of document title used by the installation process to close the window that started the installation process
			// This is necessary to remove browser windows that will still be utilizing the older version of the player after installation is complete
			document.title = document.title.slice(0, 47) + " - Flash Player Installation";
			var MMdoctitle = escape(document.title);

			sHtml = '<object name="flashObject_' + sId + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
				//'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
				"width=\"" + w + "\" height=\"" + h + "\"> " +
				sFlashVarsParam +
				'<param name="movie" value="' + vcc.sFlashExpressInstall + '?MMredirectURL='+MMredirectURL+'&MMplayerType=ActiveX&MMdoctitle='+MMdoctitle+'" />' +
				'<embed name="flashEmbed_' + sId + '" src="' + vcc.sFlashExpressInstall + '?MMredirectURL='+MMredirectURL+'&MMplayerType=PlugIn" ' + sFlashVarsAttr + ' width="' + w + '" height="' + h + '" name="flashExpressInstall" aligh="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">' +
				'<\/embed><\/object>';
		}
		else if (sDetectionMethod.indexOf("redirect") > -1 && vcc.getQS("flashredirect").toLowerCase() != "false" && (!vcc.strAuthorMode || vcc.strAuthorMode.indexOf("Authoring") < 0)) {
			location.href = sRedirectUrl;
		}
		else if (sDetectionMethod.indexOf("altContent") > -1) {
			sHtml = sAltHtml;
		}
	}
	if (bDocumentWrite)
		document.write(sHtml);
	return sHtml;
}

vcc.getFlashMovie = function(sName) {
    if (vcc.ie && vcc.win) {
        return vcc.getObj("flashObject_" + sName);
    }
    else {
        return vcc.getObj("flashEmbed_" + sName);
    }
}








// This function now calls a wrapper function (vcc.trackEvent) instead of the supplied statistics function directly (dcsMultiTrack). This is because there are bugs in the externalinterface class (in IE at least) when sending empty strings as parameters.
vcc.trackEvent = function(sUrl, sTitle, sGroup, sSubGroup) {
	if (typeof dcsMultiTrack == "function") {
		sUrl = (sUrl == "[null]") ? "" : sUrl;
		sTitle = (sTitle == "[null]") ? "" : sTitle;
		sGroup = (sGroup == "[null]") ? "" : sGroup;
		sSubGroup = (sSubGroup == "[null]") ? "" : sSubGroup;
		dcsMultiTrack('DCS.dcsuri', sUrl, 'WT.ti', sTitle, 'WT.cg_n', sGroup, 'WT.cg_s', sSubGroup);
	}
}

// Browsercheck
var oBrowserCookie = vcc.getCookie("browserchecked"); 
if ((!document.getElementById || vcc.ns6) && (!oBrowserCookie || oBrowserCookie.length < 1)) {
	vcc.setCookie("browserchecked", "true", null, "/");
	location.href = "/oldbrowser.htm";
}

