var cur_tab = 1;
var gProductions = new Array();
var gTimerId = 0;
var flash = '';
var so;
function switchProduction(i)
{
	if (cur_tab == i) {	    
		return false;
	}
	 //flash = gProductions[i][0];
	 //var elem = document.getElementById('topFlash');
	 //elem.innerHTML = "";
	 //alert(elem.innerHTML);
	 //so = new SWFObject(flash, "topFlash", "920", "188", "8");
   	// so.addParam("wmode", "transparent");
   	 //so.write("topFlash");
   	 
   // flash = gProductions[i][0]; 	
    //Effect.Fade('topFlash', {duration: .25, afterFinish: function() { 
     //       so = new SWFObject(flash, "topFlash", "920", "188", "8");
   	  //      so.addParam("wmode", "transparent");
   	   //     so.write("topFlash");
   	    //    Effect.Appear('topFlash', {duration: .25}); } });
	
	cur_tab = i;
	return true;
}

function addProduction(index, photo) {
    gProductions[index] = new Array();
	gProductions[index][0] = photo;		
	flash = photo;
}

function startAnimation() {
	gTimerID = setTimeout("animate()", 5000);
}
function stopAnimation() {
    if(gTimerID) {
        clearTimeout(gTimerID);
        gTimerID  = 0;
    }
}

function animate(){
	var next = cur_tab + 1;
	if (!gProductions[next]) {        
		next = 1;
	}
	var result = switchProduction(next);
	if (result) {
        startAnimation();
	}
}


function startClientsAnimation()
{
	var duration = 1.75;
	var delay = 3.5;
	var nextLine = (g_curLine >= g_lines) ? 1 : g_curLine+1;
	Effect.Fade('ourInvest' + g_curLine, {delay: delay, duration:duration, afterFinish: function() {
		Effect.Appear('ourInvest' + nextLine, {duration:duration, afterFinish: function() {
			g_curLine = (g_curLine >= g_lines) ? 1 : g_curLine+1;
			window.setTimeout('startClientsAnimation();', 1);
		}});
	}});
}

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