/* 
  ------------------------------------------------
For setting two <div> columns to equal heights
  ------------------------------------------------
*/
function colH2(){
 var i,oh,h=0,tg,el,np,dA=document.eqc,an=document.eqa;
 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){eqA2(dA[i+1].id,0,np);
 		}else{
 			dA[i+1].style.paddingBottom=np+"px";
 		}
 	}
 }
 
 document.eqa=1;
 document.eqth=document.body.offsetHeight;
 document.eqtw=document.body.offsetWidth;
 }
}
function eqT2(){ 
 if(document.eqth!=document.body.offsetHeight||document.eqtw!=document.body.offsetWidth){
 	colH2();
 }
}


function equalCols2(){ 
 var c,e,el;
 if(document.getElementById){
 document.eqc=new Array();
 document.eqc[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.id){
 				el.id="eq"+i;
 			}
		}
 	}
 	if(c&&el){
 		document.eqc[document.eqc.length]=c;
 		document.eqc[document.eqc.length]=el
 	}
 }
 setInterval("eqT2()",10);
 }
}


function eqA2(el,p,pt){
 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("eqA2('"+el+"',"+np+","+pt+")",sp);
	}
}



function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// new DOM loader

function addDOMLoadEvent(func) {
   if (!window.__load_events) {
      var init = function () {
          // quit if this function has already been called
          if (arguments.callee.done) return;
      
          // flag this function so we don't do the same thing twice
          arguments.callee.done = true;
      
          // kill the timer
          if (window.__load_timer) {
              clearInterval(window.__load_timer);
              window.__load_timer = null;
          }
          
          // execute each function in the stack in the order they were added
          for (var i=0;i < window.__load_events.length;i++) {
              window.__load_events[i]();
          }
          window.__load_events = null;

          // clean up the __ie_onload event
          /*@cc_on @*/
          /*@if (@_win32)
              document.getElementById("__ie_onload").onreadystatechange = "";
          /*@end @*/
      };
   
      // for Mozilla/Opera9
      if (document.addEventListener) {
          document.addEventListener("DOMContentLoaded", init, false);
      }
      
      // for Internet Explorer
      /*@cc_on @*/
      /*@if (@_win32)
          document.write("<scr"+"ipt id=__ie_onload defer src=javascript:void(0)><\/scr"+"ipt>");
          var script = document.getElementById("__ie_onload");
          script.onreadystatechange = function() {
              if (this.readyState == "complete") {
                  init(); // call the onload handler
              }
          };
      /*@end @*/
      
      // for Safari
      if (/WebKit/i.test(navigator.userAgent)) { // sniff
          window.__load_timer = setInterval(function() {
              if (/loaded|complete/.test(document.readyState)) {
                  init(); // call the onload handler
              }
          }, 10);
      }
      
      // for other browsers
      window.onload = init;
      
      // create event function stack
      window.__load_events = [];
   }
   
   // add function to event stack
   window.__load_events.push(func);
}




