var is = new browserCheck();
var imgExt = ".gif";
var myLayers = new Array ();
var thisAdrList = thisURL.split ("/"), menuHighlighted = false, menuDone = false;
var MENU_POS = {
	'height' : [25, 25, 20, 20, 20],'width' : [150, 170, 150, 150, 150],'block_top' : [0, 0, 16, 10, 10],'block_left' : [0, 160, 110, 140, 160, 180],'top' : [0, 25, 20, 21, 21],'left' : [101, 0, 0, 0, 0],'hide_delay' : [100, 100, 200, 200, 200],'expd_delay' : [200, 200, 200, 200, 200],'pixel_path' : 'hl//images/pixel.gif'};
function getMyLayers () {
	var children = document.body.childNodes;
	for (var ct=0;ct<children.length;ct++) {
		if (children[ct].nodeName.toLowerCase() == "div") {
			myLayers[myLayers.length] = children[ct].id}}};
function browserCheck() {
	var b = navigator.appName;
	this.agent = window.navigator.userAgent;
	this.win = (this.agent.indexOf('Win')>0);
	this.mac = (this.agent.indexOf('Mac')>0);
	switch (b) {
		case "Netscape": this.b = "ns"; break;
		case "Microsoft Internet Explorer": this.b = "ie"; break;
		default: this.b = b};
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
	if (this.ns4) {
		var d = document; var w = window;
		if (typeof d.cs == 'undefined') {
			d.cs = new Object;
			d.cs.csFix = new Object};
		d.cs.csFix.w = w.innerWidth;
		d.cs.csFix.h = w.innerHeight;
		window.onresize = NSFixFct}};
function NSFixFct() {
	var d = document; var w = window;
	if (d.cs.csFix.w != w.innerWidth || d.cs.csFix.h != w.innerHeight) {
		d.location = d.location}};
function clickReturn () {
	if (is.ie && (is.agent.indexOf("Mozilla/3") >= 0) && (is.mac)) {
		return true}
	else {
		return false}};
function layerObj (id) {
	this.id = id;
	this.obj = findLayer (this.id);
	if (is.ns4) {
		this.x = this.obj.left;
		this.y = this.obj.top}
	else {
		this.x = this.obj.offsetLeft;
		this.y = this.obj.offsetTop};
	this.pos_x = this.x;
	this.pos_y = this.y;
	this.write = writeLayer;
	this.clip = clipLayer;
	this.getWidth = getWidth;
	this.getHeight = getHeight;
	this.setHeight = setHeight;
	this.getClip = getClipValue;
	this.moveTo = moveLayerTo;
	this.moveBy = moveLayerBy;
	this.alignMiddle = alignMiddle;
	this.show = show;
	this.hide = hide};
function navObj (id) {
	this.id = id + "NavObj";
	eval (this.id+"=this");
	this.image = new imageObj (id.replace (/__/g, '_:'), new Array ("current", "x"), "navigation");
	this.over = new Function (this.id + '.image.set (' + this.id + '.image.x.src)');
	this.out = new Function (this.id + '.image.set (' + this.id + '.image.current.src)')};
function textObj (id, w, h, show) {
	this.id = id + "TextObj";
	eval(this.id+"=this");
	this.layer = new layerObj (id);
	this.layer.w = this.layer.getWidth ();
	this.layer.h = this.layer.getHeight ();
	if (w == null) {
		w = this.layer.w};
	if (h == null) {
		h = this.layer.h};
	if (show) {
		this.layer.show ()}};
function imageObj (id, preloads, urlprefix) {
	if (urlprefix == null) {
		this.url = "template/" + id.replace (/:/g, '/')}
	else {
		this.url =  urlprefix + "/" + id.replace (/:/g, '/')};
	if (is.ns4) {
		this.obj = findElement(id,0)}
	else {
		this.obj = document.images[id]};
	for (var ct=0;ct<preloads.length;ct++) {
		var suffix = "_" + preloads[ct];
		if (preloads[ct] == "_") {
			suffix = ""};
		this[preloads[ct]] = new Image ();
		if (preloads[ct] != "current") {
			this[preloads[ct]].src = imgprefix + "images/" + this.url + suffix + ".gif"}
		else {
			this[preloads[ct]].src = this.obj.src}};
	this.set = setImage};
