var WRITER_WIDTH = 790
var WRITER_HEIGHT = 510

var _charCodes="¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",_idCnt=1
function convStr(str,allowHTML)
{
	if (str==null) return null
	if (typeof(str) != "string")
		return str
	if (allowHTML==null) allowHTML=false

	var strOut="",c,code
	for (i=0;i<str.length;i++)
	{
		c=str.charAt(i)
		code=str.charCodeAt(i)
		
		if (_macIE)
		{
			if (code>127) c="&#"+code+";"	
			if (code<0) c="&#"+(256+code)+";"
		}
		if (_macNS) c=translateChar(c)

		if (!allowHTML)
		{
			if (c=="<") c="&lt;"
			if (c==">") c="&gt;"
			if (c=="&") c="&amp;"
			if (c=="'") c="&#39;"
		}
		strOut+=c
	}
	return strOut
}
function translateChar(c)
{
	if (_globalStringTable)
	{
		var index=_charCodes.indexOf(c)
		if (index>0) return _globalStringTable.charAt(index)
	}
	return c
}

function GetShift( e )
{
	if (_ns) return ( e.modifiers == Event.SHIFT_MASK )
	if ( _ie ) return ( event.shiftKey )
	return false
}

function GetLeftButton( e )
{
	if (_ns) return ( e.which == 1 )
	if (_ie) return ( event.button == 1 )
	return false
}

function GetRightButton( e )
{
	if (_ns) return ( e.which == 3 )
	if (_ie) return ( event.button == 2 )
	return false
}

function openStyle()
{
	document.write('<STYLE TYPE="text/css"><!--')
	return true
}

function closeStyle()
{
	document.write('--></STYLE>')
	return true;
}

function getButtons(arg)
{
	var str = ''
	str += '<table cellpadding="0" cellspacing="0" border="0">'
	str += '<tr>'
	str += '<td align="center">'
	str += '<table cellpadding="0" cellspacing="10" border="0"><tr>'
	for ( var i=0; i<arg.length; i++ )
	{
		var button = arg[i]
		
		str += '<td class="buttontable">'
		str += '<table cellpadding="0" cellspacing="0" border="0">'
		str += '<tr>'
		str += '<td><img src="/images/btn_l.gif" width="4" height="17"></td>'
		str	+= '<td class="buttontext"><nobr>'
		str += '<a class="guiLink" href="javascript:BUTTON_cb(\'' + button + '\')" onfocus="this.blur()">&nbsp;' + GetLocalized(button) + '&nbsp;</a>'
		str += '</nobr></td>'
		str += '<td><img src="/images/btn_r.gif" width="4" height="17"></td>'
		str += '</tr></table>'
		str += '</td>'
	}
	str += '</tr></table>'
	str += '</td>'
	str += '</tr>'
	str += '</table>'
	return str
}

function writeButtons()
{
	var str = getButtons( writeButtons.arguments )
	document.write( str )
}

function writeButton( button, param )
{
	var str = getButton( button, param )
	document.write( str )
}

function getButton( button, param )
{
	var str = ''
	
	str += '<table cellpadding="0" cellspacing="0" border="0" name="' + button + '">'
	str += '<tr>'
	str += '<td align="center">'
	str += '<table cellpadding="0" cellspacing="10" border="0"><tr>'
			
	str += '<td class="buttontable">'
	str += '<table cellpadding="0" cellspacing="0" border="0">'
	str += '<tr>'
	str += '<td><img src="/images/btn_l.gif" width="4" height="17"></td>'
	str	+= '<td class="buttontext">'
	str += '<nobr><a class="guiLink" href="javascript:BUTTON_cb(\'' + button + '\''
	
	if ( param )
		str += ', ' + param
		
	str += ')" onfocus="this.blur()">&nbsp;' + GetLocalized(button) + '&nbsp;</a>'
	str += '</nobr></td>'
	str += '<td><img src="/images/btn_r.gif" width="4" height="17"></td>'
	str += '</tr></table>'
	str += '</td>'
	str += '</tr></table>'
	str += '</td>'
	str += '</tr>'
	str += '</table>'
	return str
}

