var total_divs=0; //do not change this. it will be calculated automatically
var className='block-info'; //name of your class assigned to the divs you would like to rotate. Need to change it


function initPage () {
	var fMin = document.getElementById("font-min");
	var fNormal = document.getElementById("font-normal");
	var fMax = document.getElementById("font-max");
	var fSize = 100;
	
	var body = document.getElementsByTagName("body")[0];
	body.style.fontSize = "62.5%";

    if (fNormal != null && fNormal != "undefined") {
	    fNormal.onclick = function (){
		    body.style.fontSize = "62.5%";
		    return false;
	    }
	}
    if (fMin != null && fMin != "undefined") {
	    fMin.onclick = function (){
		    fSize = body.style.fontSize.replace("%","");
		    fSize = parseInt(fSize) - 10;
		    if (fSize <= 50) fSize = 50;  
		    body.style.fontSize = fSize+"%";
		    return false;
	    }
	}
    if (fMax != null && fMax != "undefined") {
	    fMax.onclick = function (){
		    fSize = body.style.fontSize.replace("%","");
		    fSize = parseInt(fSize) + 10;
		    if (fSize >= 140) fSize = 140; 
		    body.style.fontSize = fSize+"%";
		    return false;
	    }
	}
	$("."+className).attr("id", function (arr) {
	    total_divs++;
        return "fade" + (arr+1);
    })
    if (total_divs > 1) 
        fadeEngine(0);
}

if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);
	
function fadeEngine(x) {
    var y=x;    
    if(x==total_divs) y=1; else y++;
    $("#fade"+x).fadeOut("slow");
    $("#fade"+x).css("display","none");
    $("#fade"+y).fadeIn("slow");
    setTimeout('fadeEngine('+y+')',8000);
}


