<!--//--><%

tbooks = null

var READER = 0
var WRITER = 1
var GENERATE = 2

function Bookcase()
{
	this.w = 0
	this.h = 0
	this.l = 0
	this.t = 0
	
	this.init = true
	this.Title = null
	this.active = false
}

function Bookshelf()
{
	this.w = 0
	this.h = 0
	this.l = 0
	this.t = 0
	
	this.init = true
	this.number = 0
	this.Title = null
	this.active = false
}

function Book( id )
{
	this.id = id
		
	this.init = true
	this.empty = true
	
	this.readonly = false
	this.visible = true
	this.selected = false
	this.l = 0
	this.b = 0
	this.zindex = 0
	this.border = 0
	
	this.number = 0
	this.lnumber = 0
	this.bookid = ""
	this.bookstoreid = ""
	this.url = ""
	this.jid = ""
	this.jw = 0
	this.jh = 0
	this.jpid = ""
	this.jlnumber = ""
	this.jsrc = ""
	this.jtitle = ""
	this.comment = ""
	this.community = -1
	this.category = ""
	this.language = ""
	
	if ( tbooks != null )
		tbooks[tbooks.length] = this
}

with( Book )
{
	prototype.src=""
	prototype.emptysrc = ""
	prototype.w = 0
	prototype.h = 0
	prototype.path = ""
	prototype.libraryid = ""
	prototype.mode = 0		
}

Book.prototype.copyInfo = Book_copyInfo
function Book_copyInfo( book )
{
	if ( book )
	{
		this.readonly = book.readonly
		this.empty = book.empty
		this.emptysrc = book.emptysrc
		this.number = book.number
		this.lnumber = book.lnumber
		this.bookid = book.bookid
		this.bookstoreid = book.bookstoreid
		this.libraryid = book.libraryid
		this.path = book.path	
		this.src = book.src	
		this.url = book.url
		this.jid = book.jid
		this.jw = book.jw
		this.jh = book.jh
		this.jlnumber = book.jlnumber
		this.jpid = book.jpid
		this.jsrc = book.jsrc
		this.jselsrc = book.jselsrc
		this.jtitle = book.jtitle
		this.comment = book.comment
		this.community = book.community
		this.category = book.category
		this.language = book.language
	}
}
Book.prototype.GetSrc = Book_GetSrc
function Book_GetSrc()
{
	this.src = this.path + this.bookid + "_jacket.jpg"
}
Book.prototype.GetUrl = Book_GetUrl
function Book_GetUrl()
{
	var url = this.url
	if ( url && url.match( /^file:\/\/\/(.*)/ ) )
	{
		var tab = RegExp.$1.split( "\\" )
		return 'file:///' + tab.join( "/" )
	}
	return url
}

function Bookcard( isReadWrite )
{
	this.active = true
	
	this.w = 0
	this.h = 0
	this.l = 0
	this.t = 0
	
	this.init = true
	this.bookid = null
	
	this.content = ""
	
	this.Welcome = null
	this.WelcomeOutput = null
}
Bookcard.prototype.updateContent = Bookcard_updateContent
function Bookcard_updateContent(book)
{
	var str = ""
	if ( book && ! book.empty )
	{
		if ( this.bookid != book.id )
		{
			this.bookid = book.id
			this.content = this.formatHtml(book.comment)
		}
		else
			return false
	}
	else
	{
		this.content = this.formatHtml((this.WelcomeOutput==null?this.Welcome:this.WelcomeOutput))
		if ( this.bookid )
			this.bookid = null
		return false
	}
	return true
}
Bookcard.prototype.formatHtml = Bookcard_formatHtml
function Bookcard_formatHtml( text )
{
	if ( text )
	{
		var str = ""
		str += text
		str = str.replace( /\n/g, "<br>" )
		return str
	}
	else
		return '&nbsp;'
}
Bookcard.prototype.getContent = Bookcard_getContent
function Bookcard_getContent(str)
{
	return '<table cellpadding="0" cellspacing="0" border="0" width="'+this.w+'" height="'+this.h+'">\n'	
		 + '<tr><td width="'+this.w+'" height="'+this.h+'" class="bookcardText">'+str+'</td></tr>\n'
		 + '</table>\n'
		 
}
function Contact( active )
{
	this.active = active
	
	this.w = 0
	this.h = 0
	this.l = 0
	this.t = 0
	
	this.text = null
	this.email = ""
}

//%>