function trim(s) {
	 while(s && (s.indexOf(" ")==0)) s=s.substring(1);
	 while(s && (s.lastIndexOf(" ")==(s.length-1))) s=s.substr(0, s.length-1);
	 return s;
}

var logo = new Array(
"html/img/main_chevrolet_astra.jpg",
"html/img/main_chevrolet_corsa.jpg",
"html/img/main_chevrolet_corvette.jpg",
"html/img/main_chevrolet_spark.jpg",
"html/img/main_chrysler_300.jpg",
"html/img/main_citroen_c3.jpg",
"html/img/main_citroen_c4.jpg",
"html/img/main_citroen_c5.jpg",
"html/img/main_citroen_c6.jpg",
"html/img/main_dodge_1500.jpg",
"html/img/main_fiat_128_iava.jpg",
"html/img/main_fiat_idea_weekend.jpg",
"html/img/main_fiat_palio.jpg",
"html/img/main_fiat_palio_weekend.jpg",
"html/img/main_ford_ecosport.jpg",
"html/img/main_ford_falcon.jpg",
"html/img/main_ford_fiesta.jpg",
"html/img/main_ford_fiesta_max.jpg",
"html/img/main_ford_focus.jpg",
"html/img/main_ford_new_focus.jpg",
"html/img/main_ford_focus_exe.jpg",
"html/img/main_ford_mustang.jpg",
"html/img/main_ford_ranger.jpg",
"html/img/main_ford_s_max.jpg",
"html/img/main_ford_taunus.jpg",
"html/img/main_honda.jpg",
"html/img/main_honda_fit.jpg",
"html/img/main_mitsubishi_eclipse.jpg",
"html/img/main_mitsubishi_eclipse_spider.jpg",
"html/img/main_mitsubishi_lancer.jpg",
"html/img/main_mitsubishi_outlander.jpg",
"html/img/main_peugeot_206.jpg",
"html/img/main_peugeot_308.jpg",
"html/img/main_peugeot_404.jpg",
"html/img/main_peugeot_407.jpg",
"html/img/main_peugeot_500.jpg",
"html/img/main_peugeot_504.jpg",
"html/img/main_peugeot_504_cabriolet.jpg",
"html/img/main_renault_concept.jpg",
"html/img/main_renault_fuego.jpg",
"html/img/main_renault_fuego_turbo.jpg",
"html/img/main_renault_kangoo.jpg",
"html/img/main_renault_laguna.jpg",
"html/img/main_renault_logan.jpg",
"html/img/main_renault_megane_coupe.jpg",
"html/img/main_renault_megane_II.jpg",
"html/img/main_renault_symbol.jpg",
"html/img/main_torino_zx_coupe.jpg",
"html/img/main_toyota_corolla.jpg",
"html/img/main_toyota_hilux.jpg",
"html/img/main_toyota_sw4.jpg",
"html/img/main_volkswagen_amarok.jpg",
"html/img/main_volkswagen_bora.jpg",
"html/img/main_volkswagen_crossfox.jpg",
"html/img/main_volkswagen_gol.jpg",
"html/img/main_volkswagen_golf.jpg",
"html/img/main_volkswagen_passat.jpg",
"html/img/main_volkswagen_saverio.jpg",
"html/img/main_volkswagen_suran.jpg",
"html/img/main_volkswagen_voyage.jpg"
  );




var NS = (navigator.appName == "Netscape") ? 1 : 0;
if (NS) document.captureEvents(Event.DBLCLICK);
document.ondblclick = dict;

