
	/**
	 * Config vars
	 */
	var scrollerdelay = "2000";
	var scrollerwidth = "210px";
	var scrollerheight = "212px";
	var scrollerbg = "";


	var messages = new Array();

	var ie = '';
	var dom = '';
	var m_amount = 0;

var TICKER = {

	start : function()
	 {
		messages[0] = "<a href=\"http://www.misautomoviles.com/detalle/123\"><strong>Nissan  DAIHATSU TERIOS</strong><br />Año: <strong>2001</strong><br />Kilometros: <strong>100000</strong><br />Precio: <strong>11500 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.60151600_daihatsu.jpg\" alt=\"MisAutomoviles.com\"></a>";
messages[1] = "<a href=\"http://www.misautomoviles.com/detalle/122\"><strong>Toyota  YARIS</strong><br />Año: <strong>2002</strong><br />Kilometros: <strong>90000</strong><br />Precio: <strong>0 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.40917300_toyotayaris1.jpg\" alt=\"MisAutomoviles.com\"></a>";
messages[2] = "<a href=\"http://www.misautomoviles.com/detalle/119\"><strong>Chevrolet  SWIFT</strong><br />Año: <strong>1993</strong><br />Kilometros: <strong>100000</strong><br />Precio: <strong>5500 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.59724400_SWIFT10.jpg\" alt=\"MisAutomoviles.com\"></a>";
messages[3] = "<a href=\"http://www.misautomoviles.com/detalle/114\"><strong>Toyota  SUMO</strong><br />Año: <strong>2005</strong><br />Kilometros: <strong>105000</strong><br />Precio: <strong>18000 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.05650300_TOYOTA344W.jpg\" alt=\"MisAutomoviles.com\"></a>";
messages[4] = "<a href=\"http://www.misautomoviles.com/detalle/110\"><strong>Chevrolet  SILVERADO</strong><br />Año: <strong>2002</strong><br />Kilometros: <strong>123000</strong><br />Precio: <strong>14500 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.43559500_SILVEWILLI.jpg\" alt=\"MisAutomoviles.com\"></a>";
messages[5] = "<a href=\"http://www.misautomoviles.com/detalle/79\"><strong>Ford  F250</strong><br />Año: <strong>2009</strong><br />Kilometros: <strong>0</strong><br />Precio: <strong>0 USD</strong><br /><img src=\"http://www.misautomoviles.com/img/autos/0.78596500_FORDDUTY.jpg\" alt=\"MisAutomoviles.com\"></a>";

	 	ie = document.all;
		dom = document.getElementById;

		m_amount = (messages.length > 2) ? 2 : 0;

		var main_ticker_div = document.getElementById('main_ticker_div');
		var sub_main_ticker = document.getElementById('sub_main_ticker');

		main_ticker_div.style.width = scrollerwidth;
		main_ticker_div.style.height = scrollerheight;
		main_ticker_div.style.background = scrollerbg;

		sub_main_ticker.style.width = scrollerwidth;
		sub_main_ticker.style.width = scrollerheight;

		TICKER.startscroll();

	 },


	move_ticker : function(whichdiv)
	 {
		tdiv = eval(whichdiv);
		if(parseInt(tdiv.style.top) > 0 && parseInt(tdiv.style.top) <= 5)
		 {
			tdiv.style.top = 0 + "px";
			setTimeout("TICKER.move_ticker(tdiv)", scrollerdelay);
			setTimeout("TICKER.move_ticker_2(second_ticker_obj)", scrollerdelay);
			return;
		 }
		if(parseInt(tdiv.style.top) >= tdiv.offsetHeight*-1)
		 {
			tdiv.style.top = parseInt(tdiv.style.top)-5 + "px";
			setTimeout("TICKER.move_ticker(tdiv)", 50);
		 }
		else
		 {
			tdiv.style.top = parseInt(scrollerheight) + "px";
			tdiv.innerHTML = messages[m_amount];
			if(m_amount == messages.length-1)
				m_amount = 0;
			else
				m_amount++;
		 }
	 },


	move_ticker_2 : function(whichdiv)
	 {
		tdiv2 = eval(whichdiv);
		if(parseInt(tdiv2.style.top) > 0 && parseInt(tdiv2.style.top) <= 5)
		 {
			tdiv2.style.top = 0 + "px";
			setTimeout("TICKER.move_ticker_2(tdiv2)", scrollerdelay);
			setTimeout("TICKER.move_ticker(first_ticker_obj)", scrollerdelay);
			return;
		 }
		if(parseInt(tdiv2.style.top) >= tdiv2.offsetHeight*-1)
		 {
			tdiv2.style.top = parseInt(tdiv2.style.top)-5 + "px";
			setTimeout("TICKER.move_ticker_2(second_ticker_obj)", 50);
		 }
		else
		 {
			tdiv2.style.top = parseInt(scrollerheight) + "px";
			tdiv2.innerHTML = messages[m_amount];
			if(m_amount == messages.length-1)
				m_amount = 0;
			else
				m_amount++;
		 }
	 },


	startscroll : function()
	 {

		if(ie || dom)
		 {
			document.getElementById('first_ticker').innerHTML = messages[0];
			document.getElementById('second_ticker').innerHTML = messages[dyndetermine=(messages.length==1) ? 0 : 1];
		 }

		if(m_amount == 2)
		 {
			first_ticker_obj = ie ? first_ticker : document.getElementById("first_ticker");
			second_ticker_obj = ie ? second_ticker : document.getElementById("second_ticker");
			TICKER.move_ticker(first_ticker_obj);
			second_ticker_obj.style.top = scrollerheight;
			second_ticker_obj.style.visibility = 'visible';
		 }
	 }

}


/* LOAD */

function addLoadEvent(fn)
 {
	var old = window.onload;
	if(typeof window.onload != 'function')
		window.onload = fn;
	else
		window.onload = function()
		 {
			old();
			fn();
		 }
 }

addLoadEvent( function() { TICKER.start(); } );