function findElement(name, layer) {
	if (is.version < 4) {
		return document[name]};
	if (is.v == 4) {
		var curDoc = layer ? layer.document : document, elem = curDoc[name];
		if (!elem) {
			for (var i=0;i<curDoc.layers.length;i++) {
				elem = findElement (name, curDoc.layers[i]);
				if (elem) {
					return elem}}}}
	else {
		elem = document.getElementById (name)};
	return elem};
function findLayer (name) {
	if (is.ie) {
		return document.all.tags("div")[name]}
	else {
		return findElement(name,0)}};
function setImage (url) {
	this.obj.src = url};
function getWidth1 () {
	if (is.ie) {
		return (is.ie4)? this.obj.style.pixelWidth :  this.obj.offsetWidth}
	else {
		if (is.ns4) {
			if ( this.obj.document.width) {
				return ( this.obj.document.width)}
			else {
				return ( this.obj.clip.right -  this.obj.clip.left)}}
		else {
			return this.obj.style.width}};
	return -1};
function getWidth () {
	if (is.ns4) {
		return this.obj.clip.width}
	else if (is.ie) {
		return 500}
	else {
		return parseInt (this.obj.scrollWidth)};
	return -1};
function getHeight () {
	if (is.ns4) {
		return this.obj.clip.height}
	else if (is.ie) {
		return this.obj.clientHeight}
	else {
		return parseInt (this.obj.scrollHeight)};
	return -1};
function setHeight (value) {
	if (is.ns4) {
		this.obj.document.height = value}
	else {
		this.obj.style.height = value};
	return true};
function writeLayer (html) {
	if (is.ns4) {
		this.obj.document.open ();
		this.obj.document.write (html);
		this.obj.document.close ()}
	else {
		this.obj.innerHTML = html}};
function readLayer () {
	return this.obj.innerHTML};
function moveLayerTo (x, y) {
	if (x!=null) {
		this.x = x;
		if (is.ie) {
			 this.obj.style.pixelLeft = this.x}
		else {
			if (is.ns4) {
				this.obj.left = this.x}
			else {
				this.obj.style.left = this.x}}};
	if (y!=null) {
		this.y = y;
		if (is.ie) {
			 this.obj.style.pixelTop = this.y}
		else {
			if (is.ns4) {
				this.obj.top = this.y}
			else {
				this.obj.style.top = this.y}}}};
function HandlerOnChange() {
	var mySelect = document.forms[0].language;
	if (mySelect.selectedIndex>-1) {
		var value = mySelect.options[mySelect.selectedIndex].value;
		document.location.href="" +  value}};
function moveLayerBy (dx, dy) {
	this.moveTo(this.x+dx,this.y+dy)};