var newwin;
function dict() {
if (NS) {
t = document.getSelection();
opennewwin(t);
}
else {
t = document.selection.createRange();
if(document.selection.type == 'Text' && t.text != '') {
document.selection.empty();
opennewwin(t.text);
      }
   }
}
function opennewwin(text) {
text = trim(text);
 switch (text.toLowerCase()) {
  case 'alta':
  				_faq='alta';
  				_tit='Alta';
  				_des='Aca ta la alta!!!!!.';
          break;
	case 'cv':
  				_faq='CV';
  				_tit='Caballo Vapor';
  				_des='Medida de potencia (en sistema métrico). Equivale a 735,49875 W, o a 0,9863 HP';
          break;
  case 'gnc':
  				_faq='GNC/GNV';
  				_tit='Gas Natural Comprimido';
  				_des='Combustible alternativo a la nafta, también denominado GNV (Gas Natural Vehicular).';
          break;
	case 'gnv':
  				_faq='GNV/GNC';
  				_tit='Gas Natural Vehicular';
  				_des='Combustible alternativo a la nafta, también denominado GNC (Gas Natural Comprimido).';
          break;
	case 'hp':
  				_faq='HP';
  				_tit='Horse Power';
  				_des='Medida de potencia (en sistema inglés). Equivale a 745,69987 W, o a 1,0138 CV.';
          break;
  case 'iac':
  				_faq='IAC';
  				_tit='Idle Air Control';
  				_des='Válvula que habilita el flujo de aire hacia el motor cuando la mariposa de aceleración se encuentra totalmente cerrada (ralenti), permitiendo que el motor trabaje sin necesidad de pisar el acelerador y tenga una marcha mínima estable.';
          break;
	case 'kilowatt':
  				_faq='kw';
  				_tit='kilowatt';
  				_des='Medida de potencia (en sistema internacional). Un kW (1000 W) equivale a 1,35962 CV, o a 1,34102 HP.';
          break;
	case 'kw':
  				_faq='kw';
  				_tit='kilowatt';
  				_des='Medida de potencia (en sistema internacional). Un kW (1000 W) equivale a 1,35962 CV, o a 1,34102 HP.';
          break;
  case 'potencia':
  				_faq='Potencia';
  				_tit='Significado:';
  				_des='En física, potencia es la cantidad de trabajo efectuado por unidad de tiempo. Se mide, por ej., en CV o HP.';
          break;
	case 'rpm':
  				_faq='RPM';
  				_tit='Revoluciones por Minuto';
  				_des='Velocidad a la cual gira el motor. En uno de 2 tiempos, un ciclo se realiza durante un giro, en uno de 4 tiempos durante 2.';
          break;
  case 'trabajo':
  				_faq='Trabajo';
  				_tit='Significado:';
  				_des='En mecánica, trabajo es el que realiza una fuerza aplicada sobre una partícula durante un cierto desplazamiento. Se mide, por ej. en Kg x mt (Kgm).';
          break;
	case 'w':
  				_faq='w';
  				_tit='Watt';
  				_des='Medida de potencia (en sistema internacional). Un kW (1000 W) equivale a 1,35962 CV, o a 1,34102 HP.';
          break;
	case 'watt':
  				_faq='w';
  				_tit='Watt';
  				_des='Medida de potencia (en sistema internacional). Un kW (1000 W) equivale a 1,35962 CV, o a 1,34102 HP.';
          break;
  default:
   				_faq='';
  break;
 }
if(_faq!='') {
	html = '<html><head>';
	html += '<base href="http://www.gnceros.com.ar/" />';
	html += '<link href="html/style.css" rel="stylesheet" type="text/css">';
	html += '<title>Glosario</title></head>';
	html += '<body style="background: url(html/img/t_bg.gif) ",,leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>';
	html += '<center><H5 class="glosario"><b>'+_faq+'</b></H5><H5 class="glosario"><b><i>'+_tit+'</i></b></H5><H6 class="glosario">'+_des+'</H6>';
	html += '</center></body></html>';
	popupWindow = window.open('','','scrollbars=1,resizable=0,toolbar=0,status=0,menubar=0,location=0,directories=0,height=250,width=220,left=0,top=0');
	popupWindow.document.open();
	popupWindow.document.write(html);
	popupWindow.document.close();
	}
}


