// flash fix
function __ffix()
{   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" height="158" width="766">');
    document.write('<param name="movie" value="img/img/windows.swf">');
    document.write('<param name="quality" value="high">');
    document.write('<embed src="img/img/windows.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="158" width="766">');
    document.write('</object>');
}

// setting image
function fs(obj, _img)
{   if (document.images)
    {   src = obj.src;
        src = src.replace(/[a-z\.-]*gif$/,"");
        obj.src = src + _img;
    }
}
var initStr    = null;
var iCharPos   = 0;
var oText      = null;
var blRight    = true;

var sNewInit    = null;
var iNewCharPos = 0;
var oNews       = null;
var blNewRight  = true;
var sNewColor   = "color:#efe3bd";
//var sNewColor   = "color:#000000";

//var iColorPos = 0;
//var aColors   = new Array("#00ffff", "#000000", "#0000ff", "#00ffff", "#ff00ff", "#00ff00", "#ff00ff", "#ff0000", "#ffffff", "#ffff00");

// preloading images
function pr()
{   if (document.images)
    {   sUrl = 'http://www.fortosiena.lt/img/img/';
        aImg = new Array(7);
        aImg[0] = 'ltu_aboutus';
        aImg[1] = 'ltu_sell';
        aImg[2] = 'ltu_buy';
        aImg[3] = 'ltu_rent';
        aImg[4] = 'ltu_estimation';
        aImg[5] = 'ltu_loan';
        aImg[6] = 'ltu_insurance';
        aoImg = new Array(14);
        var i=0;
        for (x=0; x<7; x++)
        {   aoImg[i] = new Image();
            aoImg[i].src = aImg[x] + '.gif';
            i++;
            aoImg[i] = new Image();
            aoImg[i].src = aImg[x] + '-act.gif';
            i++;
        }
    }
    
    /*
    // animation effect
    oText = document.getElementById("_offer");
    if (oText != null) 
    {   initStr = oText.innerHTML;
        setTimeout('animate()', 300);
    }*/
    
    // newsletter form animation effect
    oNews = document.getElementById("_news");
    if (oNews!= null)
    {   sNewInit = oNews.innerHTML;
        setTimeout('animateNews()', 300);
    }
}

function animate()
{

    if (oText == null || initStr == null)
        return;
    /*
    if (iCharPos >= initStr.length || iCharPos < 0 )
        iCharPos = 0;
    
    // taking highlighted char
    sChar = "<b style='color:#ffff00'>" + initStr.charAt(iCharPos) + "</b>";
    
    // braking words
    sStart = initStr.substring(0, iCharPos);
    sEnd   = initStr.substring(iCharPos+1, initStr.length);
    
    oText.innerHTML = sStart + sChar + sEnd;
    
    if ((iCharPos+1) == initStr.length)
        blRight = false;
    if (iCharPos == 0)
        blRight = true;

    if (blRight)
        iCharPos++;
    else    
        iCharPos--;       

    */
    iCharPos++;
    if (iCharPos == 1)
    {   oText.innerHTML = "<b style='background-image: url(http://www.fortosiena.lt/img/img/bbg.jpg);width: 110;filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75;'>" + initStr + "</b>";
        // reloading
        setTimeout('animate()', 200);
    }
    else if (iCharPos == 2)
    {   oText.innerHTML = "<b style='background-image: url(http://www.fortosiena.lt/img/img/bbg.jpg);width: 110;filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;'>" + initStr + "</b>";
        // reloading
        setTimeout('animate()', 200);
    }
    else if  (iCharPos == 3)
    {   oText.innerHTML = "<b style='background-image: url(http://www.fortosiena.lt/img/img/bbg.jpg);width: 110;filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;'>" + initStr + "</b>";
        // reloading
        setTimeout('animate()', 200);       
    }
    else if (iCharPos == 4)
    {   oText.innerHTML = "<b style='background-image: url(http://www.fortosiena.lt/img/img/bbg.jpg);width: 110;filter:alpha(opacity=100);-moz-opacity:1.0;opacity:1.0;'>" + initStr + "</b>";
        // reloading
        setTimeout('animate()', 1800);
    }
    
    if (iCharPos > 3)
        iCharPos = 0;

    /*if (oText == null) return;
    if (iColorPos > aColors.length) iColorPos = 0;
    
    oText.innerHTML = "<div style='color:" + aColors[iColorPos] + "'>" + initStr + "</div>";
    
    iColorPos++;
    setTimeout('animateNews()', 300);*/  
}

function animateNews()
{


    if (oNews == null || sNewInit == null)
        return;
		/*
    if (iNewCharPos >= sNewInit.length || iNewCharPos < 0 )
        iNewCharPos = 0;
    
    // taking highlighted char
    sChar = "<b style='color:#ffff00;font-weight_:normal'>" + sNewInit.charAt(iNewCharPos) + "</b>";
    
    // braking words
    sStart = sNewInit.substring(0, iNewCharPos);
    sEnd   = sNewInit.substring(iNewCharPos+1, sNewInit.length);
    
    oNews.innerHTML = sStart + sChar + sEnd;
    
    if ((iNewCharPos+1) == sNewInit.length)
        blNewRight = false;
    if (iNewCharPos == 0)
        blNewRight = true;

    if (blNewRight)
        iNewCharPos++;
    else    
        iNewCharPos--;       

    // reloading
    setTimeout('animateNews()', 140);   
		*/
    /*if (oNews == null) return;
    if (iColorPos > aColors.length) iColorPos = 0;
    
    oNews.innerHTML = "<div style='color:" + aColors[iColorPos] + "'>" + sInitNew + "</div>";
    
    iColorPos++;
    setTimeout('animateNews()', 300);*/

    iNewCharPos++;
    if (iNewCharPos == 1)
    {   oNews.innerHTML = "<div class='newshead' style='" + sNewColor + ";padding:0px;filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75;'>" + sNewInit + "</div>";
        // reloading
        setTimeout('animateNews()', 200);
    }
    else if (iNewCharPos == 2)
    {   oNews.innerHTML = "<div class='newshead' style='" + sNewColor + ";padding:0px;filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;'>" + sNewInit + "</div>";
        // reloading
        setTimeout('animateNews()', 200);
    }
    else if (iNewCharPos == 3)
    {   oNews.innerHTML = "<div class='newshead' style='" + sNewColor + ";padding:0px;filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;'>" + sNewInit + "</div>";
        // reloading
        setTimeout('animateNews()', 200);
    }
    else if (iNewCharPos == 4)
    {   if ( sNewColor == "color:#efe3bd")
				    sNewColor = "color:#ffffff";
				else
				    sNewColor = "color:#efe3bd";

		    oNews.innerHTML = "<div class='newshead' style='" + sNewColor + ";padding:0px;filter:alpha(opacity=100);-moz-opacity:1.0;opacity:1.0;'>" + sNewInit + "</div>";
        // reloading
        setTimeout('animateNews()', 1800);
    }

    if (iNewCharPos > 3)
        iNewCharPos = 0;
				
		
}