var delay=5000;
var delayCon=4000;
var delayPro=5000;

var proNext=0;
var conNext=0;
var estNext=0;
var $estrenosActual=1;
var $estrenos3dActual=1;
var $cartelActual=1;

function DomGet(i)
{
	return document.getElementById(i);
}
function StartScrolls()
{
	$arr_pro = document.getElementsByName('proTabs');
	$arr_con = document.getElementsByName('conTabs');
	$arr_est = document.getElementsByName('estTabs');
	$arr_estrenos = document.getElementsByName('estNEs');
	$arr_car = document.getElementsByName('carTabs');
	$arr_cartel = document.getElementsByName('carNEs');
	proTimer = window.setInterval('SwapTabs($arr_pro,"proNext")',delayPro);
	conTimer = window.setInterval('SwapTabs($arr_con,"conNext")',delayCon);
	//estTimer = window.setInterval('SwapTabs($arr_est,"estNext")',delay);
	StartEstrenosScroll();
	StartEstrenos3dScroll();
	StartCartelScroll();	
}
function StartEstrenosScroll()
{
	DomGet('btnPlayEstreno').style.display = 'none';
	DomGet('btnPauseEstreno').style.display = '';
	estrenosTimer = window.setInterval('SwapNextEstreno()',delay);
}
function StartEstrenos3dScroll()
{
	if(DomGet('btnPlayEstreno3d'))
	{
		DomGet('btnPlayEstreno3d').style.display = 'none';
		DomGet('btnPauseEstreno3d').style.display = '';
		estrenos3dTimer = window.setInterval('SwapNextEstreno3d()',delay);
	}
}
function StopEstrenosScroll()
{
	DomGet('btnPlayEstreno').style.display = '';
	DomGet('btnPauseEstreno').style.display = 'none';
	clearInterval(estrenosTimer);
}
function StopEstrenos3dScroll()
{
	if (DomGet('btnPlayEstreno3d'))
    {
		DomGet('btnPlayEstreno3d').style.display = '';
		DomGet('btnPauseEstreno3d').style.display = 'none';
		clearInterval(estrenos3dTimer);
    }
}
function StartCartelScroll()
{
	DomGet('btnPlayCartel').style.display = 'none';
	DomGet('btnPauseCartel').style.display = '';
	cartelTimer = window.setInterval('SwapNextCartel()',delay);
}
function StopCartelScroll()
{
	DomGet('btnPlayCartel').style.display = '';
	DomGet('btnPauseCartel').style.display = 'none';
	clearInterval(cartelTimer);
}


function ChangeImage($this)
{
	$id = $this.id.substring(7,8);
	$wich = $this.id.substring(0,3);

	$arr_buts = document.getElementsByName($wich + 'Tabs');
	
	for ($i = 1; $i <= $arr_buts.length; $i++)
	{
		if ($arr_buts[$i - 1].id == $wich + 'Tab_' + $id)
		{
			//Cambio el estilo del Tab
			DomGet($wich + 'Tab_' + $i).className = 'tab' + $wich + ' on';
			DomGet($wich + 'Img_' + $i).style.display = '';
			DomGet($wich + 'Izq_' + $i).src = 'images/tabs/tab_'+$wich+'_left.gif';
			DomGet($wich + 'Der_' + $i).src = 'images/tabs/tab_'+$wich+'_right.gif';
		}
		else
		{
			DomGet($wich + 'Tab_' + $i).className = 'tab' + $wich + ' off';
			DomGet($wich + 'Img_' + $i).style.display = 'none';
			DomGet($wich + 'Izq_' + $i).src = 'images/tabs/tab_'+$wich+'_left_off.gif';
			DomGet($wich + 'Der_' + $i).src = 'images/tabs/tab_'+$wich+'_right_off.gif';
		}
	}
}
function SwapNextEstreno($stop)
{
	$cantEstrenos = DomGet('cantEstrenos').innerHTML;
	$estrenosActual = ($estrenosActual == $cantEstrenos)?1:$estrenosActual+1;
	
	ChangeViewEstrenos(DomGet('estreno_' + $estrenosActual));
	
	if ($stop)
	{
		StopEstrenosScroll();
	}
}

