// 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 ("Sorry, but NS4 does not allow font changes."); 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 ("Sorry, but NS4 does not allow alignment change."); 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 ("I'm sorry.  Your browser: "+navigator.appName+" "+navigator.appVersion+ "\n doesn't support automatic bookmarking.\n  You have to manually bookmark this page.");
	}
}

function toPrint() {
	window.print();
}

function KW_expertPopup(sc,iw,ih,mg,wd,hg,sb,fs,bg,tl,nr,ms,cs,cb){
	pw=(wd!=0)?wd:(iw+mg*2);psw=parseInt(screen.width/2-pw/2);ph=(hg!=0)?hg:(ih+mg*2);
	psh=parseInt(screen.height/2-ph/2);if (fs) {pw=screen.width;ph=screen.height;psh=0;psw=0;mg=0}
	look="width="+pw+",height="+ph+",screenX="+psw+",screenY="+psh+",left="+psw+",top="+psh
	ovf="html,body{overflow:hidden;} "; if (sb==1) {look+=",scrollbars=yes";ovf="";} else look+=",scrollbars=no";
	if (bg==" ")bg="#ffffff";
	pStr="<ht"+""+"ml><he"+""+"ad><ti"+""+"tle>"+tl+"</ti"+""+"tle><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></he"+""+"ad><st"+""+"yle type=\"text/css\"> <!-- BODY {  margin : "+mg+"px; } "+ovf+" --> </style><bo"+""+"dy bgcolor="+bg+"  marginwidth=\"0\" marginheight=\"0\" "
	if (cs!=0) pStr+="onLoad=\"setTimeout('window.close()',"+cs+")\" ";if (cb!=0) pStr+="onBlur=\"window.close()\""
	pStr+=">"
	if (nr!=0) pStr+="<scr"+""+"ipt>  var msg=\""+ms+"\";function disableIE() {if (document.all) {alert(msg);return false;}} function disableNS(e){ if (document.layers||(document.getElementById&&!document.all)) {  if (e.which==2||e.which==3) {alert(msg);return false;} }} if (document.layers) {  document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;} else {  document.onmouseup=disableNS;document.oncontextmenu=disableIE;} document.oncontextmenu=new Function('alert(msg);return false')</sc"+""+"ript>"
	pStr+=(fs)?"<table border=\"0\" width=\"100%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td ><div align=\"center\"><"+""+"a hr"+""+"ef='javasc"+""+"ript:self.close();'><img src='"+sc+"' border=0 alt=\"Click Image to Close\"></"+""+"a></div></td></tr></table></bo"+""+"dy></ht"+""+"ml>":"<"+""+"a hr"+""+"ef='javasc"+""+"ript:self.close();'><img src='"+sc+"' border=0 alt=\"Click Image to Close\"></"+""+"a></bo"+""+"dy></ht"+""+"ml>"
	popwin=window.open('','',look);
	popwin.document.open();
	popwin.document.write(pStr);
	popwin.document.close();
}