/* These are webbybuddy created functions */
var myWidth = 0, myHeight = 0;

function fixLeftPaneHeight()
{
	var iHeight = 0;
	var objPane = document.getElementById("dv_body_left");
	var objBody=document.getElementById("dv_body_right");
	
	var iHeight = objBody.scrollHeight;
	
	if(objPane!=null)
		objPane.style.minHeight=iHeight+"px";
}

// Function to get position of elements
function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}
    
function pageHeight() {
	height = document.innerHeight;
	
    if(height==undefined)
	{
	    height = document.documentElement.clientHeight;
	    if(height==0){height=document.body.clientHeight;}
	}

    return height;
}

function itemHeight() {
	var Height;
	
	if (window.innerHeight && window.scrollMaxY) {// Firefox         
		Height = window.innerHeight + window.scrollMaxY;
		//xWithScroll = window.innerWidth + window.scrollMaxX;     
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac         
		Height = document.body.scrollHeight;
		//xWithScroll = document.body.scrollWidth;     
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari         
		Height = document.body.offsetHeight;
		//xWithScroll = document.body.offsetWidth;       
	}

    return Height;
}

function itemInnerHeight(item) {
	var Height = document.getElementById(item).innerHeight;
	
    if(Height==undefined)
	{
	    Height = document.getElementById(item).clientHeight;
	}

    return Height;
}

function setItemHeight(item,height) {
	document.getElementById(item).style.height = height;
}
    
function Appear(id, opacity, maxOpacity) {
    
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + (opacity + 10) + ")";
    object.display='';

	if (opacity+20 <= maxOpacity) {
		setTimeout("Appear('" + id + "', " + (opacity+15) + ", " + maxOpacity + ");", 1);
	}
}

function formatCurrency(nStr) {
    nStr = parseFloat(nStr).toFixed(2);
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}

function validateNumber() {
    var unicode = event.keyCode ? event.keyCode : event.charCode;

    if (unicode < 48 || unicode > 57) {
        return false;
    } else {
        return true;
    }
}
// End
