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_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_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 derecha(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){
		return false;
	}	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2)){
		return false;
	}
}
	document.onmousedown=derecha
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror')){
	browser = "Konqueror";
	OS = "Linux";}
else if (checkIt('chrome')) browser = "Chrome"
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('firefox')) browser = "Firefox"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie 4')) browser = "IE 4"
else if (checkIt('msie 5')) browser = "IE 5"
else if (checkIt('msie 6.0')) browser = "IE 6"
else if (checkIt('msie 7.0')) browser = "IE 7"
else if (checkIt('msie 8.0')) browser = "IE 8"
else if (checkIt('msie')) browser = "IE"
else if (!checkIt('compatible')){
	browser = "Netscape Navigator"
	version = detect.charAt(8);}
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS){
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}
function checkIt(string){
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
function init() {
	if(OS == 'Mac'){
		document.getElementById('Mautos1').style.padding = "0 25px";
		document.getElementById('Msuvs1').style.padding = "0 21px";
		document.getElementById('Mcrossovers1').style.padding = "0 14px";
		document.getElementById('Mtodos1').style.padding = "0 26px";
	}
	borraMenu();
	borraSubs();
	if(document.getElementById('galery1')){
		muestraOculta('galery1,galery2','galery1','currenP','galeriaP');
	}
	//if(document.getElementById('interior'))
	//	muestraOculta('interior,exterior','interior','currenP','galeriaP');
	
	if(document.getElementById('van1')){
		muestraOculta('van1,van2,van3','van1','currentFTM','galeriaFTM');
	}
}

function creaEmbed(pelicula,ancho,alto) {
	cadena='<embed src="' + pelicula + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + ancho + '" height="' + alto + '" wmode="transparent"></embed>'
	document.write(cadena)
}

function miBorde(){
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}

function borraMenu(){
	var menus = new Array (5);
	  menus[0]='Mautos';
	  menus[1]='Msuvs';
	  menus[2]='Mcrossovers';
	  menus[3]='Mcamiones';
	  menus[4]='Mtodos';
	for (i=0; i<menus.length; i++){
		menuses = menus[i]+'M';
		if (document.getElementById(menus[i]+'M')) {
			document.getElementById(menus[i]+'M').style.display = 'none';
			document.getElementById(menus[i]+'1').className = menus[i];
		}
	}
}

var menus = new Array (19);
  menus[0]='ikon';
  menus[1]='fiesta';
  menus[2]='focus';
  menus[3]='fusion';
  menus[4]='mustang';
  menus[5]='ecosport';
  menus[6]='escape';
  menus[7]='explorer';
  menus[8]='expedition';
  menus[9]='edge';
  menus[10]='courier';
  menus[11]='ranger';
  menus[12]='serief';
  menus[14]='lobo';
  //menus[15]='lobo_raptor';
  menus[17]='e-150';
  menus[18]='transit';
function borraSubs() {
	for (i=0; i<menus.length; i++){
		if (document.getElementById(menus[i])) {
			document.getElementById(menus[i]).style.display = 'none';
		}
		sinsombra = menus[i]+'i';
		if (document.getElementById(sinsombra)){
			document.getElementById(sinsombra).style.backgroundColor = "#fff";
		}
	}
}
function opacalos() {
	var menus = new Array (30);
	  menus[0]='ikonIMG';
	  menus[1]='fiestaIMG';
	  menus[2]='focusIMG';
	  menus[3]='focus5ptasIMG';
	  menus[4]='focusrsIMG';
	  menus[5]='focusstIMG';
	  menus[6]='fusionsportIMG';
	  menus[7]='fusionIMG';
	  menus[8]='mustangIMG';
	  menus[9]='mustangshelbyIMG';
	  menus[10]='ecosportIMG';
	  menus[11]='escapeIMG';
	  menus[12]='explorerIMG';
	  menus[13]='explorersporttracIMG';
	  menus[14]='expeditionIMG';
	  menus[15]='expeditionmaxIMG';
	  menus[16]='expeditionkingranchIMG';
	  menus[17]='edgesportIMG';
	  menus[18]='edgeIMG';
	  menus[19]='courierIMG';
	  menus[20]='rangerIMG';
	  menus[21]='f-150IMG';
	  menus[22]='f-250superdutyIMG';
	  menus[23]='loboIMG';
	  //menus[24]='lobokingranchIMG';
	  menus[24]='loboraptorIMG';
	  menus[25]='lobolimitedIMG';
	  menus[26]='f-350IMG';
	  menus[27]='f-450_550IMG';
	  menus[28]='e-150_350IMG';
	  menus[29]='transitIMG';
	  
	for (i=0; i<menus.length; i++){
		if (document.getElementById(menus[i])) {
			if ((browser == 'IE 7') || (browser == 'IE 6')){ 
				document.all(menus[i]).style.filter = 'alpha(opacity = 20)';
			} else {
				document.getElementById(menus[i]).style.opacity = 0.2;
				document.getElementById(menus[i]).style.filter = 'alpha(opacity = 20)';
			}
			document.getElementById(menus[i]).style.cursor = 'normal';
		}
	}
}
function muestraMenu(menu) {
	borraMenu();
	menum = menu+'M';
	document.getElementById(menum).style.display = 'block';
	/*
	if ((browser == 'IE 7') || (browser == 'IE 6')){ 
		document.getElementById(menum).style.display = 'block';
	} else {
		 new Effect.BlindDown(menum, {duration: .3 });
	}
	*/
	overclass = menu+'Actual';
	obj = menu+'1'; 
	document.getElementById(obj).className = overclass;
}

function muestraSub(subm) {
	borraSubs();
	sombra = subm+'i';
	for(i=0;i<menus.length;i++){
		img = menus[i]+'i';
		if(document.getElementById(img)){
			document.getElementById(img).className = img;
		}
	}
	document.getElementById(sombra).className = sombra+'Actual';
	document.getElementById(subm).style.display = 'block';
	/*
	if ((browser == 'IE 7') || (browser == 'IE 6')){ 
		document.getElementById(subm).style.display = 'block';
	} else {
		if(document.getElementById('thumbs')){ // si esta la librería de JQuery, descubrir el menú de zopetón
			document.getElementById(subm).style.display = 'block';
		} else {
			new Effect.BlindDown(subm, {duration: .3 });
		}
	}
	*/
}
function cambiaclass(quien,classover) {
	if (document.all||document.getElementById) {
		quien.className = classover;
	}
}

function elegirAutos(autos){
	opacalos();
	var carros = autos.split(",");
	for(i=0; i<carros.length; i++){
		if(document.getElementById(carros[i])){
			if ((browser == 'IE 7') || (browser == 'IE 6')){ 
				document.all(carros[i]).style.filter = 'alpha(opacity = 100)';
			} else {
				document.getElementById(carros[i]).style.opacity = 1.0;
				document.getElementById(carros[i]).style.filter = 'alpha(opacity = 100)';
			}
			document.getElementById(carros[i]).style.cursor = 'pointer';
		}
	}
}
function muestraOculta (galeria, actual,claseactual,claseswitch){
	var galer = galeria.split(",");
	for(i=0;i<galer.length; i++){
		document.getElementById(galer[i]).style.display = 'none';
		document.getElementById(galer[i]+'p').className = claseswitch;
	}
	document.getElementById(actual).style.display = 'block';
	document.getElementById(actual+'p').className = claseactual;
}

/* MENU */
var menu=function(){
	//var t=15,z=50,s=6,a;
	if ((browser == 'IE 7') || (browser == 'IE 6')){ 
	var t=50,z=0,s=1,a;
	
	} else {
	var t=15,z=50,s=6,a;
	}
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onclick='';
			h.onmouseout=new Function(this.n+'.st('+i+')');
			
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();

/* MENU */


/* Begin:Overs */
function SetStyle(sDivID, sStyle)
{
	document.getElementById(sDivID).className=sStyle;	
}
/* Begin:Overs */

