/* resize */
function initPage () {
	var fMin = document.getElementById("font-min");
	var fMax = document.getElementById("font-max");
	var fSize = 100;
	
	var body = document.getElementsByTagName("body")[0];
	body.style.fontSize = "62.5%";
	fMin.onclick = function (){
		fSize = body.style.fontSize.replace("%","");
		fSize = parseInt(fSize) - 10;
		if (fSize <= 42.5) fSize = 42.5;  
		body.style.fontSize = fSize+"%";
		return false;
	}
	fMax.onclick = function (){
		fSize = body.style.fontSize.replace("%","");
		fSize = parseInt(fSize) + 10;
		if (fSize >= 82.5) fSize = 82.5; 
		body.style.fontSize = fSize+"%";
		return false;
	}
}

if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);

/* height-box */
function main_height()
{
	
	//code below commented out by Alexis
	/*
	var col = document.getElementsByTagName("div");
	for (var i = 0; i < col.length; i++)
	{
		if(col[i].className.indexOf('triple-holder') != -1)
		{
			var _h = col[i].offsetHeight;
			var hold = col[i].getElementsByTagName("div");
			for( var j = 0 ; j < hold.length ; j++)
				if( hold[j].className.indexOf('box') !=-1)
				{
					hold[j].style.minHeight = _h - 8 +'px';
					if (window.attachEvent && !window.opera){ hold[j].style.height = _h - 8 + 'px'; }
				}
				
		}
	}
	*/
	
	
	//code below added by Alexis
	var counter = 0;
	var batchCounter = 0;
	var batches = [];
	batches[batchCounter] = [];
	
	
	$('.triple-holder .box').each(function(index, valueElem)
	{
		if(counter>2)
		{
			//alert(batchCounter);
			counter = 0;
			batchCounter++;
			batches[batchCounter] = [];
		}	
		
		batches[batchCounter][counter] = valueElem;
		counter++;
	}); 
	
	$(batches).each(function(index, val){
		var biggestSize = $(val[0]).height();
		
		$(val).each(function(index2, val2){
			var currentSize = $(val2).height();
			//alert(currentSize);
			if(currentSize > biggestSize)
				biggestSize = currentSize;
		});
		
		if(biggestSize<200)
			biggestSize=200;
		
		$(val).each(function(index2, val2){
			$(val2).height(biggestSize);
		});
		
		//alert('biggestSize ' + biggestSize);
	});
	
	
}

if (window.addEventListener){
	window.addEventListener("load", main_height, false);
}
else if (window.attachEvent && !window.opera){
	window.attachEvent("onload", main_height);
}
