// Scarlet Blaze Article Tool 
// By: Jose Mulia
// http://www.scarletblaze.com
// Version: 1.1

ns4 = document.layers;
ie = document.all;
moz = document.getElementById && !document.all;
	 
function changeFontSize (id, isIncrease) {
// 1 = increase
// 0 = decrease
var obj;
var size; 

if (ns4) { alert ("ご使用中のブラウザでは、文字サイズの変更が働きません。ブラウザ標準機能をご利用ください。"); return false;

} else if (ie) { 
 	// tested on ie6
	// the font value is increased/decreased in em;
	obj = document.getElementById(id);
	size = obj.currentStyle.fontSize;
	
	if (isIncrease) { size = parseFloat(size) + .1;	// increase 
	} else { size = parseFloat(size) - .1;  // decrease 
	}  
	obj.style.fontSize = size + "em";

} else if (moz) {
 	// only tested on firefox
 	// The next 2 lines work, but only return font size in px!
 	// So the font value is increased/decreased in px;
	obj = window.getComputedStyle(document.getElementById(id), ''); 
	size = obj.getPropertyValue('font-size');  // value only in px
	
	 if (isIncrease) { size = size = parseFloat(size) + 1; // increase 	
	 } else { size = size = parseFloat(size) - 1; // decrease
	 }

	document.getElementById(id).style['fontSize'] = size + "px";
}

if (!obj) { alert("unrecognized ID"); return false; }
   
return true;
}

function changeAlignment (id, alignment) {
// align: "right", "left", "justify"	
var obj;

if (ns4) { alert ("ご使用中のブラウザでは、文字サイズの変更が働きません。ブラウザ標準機能をご利用ください。"); return false;

} else if (ie) { 
 	// tested on ie6
	// the font value is increased/decreased in em;
	obj = document.getElementById(id);
	obj.style.textAlign = alignment;

} else if (moz) {
 	// only tested on firefox
	obj = window.getComputedStyle(document.getElementById(id), ''); 
	document.getElementById(id).style['textAlign'] = alignment;
}

if (!obj) { alert("unrecognized ID"); return false; }
  
return true;
}

function Bookmark(docUrl, docTitle) {
	if(document.all) 
	{
		window.external.AddFavorite(docUrl, docTitle);
	}
	else
	{
		alert (" ご使用中のブラウザ: "+navigator.appName+" "+navigator.appVersion+ "\n では、オートマチックブックマーキングが働きません。\n  ブラウザ標準機能をご利用になり、このページをブックマークしてください。");
	}
}

function toPrint() {
	window.print();
}