function SwapNextEstreno3d($stop)
{
	$cantEstrenos3d = DomGet('cantEstrenos3d').innerHTML;
	$estrenos3dActual = ($estrenos3dActual == $cantEstrenos3d)?1:$estrenos3dActual+1;
	
	ChangeViewEstrenos3d(DomGet('estreno3d_' + $estrenos3dActual));
	
	if ($stop)
	{
		StopEstrenos3dScroll();
	}
}

function SwapPrevEstreno()
{
	$cantEstrenos = DomGet('cantEstrenos').innerHTML;
	
	$estrenosActual = ($estrenosActual== 1) ? $cantEstrenos : ($estrenosActual -1);
	
	ChangeViewEstrenos(DomGet('estreno_' + $estrenosActual));
	
	StopEstrenosScroll();
}

function SwapPrevEstreno3d()
{
	$cantEstrenos3d = DomGet('cantEstrenos3d').innerHTML;
	
	$estrenos3dActual = ($estrenos3dActual== 1) ? $cantEstrenos3d : ($estrenos3dActual -1);
	
	ChangeViewEstrenos3d(DomGet('estreno3d_' + $estrenos3dActual));
	
	StopEstrenos3dScroll();
}
function ChangeViewEstrenos($this)
{
	$cantEstrenos = DomGet('cantEstrenos').innerHTML;
	
	for ($e = 1; $e <= $cantEstrenos; $e++)
	{
		if ($e == $estrenosActual)
		{
			DomGet('estreno_' + $e).style.display = '';
		}
		else
		{
			DomGet('estreno_' + $e).style.display = 'none';
		}
	}
}
function ChangeViewEstrenos3d($this)
{
	$cantEstrenos3d = DomGet('cantEstrenos3d').innerHTML;
	
	for ($e = 1; $e <= $cantEstrenos3d; $e++)
	{
		if ($e == $estrenos3dActual)
		{
			DomGet('estreno3d_' + $e).style.display = '';
		}
		else
		{
			DomGet('estreno3d_' + $e).style.display = 'none';
		}
	}
}
function SwapNextCartel($stop)
{
	$cantCartel = DomGet('cantCartel').innerHTML;
	
	$cartelActual = ($cartelActual == $cantCartel)?1:$cartelActual+1;
	
	ChangeViewCartel(DomGet('cartel_' + $cartelActual));
	
	if ($stop)
	{
		StopCartelScroll();
	}
}

function SwapPrevCartel()
{
	$cantCartel = DomGet('cantCartel').innerHTML;
	
	$cartelActual = ($cartelActual== 1) ? $cantCartel : ($cartelActual -1);
	
	ChangeViewCartel(DomGet('cartel_' + $cartelActual));
	
	StopCartelScroll();
}
function ChangeViewCartel($this)
{
	$cantCartel = DomGet('cantCartel').innerHTML;
	
	for ($e = 1; $e <= $cantCartel; $e++)
	{
		if ($e == $cartelActual)
		{
			DomGet('cartel_' + $e).style.display = '';
		}
		else
		{
			DomGet('cartel_' + $e).style.display = 'none';
		}
	}
}


function SelectPelicula($this)
{
	if ($this.value !='') 
	{
		window.location = 'peliculadetalle.php?idpelicula=' + $this.value
	}
}

function SelectPeliculaVerMas(objeto, tipocartel, cantidad)
{
	cant = DomGet(cantidad).innerHTML;
	
	for (e = 1; e <= cant; e++)
	{
		if (DomGet(tipocartel + e).style.display == '')
		{
			
			oculto = DomGet(tipocartel + e + '_hidden').value;
			location.href = 'peliculadetalle.php?idpelicula=' + oculto;
		}
	}
}

function SelectComplejo($this)
{
	if ($this.value !='') 
	{
		window.location = 'complejodetalle.php?idcomplejo=' + $this.value
	}
}