function getStyledButton( button, style, param )
{
	var fstyle = style.toLowerCase()
	var str = ''
	str += '<table cellpadding="0" cellspacing="0" border="0">'
	str += '<tr>'
	str	+= '<td>'
	str += '<a href="javascript:BUTTON_cb(\'' + button + '\''
	if ( param )
		str += ', ' + param
	str += ')" onfocus="this.blur()"><img border="0" src="/artlib/'+fstyle+'/btn_l.gif"></a>'
	str += '</td>'
	str	+= '<td class="'+style+'ButtonText">'
	str += '<nobr><a class="'+style+'Link" href="javascript:BUTTON_cb(\'' + button + '\''
	if ( param )
		str += ', ' + param
	str += ')" onfocus="this.blur()">&nbsp;' + GetLocalized(button) + '&nbsp;</a>'
	str += '</nobr></td>'
	str	+= '<td>'
	str += '<a href="javascript:BUTTON_cb(\'' + button + '\''
	if ( param )
		str += ', ' + param
	str += ')" onfocus="this.blur()"><img border="0" src="/artlib/'+fstyle+'/btn_r.gif"></a>'
	str += '</nobr></td>'
	str += '</tr>'
	str += '</table>'
	return str
}

function getStyledButtons( tab, style )
{
	var str = ''
	str += '<table cellpadding="0" cellspacing="10" border="0">'
	str += '<tr>'
	for ( var i=0; i<tab.length; i++ )
		str += '<td>' + getStyledButton(tab[i],style) + '</td>'
	str += '</tr>'
	str += '</table>'
	return str
}

function writeStyledButtons( tab, style )
{
	document.write( getStyledButtons( tab, style ) )
}

function BUTTON_cb( name )
{
	var func = eval( "window.cb" + name )
	if ( func )
	{
		func()
	} 
}

function getStyledHeader( style, label )
{
	var fstyle = style.toLowerCase()
	var str = ""
	var txt = (label==null?'<img src="/artlib/transparent.gif">':GetLocalized(label))
	str += '<table border="0" cellPadding="0" cellSpacing="0" class="'+style+'" width="100%">\n'
	str += '<tr>'
	str += '<td class="'+style+'UpperLeft"><img src="/artlib/'+ fstyle+'/tl.gif"></td>'
	str += '<td class="'+style+'UpperCenter">' + txt + '</td>'
	str += '<td class="'+style+'UpperRight"><img src="/artlib/'+fstyle+'/tr.gif"></td>'
    str += '</tr>\n'
    str += '<tr>'
    str += '<td class="'+style+'MiddleLeft">&nbsp;</td>'
    str += '<td class="'+style+'MiddleCenter">\n'
    return str
}
function getStyledFooter( style )
{
	var fstyle = style.toLowerCase()
	var str = ""
	str += '</td>'
	str += '<td class="'+style+'MiddleRight">&nbsp;</td>'
	str += '</tr>\n'
    str += '<tr>'
	str += '<td class="'+style+'LowerLeft"><img src="/artlib/'+ fstyle+'/bl.gif"></td>'
	str += '<td class="'+style+'LowerCenter"><img src="/artlib/transparent.gif"></td>'
	str += '<td class="'+style+'LowerRight"><img src="/artlib/'+ fstyle+'/br.gif"></td>'
    str += '</tr>\n'
    str += '</table>'
	return str
}

