//<![CDATA[

var redElem = "ust";
var lastParaOpen;

 String.prototype.toProper = function(){
   return this.replace( /(\b\w)(\w*)/g ,
     function(x,a,b){return a.toUpperCase()+b.toLowerCase();});
 }; 
 
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


function PopShow(id) {
	document.getElementById(id).style.visibility="visible";
}

function PopHide(id) {
	document.getElementById(id).style.visibility="hidden";
}

function go_anchor(sourceTag, aTag) {
	//debugger;
	var pDIV = sourceTag.substring(0, sourceTag.indexOf("_"));
	Lightbox.show($(pDIV));
	document.getElementById(sourceTag).scrollTop = document.getElementById(aTag).offsetTop - 60
	togglePara(sourceTag, "a_" + aTag);
}

function go_anchorlt(sourceTag, aTag) {
	//debugger;
	document.getElementById(sourceTag).scrollTop = document.getElementById(aTag).offsetTop - 60
}

function togglePara(sourceTag, aTag) {
	//debugger;
	var aTagShort = aTag.substring(aTag.indexOf("_") + 1);
	if (document.getElementById(aTag).style.display=="inline") {
		document.getElementById(aTag).style.display="none";
		lastParaOpen = "";
		document.getElementById(aTagShort).childNodes[0].style.color="";
		redElem = "";
	} else {
		if (lastParaOpen) {
			document.getElementById(lastParaOpen).style.display="none";
			document.getElementById(redElem).childNodes[0].style.color="";
			redElem = "";
		}
		document.getElementById(aTagShort).childNodes[0].style.color="red";
		redElem = aTagShort;
		document.getElementById(aTag).style.display="inline";
		//go_anchorlt(sourceTag, aTag);
		lastParaOpen = aTag;
	}
}

function revertStyle() {
	if (redElem) {
		togglePara("faq", "a_" + redElem);
		//document.getElementById(redElem).style.color="";
		//document.getElementById(redElem).parentNode.scrollTop = 0;
	}
}

function goOrderPage() {

	 document.location = orderLink + "?address=" + address + "'>"

}

//]]>