function clipLayer(clipleft, cliptop, clipright, clipbottom) {
	if (is.ns4) {
		this.obj.clip.left  = clipleft;
		this.obj.clip.top = cliptop;
		this.obj.clip.right = clipright;
		this.obj.clip.bottom = clipbottom}
	else {
		this.obj.style.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';}};
function getClipValue (which) {
	if (is.ns4) {
		return this.obj.clip[which]}
	else {
		if (this.obj.style.clip) {
			var clip = getIEClipValues(this.obj.style.clip);
			switch (which) {
				case "top": return clip[0];
				case "right": return clip[1];
				case "bottom": return clip[2];
				case "left": return clip[3]}}};
	return 0};
function getIEClipValues(str) {
	var clip = new Array();
	var i;
	i = str.indexOf("(");
	clip[0] = parseInt(str.substring(i + 1, str.length), 10);
	i = str.indexOf(" ", i + 1);
	clip[1] = parseInt(str.substring(i + 1, str.length), 10);
	i = str.indexOf(" ", i + 1);
	clip[2] = parseInt(str.substring(i + 1, str.length), 10);
	i = str.indexOf(" ", i + 1);
	clip[3] = parseInt(str.substring(i + 1, str.length), 10);
	return(clip)};
function show () {
	if (is.ns4) {
		this.obj.visibility = 'show'}
	else {
		this.obj.style.visibility = "visible"}};
function hide () {
	if (is.ns4) {
		this.obj.visibility = 'hide'}
	else {
		this.obj.style.visibility = "hidden"}};
function alignMiddle () {
	var pageWidth = 955, leftIndent = 0;
	if (is.ie) {
		leftIndent = (document.body.clientWidth-pageWidth)/2 + 8}
	else {
		leftIndent = (window.innerWidth-pageWidth)/2};
	left = leftIndent + this.pos_x;
	if (left <  this.pos_x) {
		left = this.pos_x};
	this.moveTo (left, this.y)};
function alignLayers() {
	for (var ct=0;ct<myLayers.length;ct++) {
		myObj = eval(myLayers[ct] + "TextObj");
		myObj.layer.alignMiddle ()}};
function wrap(text, activeURL,img) {
	var styleExtra = "";
	if (!menuDone) {
		if (menuHighlighted) {
			matches = activeURL.split ("/");
			if (matches.length == 2 && matches[matches.length] == "") {
				menuDone = true}};
		if (activeURL == thisURL.substr(0, activeURL.length)) {
			styleExtra =  " class='menuhighlight'";
			menuHighlighted = true}};
	//htmltext =  "<table cellpadding='0' cellspacing='0' border='0' style='width:100%' ><tr><td  style='padding-left:3px;" + styleExtra + "' nowrap>" + text + "</td></tr></table>"
	htmltext =  "<span style=" + styleExtra + ">" + text  + "</span><img src='images/pixel.gif' name='img"+ img +"'>";
	return htmltext};
function wrapsub(text, activeURL) {
	var styleExtra = "";
	if (!menuDone) {
		if (menuHighlighted) {
			matches = activeURL.split ("/");
			if (matches.length == 2 && matches[matches.length] == "") {
				menuDone = true}};
		if (activeURL == thisURL.substr(0, activeURL.length)) {
			styleExtra =  " class='menuhighlight'";
			menuHighlighted = true}};
	//htmltext =  "<table cellpadding='0' cellspacing='0' border='0' style='width:100%' ><tr><td  style='padding-left:3px;" + styleExtra + "' nowrap>" + text + "</td></tr></table>"
	htmltext =  "<span style=" + styleExtra + ">" + text  + "</span>";
	return htmltext};


function createLink() {
	var url = "";
	url = document.form1.language.options[document.form1.language.selectedIndex].value;
	url = url + "/" + document.form1.custType.options[document.form1.custType.selectedIndex].value + "/";
	window.location.href=url;
	return true};
function loadHTML () {
	var textItems = new Array ("bodytext");
	var contentArray = new Array ();
	for (var ct=0;ct<textItems.length;ct++) {
		myLayer =  new textObj(textItems[ct], null, null, false);
		contentArray[contentArray.length] = myLayer.layer.read ();
		myLayer.layer.write ("")};
	if (template == "tyre") {
		var text2Items = new Array ("intro", "feature", "tyre_sizes", "technology");
		for (var ct=0;ct<text2Items.length;ct++) {
			myLayer =  new textObj(text2Items[ct], null, null, false);
			contentArray[contentArray.length] = myLayer.layer.read ()}};
	parent.displayPage (contentArray, targetWindow, template)};
function displayPage (myContent, myTarget, myTemplate) {
	var myTargetObj = eval(myTarget + "TextObj");
	var myHTML = myContent[0];
	myHTML = myHTML.replace ("<xobject", "<object");
	myHTML = myHTML.replace ("<xembed", "<embed");
	myTargetObj.layer.write ("<div id='" + myTarget + "_content' class='content'>" + myHTML + "</div>");
	initScrollLayer (myTarget)};
function showContent (name) {
	var navItems = new Array ("intro", "feature", "tyre_sizes", "technology");
	var navLabels= new Array ("Intro", "Feature & Action", "Tire sizes", "3Bis"), s = "", c= "";
	for (var ct=0;ct<navItems.length;ct++) {
		if (navItems[ct] == name) {
			c = myContent[ct+3];
			if (s != "" && ct < (navItems.length)) {
				s = s + " / "};
			s = s + "<span style='color:#FFE714'>" + navLabels[ct] + "</span>"}
		else {
			if (myContent[ct+3].replace (/\W/g, "") != "") {
				if (s != "" && ct < (navItems.length)) {
					s = s + " / "};
				s = s + "<a href=\"javascript:showContent('" + navItems[ct] + "')\">" + navLabels[ct]  + "</a>"}}};
	displayTextObj.layer.write (c + contentExtender);
	subnavTextObj.layer.write (s);
	initScrollLayer ()};
function init() {
	getMyLayers ();
	window.onresize = alignLayers;
	for (var ct=0;ct<myLayers.length;ct++) {
		myObj = new textObj (myLayers[ct], null, null, true);
		myObj.layer.pos_x = myObj.layer.x;
		myObj.layer.pos_y = myObj.layer.y;
		myObj.layer.alignMiddle ()};
	initialized = true}