function makeSubscription(subscribe)
{
	var callback =
	{
		success: showConfirmation,
		validationError: showConfirmation,
		failure: networkFailure,
		json: true
	}
	
	Request.send('makesubscription.php',
					{'idNewsletter' : 1, 'email' : document.getElementById('txtEmailNewsletter').value, 'subscribe' : subscribe},
					callback);
}

function makeDesuscription()
{
	var email = document.getElementById('txtEmailNewsletter').value;
	if (ValidaMailSORTEO(email))
	{
		alert("Ingrese un email válido");
	}
	else
	{
		window.location = 'enviardesuscripcion.php?email=' + email
	}
}

function makeDesuscriptionNews(email,woc)
{
	var callback =
		{
			validationError: showConfirmation,
			failure: networkFailure,
			json: true
		}	

	
	Request.send('makesubscription.php',
					{'idNewsletter' : 1, 'email' : email, 'subscribe' : 0, 'woc' : woc}, callback);
}


function makeAutoSubscription(subscribe,mail)
{
	var callback =
	{
		validationError: showConfirmation,
		failure: networkFailure,
		json: true
	}
	Request.send('makesubscription.php',
					{'idNewsletter' : 1, 'email' : mail, 'subscribe' : subscribe,'woc' : 1},
					callback);
}

function DesOnlyNews(subscribe,mail)
{
	 makeAutoSubscription(subscribe,mail);
}


function networkFailure()
{
	alert('Se produjo un error de comunicación con el servidor. Por favor, intente nuevamente.');
}

function showConfirmation(responseObject)
{
	var result = responseObject.json;
	alert(result[0]);
}
function SwapTabs($arr,$wich)
{
	switch($wich)
	{
		case 'proNext':
			$pos = proNext;
		 break;
		case 'conNext':
			$pos = conNext;
		 break;
		case 'estNext':
			$pos = estNext;
		 break;
		case 'estrenosNext':
			$pos = estrenosNext;
		 break;
	}
	
	ChangeImage($arr[$pos]);
	$pos = ($pos+1>($arr.length-1))?0:$pos+1;
	
	switch($wich)
	{
		case 'proNext':
			proNext = $pos;
		 break;
		case 'conNext':
			conNext = $pos;
		 break;
		case 'estNext':
			estNext = $pos;
		 break;
		case 'estrenosNext':
			estrenosNext = $pos;
		 break;
	}
}
function StopScroll($timer)
{
	try{
		clearInterval(eval($timer));
	}catch($e) {}
}

function cambiarImagen(id, url)
{
	imagen = document.getElementById(id);
	imagen.src = url;
}

function cambiarColor(id, color)
{
	elemento = document.getElementById(id);
	elemento.style.color = color;
}
// ***** SCROLL IMAGENES DETALLE PELICULA ***** //
var $archivoActual=1;

function StartArchivoScroll()
{
	if (DomGet('btnPlayArchivo')!=null)
	{
		DomGet('btnPlayArchivo').style.display = 'none';
		DomGet('btnPauseArchivo').style.display = '';
		archivoTimer = window.setInterval('SwapNextArchivo()',delay);
	}
}
function StopArchivoScroll()
{
	DomGet('btnPlayArchivo').style.display = '';
	DomGet('btnPauseArchivo').style.display = 'none';
	clearInterval(archivoTimer);
}

function SwapNextArchivo($stop)
{
	$cantArchivos = DomGet('cantArchivos').innerHTML;
	$archivoActual = ($archivoActual == $cantArchivos) ? 1 : $archivoActual+1;
	
	ChangeViewArchivo(DomGet('archivo_' + $archivoActual));
	
	if ($stop)
	{
		StopArchivoScroll();
	}
}

function SwapPrevArchivo()
{
	$cantArchivos = DomGet('cantArchivos').innerHTML;
	
	$archivoActual = ($archivoActual == 1) ? $cantArchivos : ($archivoActual -1);
	
	ChangeViewArchivo(DomGet('archivo_' + $archivoActual));
	
	StopArchivoScroll();
}

