
// global defaults
xWinBodyClass = "txt";
xWinTransLevel = 100;

// initialize xWinLib
xlib.init( XINIT_ALL );

// window names
var WIN_HOME		= "btnHome";
var WIN_FEATURES	= "btnFeatures";
var WIN_DEMOS		= "btnDemos";
var WIN_DOWNLOADS	= "btnDownloads";
var WIN_DOCS		= "btnDocs";
var WIN_SUPPORT		= "btnSupport";

var pNoTooltip = 0;

function initNavBar( curPage, NoTooltip ) {
	var w, e;

	pNoTooltip = NoTooltip;

	w = xtheme_Default( WIN_HOME, 10, 10,  70, 20, null, xNavButton( "Home", "btnOrange" ), 
		"document.location='index.htm';", 
		"Click to return to the <b>home</b> page...<center><img src='images/icoHome.png' border=0 width=88 height=90></center>", 
		100, "#ffe2ca" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );
					
	w = xtheme_Default( WIN_FEATURES,	 85, 10,  85, 20, null, xNavButton( "Features", "btnGold" ), 
		"document.location='features.htm';", 
		"Click to access the <b>xWinLib</b> feature set, which includes:<ul><li>Advanced Windowing Environment<li>Cross-domain Drag and Drop<li>Integrated Ajax Functionality<li>Customizeable Window Styles and Themes<li>User-defined Tooltips<li>Efficient Download Profile<li>Lots more...<br><br><li>Price: <b>FREE!</b></ul>", 
		null, "#fffabe" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );
					
	w =xtheme_Default( WIN_DEMOS, 		175, 10,  80, 20, null, xNavButton( "Demos", "btnGreen" ), "document.location='demos.htm'", "Access cool <b>xWinLib</b> demos...", 200, "#e0ffc9" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );

	w = xtheme_Default( WIN_DOWNLOADS, 	260, 10, 100, 20, null, xNavButton( "Downloads", "btnBlue" ), "document.location='downloads.htm';", "<b>Download</b> the latest version of the <b>xWinLib</b> toolkit...", null, "#c9d6fe" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );

	w = xtheme_Default( WIN_DOCS, 		365, 10, 125, 20, null, xNavButton( "Documentation", "btnRed" ), "document.location='documentation.htm';", "Access the <b>xWinLib</b> documentation...", 230, "#ffd3cc" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );
	
	w = xtheme_Default( WIN_SUPPORT, 	495, 10,  85, 20, null, xNavButton( "Support", "btnBlack" ), "document.location='support.htm';", "Access the <b>xWinLib</b> support options...", 240, "#E0E0E0" );
	w.displayMode = DISP_NORMAL | DISP_ANIM_TOOLTIP;
	w.create( );
	

	try {
		xWinFromName( curPage ).winBody( ).getElementsByTagName( "table" )[0].className = "curMenu";
	} catch ( e ) { };
};


// window theme handler
function xtheme_Default( name, x, y, w, h, style, action, eClick, tooltip, ttWidth, ttBG ) {
	var o = new xWindow( )

	o.name = name;
	o.overflow = "hidden";
	o.style = style ? style : WS_NORMAL | WS_TRANSPARENT | WS_MOVEABLE;
	o.setposition( x, y, w, h );
	if ( ! pNoTooltip ) {
		o.tooltip = tooltip;
	}
	o.ttWidth = ttWidth ? ttWidth : o.ttWidth;
	o.ttBG = ttBG ? ttBG : o.ttBG;
	o.eClick = eClick;
	o.action = action;

	return( o );
};

function xNavButton( title, image ) {
	return( "<table border=0 cellspacing=0 cellpadding=0 class='smtxt'><tr><td>" + xlib.imageRender( "images/" + image + ".png", 20, 20 ) + "</td><td>&nbsp;" + title + "</td></tr></table>" );
};

function exampleLinks( ex ) {
	var s = "<a href='#' onclick=\"" + ex + "( xlib.eventGet( event ) ); return false;\" title=\"Click to view example...\"><img src=\"/images/example.gif\" border=0 width=41 height=11 style='position:relative; top:1;'></a>&nbsp;" +
		"<a href=\"javascript:" + ex + "_close( );\" title=\"Click to reset example...\"><img src=\"/images/reset.gif\" border=0 width=41 height=11 style='position:relative; top:1;'></a>&nbsp;" +
		"<a href=\"javascript:exSource( '" + ex + "' );\" title=\"Toggle example source...\"><img src=\"/images/source.gif\" border=0 width=41 height=11 style='position:relative; top:1;'></a><br><div id='" + ex + "_src' class='exSource'></div><p>";
	document.write( s );
};


