/****************************/
/* Developed by MediaThread */
/* http://mtcrossmedia.com/ */
/*  Brandsite Toyota Camry  */
/****************************/

var req;
var savedClr   = "";
var savedBkClr = "";
var reqURL = "";
var msgDefault = "[ Nuevo Toyota Camry ]";
var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;

var aMsg = new Array(7);
aMsg[0] = "";
aMsg[1] = "Regístrese y reciba información preferencial";
aMsg[2] = "Contáctenos";
aMsg[3] = "Recomiende este sitio a un amigo";
aMsg[4] = "Wallpapers y Screensavers";
aMsg[5] = "Red de concesionarios Toyota";
aMsg[6] = "Términos y condiciones";

window.defaultStatus = msgDefault; // StatusBar por defecto

function g(n) {return document.getElementById(n);}

function contact() {
	var popup = '';
	popup=open('http://eventostoyota.com.ar/contacto/index.php?website=camry', 'Contacto', 'scrollbars=no, width=550, height=400, status=no, menubar=no, location=no, resizable=no, scrollbars=no, hotkeys=no');
	popup.document.close();
}

function referer() {
	var popup = '';
	popup=open('http://eventostoyota.com.ar/webadmin/camry/amigo.html', 'Recomendar', 'scrollbars=no, width=550, height=300, status=no, menubar=no, location=no, resizable=no, scrollbars=no, hotkeys=no');
	popup.document.close();
}

function gifts() {
	var popup = '';
	popup=open('regalos.html', 'Regalos', 'scrollbars=no, width=650, height=300, status=no, menubar=no, location=no, resizable=no, scrollbars=no, hotkeys=no');
	popup.document.close();
}

function register() {
	var popup = '';
	popup=open('http://eventostoyota.com.ar/webadmin/camry/registrar.html', 'Registrar', 'scrollbars=yes, width=750, height=450, status=no, menubar=no, location=no, resizable=no, scrollbars=yes, hotkeys=no');
	popup.document.close();
}

function dealerMap() {
	var popup = '';
	popup=open('http://www.eventostoyota.com.ar/mapa/mapa.html', 'Mapa', 'scrollbars=no, width=403, height=505, status=no, menubar=no, location=no, resizable=no, scrollbars=no, hotkeys=no');
	popup.document.close();
}

function terms() {
	var popup = '';
	popup=open('terminos.htm', 'Terminos', 'scrollbars=yes, width=560, height=560, status=no, menubar=no, location=no, resizable=no, hotkeys=no');
	popup.document.close();
}

function flashPop(dest,num) {
	var popup = '';
	popup=open(dest, num, 'scrollbars=yes, width=640, height=480, status=no, menubar=no, location=no, resizable=no, scrollbars=no, alwaysLowered=yes, hotkeys=no');
	popup.document.write("<html><head><title></title><meta name='Developer' content='MediaThread'></head>");
	popup.document.write("<body style='margin: 0px; padding: 0px'><div align='center'><img src='full/"+dest+"' alt='Cargando ...' onClick='window.close()'></div></body></html>");
	popup.document.close();
	popup = '';
}

function popUpper(num, dest, title) {
	var popup = '';
	popup=open(dest, 'Detail'+num, 'scrollbars=yes, width=640, height=480, status=no, menubar=no, location=no, resizable=no, scrollbars=no, alwaysLowered=yes, hotkeys=no');
	popup.document.write("<html><head><title>Detalle: "+title+"</title><meta name='Developer' content='MediaThread'></head>");
	popup.document.write("<body style='margin: 0px; padding: 0px'><div align='center'><img src='"+dest+"' alt='Cargando ...' onClick='window.close()'></div></body></html>");
	popup.document.close();
	popup = '';
}

function showSubs() {
	g('ContentBox').style.display = 'block';
}

function hideSubs() {
	g('ContentBox').style.display = 'none';
}

function processReqChange() {
    if (req.readyState == 4) {
        if (req.status == 200) {
		if (req.responseText != "") {
			tTag = g('ContentBox');
			tTag.innerHTML = req.responseText;
			showSubs();
			
			tTable = tTag.getElementsByTagName('TABLE')[0];
			urchinTracker("/"+tTable.summary);

		} else {
			alert("Hubo un problema al tratar de contactar al servidor.");
		}
        } else {
        	alert("Hubo un problema al tratar de contactar al servidor.\nPor favor inténtelo nuevamente.");
        }
    }
}


function getData(url) {
    // Hide until new data is available
    hideSubs();
    // Store requested URL
    reqURL = url;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", 'tables/'+url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", 'tables/'+url, true);
            req.send();
        }
    }
}


function thumbIn(src) {
	if (!MSIE) return;
	src.style.filter = '';
}

function thumbOut(src) {
	if (!MSIE) return;
	src.style.filter = 'gray alpha(opacity=80, style=0)';
}


function cellOver (src, color) {
	src.style.cursor = 'default';
	savedClr = src.style.color;
	savedBkClr = src.style.backgroundColor;
	src.style.backgroundColor = color;
	src.style.color = '#222';
}

function cellOut (src) {
	src.style.backgroundColor = savedBkClr;
	src.style.color = savedClr;
}

function cellClick (src) {
	if (!MSIE) return;
	var i = 0;
	do {
		var tTD = src.getElementsByTagName('TD')[i];
		if (tTD.style.backgroundColor.toUpperCase() == '#16317E') tTD.style.backgroundColor = '';
		else tTD.style.backgroundColor = '#16317E';
		i++;
	} while ( src.getElementsByTagName('TD')[i] );
}