function ChangeViewArchivo($this)
{
	$cantArchivos = DomGet('cantArchivos').innerHTML;
	
	for ($e = 1; $e <= $cantArchivos; $e++)
	{
		if ($e == $archivoActual)
		{
			DomGet('archivo_' + $e).style.display = '';
		}
		else
		{
			DomGet('archivo_' + $e).style.display = 'none';
		}
	}
}

// ***** SCROLL IMAGENES CONCURSOS ***** //

function StartConcursoScroll($id)
{
	archivoTimer = window.setInterval('SwapNextImage("'+$id+'")',delay);
}

function SwapNextImage($id)
{
	$displayNext = false;
	$obj = DomGet($id).getElementsByTagName('img');
	for ($i = 0; $i < $obj.length; $i++)
	{
		if ($obj[$i].style.display == '')
		{
			$obj[$i].style.display = 'none';
			$displayNext = true;
		}
		else
		{
			if ($displayNext)
			{
				$obj[$i].style.display = '';
				$displayNext = false;
			}
		}
	}
	if ($displayNext) $obj[0].style.display = '';
}

function restartEstrellas()
{
	for (i = 1; i <= 5; i++)
	{
		estrella = document.getElementById('estrella_' + i);
		estrella.src = '/images/caja-calificar/estrella-inactiva.gif';
	}
}

function activaEstrella(cual)
{
	estrella = document.getElementById('estrella_' + cual);
	estrella.src = '/images/caja-calificar/estrella-activa.gif';
}

function activaEstrellas(cantidad)
{
	restartEstrellas();
	
	document.frmCalificar.estrellas.value = cantidad;
	
	for (i = 1; i <= cantidad; i++)
	{
		activaEstrella(i);
	}
}

function CreateSwfControl(container, width, height, src) 
{
	if (typeof(container) == 'string')
	{
		var c = document.getElementById(container);
	}
	else
	{
		var c = container;
	}
	if (c != null)
	{
		var widthStr = '';
		var heightStr = '';
		if(width != '' && width != null)
		{
			widthStr = ' width=' + width;
		}
		if(height != '' && height != null)
		{
			heightStr = ' height=' + height;
		}
		c.innerHTML += '<object wmode="transparent" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + widthStr + heightStr + '"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"><param name="src" value="' + src + '"/><param name="wmode" value="transparent"/><param name="quality" value="high"/><embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"' + widthStr + heightStr + '" wmode="transparent"></embed></object>';
	}
}

function clickEstreno()
{
	divEstreno 		= DomGet('estImg_1');
	divCartelera 	= DomGet('estImg_2');
	divPeli3d	 	= DomGet('estImg_3');
	estrenoImg		= DomGet('imgEstrenos');
	carteleraImg	= DomGet('imgCartelera');
	peli3dImg		= DomGet('imgPeli3d');
	
	if (divEstreno.style.display == 'none')
	{
		divEstreno.style.display = '';
		if(estrenoImg)
		{
			estrenoImg.setAttribute('src', '/images/estrenos_semana_activo.gif');
		}
		
		divCartelera.style.display = 'none';
		carteleraImg.setAttribute('src', '/images/peliculas_cartel_inactivo.gif');
		
		if(divPeli3d)
		{
			divPeli3d.style.display = 'none';
			peli3dImg.setAttribute('src', '/images/peliculas_3d_inactivo.gif');
		}
	}
}

function clickCartelera()
{
	divEstreno 		= DomGet('estImg_1');
	divCartelera 	= DomGet('estImg_2');
	divPeli3d	 	= DomGet('estImg_3');
	estrenoImg		= DomGet('imgEstrenos');
	carteleraImg	= DomGet('imgCartelera');
	peli3dImg		= DomGet('imgPeli3d');
	if (divCartelera.style.display == 'none')
	{
		divEstreno.style.display = 'none';
		if(estrenoImg)
		{
			estrenoImg.setAttribute('src', '/images/estrenos_semana_inactivo.gif');
		}
		
		divCartelera.style.display = '';
		carteleraImg.setAttribute('src', '/images/peliculas_cartel_activo.gif');
		
		if (divPeli3d)
		{
			divPeli3d.style.display = 'none';
			peli3dImg.setAttribute('src', '/images/peliculas_3d_inactivo.gif');
		}
	}
}

