/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/

// by Paul@YellowPencil.com and Scott@YellowPencil.com
// feel free to delete all comments except for the above credit

function setTall() {

//alert("settall");
	if (document.getElementById) {
		// the divs array contains references to each column's div element.  
		// Replace 'center' 'right' and 'left' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(document.getElementById('leftsection'),document.getElementById('middlesection'),document.getElementById('rightsection'));
		
		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
		   // alert("The height is :" + divs[i].offsetHeight );
		   if(divs[i])
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		// Let's set all columns to that maximum height
		for (var i = 0; i < divs.length; i++) {
			//alert("setting"+ i);
			
		if(i<2)
		{
		 if(divs[i])
			divs[i].style.height = maxHeight + 'px';
			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			
			//alert("i is less than 2");
			 if(divs[i])
			 {
				if (divs[i].offsetHeight > maxHeight) 
				{			
					divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
				}
			}
		}
		//else
		//{
		 //   divs[i].style.height = 0;
		//	divs[i].style.height = maxHeight + 'px';
		//}
		}//end for
		
		//alert("The height of leftcontainer is :"+ document.getElementById('leftcontainer').style.height);
		//alert("The height is set to :"+  eval(maxHeight-179));
		//alert("The height of the logo is "+ document.getElementById('logo').offsetHeight);
		//document.getElementById('leftcontainer').style.height = eval(maxHeight-179)+ 'px';
	}
}

window.onload = function() {
	 
	setTall();
	
}

window.onresize = function() {

	setTall();
}

function sethome()
{
	//alert("In down "+maxHeight);//rightoplinktext3
	
	var r1=document.getElementById('contentleftdummy');
	var r2=document.getElementById('contentcol3');
	var r3=document.getElementById('contentcol2');
	var r4=document.getElementById('contentcol3');
	
		
	var r1h=r1.offsetHeight;
	var r2h=r2.offsetHeight;
	var r3h=r3.offsetHeight;
	var r4h=r3.offsetHeight;
	
	if ((r2h > r3h) && (r2h > r4h))
		r1.style.height = r2h + 'px';
	if ((r3h > r2h) && (r3h > r4h))
		r1.style.height = r3h + 'px';
	if ((r4h > r2h) && (r4h > r3h))
		r1.style.height = r4h + 'px';
	
	 
}


function setheight()
{


   var maxHeight = 0;
   document.getElementById("leftsection").style.height = 2000;
   alert(document.getElementById("leftsection").offsetHeight);
   if (document.getElementById("leftsection").offsetHeight > document.getElementById("middlesection").offsetHeight)
   {
     maxHeight = document.getElementById("leftsection").offsetHeight;
   }
   
   document.getElementById("leftsection").style.height = maxHeight+'px';
   document.getElementById("rightsection").style.height=maxHeight+'px';
   alert(":hello");
 //for (var i = 0; i < divs.length; i++) {
//if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
//}


//	var staticheight=2000;
	 alert(document.getElementById("leftsection").offsetHeight);
  //  document.getElementById("leftsection").style.height =staticheight + 'px';
	alert(document.getElementById("rightsection").offsetHeight);
	
	
	//document.getElementById("middlesection").style.height =staticheight + 'px';
	
	
//	getwindowheight(document.getElementById("leftsection"));
}


function getWindowHeight() {
var windowHeight=0;
if (typeof(window.innerHeight)=='number') {
windowHeight=window.innerHeight;
}
else {
if (document.documentElement&&
document.documentElement.clientHeight) {
windowHeight=
document.documentElement.clientHeight;
}
else {
if (document.body&&document.body.clientHeight) {
windowHeight=document.body.clientHeight;
}
}
}
return windowHeight;
}



function rollover(imgid,imgsrc)
{
	document.getElementById(imgid).src=imgsrc;
}

function rollout(imgid,imgsrc)
{
	document.getElementById(imgid).src=imgsrc;
}


function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
	dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;
	var rightSection =document.getElementById("rightsection").offsetHeight;
	var leftSection=document.getElementById("leftsection").offsetHeight;
	if(document.getElementById("middlesection"))
	{
		var middleSection=document.getElementById("middlesection").offsetHeight;
	}
	if(rightSection>leftSection)
	{
		document.getElementById("leftcontainer").style.paddingBottom=rightSection -leftSection  + "px"; 
		if(document.getElementById("middlesection"))
		{
			if(rightSection>middleSection)
				document.getElementById("middlesection").style.paddingBottom=rightSection - middleSection  + "px";
		}
		var rightSection =document.getElementById("rightsection").offsetHeight;
		var leftSection=document.getElementById("leftsection").offsetHeight;
		if(document.getElementById("middlesection"))
		{
		var middleSection=document.getElementById("middlesection").offsetHeight; 
		}
		//alert("m" + middleSection);
	//	alert("r" + rightSection );
		if(leftSection>rightSection)
		{
			document.getElementById("rightsection").style.paddingBottom=leftSection-rightSection  + "px";
			//document.getElementById("middlesection").style.paddingBottom=leftSection-middleSection + "px";
		//	alert("r" + document.getElementById("rightsection").offsetHeight) ;
		//	alert("m" + document.getElementById("middlesection").offsetHeight) ;
		}
	}
	else
	{
		document.getElementById("leftcontainer").style.paddingBottom=leftSection - rightSection + "px"; 
		if(document.getElementById("middlesection"))
		{
			document.getElementById("middlesection").style.paddingBottom=rightSection -middleSection  + "px";
		}
	}
	
 }
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
/*test();*/
 var c,e,el;
 if(document.getElementById)
    {
    	document.p7eqc=new Array();
 	document.p7eqc[0]=arguments[0];
 	for(i=1;i<arguments.length;i+=2)
 		{
 			el=null;
 			c=document.getElementById(arguments[i]);
 			if(c)
 			   {
 			   	e=c.getElementsByTagName(arguments[i+1]);
 	
 				if(e)
 				 {
 				   el=e[e.length-1];
 				   if(el!=null)
 				   {
 					if(!el.id)
 						{
 						el.id="p7eq"+i;
 						}
 				    }
 				  }
 			    }
 			 if(c&&el)
 			    {
 			    
 				document.p7eqc[document.p7eqc.length]=c;
 				document.p7eqc[document.p7eqc.length]=el
 			     }
 		 }
 	setInterval("P7_eqT2()",10);
    }
}
		 
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}
function setDiv(){ 
/*test();*/
 var maxHeight=0;
 //alert(arguments.length);
 if(document.getElementById)
    {
    var divs=new Array();
    
    for(i=0;i<arguments.length;i+=1)
 		divs[i]=document.getElementById(arguments[i]);
 
 	for (var i = 0; i < divs.length; i++) 
		if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
	//alert(maxHeight);
	
	
	for (var i = 0; i < divs.length; i++) 
	{
		if(i<2)
		{
		 if(divs[i])
			divs[i].style.height = maxHeight + 'px';
			if(divs[i])
			 {
				if (divs[i].offsetHeight > maxHeight) 
				{			
					divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
					
				}
			}
		}
		else
		{
			divs[i].style.height = 0;
			divs[i].style.height = maxHeight + 'px';
		}
	}// end for
	
 	}// end if 
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}