function validaImg(IdImg,ancho,alto)
{
	var img=IdImg;
	var anchoImg=img.width;
	var altoImg=img.height;
	if (anchoImg>ancho || altoImg>alto)
	{
		img.width=ancho;
		img.height=alto;
		img.alt="Esta imagen se ve distorcionada por exceder medidas permitidas, 500 x 150 pixeles."
	}
}


titulo="";
function ventanaweb(sitio) {
	subvent = "http://www." + sitio ;
   kk= window.open(subvent,titulo,"scrollbars=yes, left=10, top=90, width=800, height=500, directories=0, toolbar=1, resizable=1, location=0, menubar=1,false");
}
function ventanaFonos(sitio) {
	subvent = "http://www.automovilistas.cl/forum/secciones/" + sitio ;
   kk= window.open(subvent,titulo,"scrollbars=yes, left=200, top=150, width=400, height=380, directories=0, toolbar=0, resizable=0, location=0, menubar=0,false");
}

function Votar(IdEncuesta,TotalResp, usuario, pt)
{
	if (usuario != "")
	{
		IdRespuesta = 0
		if ( usuario != -1)
		{
			for(i=0; i<=TotalResp-1; i++)
			{
				if (document.FrmVotacion.opcion(i).checked)
				{
					IdRespuesta= document.FrmVotacion.opcion(i).value;
					break;
				}
			}
		}	
		if ( IdRespuesta > 0 || usuario == -1)
		{
			document.FrmVotacion.action ="encuestas/EstadisticaEncuesta.asp?Id_Encuesta="+IdEncuesta+"&opcion=1&Id_Respuesta="+IdRespuesta;
			document.FrmVotacion.submit();
		}
		else
			alert("Selecccione una alternativa y luego haga click en Votar")
	}	
	else
		alert("Solo pueden votar los usuarios registrados en la AUCH.")
}	

function swImagen(obj, img) 
{ 
	obj.src=img;
}

function changeto(highlightcolor) 
{
	source=event.srcElement;
	source.style.background=highlightcolor;
}

function changeback(colororiginal) 
{
	source.style.background=colororiginal;
}

function changetd(id) 
{
	var kk = document.getElementById(id)
	kk.style.background='url(/forum/images/fdo_td_menus_b.jpg)';
	kk.style.fontWeight='bold';
	kk.style.color='brown';
}

function changebacktd(id) 
{
	var kk = document.getElementById(id)
	kk.childNodes[0].src = "images/fdo_td_menus_b.jpg"
	kk.style.fontWeight='normal';
	kk.style.color='navy';
}


function ChangeBkgDistancias(Obj, Clr, Dos)
{
	var kk=Obj.parentNode;
	Obj.style.background = Clr;
	kk.scr="menu_f_prensa.gif" 
	kk.childNodes[0].style.background = Dos;
}


function ChangeBkg(Obj, Clr)
{
	Obj.style.background = Clr
}

function verinfo(Obj) 
{
	kk = document.getElementById(Obj)
	if (kk.style.display== 'none')
		kk.style.display = 'block';
	else
		kk.style.display = 'none'; 
}

function verindices(Obj,Opc) 
{
	kk = document.getElementById(Obj)

	utm = document.getElementById('indutm')
	uf = document.getElementById('induf')
	
	if (Obj == 'indutm')
	{
		Opc.style.background="black";
		uf.style.display = 'none';
		kk1 = eval(document.getElementById('tduf'))
		kk1.style.background = 'navy';
		kk1 = eval(document.getElementById('tdutm'))
		kk1.style.background = 'ForestGreen';
		kk1 = eval(document.getElementById('tdipc'))
		kk1.style.background = 'ForestGreen';
	}
	else
	{
		utm.style.display = 'none';
		kk1 = eval(document.getElementById('tdutm'))
		kk1.style.background = 'navy';
		kk1 = eval(document.getElementById('tdipc'))
		kk1.style.background = 'navy';
		Opc.style.background="ForestGreen";	
	}  
	
	if (kk.style.display== 'none')
		kk.style.display = 'block';
	else
		kk.style.display = 'none';
}

function ampliar(idAuto) 
{
	subvent = 'album_autos/ampliar.asp?id_Auto='+idAuto ;
	kk= window.open(subvent,'new_page','scrollbars=yes, left=10, top=40, width=800, height=550, directories=0, toolbar=1, resizable=1, location=0, menubar=1,false');
}
