// by Paul@YellowPencil.com and Scott@YellowPencil.com
// feel free to delete all comments except for the above credit

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

<!-- Copyright 2006 Bontrager Connection, LLC
var cX = 0; var cY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
	if (parseInt(cX+400) >= window.innerWidth){
		d.style.left = (cX-250) + "px";
	} else {
		d.style.left = (cX+10) + "px";
	}
	
	//if (parseInt(cY+150) >= window.innerHeight){
	//	d.style.top = (cY-250) + "px";
	//} else {
	//	d.style.top = (cY+20) + "px";
	//}
	d.style.top = (cY+20) + "px";

}
function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d, theID, theTitle) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
    dd.style.opacity = 0;
    dd.style.MozOpacity = 0;
    dd.style.KhtmlOpacity = 0;
    dd.style.filter = "alpha(opacity=" + 0 + ")";
	dd.style.display = "";
	changeContent(theID, theTitle);
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = ""; }
else { dd.style.display = "none"; }
}

function changeContent(theContent, theTitle) {
	document.getElementById("assetPreviewBox").innerHTML = '<h2>' + theTitle + '</h2><img src="/images/dynamic/assetPreview3.aspx?id=' + theContent + '&size=l" />';
	opacity('assetPreviewBox', 0, 100, 450)
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        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++;
        }
    }
}

//change the opacity for different browsers
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 + ")";
} 

function hideLeft() {
	document.getElementById('lhsArea').style.display = "none";
	document.getElementById('centreArea').style.marginLeft = "10px";
	document.getElementById('lhsAreaLittle').style.display = "block";
}

function showLeft() {
	document.getElementById('lhsArea').style.display = "";
	document.getElementById('centreArea').style.marginLeft = "154px";
	document.getElementById('lhsAreaLittle').style.display = "none";
}

function hideRight() {
	document.getElementById('rhsArea').style.display = "none";
	document.getElementById('centreArea').style.marginRight = "10px";
	document.getElementById('rhsAreaLittle').style.display = "block";
}

function showRight() {
	document.getElementById('rhsArea').style.display = "";
	document.getElementById('centreArea').style.marginRight = "154px";
	document.getElementById('rhsAreaLittle').style.display = "none";
}
//-->