function clickPeli3d()
{
	divEstreno 		= DomGet('estImg_1');
	divCartelera 	= DomGet('estImg_2');
	divPeli3d	 	= DomGet('estImg_3');
	estrenoImg		= DomGet('imgEstrenos');
	carteleraImg	= DomGet('imgCartelera');
	peli3dImg		= DomGet('imgPeli3d');

	if ((divPeli3d) && divPeli3d.style.display == 'none')
	{
		divEstreno.style.display = 'none';
		if(estrenoImg)
		{
			estrenoImg.setAttribute('src', '/images/estrenos_semana_inactivo.gif');
		}
		
		divCartelera.style.display = 'none';
		carteleraImg.setAttribute('src', '/images/peliculas_cartel_inactivo.gif');

		divPeli3d.style.display = 'block';
		peli3dImg.setAttribute('src', '/images/peliculas_3d_activo.gif');
	}
}

function closeCentralHome()
{
	var player = document.getElementById('single');
	player.sendEvent('STOP');
	document.getElementById('bannerfloat').style.display = 'none';
	document.getElementById('video_1').innerHTML = '';
	
}

function CreateSwfControlVHC(container, width, height, src) {
	if (typeof(container) == 'string')
	{
		var c = document.getElementById(container);
	}
	else
	{
		var c = container;
	}
	if (c != null)
	{
		var widthStr = '';
		var heightStr = '';
		if(width != '' && width != null)
		{
			widthStr = ' width=' + width;
		}
		if(height != '' && height != null)
		{
			heightStr = ' height=' + height;
		}
		c.innerHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + widthStr + heightStr + '"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"><param name="src" value="' + src + '"/><param name="quality" value="high"/><embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"' + widthStr + heightStr + '" wmode="transparent"></embed></object>';
		margen = (window.screen.width - width)/2;
		if(navigator.userAgent.indexOf('MSIE 7')>0)
		{
			
			document.getElementById(container).style.right = margen +'px';
			document.getElementById('bannerfloat').style.right = margen +'px';
			document.getElementById(container).style.overflow = 'hidden';
			document.getElementById('bannerfloat').style.overflow = 'hidden';
		}
		
		document.getElementById(container).style.left = margen +'px';
		document.getElementById('bannerfloat').style.left = margen +'px';
	}
}

function CreateImageVHC(container, width, height, src) {
	if (typeof(container) == 'string')
	{
		var c = document.getElementById(container);
	}
	else
	{
		var c = container;
	}
	if (c != null)
	{
		margen = (window.screen.width - width)/2;
		
		if(navigator.userAgent.indexOf('MSIE 7') > 0)
		{
			document.getElementById(container).style.right = margen +'px';
			document.getElementById('bannerfloat').style.right = margen +'px';
			
			document.getElementById(container).style.overflow = 'hidden';
			document.getElementById('bannerfloat').style.overflow = 'hidden';
		}
		
		document.getElementById(container).style.left = margen +'px';
		document.getElementById('bannerfloat').style.left = margen +'px';
	}
}

function PurchaseMovieComplex(idForm, idSelPeli, idSelCompl, domain, urlComp)
{
	var oForm = document.getElementById(idForm),
	oPeli = document.getElementById(idSelPeli),
	oComp = document.getElementById(idSelCompl),
	i = 0;
	
	if (oForm && oPeli && oComp)
    {
		if (oPeli.value && oComp.value)
		{
			i = 1;
		}
		else if (oPeli.value || oComp.value)
		{
			if (oPeli.value)
            {
	            i = 2;
            }
            else if(oComp)
            {
            	i = 3;
            }
		}

		switch (i)
        {
        	case 1 :
        		var callback =
        		{
        			success: function(o)
        			{
        				if (o.responseText != '')
                        {
        					window.location = '/compraentradas.php?idcartelera='+o.responseText;
                        }
        			},
        			failure: null
        		};
        		
        		YAHOO.util.Connect.asyncRequest('POST', '/ajaxrequest/ajaxaction.php', callback, 'method=GetIdCartelByIdPeliIdCompBs64&ip='+oPeli.value+'&ic='+oComp.value);
        		break;
        		
        	case 2 :
		        window.location = '/compraentradas.php?idpelicula='+oPeli.value;
        		break;
        		
	        case 3 :
		        window.location = '/compraentradas.php?idcomplejo='+oComp.value+'&ruri='+urlComp;
		        break;

	        default :
		        break;
        }
    }

	return false;
}

