function abrirVentana(url, nombre, opciones){
	window.open(url, nombre, opciones);
}

// Precarga una imagen
function preCargaImg(imageURL) {
		image = new Image();
		image.src = imageURL;
		return image;
}

// Cambia el SRC de una imagen
function CambiarImg(buttonName,sourceImage) {
		buttonName.src = sourceImage.src;
		return true;
}

function objetoAjax(){
        var xmlhttp=false;
        try {
               xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
               try {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (E) {
                       xmlhttp = false;
               }
        }
 
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
               xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}

function enlaces(id){        
        datos = 'http://www.sobrecoches.com/lib/enlaces/enlace.php?destiny='+id+"&ms="+new Date().getTime();
        ajax=objetoAjax();
        ajax.open("GET", datos);
        ajax.send(null);
}
function cambio_submenu(id){
	if (document.getElementById(id).style.display=='none' || document.getElementById(id).style.display=='')
		document.getElementById(id).style.display='block'
	else
		document.getElementById(id).style.display='none'
}
