/**************************************************************************************************************************/
// RESIZE TEXT
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
      && a.getAttribute("title")) {
    a.disabled = true;
    if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}
function getActiveStyleSheet() {
 var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1
  && a.getAttribute("title")
  && !a.disabled) return a.getAttribute("title");
  }
  return null;
}
function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

/**************************************************************************************************************************/
// MAKE EQUAL HEIGHT DIVS
function fixH(one,two) {
  var lc=$get('ctl00_leftPanel');
  var rc=$get('content');
  var lowestPart = Math.max((findTop(lc)+lc.offsetHeight), (findTop(rc)+rc.offsetHeight));
  lc.style.height = lowestPart-findTop(lc)-10+"px";
  rc.style.height = lowestPart-findTop(rc)+"px";
}
function findTop(obj) {
	var curtop = 0;
  if (obj.offsetParent) {
    do {
			curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
	return curtop;
	}
}

/**************************************************************************************************************************/
// OPACITY
function opacity(id, opacStart, opacEnd, secs) { 
  speed = Math.round(secs * 10) //speed for each frame
  timer = 0
  if(opacStart > opacEnd) { //determine the direction for the blending
  for(i = opacStart; i >= opacEnd; i--) { 
    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
    timer++; 
  }
  } else if(opacStart < opacEnd) { 
    for(i = opacStart; i <= opacEnd; i++) 
      { 
      setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
      timer++; 
    }
	//document.getElementById(id).style.filter = "none"
  }
}
//change the opacity for different browsers (by id)
function changeOpac(opacity, id) { 
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
	object.filter = "alpha(opacity=" + opacity + ")"; 
}