function img_switch() {
	var azar = Math.floor(Math.random() * logo.length);
	document.images["main"].src = logo[azar];
}
function abreFoto(ruta)
{
i1 = new Image;
i1.src = ruta;
html = '<html><head><title>Imagen</title></head>';
html += '<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>';
html += '<center><img src="'+ruta+'" border=0 name="Foto" ';
html += 'onLoad="window.resizeTo(document.Foto.width,document.Foto.height)">';
html += '</center></body></html>';
popupImage = window.open('','_blank','scrollbars=0,resizable=1');
popupImage.document.open();
popupImage.document.write(html);
popupImage.document.close();
} 
function IncluirFoto(Ruta,Foto,Minifoto,Ancho,Alto)
{

if (Minifoto+"" == "undefined" || Minifoto+"" == "null" || Minifoto+"" == "") {
Minifoto = '';
}

if (Ancho+"" == "undefined" || Ancho+"" == "null" || Ancho+"" == "") {
Ancho = ' width="400" ';
} else {
Ancho = ' width="'+Ancho+'" '; }

if (Alto+"" == "undefined" || Alto+"" == "null" || Alto+"" == "") {
Alto = ' ';
} else {
Alto = ' height="'+Alto+'" '; }

document.write('<H6 class=Centrado>');
document.write('<a href="'+Ruta+Foto+'" onclick="abreFoto(&#39'+Ruta+Foto+'&#39);return false"><img src="'+Ruta+Minifoto+Foto+'"'+Ancho+Alto+'border="0" alt="Click para ampliar la foto"><br>Click para ampliar la foto</A>')
document.write('</H6>');
}
function IncluirCopyright(Usuario,NumUsuario)
{
document.write('<H5 class=c><B><U>Escrito por</U>:</B><img src="html/img/spacer.gif" width="5" height="1" border="0" alt=""><a href="/phpBB/memberlist.php?mode=viewprofile&u='+NumUsuario+'" class="tc11"><img src="html/pics/orig/usuarios.png" height="30" border="0" alt="Ver su perfil"><FONT SIZE="+1"><img src="html/img/spacer.gif" width="5" height="1" border="0">'+Usuario+'<FONT SIZE="-1"><I>&#32Ver su perfil</I></a></H5>');
}

function Captura_Pantalla(){
var nodo = document.getElementsByTagName("P");
for(i = 0; i < nodo.length; i++){
//var text = document.createTextNode((i+1)+") ");
//nodo[i].insertBefore(text, nodo[i].firstChild);


// var texto = nodo[i]; devuelve [object HTMLParagraphElement]
// var texto = nodo[i].firstChild; devuelve [object HTMLFontElement]
// var texto = nodo[i].firstChild; devuelve [object HTMLFontElement]
var x=nodo[i].firstChild;
x.data = "BASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURA";
x.nodeValue = "BASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURABASURA";
var text = document.createTextNode("Basura: ");
nodo[i].insertBefore(text, nodo[i].firstChild);
}
}

function Captura_Pantalla2() {

	var	TableText = document.getElementsByTagName("H1").item(0);
	TableText.firstChild.data = 'GRRRRRRRRRRRRRR';
	var	para = document.getElementsByTagName("P").item(0);
	para.firstChild.data = 'GRRRRRRRRRRRRRR';
	var newText = document.createTextNode("Este es el segundo parrafo");
	var newElement = document.createElement("P");
	newElement.appendChild(newText);
	para.parentNode.appendChild(newElement);

	html = '<html><head><title>Prueba</title></head>';
	html += '<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>';
	html += '<center>Prueba de la función<br>' + TableText.length + '<br>';

	for (i=0;i<TableText.length;i++) {
		html += TableText[i].childNodes[0].innerHTML + '<br>';
		TableText[i].childNodes[0].innerHTML = 'GRRRRRRRRRRRRRR';
		html += TableText[i];
		TableText.firstChild.data = 'GRRRRRRRRRRRRRR';
		html += '<br>';
	}

	html += '</center></body></html>';
	PcImage = window.open('','_blank','scrollbars=0,resizable=1');
	PcImage.document.open();
	PcImage.document.write(html);
	PcImage.document.close();
}

function init() {
	img_switch();
}