// JavaScript Document

//this only for two div/s height setting
function fixHeightGeneral(one,two) {
	if (document.getElementById(one)) 
	{
		var lh=document.getElementById(one).offsetHeight;
		var rh=document.getElementById(two).offsetHeight;
		var nh = Math.max(lh, rh); 
		document.getElementById(one).style.height=nh+"px";
		document.getElementById(two).style.height=nh+"px";
	}
}


//this does it for three or more number options just keep increasing the Array for numbers
//No matter how many div have to be of equal height div=id
function sortNum(a,b) { return b-a} 

function fixHeightSetOne(one,two,three,four,five) 
{
	//if (document.getElementById(one))
	if (document.getElementById(one))
	{
		var obj=new Array(5);
		var option=[one,two,three,four,five];
		for(var i=0; i<option.length; i++) 
		{
			document.getElementById(option[i]).style.height="auto";
			obj[i]=document.getElementById(option[i]).offsetHeight;
			nh=obj.sort(sortNum);
		} 
		nh1=nh.splice(1,5); //nh.splice(1,2) splice important for number of divs along with the first one
		//alert(nh1);
		for(var i=0; i<option.length; i++) 
		{
			document.getElementById(option[i]).style.height=nh+"px";
		}
	}
}

function fixHeightSetTwo(one,two)
{
	if (document.getElementById(one))
	{
		var obj1=new Array(2);
		var option=[one,two];
		for(var i=0; i<option.length; i++) 
		{
			document.getElementById(option[i]).style.height="auto";
			obj1[i]=document.getElementById(option[i]).offsetHeight;
			nh=obj1.sort(sortNum);
			//alert(obj1);
		} 
		nh2=nh.splice(1,2); //nh.splice(1,2) splice important for number of divs along with the first one
		//alert(nh2);
		for(var i=0; i<option.length; i++) 
		{
			document.getElementById(option[i]).style.height=nh+"px";
		}
	}
}
//


window.onload=function(){
//fixHeightGeneral('c1ContHldr','c2ContHldr'); //for only two blocks accross
fixHeightSetOne('cellOneHldr','cellTwoHldr','cellThreeHldr','cellFourHldr','cellFiveHldr'); /*Set-1*/
fixHeightSetTwo('c1ContHldr','c2ContHldr'); /*Set-2*/
}