function OpenPopUpPromotions(idElm, pathRes, type, width, height, url)
{
//	if (readCookie(idElm) != 1)
//	{
		$(document).ready(function()
		    {
				switch (type)
		        {
		        	case 'swf' :
		        		swfobject.embedSWF(pathRes, idElm + '_body', width, height, "8.0.0");
		        		break;
		        		
			        case 'flv' :
		        		var s1 = new SWFObject('/player/flvplayer.swf','single',width,height,"7");
		        		s1.addParam('allowfullscreen','false');
		        		s1.addVariable('file', (/^\/[.]+/.test(pathRes) ? '' : '/') + pathRes);
		        		s1.addVariable("width",width);
		        		s1.addVariable("height",height+25);
		        		s1.addVariable("displaywidth",width);
		        		s1.addVariable("displayheight",height);
		        		s1.addVariable("displayclick","none");
		        		s1.addVariable("enablejs","true");
		        		s1.addVariable("shownavigation","true");
		        		s1.addVariable("autostart","false");
			        	//s1.addVariable("controlbar","none");
		        		s1.addVariable("showicons","true");
		        		s1.addVariable("usekeys","false");
		        		s1.addVariable("javascriptid",'single');
		        		s1.write(idElm + '_body');
				        break;
		
			        default :
				        $('<img id="'+idElm+'_resource" src="' + pathRes + '" border="0">').appendTo($("#" + idElm + '_body'));
			        	if (url) 
			        	{
			        		$("#" + idElm+"_resource").css('cursor', 'pointer');
			        		$("#" + idElm+"_resource").click(function()
	        		        {
			        			window.location = (url);
	        		        });
			        	}
				        break;
		        }
		
		        var cont_w = width;
		        var cont_h = height + 19;
		
		        // Darle el alto y ancho
		        $("#" + idElm).css('width', cont_w + 'px');
		        $("#" + idElm).css('height', cont_h + 'px');
		
		        // Esconder el popup
		        $("#" + idElm).hide();
		
		        // Consigue valores de la ventana del navegador
		        var w = $(window).width();
		        var h = $(window).height();
		
		        // Centra el popup
		        w = (w / 2) - (width / 2);
		        h = (h / 2) - (height / 2);
		
		        $("#" + idElm).css("left", w + "px");
		        $("#" + idElm).css("top", h + "px");
		
		        $("#" + idElm).css('display', 'block');
		
		        // temporizador, para que no aparezca de golpe
		        var fnc = 'setTimeout("mostrar(\'' + idElm + '\');", 1500);';
		        eval(fnc);
		
		        // Función para cerrar el popup
		        $("#" + idElm + '_close').click(function()
		        {
		        	//createCookie(idElm, '1', 1);
		        	
			        $("#" + idElm).fadeOut('slow');
		        });
		    }
		);
//	}
}

function mostrar(idElm)
{
	$("#"+idElm).fadeIn('slow');
}

function createCookie(name, value, days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	}
	else
		var expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for ( var i = 0; i < ca.length; i++)
	{
		var c = ca[i];
		while (c.charAt(0) == ' ')
			c = c.substring(1, c.length);
		if (c.indexOf(nameEQ) == 0)
			return c.substring(nameEQ.length, c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name, "", -1);
}

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
}

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
}

function mycarousel_getItemHTML(item)
{
	return '<img class="' + item.css + '" src="' + item.url + '" width="75" height="75" border="0" alt="' + item.title + '" onclick="window.location = \'' + item.link + '\'"/>';
}