function PopUpWindow( url, name, properties, center, w, h, x, y )
{
	var prop = properties
	prop += ',width='+w+',height='+h
	var l,t
	switch( center )
	{
		case true:
			if (_ns)
			{
				l=top.screenX;t=top.screenY+25;
			}
			else
			{
				l=top.screenLeft;t=top.screenTop;
			}
			l+=Math.round((winWidth()-w)/2)	
		break;
		case false:
			if (x==null) x=Math.round(w/2);
			if (y==null) y=Math.round(h/2); 
			l = Math.max(0,x-Math.round(w/2))
			t = Math.max(0,y-Math.round(h/2))
		break;
		default:
			l=null; t=null;
		break;
	}		
	if ( _ns4 )
	{
		if ( l!=null && t!=null ) prop += ',screenX='+l+',screenY='+t
		var theWin=window.open("",name,prop)
		if ( url.match(/^file/) )
			theWin.document.location.replace("/phplib/redirect.php?Url="+url.replace(/\\/g,'/'));
		else
			theWin.document.location.replace(url);return theWin
		return theWin
	}
	else
	{
		if ( l!=null && t!=null ) prop += ',left='+l+',top='+t
		return window.open( url, name, prop )
	}
}

var infoTO = null
var isrunning = false
var infoel = null
function loadInfo( info )
{
	var str = ''
	if (info)
	{
		if ( infoTO )
		{
			clearTimeout( infoTO )
			infoTO = null
		}	
		str += '<table cellpadding="0" cellspacing="0" border="0"><tr><td class="InfoText"><nobr>'
		str += GetLocalized( info )
		str += '</nobr></td></tr></table>'				
		updateLayer( str, "DivInfo", parent.frames["tooltip"] )
	}
	showLayer(info!=null,"DivInfo",parent.frames["tooltip"])
	return false;
}
function clearInfo()
{
	if ( infoTO )
	{
		clearTimeout( infoTO )
		infoTO = null
	}
	infoTO = setTimeout( "loadInfo()", 20 )
}
var ghostTO = null
var ghostID = null
var ghostObj = ""
function showGhost(flag)
{
	if ( flag )
	{	
		if ( ghostTO )
		{
			clearTimeout( ghostTO )
			ghostTO = null
		}	
		if ( ghostObj=="movebook")
			loadInfo("InfoMoveBook");
		else
			loadInfo("InfoAddBook");
	}
	showLayer(flag&&overbook,ghostObj)
	showLayer(false,(ghostObj=="movebook"?"ghostbook":"movebook"))
}
function clearGhost()
{
	if ( ghostTO == null )
		ghostTO = setTimeout( "showGhost()", 100 )
}
function moveGhost(isselected)
{
	if ( ghostID )
	{		
		var b = eval(ghostID)
		ghostObj = (isselected?"movebook":"ghostbook")
		zindexLayer(b.zindex+1,ghostObj)
		clipLayer(0,0,b.w,b.h,ghostObj)
		moveLayer(b.l,b.b-b.h,ghostObj)
		showGhost(true)
	}
}
function switchLang( lang )
{
	var newlang = (lang=="enu"?"fra":"enu")
	top.location.href = top.location.href.replace( new RegExp(lang,"g"), newlang )
}

function cbCloseMessagePopup()
{
	window.close()
}

function showRequirements()
{
	var prop = "location=0,toolbar=0,resizable=1,scrollbars=0"

	var w = parseInt(GetLocalized( "RequirementsW" ))
	var h = parseInt(GetLocalized( "RequirementsH" ))
	prop += ",width=" + w
	prop += ",height=" + h
	var l,t
	if (_ns)
	{
		l=top.screenX;t=top.screenY+25;
	}
	else
	{
		l=top.screenLeft;t=top.screenTop;
	}
	l+=Math.round((winWidth()-w)/2)	
	if ( _ns4 )
		prop += ',screenX='+l+',screenY='+t
	else
		prop += ',left='+l+',top='+t
	window.open( "../about/requirements.htm", "Requirements", prop )
}

function Preload()
{
	parent.frames["process"].location.href = "../writer/preloadframeset.php"
}

function dbgWrite() {}
function dbgPrint() {}
if ( top.opener && top.opener.closed==false && (typeof(top.opener.dbg)!="unknown"||typeof(top.opener.dbg)!="undefined") ) document.write( '<SCR' + 'IPT language="javascript" SRC="/commonscriptlib/log/debug.js"><\/SCRIPT>' )