﻿// JavaScript Document
$(function(){
 
 autoheight();
});

var autoheight = function(){
 
var l = $("#sidebar").height();
var r = $("#content").height();

if(r > l){
 	$("#sidebar").css('height',r);
}
else{
	 $("#content").css('height',l);
}

}

/*
不要在样式表里写padding否则计算的结果不准确
用JQ 写的兼容性比较好
*/

/*
function exist(id){
    var hasId=document.getElementById(id);
    if(hasId){return true}
    else{return false}
   }

function autoHeight(){	
		var con_height = document.getElementById("content").scrollHeight  ; //取Content的高度
		var sider_height = document.getElementById("sidebar").scrollHeight ; //取sidebar的高度
		
		//document.getElementById("sidebar").style.height = con_height ;   
		
		
		if( con_height < sider_height ){
			document.getElementById("content").style.height = sider_height ;
			//document.getElementById("sidebar").style.height = sider_height;
			//alert(con_height);
			//alert ("1");
		}

		else{
			document.getElementById("sidebar").style.height = con_height;
			//alert ("2");    
		}
		
		
}
			
function pageOnload()
{
	 if (exist("content")){ 
		autoHeight();
	}
	else{
	}  
}
	
window.onload = pageOnload;
*/
