function leftAlign() {
	var elements = document.getElementsByTagName("p");
	for(var i = 0; i < elements.length; i++) {
	elements.item(i).style.textAlign = "left";
	}
}

function justifyAlign() {
	var elements = document.getElementsByTagName("p");
	for(var i = 0; i < elements.length; i++) {
	elements.item(i).style.textAlign = "justify";
	}
}

function OpenComments (c) {
    window.open(c,
                    'comments',
                    'width=580,height=580,scrollbars=yes,status=yes');
}

function OpenTrackback (c) {
    window.open(c,
                    'trackback',
                    'width=580,height=580,scrollbars=yes,status=yes');
}
var getById = (typeof document.getElementById != "undefined");		

function toggleDisplay(obj,display1,display2){

	if(!getById) return;
	
	obj = getRef(obj);
	
	if(obj.style.display == display1)
		obj.style.display = display2;
	else
		obj.style.display = display1;
	
	repaintFix();
}

function getRef(obj){
	if(getById)
		return(typeof obj == "string") ? document.getElementById(obj) : obj;
}

function repaintFix(obj){ 
	
	if("undefined" == typeof document.body
	  || "undefined" == typeof document.body.style) return;
	
	if(obj == null)
		obj == document.body;
	else obj = getRef(obj);
	
	document.body.style.visibility = "hidden";
	document.body.style.visibility = "visible";
}

function setActiveSS(title) {
  var i, a, main;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveSS() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title") &&
        !a.disabled
        ) return a.getAttribute("title");
  }
  return null;
}

function getPreferredSS() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("rel").indexOf("alt") == -1 &&
        a.getAttribute("title")
        ) return a.getAttribute("title");
  }
  return null;
}