// Jorge Moreno (c) 2005 . www.alterebro.com
window.defaultStatus = '  MercsOnly. Mercedes Garage London '

function XHConn() {
var xmlhttp, bComplete = false;
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) { try { xmlhttp = new XMLHttpRequest(); }
catch (e) { xmlhttp = false; }}}
	if (!xmlhttp) return null;
  		this.connect = function(sURL, sMethod, sVars, fnDone) {	
    		if (!xmlhttp) return false;
    		bComplete = false;
    		sMethod = sMethod.toUpperCase();
			    try {
      				if (sMethod == "GET") {
        				xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        				sVars = "";
      				} else {
        				xmlhttp.open(sMethod, sURL, true);
        				xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        				xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
     				}
     	xmlhttp.onreadystatechange = function() {
        	if (xmlhttp.readyState == 4 && !bComplete) {
          		bComplete = true;
          		fnDone(xmlhttp);
        	}
		};
      		xmlhttp.send(sVars);
    	}
    	catch(z) { return false; }
		return true;
	};
return this;
}

function filter() {
	var ajax_filter = new XHConn();
	if (ajax_filter) {
		ajax_enabled = true
		document.write('<style type="text/css" media="all">@import "css/mercsonly.css"; </style>');
	}
}
filter();

// get external data. via-XHConn
function get_page(targetId,url,params) {
	target= document.getElementById(targetId);
	target.innerHTML = '<img src="img/loading_data.gif" />';
	var myConn = new XHConn();
    	if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
    	var query = function (oXML) {  target.innerHTML = oXML.responseText; };
    myConn.connect(url, "GET", params, query);
}

function switch_section(url,height,picture) {
	document.getElementById('picture').innerHTML = '<img src="'+picture+'" />'
	document.getElementById('content').style.height = height+"px"
	get_page('content',url)
	
}

function write_flash() {
	if (ajax_enabled == true) {
		var fc ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="720" height="120">';
		fc +=	'	<param name="movie" value="swf/header.swf"> <param name="menu" value="false"> <param name="scale" value="noscale"> <param name="salign" value="LT"> <param name="bgcolor" value="#000000"> <param name="quality" value="best">';
		fc +=	'	<embed src="swf/header.swf" width="720" height="120" menu="false" scale="noscale" salign="LT" bgcolor="#000000" quality="best" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		fc +=	'</object>';
		document.getElementById('header').innerHTML=fc;
	}
}
function make_buttons() {
	document.getElementById('our_services').innerHTML = '<img src="img/button_ourservices.gif" onmouseover="this.src=\'img/button_ourservices_over.gif\'" onmouseout="this.src=\'img/button_ourservices.gif\'" />'
	document.getElementById('about_us').innerHTML = '<img src="img/button_aboutus.gif" onmouseover="this.src=\'img/button_aboutus_over.gif\'" onmouseout="this.src=\'img/button_aboutus.gif\'" />'
	document.getElementById('locations').innerHTML = '<img src="img/button_locations.gif" onmouseover="this.src=\'img/button_locations_over.gif\'" onmouseout="this.src=\'img/button_locations.gif\'" />'
	document.getElementById('bodyshop').innerHTML = '<img src="img/button_bodyshop.gif" onmouseover="this.src=\'img/button_bodyshop_over.gif\'" onmouseout="this.src=\'img/button_bodyshop.gif\'" />'
}
window.onload = function() {
	write_flash()
	make_buttons()
}