﻿	
//positining functions	
function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
    alert(yPos);
}	
	
function rollover(img, onoff, permanent) {
    str = img.firstChild.src
    if (onoff) {
        str = str.substring(0,str.length-4) + '_over.gif'
    } else {
        str = str.substring(0,str.length-9) + '.gif'
    }
    img.firstChild.src = str
    if (permanent) {
        img.onmouseover = function() {}
        img.onmouseout = function() {}
    }
    
    
}	
	
function addLoadEvent(func) {
  var oldonload = window.onload;
  
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
	

function loadRow(tmpStr, tbl, cls,  rnum, cnum, remove, no_remove) {
    tbody = document.getElementById(tbl);
    tbody = tbody.getElementsByTagName("tbody")[0];
            
    if ((currrow > 0) && (remove)) {
        tbody.removeChild(tbody.getElementsByTagName("tr")[currrow])
    }                    
    trow = tbody.getElementsByTagName("tr")[rnum + 1];                
    
    var row = document.createElement("TR")
    var td1 = document.createElement("TD")
    row.appendChild(td1);
    td1.innerHTML = tmpStr        
    td1.colSpan = cnum
    td1.className = cls

    if ((rnum + 1) == (tbody.getElementsByTagName("tr").length)) {
       tbody.appendChild(row);
    } else {
        tbody.insertBefore(row,trow);
    }
    
    if (no_remove) {
        currrow = -1   
    } else {
        currrow = rnum + 1 
    }
}	

function row_class_change(tbl, cls,  rnum) {
    tbody = document.getElementById(tbl);
    tbody = tbody.getElementsByTagName("tbody")[0];
            
              
    trow = tbody.getElementsByTagName("tr")[rnum + 1];                
    trow.className = cls
    
}	


function showCaption(id, onoff) {
    cap = document.getElementById(id)
    if (onoff) {
        cap.style.display = 'block';
        cap.style.margin = '-' + (cap.scrollHeight - 0) + 'px 0px 0px 0px';
        cap.className = 'media_object_caption';
    } else {
       cap.style.display = 'none';
    }
}