// CONFIG SITE VARS
blogCfgSite=new Object;
blogCfgSite.title="Booklyn";

	// CONFIG SITE URLS
	blogCfgSite.url=new Object;
	blogCfgSite.url.domain="";
	blogCfgSite.url.testDir="";
		docLocStr=document.location+"";
		if(docLocStr.indexOf("blog.org")>-1)blogCfgSite.url.domain="http://www.fogchill.com/booklyn/";
		if(docLocStr.indexOf("/v2/")>-1)blogCfgSite.url.domain=blogCfgSite.url.domain+"v2/";
	blogCfgSite.url.css=blogCfgSite.url.domain+"_include/_include.css";
	blogCfgSite.url.img=blogCfgSite.url.domain+"_images/";
	
	// CONFIG SITE COLORS
	blogCfgSite.clr=new Object;
	blogCfgSite.clr.bodyBg="#cccccc";
	
	// CONFIG IMAGES
	blogCfgSite.img=new Object;
	
	// CONFIG IMAGES FOR NAVIGATION
	blogCfgSite.img.data=new Array();
	cnt=1;
		/* format
		blogCfgSite.img.nav[1]=new Array("altText","fileName","width","height","linkHrefRelativeToRoot");
		*/
	//blogCfgSite.img.data[cnt++]=new Array("HOME","btn_home","152","25","index.php");
	
	// PRELOAD IMAGES
	for (i=1; i < blogCfgSite.img.data.length; i++) {
		//alert(blogCfgSite.img.nav[i]);
		blogCfgSite.img[i]=new Array();
		blogCfgSite.img[i][0]=new Image();
		blogCfgSite.img[i][1]=new Image();
		blogCfgSite.img[i][0].src=blogCfgSite.url.img+blogCfgSite.img.data[i][1]+".gif";
		blogCfgSite.img[i][1].src=blogCfgSite.url.img+blogCfgSite.img.data[i][1]+"_sel.gif";
	}

// INITIALIZE AREA VARS
blogCfgArea=new Object;

// INITIALIZE AREASUB VARS
blogCfgAreaSub=new Object;

// INITIALIZE PAGE VARS
blogCfgPage=new Object;

// HTML WRITING FUNCTIONS: MAIN
function blogHtmlStyleSheet(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<link rel=\"stylesheet\" href="+blogCfgSite.url.css+">";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlBodyOpen(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<body bgcolor="+blogCfgSite.clr.bodyBg+">";
	rVal+="<center>";
	rVal+=blogHtmlHeader('return');
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlBodyClose(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+=blogHtmlFooter('return');
	rVal+="</center>";
	rVal+="</body>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlHeader(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<a name=blogTop></a>";
	rVal+="<table cellpadding=0 cellspacing=0 border=0 width=100% background="+blogCfgSite.url.img+"_hdr_bg.gif><tr><td>";
	rVal+="<div align=center><a href="+blogCfgSite.url.domain+"index.php><img src="+blogCfgSite.url.img+"_hdr_logo.gif width=164 height=38 border=0></a></div>";
	rVal+="</td></tr></table>";

	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlFooter(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<table cellpadding=0 cellspacing=0 border=0 width=100% height=12><tr><td>&nbsp</td></tr></table>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}

// HTML WRITING FUNCTIONS: PAGE
function blogHtmlPageOpen(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<table cellpadding=0 cellspacing=0 border=0 width=100%>";
	rVal+="<tr>";
		rVal+="<td width=100% valign=top>";
			//rVal+="<table cellpadding=12 cellspacing=0 border=0 width=100%>";
			//rVal+="<tr>";
				//rVal+="<td>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlPageClose(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
				//rVal+="</td>";
			//rVal+="</tr>";
			//rVal+="</table>";
		rVal+="</td>";
	rVal+="</tr>";
	rVal+="<tr><td colspan=2 align=right valign=bottom height=12><a href=#blogTop>---^</a></td></tr>";
	rVal+="</table>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlPageTitle(mode,text) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if(!text)text="&nbsp;"
	rVal+="<P>";
	rVal+="<div class=blogPageTitle>"
	rVal+="<div class=blogPageTitleTxt>"+text+"</div>";
	rVal+="</div><br>";
	rVal+="";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlPageTitleSub(mode,text) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if(!text)text="&nbsp;"
	rVal+="<P>";
	rVal+="<div class=blogPageTitleSub>"
	rVal+="<div class=blogPageTitleSubTxt>"+text+"</div>";
	rVal+="</div>";
	rVal+="";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlPageLabel(mode,text) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if(!text)text="&nbsp;"
	rVal+="<span class=blogPageLabelTxt>"+text+"&nbsp;:&nbsp;</span>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlPageError(mode,text) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if(!text)text="&nbsp;"
	rVal+="<span class=blogPageErrorTxt>"+text+"</span>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}

// HTML WRITING FUNCTIONS: MODULES
function blogHtmlModuleAlbum(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if((typeof blogCfgPage.albumDir)!="undefined"){
		if((typeof blogCfgPage.albumDat)!="undefined"){
			for(var i=0;i<blogCfgPage.albumDat.length;i++){
				rVal+="<a href="+blogCfgSite.url.domain+"misc/albumViewer.php?img="+escape(blogCfgPage.albumDir+"/"+blogCfgPage.albumDat[i][0])+"><img src="+blogCfgSite.url.img+"album/"+blogCfgPage.albumDir+"/thumbs/"+blogCfgPage.albumDat[i][0]+" vspace=12 hspace=12 border=0></a> ";
			}
		}
	}
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlModuleAlbumImg(mode,img) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="<img src="+blogCfgSite.url.img+"album/"+img+"  vspace=12 hspace=12 border=0>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
function blogHtmlModuleArticleImg(mode, imgArgs, caption) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	if(imgArgs==null)imgArgs="";
	if(caption==null)caption="";
	rVal+="<table cellpadding=6 cellspacing=0 border=0 align=right width=212>";
		rVal+="<tr>";
		rVal+="<td>";
			if(imgArgs)rVal+="<img src="+blogCfgSite.url.img+imgArgs+" border=1><br>";
			if(caption)rVal+="<span class=blogCaption>"+caption+"</span><br>";
		rVal+="</td>";
		rVal+="</tr>";
	rVal+="</table>";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}

//
var blogArrTblRowMarked = new Array;
function blogTableRowHighlight(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{

	if(!theDefaultColor) 	var theDefaultColor 	= '#cccccc';
	if(!thePointerColor) 	var thePointerColor 	= '#ccffcc';
	if(!theMarkColor) 		var theMarkColor 		= '#FFCC99';

    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0) 
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            blogArrTblRowMarked[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(blogArrTblRowMarked[theRowNum]) == 'undefined' || !blogArrTblRowMarked[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            blogArrTblRowMarked[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            blogArrTblRowMarked[theRowNum] = (typeof(blogArrTblRowMarked[theRowNum]) == 'undefined' || !blogArrTblRowMarked[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} 

/*
function blogFUNCTIONTEMPLATE(mode) {
	if(mode==null)mode="docwrite";var rVal="";
	//-------------------------------------------------------
	rVal+="";
	//-------------------------------------------------------
	if(mode=="return") return rVal;else document.write(rVal);
}
*/