// Divs in IE don't auto adjust even if you put height of 100%.  This is to calculate the main content's height on page load and adjust accordingly
function adjustHeight() {
	mainBox = document.getElementById('mainc');
	mainMargin = document.getElementById('main_margin');
	leftSide = document.getElementById('leftc');
	rightSide = document.getElementById('rightc');
	divider = document.getElementById('divider');

	mainHeight = Math.max(mainBox.offsetHeight, mainBox.scrollHeight);
	if (leftSide)
		leftHeight = Math.max(leftSide.offsetHeight, leftSide.scrollHeight);
	if (rightSide)
		rightHeight = Math.max(rightSide.offsetHeight, rightSide.scrollHeight);

	if (leftSide)
		maxHeight = Math.max(mainHeight, leftHeight);
	if (rightSide)
		maxHeight = Math.max(mainHeight, rightHeight);

	maxHeight = maxHeight + 'px';

	if (rightSide)
		rightSide.style.height=maxHeight;
/*
	mainBox.style.height = maxHeight;
	leftSide.style.height=maxHeight;

	if (rightSide)
		rightSide.style.height=maxHeight;
	mainMargin.style.height=maxHeight;


	s1 = document.getElementById('shadow1');
	s1.style.height=maxHeight;

	s2 = document.getElementById('shadow2');
	if (s2) {
		s2.style.height=maxHeight;
	}

	s3 = document.getElementById('shadow_mid');
	s3.style.height=maxHeight;
*/
}
function toggleElement(elementname) {
    thisItem = document.getElementById(elementname);
    if (thisItem.style.display == 'none') {
        thisItem.style.display = 'inline';
    }
    else {
        thisItem.style.display = 'none';
    }
}

function toggleBullet(bulletname, bulleton, bulletoff) {
    thisItem = document.getElementById(bulletname);

    if (thisItem.style.listStyleImage=='url(' + bulleton + ')')
        thisItem.style.listStyleImage='url(' + bulletoff + ')';
    else
        thisItem.style.listStyleImage='url(' + bulleton + ')';
}

 function calculateCornerY(floatingMenu) {  
//     if (floatingMenu.targetY != 'center')  
  //       return floatingMenu.shiftY + floatingMenu.targetY;  
   
     var height = parseInt(floatingMenu.offsetHeight);  
     // Handle Opera 8 problems                                   
     var clientHeight =   
         floatingMenu.hasElement && floatingMenu.hasInner  
         && document.documentElement.clientHeight   
             > window.innerHeight  
         ? window.innerHeight  
         : document.documentElement.clientHeight  

alert(floatingMenu.hasElement);   
     var cornerY =  
         floatingMenu.hasElement  
         ? (floatingMenu.hasInner    
            ? pageYOffset  
            : document.documentElement.scrollTop) +   
           (clientHeight - height)/2  
         : document.body.scrollTop +   
           (document.body.clientHeight - height)/2;  
     return cornerY;  
 }

 function calculateYPos(item, startPos) {  
	var pageHeight = document.body.clientHeight;
	var pixelsScrolled = document.body.scrollTop;

     var posY =  startPos + pixelsScrolled;
     return posY;  
 }

function getPos(el) {
    // yay readability
    for (var lx=0, ly=0;
         el != null;
         lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent);
    return {x: lx,y: ly};
}

