﻿// JScript File

    window.defaultStatus="Portal EXPRESSO MARINGÁ"

    function fd() {
        window.open('../expFormularios/pg_Fidelidade.aspx', '_top');
    }

    function fale() {
        window.open('../expFormularios/pg_Fale.aspx', '_top');
    }
    
    function Inicio() {
        window.open('../expFormularios/pg_Principal00.aspx', '_top');
    }

    function cl() {
        window.open("http://www.climatempo.com.br/")
    }
    
    var news = new Array()

    news[0]  = [ "COMPRE SUA PASSAGEM SEM SAIR DE CASA!" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[1]  = [ "Pague em 3x sem juros nos cartões VISA" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[2]  = [ "Pague no vencimento nos cartões MASTERCARD" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[3]  = [ "COMPRE AGORA, é rápido e seguro!" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[4]  = [ "Escolha seu destino..." , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[5]  = [ "GUARATUBA, CURITIBA, MARINGÁ, CAMPO GRANDE...?" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[6]  = [ "Consulte nossas LINHAS E HORÁRIOS" , "http://www.expressomaringa.com.br/expFormularios/pg_Horario.aspx" ];
    news[7]  = [ "Para tirar dúvidas, sugerir ou reclamar..." , "http://www.expressomaringa.com.br/expFormularios/pg_Fale.aspx" ];
    news[8]  = [ "FALE CONOSCO!" , "http://www.expressomaringa.com.br/expFormularios/pg_Fale.aspx" ];
    news[9]  = [ "EXPRESSO MARINGÁ, ONDE VOCÊ É TUDO!" , "http://www.expressomaringa.com.br" ];
    news[10]  = [];

    var ticker_layer = false ;
    var step_time = 30 ;
    var freeze_time = 3000 ;
    var news_index = 0 ;
    var title_index = 0 ;
    var end_title = "_" ;
    var title_max_size = 65 ;

    for (var i=0;i<news.length-1;i++){
	    t = news[i][0] ;
	    t=t.replace(/\&quot;/gi,'"');
	    t=t.replace(/\&amp;/gi,'&');
	    t=t.replace(/\&#039;/gi,'\'');
	    if (t.length>title_max_size){
		    t = t.substring( 0 , title_max_size ) ;
		    t=t.substring(0,t.lastIndexOf(' '));
		    t+='...';
	    }
	    news[i][0]=t;
    }

    function begin_roll_ticker(){
	    //fxLN();
        pn = document.getElementById("imgPN");
        pn.style.visibility="visible";
	    window.setTimeout( "roll_ticker()" , step_time ) ;
    }

    function roll_ticker(){
	    var title ;
	    if ( title_index == 0 ){
		    while ( document.getElementById('ticker').lastChild != null ){
			    child = document.getElementById('ticker').lastChild ;
			    document.getElementById('ticker').removeChild( child ) ;
		    }
	    }
	    if ( news.length > news_index + 1 && news[news_index][0].length >= title_index ){
		    title = news[ news_index ] ;
    		
		    document.getElementById('ticker_anchor').setAttribute( "href" , title[1] ) ;

		    s_text = title[0].substring( title_index  , title_index + 1 ) ;
		    title_index++ ;

		    if ( document.getElementById('ticker').lastChild != null ){
			    if ( document.getElementById('ticker').lastChild.nodeValue == "_" ){
				    child = document.getElementById('ticker').lastChild ;
				    document.getElementById('ticker').removeChild( child ) ;
			    }
		    }

		    txt = document.createTextNode( s_text ) ;
		    document.getElementById('ticker').appendChild( txt ) ;

		    if ( title[0].length > title_index ) {
			    if ( title_index % 10 != 0 ){
				    txt = document.createTextNode( "_" ) ;
				    document.getElementById('ticker').appendChild( txt ) ;
			    }
		    }
		    window.setTimeout( "roll_ticker()" , step_time ) ;
	    }
	    else{
		    news.length == news_index + 2 ? news_index = 0 : news_index++ ;
		    title_index = 0 ;
		    window.setTimeout( "roll_ticker()" , freeze_time ) ;
	    }
    }