/********** IdeaBlade Master JavaScript *****************
 *
 * General utility routines xxxxxxxxxxxxxxxxxxxxxx
 *
 * Load on every page, typically in the header
 *
 * Date      Who      Comment
 * --------  -------  ----------------------------------
 * 03/27/03  CFox     New - cleared version. Different from orig "IdeaBlade.js" (note caps)
 * 04/07/03  WBell    Add IdeaBladeAddr and IdeaBladePhone fns.
 * 04/15/03  WRB      Add 800 #, extend copyright 2001-2003	
 * 05/29/03  WRB      Re-purpose for ObjectWare
 * 06/25/03  WRB	    Add GlobalsInit, Menu handling, IBImage and IBURL
 * 07/08/03  WRB      Convert left menus to IBPages
 * 07/11/03  WRB      Add String extensions, Cookie Lib and Privileged Page functionality
 * 07/19/03  WRB      Submenus extended so can open in a separate window.
 * 07/30/03  WRB      Add styles to SpacerRowHTML(), turn on Support menu
 * 10/22/03  WRB      Replace IB logo with OWare logo in header; add .NET Connected logo to foot; "rich" -> "smart"
 * 10/24/03  WRB      writeDataSheets added
 * 12/02/04  KRJ      Utility functions for email links; changes to support pages; GetCookie; ResourceURL changes
 * 03/21/05  WRB      Adapt to new RAD message
 * 03/25/05  WRB      Refactor menus and paging. Convert most direct URLs into lookups
 * 04/01/05  WRB      If local, rootpath should look for IdeaBladeWebsite first
 * 04/22/05  WRB      Support Privacy Policy
 * 05/02/05  WRB      Privacy Policy link (PrivacyPolicyLinkHTML) launches in separate window without menus.
 * 05/10/05  WRB      Added WriteIBDownloadSystemRequirements and the DevExEval (Developer Express Evaluation)
 *                    resource link pointing to the DevEx suite evaluation version that is most compatible with 
 *                    the IdeaBlade version offered on-line.
 * 06/17/05  JOtis    Added Webinar IBPage keys and "Webinars" Left Panel menu
 * 06/22/05  JOtis    Added IBLite IBPage keys and "IBLite" Left Panel menu
 * 06/22/05  JOtis    Removed "Trial Downloads" from menus
 * 06/30/05  JOtis    Added "NewsGroup" IBPage key, added Left Panel link to Support, Resources, IBLite menus
 * 07/25/05  JOtis    Remove "MANAGEMENT" menu item from left Panel of Company as per Albert
 * 07/28/05  WRB      Add ORP_IN_DOTNET stuff including new Resources page and links
 * 08/01/05  JOtis    Added "SUBSCRIBE" IBPage keys for NewsFlash emailings
 * 08/27/05  WRB      Added MSDN WebCast support; added IdeaBlade VB landing page
 * 09/05/05  WRB      Restore "MANAGEMENT" and add "TAC" (Tech Advisory Council)
 * 09/09/05  JOtis    Added "POWERBUILDER" IBPage keys and PowerBuilder landing page, links
 * 09/29/05  JOtis    Added "IBNEWS" and "OCTOBERCAL" pages, removed July and August calendar from 
 		      Webinars menu, added IBNEWS to Resources menu and main index page
 * 10/29/05  WRB      Extended WriteIBDownloadSystemRequirements for DevForce
********************************************************/
// gGlobals = collection of IdeaBlade global vars
function GlobalsInit(){
	// Path = Current URL path after domain & port & 1st '/' (corrected for local test)
	// Level = Current URL's depth from domain (from www.ideablade.com). 0=root level
	// Art = rel. addr of art directory (where most images kept)
	// PathToRoot = rel. addr to root
	// Section = Current URL's website section name; derived from directory off root

	if (!window.gGlobals) gGlobals = new Object();
	if (!gGlobals.IsPrivilegedPage) gGlobals.IsPrivilegedPage = false; // not privileged unless (pre)set true.
	if (!gGlobals.NoPageSet) gGlobals.NoPageSet = false; // do paging cookie set unless (pre)set to true.
	// Derivation of base path is messy when site is on local drive. Have to strip from front to root dir
	// These are known local root directory names.
	gGlobals.LocalBasePathJunk = new Array ("IdeaBladeWebsite", "IdeaBlade");
	gGlobals.Path = path = FindPagePath();
	gGlobals.Level = level = FindDirLevel(path); // depth: 0 = top level
	gGlobals.PathToRoot=(new Array(level+1)).join("../") 
 	
	gGlobals.Art=gGlobals.PathToRoot+"art/"
	gGlobals.Spacer=gGlobals.Art+'spacer.gif'
	
	gGlobals.HomeDir=gGlobals.PathToRoot+"home/"
	gGlobals.FAQDir=gGlobals.PathToRoot+"faq/"
	gGlobals.ProductTourDir=gGlobals.PathToRoot+"productTour/"
	gGlobals.ResourcesDir=gGlobals.PathToRoot+"resources/"
	gGlobals.ServicesDir=gGlobals.PathToRoot+"services/"
	gGlobals.SupportDir=gGlobals.PathToRoot+"support/"
  
  gGlobals.PrivacyPolicy = gGlobals.PathToRoot + "privacy.html";
	
	if (!gGlobals.Section) {// may have been overridden
		if (0==level)
			gGlobals.Section="home";
		else 
			gGlobals.Section=path.substring(0,path.search(/[\\\/]/)).toLowerCase();
	}
	// gURLS object is an unordered collection of IBURLs
	if (!window.gURLs) gURLs = new Object();
	// gIBImages object is an unordered collection of IBImages (def'd in ideablade.js)
	if (!window.gIBImages) gIBImages = new Object();
}
GlobalsInit();

// Find depth (level) in a path. 0= top level
function FindDirLevel(pPath) {
	var slashes = path.match(/[\\\/]/g); // count forward & backward slashes for directory depth
	return (slashes == null) ? 0 : slashes.length-1;
}

// Find the page path of this site (from protocol through the root dir)
function FindPagePath() {
	var path=document.location.pathname;
	// strip junk from front of local drive pathname
	if (""==document.location.host) {
	  // junk in local path names change depending on local environment; Which one are we using now?
	  basePathJunk = gGlobals.LocalBasePathJunk;
	  for (var i=0; i < basePathJunk.length; i++) {
	    var ix = path.indexOf(basePathJunk[i]);
	    if (ix > -1)  {
	     // alert(path+" : "+basePathJunk[i]+" : "+(ix + basePathJunk[i].length));
	     path = path.substring(ix + basePathJunk[i].length);
	     break;
	    }
	  }
	}
	path = path.substring(path.indexOf(/[\\\/]/)); // strip to and including first slash in path
	return path;
}

/**************************************************************
 * Standard Page Header: Banner, Menus, Page Title
 * Args are pass through to TitleWrite()
 **************************************************************/
function PageHeaderWrite(pHeaderImg, pTitleHeight, pHeroImg, pHeroNativeWidth, pHeroNativeHeight, 
    pHeaderTitle, pFarCells, pTitleAttributes) {
  SetPagingInfo();
  WriteBanner();
  IBMenusWrite();
  TitleWrite(pHeaderImg, pTitleHeight, pHeroImg, pHeroNativeWidth, pHeroNativeHeight, 
    pHeaderTitle, pFarCells, pTitleAttributes);
}

function TitleWrite(pHeaderImg,pTitleHeight,pHeroImg,pHeroNativeWidth,pHeroNativeHeight, 
  pHeaderTitle, pFarCells, pTitleAttributes) {
	document.write(TitleHTML(pHeaderImg,pTitleHeight,pHeroImg,pHeroNativeWidth,pHeroNativeHeight, 
	  pHeaderTitle, pFarCells, pTitleAttributes))
}

/****************************************************************
 * Page Title spread just below menu
 * ex: TitleWrite("buildSmartHeader.gif",54,"homeHero.jpg");
 * Optional "Hero" picture followed by page title
 * pHeaderImg (reqs): Header title image URL relative to root dir, e.g. "art/homeHeader.gif"
 * pTitleHeight (opt): Enforced height of title. Default: if has hero image, hero height, else 54
 * pHeroImg (opt): Hero image URL relative to root directory, e.g., "art/homeHero.gif"
 * pHeroNativeWidth, pHeroNativeHeight (opt): unresized dimensions of Hero.
 *    Actual, if supplied, always overrides. If can't tell, use these. If not supplied, give up
 * pHeaderTitle (opt): use with or in place of pHeaderImg (if pHeaderImg is null)
 * pFarCells (opt): HTML defining separate cell(s) to the right of the title text.
 * pTitleAttributes (op): Title TD attributes to override the defaults
 * 12/1/04 KRJ - Support null header image, and new header title string
 * 03/22/05 WB - Add pFarCells; add pTitleAttributes
 ****************************************************************/
 function TitleHTML(pHeaderImg, pTitleHeight, pHeroImg, pHeroNativeWidth, pHeroNativeHeight, 
    pHeaderTitle, pFarCells, pTitleAttributes) {
	var heroImgSrc, heroImgHTML = "";
	var	titleHeight = (!pTitleHeight) ? 54 : pTitleHeight;
	if (!!pHeroImg) {// Hero image provided
		var heroImg = new Image;
		heroImg.src = heroImgSrc = gGlobals.PathToRoot+pHeroImg;
		heroImgHTML='<img src="'+heroImgSrc+'" border=0 ';
		var heroHeight = heroImg.height;
		var heroWidth =  heroImg.width;
		if (!heroHeight){// can't determine height or width; go with "native" img size
			heroHeight=(!pHeroNativeHeight) ? "": pHeroNativeHeight;
			heroWidth=(!pHeroNativeWidth) ? "": pHeroNativeWidth;
		}
		if (!heroHeight)
			heroImgHTML+='>'; // can't determine height or width; go with actual img size
		else { 
			if (!pTitleHeight) titleHeight = heroHeight;
			if (heroHeight == titleHeight) heroImgHTML+='>'; // no scaling needed; go with native img size
			else {// rescale hero image to title height
				heroWidth = Math.floor(heroWidth * (titleHeight / heroHeight) );
				heroImgHTML+=' height="'+titleHeight+'" width="'+heroWidth+'">';
			}
		}
	}
	
	// Header row with Hero image and page header title
	var s='<tr bgcolor="d2d2d2">\n<td class="leftMargin" height="4"'+
	      ' style="background-color:#d2d2d2;">&nbsp;</td>\n'+
        '<td colspan="8" bgcolor="d2d2d2" class="hotText1" align="right">\n';
  s+= TitleHTML_FormatHeaderTitle(heroImgHTML, pHeaderImg, pHeaderTitle, pFarCells, pTitleAttributes);
  
	s+= '</tr>\n'+SpacerRowHTML(20); // white row on bottom

	return s;
}

// Returns formatted HTML for the Header title.
// Called exclusively by TitleHTML
function TitleHTML_FormatHeaderTitle(pHeroImgHTML, pHeaderImg, pHeaderTitle, pFarCells, pTitleAttributes) {
  var s='<table cellspacing=0 cellpadding=0 border=0 width="100%">\n<tr>'+
        '<td align="left" width="1">'+pHeroImgHTML+
        '</td><td width="14"><img src="'+gGlobals.Spacer+'" width="14" height="4"></td>\n';
        
	if (pTitleAttributes == null)
	  pTitleAttributes=' valign= "middle" class="bannerHeader" '; // Default title format

  //	Use either a title image or title text
  var titleTD ='<td '+pTitleAttributes+' >';
  if (pHeaderImg != null) {
		s+= titleTD + '<img src="'+gGlobals.PathToRoot+pHeaderImg+'">' + '</td>';
  } else if (pHeaderTitle != null) {
		s+= titleTD + pHeaderTitle + '</td>';
	}
	
	if (pFarCells != null) s+=pFarCells;
	
  s+='<td width="1"><img src="'+gGlobals.Spacer+'" width="1" height="4"></td></tr></table>\n</td>\n'
  return s;
}

// Spacer row essential on some pages to make 9 cols widths exactly correct
function SpacerRowHTML(pHeight){
	if (!pHeight) pHeight=1
	var spacer='<img src="'+gGlobals.Spacer+'" width="1" height="'+pHeight+'"></td>\n';
    var s='<tr height="'+pHeight+'">\n'+
    '<td width="20" class="leftMargin">'+spacer+
    '<td width="140" class="leftPanel">'+spacer+
    '<td width="12" class="centerLeftMargin">'+spacer+
    '<td width="12" class="centerLeftMargin">'+spacer+
    '<td width="378" class="centerPanel">'+spacer+
    '<td width="12" class="centerRightMargin">'+spacer+
    '<td width="12" class="centerRightMargin">'+spacer+
    '<td width="160" class="rightPanel">'+spacer+
    '<td class="rightMargin">'+spacer+'</tr>';
	return(s);
}
function SpacerRowWrite(pHeight){document.write(SpacerRowHTML(pHeight))}
/*********************************************************************
 * Banner with IdeaBlade and Building Top
 * pPath is the path prefix to prepend to the non-self link to get to the standard link address
 * In most cases, this is "../" but any appropriate path can be specified
 *********************************************************************/
function BannerHTML() {
	var art=gGlobals.Art;
	var spacer=gGlobals.Spacer;
	var s='<tr><td colspan="9" height="5">'
	    s+='<table cellSpacing="0" cellPadding="0" border="0" width="100%" bgColor="#ffffff"><tr>'+
  	  '<td width="22" height="5"><img src="'+spacer+'" width="1" height="5" border="0"></td>'+
    	'<td height="5" ><img src="'+spacer+'" width="1" height="5" border="0"></td>'+
   		'<td rowspan="3" align="right"><img src="'+art+'bldgTop.gif" width="204" height="65"></td>'+
    	'</tr><tr>'+
    	'<td height="55"><img src="'+spacer+'" width="1" height="55" border="0"></td>'+
    	'<td><a href="'+gGlobals.PathToRoot+'index.html"><img src="'+art+'IdeaBladeLogo_122_55.gif" width="122" height="55" border="0"></a></td>'+
    	'</tr><tr>'+ 
    	'<td height="5" colspan="2"><img src="'+art+'spacer54.gif" width="1" height="5" border="0"></td></tr>\n'+
    	'</table></td></tr>';
		s+=SpacerRowHTML();
	return(s);
}

function WriteBanner(pPath) {document.write(BannerHTML(pPath));}

/********** IdeaBlade Menus **************/
function IBMenuItem(sect,normal,roll,href,altNm) {
	var art = gGlobals.Art;
	this.Section = sect.toLowerCase();
	this.MenuImgNm = "MenuImg"+sect
	if (sect == gGlobals.Section) { // reverse normal & roll if in this section
		var flop = normal
		normal = roll;
		roll = flop;
	}
	this.NormalSrc = art+normal;
	this.RollSrc = art+roll;
	var img = new Image; // preload the Roll image; derive dims from it
	img.src = this.RollSrc;
	// these 2 lines are not working on all browsers; force size
	//this.Width = img.width;
	//this.Height = img.height;
	this.Width = 81;
	this.Height = 28;
	this.Href = gGlobals.PathToRoot+href;
	if (!altNm) altNm = sect;
	this.AltNm = altNm;
}

function IBMenuItemHTML(pIBMenusIx) {
	var menuItem=IBMenus[pIBMenusIx];
	var imgNm=menuItem.MenuImgNm;
	var imgHTML='<img src="'+menuItem.NormalSrc+'" name="'+imgNm+'" height="28" border="0" alt="'+menuItem.AltNm+'">'
	if ("" != menuItem.Href) {
		var s='<a href="'+menuItem.Href+'" onMouseOut="IBMouseOut('+pIBMenusIx+')" onMouseOver="IBMouseOver('+pIBMenusIx+')">'+imgHTML+'</a>';
//		var s='<a href="'+menuItem.Href+'" onMouseOut="'+
//			imgNm+'.src=\''+menuItem.NormalSrc+'\'" onMouseOver="'+
//			imgNm+'.src=\''+menuItem.RollSrc+'\'">'+s+'</a>'
	}
	return s;
}

function writeNewsAndEventsBanner(pText, pClipped)  {document.write(NewsAndEventsBannerHTML(pText, pClipped));}

function NewsAndEventsBannerHTML(pText, pClipped){
  var heroImg = (!pClipped) ? "newsAndEventsHero.gif" : "newsAndEventsHero_clipped.gif"
	var art=gGlobals.Art;
	var spacer=gGlobals.Spacer;
	var s='<table cellSpacing="0" cellPadding="0" border="0" width="100%" bgColor="#ffffff"><tr>'+
    	'<td><img src="'+art+heroImg+'" border="0"></td>'+
    	'<td class="bannerHeader">'+pText+'</td>'+
    	//'<td><a href="'+gGlobals.PathToRoot+'index.html"><img src="'+art+'IdeaBladeLogo_122_55.gif" width="122" height="55" border="0"></a></td>'+
    	'<td align="right"><img src="'+art+'IdeaBladeLogo_122_55.gif" width="122" height="55" border="0"></td>'+
  	  '<td width="8"><img src="'+spacer+'" width="8" height="5" border="0"></td>'+
    	'</tr><tr><td colspan="4"><img src="'+spacer+'" height="5" border="0"></td></tr>\n'+
    	'</table>';
  return s;
}

function IBMouseOut(pIBMenusIx){
	var menuItem=IBMenus[pIBMenusIx];
	var img = eval("document."+menuItem.MenuImgNm);
	img.src = menuItem.NormalSrc;
}
function IBMouseOver(pIBMenusIx){
	var menuItem=IBMenus[pIBMenusIx];
	var img = eval("document."+menuItem.MenuImgNm);
	img.src = menuItem.RollSrc;
}

function IBMenuItemWrite(menuItem) {document.write(IBMenuItemHTML(menuItem));}

function IBMenusWrite(){
	var mBg=gGlobals.Art+'menuBackground.gif'
	var s='<tr><td height="28" background="'+mBg+'" bgcolor="696969">&nbsp;</td>\n'+
	'<td colspan="7" background="'+mBg+'" bgcolor="696969">';
	// Bug watch: doesn't work with linebreaks ("\n")!
	for (var i=0; i < IBMenus.length; i++) s+=IBMenuItemHTML(i);
	s+=	'</td>\n<td width="20" background="'+mBg+'" bgcolor="696969">&nbsp;</td></tr>';
	document.write(s);
}

// Section Menus 
IBMenus = new Array(
	new IBMenuItem("home","homeButton.gif","homeRoll.gif","index.html","Home"),
	new IBMenuItem("products","productsButton.gif","productsRoll.gif","products/products.html","Products"),
	new IBMenuItem("services","servicesButton.gif","servicesRoll.gif","services/services.html","Services"),
	new IBMenuItem("faq","faqButton.gif","faqRoll.gif","faq/faq.html","Frequently Asked Questions"),
	new IBMenuItem("resources","resourcesButton.gif","resourcesRoll.gif","resources/resources.html","Resources"),	
	new IBMenuItem("support","supportButton.gif","supportRoll.gif","support/support.html","Support"),	
	new IBMenuItem("company","companyButton.gif","companyRoll.gif","company/company.html","Company"),
//	new IBMenuItem("partners","partnersButton.gif","partnersRoll.gif","partners/partners.html","Partners"), // now in Company	
	new IBMenuItem("contact","contactButton.gif","contactRoll.gif","contact/contact.html","Contact Us")
)


/********** IdeaBlade SubMenus (Displayed on left side) ************/
// Index is Section. Value is array of IBPageKeys, in order.
IBSubMenus = new Array ()
IBSubMenus['HOME'] =
  new Array('IBVB','REDUCECOSTS','BUILD','VISUALSTUDIO','PERFORMANCE','WHATIS','JAVASCRIPT');
IBSubMenus['COMPANY'] =
  new Array('COMPANY','HQLOCATION','MANAGEMENT','TAC'); //,'BUILD','CUSTOMERS','PARTNERS');
IBSubMenus['INTRANET'] =
  new Array('MANAGEMENT');
IBSubMenus['SERVICES'] =
  new Array('SERVICES','TRAINING','TRAININGSCHED','WEBINARS','SUBSCRIBE');
IBSubMenus['RESOURCES'] =
  new Array('RESOURCES','DEMOS','ORP_IN_DOTNET','POWERBUILDER','MOBILIZEDAPPS','WHITEPAPERS','ARTICLES','READING','GENERALINTEREST','WEBINARS','NEWSGROUP','IBNEWS'); // ,'REFERRALS');
IBSubMenus['SUPPORT'] =
  new Array('SUPPORT','IBDOWNLOADS','OTHERDOWNLOADS','TRAININGSCHED','WEBINARS','NEWSGROUP','FEEDBACK');
IBSubMenus['FAQ'] =
  new Array('FRAMEWORK','SERVER','DOTNET'); // ,'COMPANY');
IBSubMenus['WEBINARS'] =
  new Array('WEBINARS','MSDNWEBCAST','DOTNETDEV','BASICTRAINING','ADVTRAINING','SEPTCAL','OCTOBERCAL','WEBINARFEEDBACK');
IBSubMenus['IBLITE'] =
  new Array('SUPPORT','TRAINING','WEBINARS','RESOURCES','COMPANY','NEWSGROUP','FEEDBACK');

function LeftMenuHTML(pSectKey, pPageKey) {
	pSectKey=pSectKey.toUpperCase();
	var line='';
	var s='';
	var pageKeys = IBSubMenus[pSectKey];
	var pageKeysLength = pageKeys.length;
	for (var i=0; i < pageKeysLength; i++) {
	  s+=line+IBPageLink(GetIBPageFromKey(pageKeys[i]), pPageKey);
	  if (""==line)
	    line = '<br><img src="' + gGlobals.Art + 'underline.gif" width="140" height="14"><br>';
	}
	if (''!=s)
	  s = '<span class="hotTextBold">' + s + '</span>';
	return s;
}

function WriteLeftMenu(pSectKey, pPageKey) {document.write(LeftMenuHTML(pSectKey, pPageKey));}


/* Delete these functions as soon as possible */
function writeHomeMenu(pPageKey) {WriteLeftMenu('Home',pPageKey)}
function writeServicesMenu(pPageKey) {WriteLeftMenu('Services',pPageKey)}
function writeResourcesMenu(pPageKey) {WriteLeftMenu('Resources',pPageKey)}
function writeFAQMenu(pPageKey) {WriteLeftMenu('FAQ',pPageKey)}


/********** IdeaBlade Pages **************/

IBPages = new Array(
  new IBPage('IBVB','IdeaBlade in VB.NET','home','IBVb.html'),
  new IBPage('REDUCECOSTS','Reduce development time and life cycle costs','home','reducecosts.html'),
  new IBPage('BUILD','Build Smart Client Internet Applications','home','buildsmartclient.html'),
  new IBPage('VISUALSTUDIO','Teamwork in Visual Studio','home','visualstudio.html'),
  new IBPage('PERFORMANCE','High performance over low speed lines','home','highbandwidth.html'),
  new IBPage('WHATIS','What is &quot;Smart Client&quot;','home','smartclient.html'),
  new IBPage('JAVASCRIPT','The JavaScript Trap','home','javascripttrap.html'),
  new IBPage('COMPANY','Company','company','company.html'),
  new IBPage('HQLOCATION','Location','company','hqlocation.html'),
  new IBPage('CUSTOMERS','Customers','company','customers.html'),
  new IBPage('MANAGEMENT','Management','company','management.html'),
  new IBPage('TAC','Technical Advisory Council','company','tac.html'),
  new IBPage('PARTNERS','Partners','company','partners.html'),
  new IBPage('CONTACT','Contact Us','..','contact.html'),
  new IBPage('SERVICES','Services','..','services.html'),
  new IBPage('TRAINING','Training','..','training.html'),
  new IBPage('TRAININGSCHED','Training Schedule','..','training_schedule.html'),
  new IBPage('RESOURCES','Resources','resources','resources.html'),
  new IBPage('ORP_IN_DOTNET','Object Relational Persistence in .NET','resources','orpInDotNet.html'),
  new IBPage('POWERBUILDER','IdeaBlade For PowerBuilder Developers','resources','PowerBuilderWithIB.html'),
  new IBPage('MOBILIZEDAPPS','Simplifying Mobilized Smart-Client Development','resources','CaseStudy_MobilizedApps.html'),
  new IBPage('DEMOS','Demonstrations','resources','demos.html'),
  new IBPage('WHITEPAPERS','White Papers','..','whitepapers.html'),
  new IBPage('ARTICLES','Articles Online','resources','articles.html'),
  // new IBPage('REFERRALS','Organizations and Experts','resources','referrals.html'),
  new IBPage('READING','Recommended Reading','resources','reading.html'),
  new IBPage('GENERALINTEREST','General Interest','resources','generalinterest.html'),
  new IBPage('SUPPORT','Support Home','..','support.html'),
  new IBPage('TRIALDOWNLOADS','IdeaBlade Trial Version','support','trialdownloads.html'),
  new IBPage('IBDOWNLOADS','IdeaBlade Downloads','support','ibdownloads.html'),
  new IBPage('OTHERDOWNLOADS','Supporting Downloads','support','otherdownloads.html'),  
  new IBPage('FEEDBACK','Feedback','..','feedback.aspx'),
  new IBPage('FRAMEWORK','Development Framework','faq','faq.html'),
  new IBPage('SERVER','Business Object Server','faq','faqbusserver.html'),
  new IBPage('DOTNET','Microsoft.Net','faq','faqmicrosoftnet.html'),
  new IBPage('IBLITE','IdeaBlade-Lite','IB-Lite_Home','index.html'),
  new IBPage('DEVFORCEEXPRESS','DevForce Express','DevForceExpress_Home','index.html'),
  new IBPage('NEWSGROUP','NewsGroup','NewsGroup','index.html'),
  new IBPage('IBNEWS','IdeaBlade News','..','news.html'),
  new IBPage('REGIBLITEFORVB','IdeaBlade-Lite for Visual Basic .NET', 'REGIB-Lite_download','IBLiteForVB.html'),
  // new IBPage(''COMPANY','IdeaBlade','faq','faqthecompany.html'),
  
  new IBPage('WEBINARS','Webinars','..','web_seminars.html'),
  new IBPage('WEBINARFEEDBACK','Feedback','IB-Webinar','webinarfeedback.aspx'),
  new IBPage('DOTNETDEV','.NET Development','IB-webinar','dotNETDevelopment.html'),
  new IBPage('BASICTRAINING','Basic Training','IB-Webinar','basictraining.html'),
  new IBPage('ADVTRAINING','Advanced Training','IB-Webinar','advtraining.html'),
  new IBPage('JUNECAL','June Events','IB-Webinar','JuneCal.html'),
  new IBPage('JULYCAL','July Events','IB-Webinar','JulyCal.html'),
  new IBPage('AUGUSTCAL','August Events','IB-Webinar','AugustCal.html'),
  new IBPage('SEPTCAL','September Events','IB-Webinar','SeptCal.html'),
  new IBPage('OCTOBERCAL','October Events','IB-Webinar','OctoberCal.html'),
  new IBPage('PayPalLink','','','https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=epay%40ideablade%2ecom&undefined_quantity=1&item_name=Support%20Call&item_number=IBLite150&amount=150%2e00&no_shipping=1&currency_code=USD&lc=US','_blank'),  
  new IBPage('NUNIT','','','http://www.nunit.org','_blank'),
  new IBPage('TESTDRIVEN','','','http://www.testdriven.net','_blank'),
  new IBPage('SUBSCRIBE','Subscribe to the IdeaBlade NewsFlash','..','subscribe.html'),

  // MSDN Web Cast Related
  new IBPage('MSDNWEBCAST','IB-Webinar','msdnwebcast.html'),
  new IBPage('MSDNWEBCAST050808','Rapidly Build Smart Client Apps with Ideablade - 08 Aug 05','IB-Webinar',
    'http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032278529%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e',
    '_blank'),
  new IBPage('MSDNWEBCAST050812','Easily Transition from VB6 to VB.NET - 12 Aug 05','IB-Webinar',
  	'http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032278727%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e',
    '_blank'),
  new IBPage('MSDNWEBCAST050826','Best Practices in Distributed Applications - 26 Aug 05','IB-Webinar',
    'http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032278544%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e',
    '_blank'),
  new IBPage('MSDNWEBCAST050831','Rapid Application Development with IdeaBlade 3.0 and VS2005 - 31 Aug 05','IB-Webinar',
    'http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032278547%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e',
    '_blank'),

  new IBPage('Sentinel','','','index.html') /* Always the last one */
);

function IBPage(pPageKey, pTopic, pSectionDir, pFilename, pWindow) {
	this.PageKey = pPageKey.toUpperCase();
	this.Topic = pTopic;
	this.SectionDir = pSectionDir;
	if (this.SectionDir.length > 0  && (this.SectionDir.charAt(this.SectionDir.length - 1) != "/"))
	  this.SectionDir += "/";
	this.Filename = pFilename;
	this.Window = (!pWindow)? "" : pWindow;  
}

function GetIBPageFromKey(pPageKey){
  var pageKey = pPageKey.toUpperCase()
  var pagesLength = IBPages.length; // TODO: Could use associative array
	for (var i=0; i < pagesLength; i++) {
    if (IBPages[i].PageKey == pageKey) {
      return IBPages[i];
    }
  }
}

function IBPageLink(pIBPage, pNoLinkPageKey) {
  var s;
	if (pIBPage.PageKey == pNoLinkPageKey.toUpperCase())
	  s='<span class="IBPageNoLink">'+pIBPage.Topic+'</span>';
	else {
	  s = '<a class="IBPageLink" href="javascript:GoIBPageKey(\''+pIBPage.PageKey+'\')">'+ pIBPage.Topic+'</a>';
	}
	return s;
}

function IBPageUrl(pIBPage) {
  var filename = pIBPage.Filename;
	return (0==filename.indexOf("http")) ? filename : gGlobals.PathToRoot+pIBPage.SectionDir+filename;
}

function GoPage(pPageUrl, pNewWindow){
  // alert(pPageUrl);
  if (!pNewWindow) { 
    location=pPageUrl; 
  } else {
    var win = (pNewWindow == true) ? "_blank" : pNewWindow;
    window.open(pPageUrl, win);
    location="#";
  }
}

function GoIBPageKey(pPageKey, pNewWindow) { 
  GoIBPage(GetIBPageFromKey(pPageKey), pNewWindow);
}

function GoIBPage(pIBPage, pNewWindow) {
  var newWin = false;
  if (pNewWindow == null) {
    newWin = pIBPage.Window;
    if (newWin == "") newWin = false;
  } else {
    newWin = pNewWindow;
  }
  GoPage(IBPageUrl(pIBPage), newWin);
}

/* Legacy: Replacy with IBPageKeys */
function GoHomePage(pPageUrl, pNewWindow) { GoPage(gGlobals.HomeDir+pPageUrl, pNewWindow);}
function GoFAQPage(pPageUrl, pNewWindow) { GoPage(gGlobals.FAQDir+pPageUrl, pNewWindow);}
function GoProductTourPage(pPageUrl, pNewWindow) { GoPage(gGlobals.ProductTourDir+pPageUrl, pNewWindow);}
function GoResourcesPage(pPageUrl, pNewWindow) { GoPage(gGlobals.ResourcesDir+pPageUrl, pNewWindow);}
function GoServicesPage(pPageUrl, pNewWindow) { GoPage(gGlobals.ServicesDir+pPageUrl, pNewWindow);}
function GoSupportPage(pPageUrl, pNewWindow) { GoPage(gGlobals.SupportDir+pPageUrl, pNewWindow);}

/*** Resource Files ***/
function resourceURL(pKey) {
  var rpath = gGlobals.ResourcesDir;
  pKey = pKey.toUpperCase();
  switch (pKey) {
    case "2MINUTEMOVIE": return rpath+"Two Minute Demo w Audio.wmv";
    case "ORMMOVIE": return rpath+"IdeaBlade_Orm.wmv";
    case "UIMOVIE": return rpath+"IdeaBlade_UIBinding.wmv";
    case "DEMOAPPHELP": return rpath+"SampleApp.chm";
    case "DEMOAPP": return rpath+"IdeaBladeDemo.msi";
    case "CONCEPTS": return rpath+"IdeaBlade Concepts.zip";
    case "TUTORIAL": return rpath+"IdeaBladeTutorials.msi";
    case "TUTORIALDB": return rpath+"IdeaBladeTutorialDB.zip";
    case "HELP": return rpath+"IdeaBladeHelp.zip";
    case "TRIAL": return rpath+"IdeaBladeTrial.zip";
    case "TRIALREADME": return rpath+"TrialDownloadReadme.html";
    case "WHATISDOTNET": return rpath+"WhatIsDotNet.pdf";
    case "IBARCHITECTURE": return rpath+"IdeaBlade_Architecture.pdf";
    case "INTERNETAPPS": return rpath+"InternetApplications.pdf";
    // the DevEx suite evaluation version compatible w/ current trial version(s) of IdeaBlade
    case "DEVEXEVAL" : return rpath + "DevExEval.exe"; 
    
    case "BROCHURE_ENTERPRISE": return rpath+"ObjectWareSolutions.pdf";
    case "BROCHURE_ISP": return rpath+"ObjectWareServiceProviders.pdf";
    case "BROCHURE_ISVS": return rpath+"ObjectWareISVs.pdf";
    
    // MSDN Article added July 2005
    case "ORP_IN_DOTNET_ARTICLE": return rpath+"OrpInDotNet.pdf";
    case "ORP_IN_DOTNET_CODE_CS": return rpath+"OrpInDotNetCodeCS.zip";
    case "ORP_IN_DOTNET_CODE_VB": return rpath+"OrpInDotNetCodeVB.zip";
    case "ORP_IN_DOTNET_MOVIE_CS": return rpath+"OrpInDotNetMovieCS_media/OrpInDotNetMovieCS.html";
    case "ORP_IN_DOTNET_MOVIE_VB": return rpath+"OrpInDotNetMovieVB_media/OrpInDotNetMovieVB.html";
    
    // IdeaBlade for PowerBuilder Article added Sept. 2005
    case "POWERBUILDER_ARTICLE": return rpath+"IdeaBladeForPowerBuilderDevelopers.pdf";
    
    // IdeaBlade Case Study Mobilized Applications Article added Sept. 2005
    case "MOBILIZEDAPPS_ARTICLE": return rpath+"SimplifyingMobilizedSmart-ClientDevelopment.pdf";

    default: return "";
  }
}

function DownloadResource(pKey, pNewWindow) { GoPage(resourceURL(pKey), pNewWindow);}

function ComingSoon() { 
  alert("Sorry ... this feature not quite ready. Please come back and try again soon!");
  return;
}
  
/********* FOOTER MATERIAL *************/
function copyrightHTML() { // use style, not css, for product tour
	return '<span style="font-family: Arial;font-size: 8pt;text-align: center;">Copyright &copy; 2001-2006 IdeaBlade  All rights reserved.</span>'
}

function PrivacyPolicyLinkHTML(pStyle){
 var style = (pStyle == null) ? "" : style=' style="'+pStyle+'" ';
  return '<a href="'+gGlobals.PrivacyPolicy+'" target="_blank" '+style+'>Privacy Policy</a>';
}
function WritePrivacyPolicyLink(pStyle) {document.write(PrivacyPolicyLinkHTML(pStyle));}

function FooterHTMLfix() {
	var s='<table cellpadding=0 cellspacing=0 border=0 align=middle width=100%>'+
		'<tr><td colspan=3 height=30>&nbsp;</td></tr>'+
		'<tr valign=middle><td align="center" width=190><img src="'+gGlobals.Art+'msCertifiedPartnerLogos/MS_Cert_small.GIF" border="0"></td>'+
		'<td align=center>'+copyrightHTML()+'&nbsp;&nbsp;'+PrivacyPolicyLinkHTML("font-family: Arial;font-size: 8pt;")+'</td>'+
//		'<td width=174 align=middle><img src="'+gGlobals.Art+'OWLogo_greengray123.gif" width="123" height="53" border="0"></td>'+
		'<td align=middle><img src="'+gGlobals.Art+'Optimized for VS logo - Med.jpg" border="0"></td>'+
'</tr></table>';
	return(s)
}


// Place at the bottom of every page as in ... <script>FooterHTML();</script></body></html>
// Mistake: should have been named WriteFooter(). Gradually phase in properly named function.
function FooterHTML() {document.write(FooterHTMLfix())}
function WriteFooter(){document.write(FooterHTMLfix())}


/**** COMMON RIGHT PANEL FUNCTIONS ***/
// Data Sheets
function writeDataSheets(){
	var path=gGlobals.ResourcesDir; 
	var li='<li  class="arrow" style="margin-left:-25; margin-bottom: 10">'
	var s='<span class="header2">Learn how IdeaBlade paves the way to .NET for </span><ul>'+
        li+'<a class="hotText1" href="javascript:DownloadResource(\'BROCHURE_ENTERPRISE\')"><b>Businesses</b></a></li>'+
        li+'<a class="hotText1" href="javascript:DownloadResource(\'BROCHURE_ISP\')"><b>Service Providers</b></a></li>'+
        li+'<a class="hotText1" href="javascript:DownloadResource(\'BROCHURE_ISVS\')"><b>Software Vendors</b></a></li>'+
        '</ul><center><img height=14 src="'+gGlobals.Art+'underline.gif" width=160></center><br>';
	document.write(s);
}
// Take the Product Tour
function writeProductTour(){
	var normal=gGlobals.Art+'productTour/productTourButton.gif';
	var roll=gGlobals.Art+'productTour/productTourRoll.gif';
	var a='<a href="javascript:;" onClick="TourLaunch(\'productTour/productTour.html\')" border=0 class="header2" '+
		'onMouseOver="TourButton.src=\''+roll+'\'" onMouseOut="TourButton.src=\''+normal+'\'">';
	var s=a+'<img  src="'+normal+'" name="TourButton" border=0 alt="Take the IdeaBlade Technology Product Tour"></a>'+
	'<br><span style="margin-top:4;">'+a+'Take the Tour</a></span>';
	document.write(s);
}
function TourLaunch(pTourURL) {
	pTourURL=gGlobals.PathToRoot+pTourURL
    var w=window.open(pTourURL,"Tour","width=768,height=550,border=0");
    w.focus();
}

// Request the Demo CD
function writeRequestCD(){
	var li='<li class="listNoLink" style="margin-left:-25; margin-bottom: 10">'
	var topic = document.title;
	if (!topic || topic=="") topic="Website";
	var s='<span class="header2" >Take a test drive on our demonstration CD:</span><ul>'+
      	li+'A sample smart client Internet application that connects to our server.</li>'+
        li+'A How-To-Build-An-App movie that guides you step-by-step</li>'+
        li+'Product Help file extract illustrating the scope and depth of documentation</li>'+
        li+'Product white papers</li></ul>'+
      	'Please <a href="mailto:%20info@IdeaBlade.com?subject='+topic+' Demonstration CD Request"><span class="hotText1">e-mail us</span></a> '+
		'to order your CD today.</span><br>';
	document.write(s);
}

/**** FAQ COMMON FUNCTIONS ***/
function writeFAQAskFeedback(){
	var s='<p class="header1">You ask the best questions!</p>'+
     	'<p class="header2"><span class="body2">We\'re eager to answer them and improve '+
     	'everyone\'s understanding of Internet application development. Why not '+
        '</span><a href="mailto:%20info@IdeaBlade.com"><span class="hotText1">e-mail '+
        'us</span></a><span class="body2"> your question and we\'ll share it with '+
        'others.</span></p>';
	document.write(s);
}

function WriteIBDownloadSystemRequirements(pIsDevForce) {
  if (!pIsDevForce) {
    var s='<p><Div class="blurb" style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 4px">IdeaBlade 2.x System requirements:</Div>'+
          'IdeaBlade applications built with releases prior to version 3.0 (such as IdeaBlade-Lite) require <a href="http://msdn.microsoft.com/netframework/downloads/howtoget.aspx" target="_blank">'+
          '.NET framework 1.1</a>. IdeaBlade development requires <a href="http://msdn.microsoft.com/vstudio/Previous/2003/" target="_blank">'+
          'Visual Studio 2003</a>. '+
          'Additionally, our tutorials require Microsoft SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine (MSDE).'+
          '<p>We often feature the Developer Express UI controls suite in our tutorials. '+
          'Here you can <a href="javascript: DownloadResource(\'DEVEXEVAL\', false)">'+
          'download the DevEx evaluation copy</a> that works with this IdeaBlade version.</p>';
    } else {
    var s='<p><Div class="blurb" style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 4px">IdeaBlade DevForce 3.x System requirements:</Div>'+
          'IdeaBlade DevForce 3.x applications require the commercial release of .NET framework 2.0. '+
          'DevForce developers can use any edition of Visual Studio 2005 although we recommend a version that includes TeamTest. '+
          'Our tutorials require Microsoft SQL Server 2000 or later; '+
          'They work fine with Microsoft SQL Server 2005 Express and Microsoft SQL Server 2000 Desktop Engine (MSDE). '+
          'DevForce Express and Professional Editions are licensed for use with Microsoft SQL Server databases only.' +
          '</p>'
    }
    document.write(s);
  }

// True if pURL has a host specification
function HasHostInURL(pURL) {
	return  0 == pURL.search(/\w+:/); 
}

/***** IdeaBlade Image Class ******/
function IBImage(pURL,pAssignedWidth,pAssignedHeight,pImgName,pAlt,pPreload) {
	this.URL = pURL;
	this.FullURL = (HasHostInURL(pURL)) ? this.URL : gGlobals.PathToRoot+this.URL;// if no host, assume rel to IB root & fix
	this.assignedWidth = (!pAssignedWidth) ? "" : pAssignedWidth;
	this.assignedHeight = (!pAssignedHeight) ? "" : pAssignedHeight
	this.ImgName = (!pImgName) ? 'IBImg' + IBImage.IBImgId++ : pImgName;
	this.Alt = (!pAlt) ? "" : pAlt;
	this.IsLoaded = false;
	if (!pPreload) 
		this.IsLoaded = false;
	else {
		this.Load();
	}
}
function IBImage_Load() {
	if (this.IsLoaded) return; // did already
	var img = new Image;
	img.src = this.FullURL;
	var height = img.height;
	// dims can't be determined on all browsers; get from "assigned" values
	if (!height) {
		this.Height=this.assignedHeight;
		this.Width=this.assignedWidth;
	}
	else { // ignore assigned and use actual
		this.Height = img.height;
		this.Width =  img.width;
	}
	this.IsLoaded = true;
}
IBImage.prototype.Load=IBImage_Load;

IBImage.prototype.GetWidth = function (){this.Load(); return this.Width};
IBImage.prototype.GetHeight = function (){this.Load(); return this.Height};
IBImage.IBImgId = 0; // class var with next image name id


// Generate HTML for the image
//  e.g. <img src="art/anImage.gif" name="anImage" width="81" height="28" border="0" alt="Hello">
// all args are optional overrides of the IBImage's values.
// If arg=="", wont use matching param. If arg omitted or null, use IBImage's value
function IBImage_ImgHTML(pName,pAlt,pWidth,pHeight) {
	var name = (null==pName) ? this.ImgName : pName;
	var alt = (null==pAlt) ? this.Alt : pAlt;
	var width = (null==pWidth) ? this.GetWidth() : pWidth;
	var height = (null==pHeight) ? this.GetHeight() : pHeight;
	if (""!=name) name=' name= "'+name+'" ';
	if (""!=alt) alt=' alt="'+alt+'" ';
	if (""!=width) width=' width="'+width+'" ';
	if (""!=height) height=' height="'+height+'" ';
	return '<img src="'+this.FullURL+'" '+name+alt+width+height+' border="0">';
}
IBImage.prototype.ImgHTML=IBImage_ImgHTML;
IBImage.prototype.toString=IBImage_ImgHTML;
function IBImage_ImgWrite(pName,pAlt,pWidth,pHeight){document.write(IBImage_ImgHTML(pName,pAlt,pWidth,pHeight))}
IBImage.prototype.ImgWrite=IBImage_ImgWrite;


/********** IdeaBlade URL Class **************/
// pURL (req'd) is the URL of the reference. Must be either absolute or relative to IB root
// pURLText: Display HTML for this URL - what should typically appear btwn <a></a> tags. Default is pURL
//   NB: This can be Image HTML, not just text
//       e.g. <img src="art/anImage.gif" name="anImage" width="81" height="28" border="0" alt="Hello">
//       1) Add IBImage object below, e.g. gIBImages.anImage = new IBImage("art/anImage",true,"anImage","Hello")
//       2) set pURLText to gIBImages.anImage.ImgHTML()
// pDescription: Descriptive HTML pertaining to what happens when clicked. Default is "".
function IBURL (pURL,pURLText,pDescription) {
	this.URL = pURL;
	this.IsAbsolute = HasHostInURL(pURL); // true if absolute addr; if false, assume rel to IB root
	this.FullURL = (this.IsAbsolute) ? this.URL : gGlobals.PathToRoot+this.URL;
	this.URLText = (!pURLText) ? FullURL : pURLText;
	this.Description = (!pDescription) ? "" : pDescription;
}
/** IBURL methods **/
// HTML for standard link to URL. No args required
// pText: link text that appears between <a></a> tags; default is in obj
// pTarget: name of pop-up window, if any.
//    "" forces no window. Omitted or null = do default = no win if relative, popup '_Blank' if absolute.
// pModifiers: additional stuff for inside <a> tag (excluding target). ""==no mods; null or no arg == std mods
function IBURL_LinkHTML(pText, pTarget, pModifiers) {
	var text = (!pText) ? this.URLText : pText;
	var target="";
	if (null==pTarget) { // no popup window specified
		if (this.IsAbsolute) target=' target="_blank" '; // if absolute, pop std win., else just go there
	}
	else { // window specified
		if ("" != pWindow) target=' target="'+pTarget+'" '; // not blank, set top pop window
	}
	var modifiers = (null==pModifiers) ? ' class="hotText1" ' : pModifiers;
	// href modifiers. Default is std link class
	return '<a href="'+this.FullURL+'" '+target+modifiers+' >'+text+'</a>';
}
IBURL.prototype.LinkHTML = IBURL_LinkHTML;
IBURL.prototype.toString = IBURL_LinkHTML;
function IBURL_LinkWrite(pText,pTarget, pModifiers) {document.write(IBURL_LinkHTML(pText,pTarget, pModifiers));}
IBURL.prototype.LinkWrite = IBURL_LinkWrite;

 /* Write IdeaBlade's Name,HQAddress.
 * Optionally don't show name and/or do show main phone
 * psOptions: "noname" = don't show name; "phone" = show phone
 */
function IdeaBladeAddrWrite(psOptions) {document.write(IdeaBladeAddrHTML(psOptions))}
function IdeaBladeAddrHTML(psOptions) {
	var bName=true,bPhone=false;
	if ("undefined"!=typeof(psOptions)&& ""!=psOptions) {
		psOptions=" "+psOptions.toLowerCase()+" ";
		bName  = (-1<psOptions.indexOf(" name"))  || (-1==psOptions.indexOf(" noname"));
		bPhone = (-1<psOptions.indexOf(" phone")) || (-1==psOptions.indexOf(" nophone"));
	}
	var s=(bName) ? "<b>IdeaBlade</b><br>" : "";
	s+="6425 Christie Avenue, Suite 260<br>Emeryville, CA&nbsp;&nbsp;94608"
	if (bPhone) s+="<br>"+IdeaBladePhoneHTML()
	return (s)
}

function IdeaBladePhoneWrite() {document.write(IdeaBladePhoneHTML())}
function IdeaBladePhoneHTML() {
	return ("1-510-596-5100")
}
function InfoEmailLinkWrite() {document.write(InfoEmailLinkHTML());}
function InfoEmailLinkHTML() {
	return '<a href="mailto:%20info@IdeaBlade.com"><span class="hotText2">info@IdeaBlade.com</span></a>';
}
function SupportEmailLinkWrite() {document.write(SupportEmailLinkHTML());}
function SupportEmailLinkHTML() {
	return '<a href="mailto:%20support@IdeaBlade.com"><span class="hotText2">support@IdeaBlade.com</span></a>';
}
function EventsEmailLinkWrite() {document.write(EventsEmailLinkHTML());}
function EventsEmailLinkHTML() {
	return '<a href="mailto:%20events@IdeaBlade.com"><span class="hotText2">events@IdeaBlade.com</span></a>';
}

/***********Additional String Methods *******************/
// Returns LeftTrim, RightTrim, and L&R Trim of whitespace from a string
String.prototype.ltrim = function () {return this.replace(/^\s+/,'');}
String.prototype.rtrim = function () {return this.replace(/\s+$/,'');}
String.prototype.trim = function () {return this.replace(/^\s+/,'').replace(/\s+$/,'');}
 
/********** COOKIE LIBRARY ******************************
 * Cookie class adapted from JavaScript: The Definitive Guide, 3rd Edition.
 * That book and this example were Written by David Flanagan.
 * They are Copyright (c) 1996, 1997, 1998 O'Reilly & Associates.
 * This example is provided WITHOUT WARRANTY either expressed or implied.
 * You may study, use, modify, and distribute it for any purpose,
 * as long as this notice is retained.        
 ********************************************************/
// The constructor function: 
//   name:     A string that specifies a name for the cookie. Required.
//   path:     Optional. String  specifies the cookie path attribute.
//             Use '/' if every page on the website needs access (see p335)
//   hours:    Optional. Number of hours from now that the cookie should expire.
//   document: Optional. Document object that the cookie is stored for. Default is current window doc.
//   domain:   An optional string that specifies the cookie domain attribute.
//   secure:   An optional Boolean value that, if true, requests a secure cookie.
function Cookie(name, path, hours, document, domain, secure) {
    // Predefined object properties begin with '$'to distinguish properties which are cookie values
    this.$name = name;
    if (path) this.$path = path; else this.$path = null;
    if (hours) this.$expiration = new Date((new Date()).getTime() + hours*3600000);
    else this.$expiration = null;
    if (document) this.$document = document; else this.$document = window.document;
    if (domain) this.$domain = domain; else this.$domain = null;
    if (secure) this.$secure = true; else this.$secure = false;
}
function _Cookie_setExpiration(hours) {
    if (hours) this.$expiration = new Date((new Date()).getTime() + hours*3600000);
    else this.$expiration = null;
}
function _Cookie_store() {
    var cookieval = "";
    for(var prop in this) {
        // Ignore properties with names that begin with '$' and also methods.
        if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) continue;
        if (cookieval != "") cookieval += '&';
        cookieval += prop + ':' + escape(this[prop]);
    }
    var cookie = this.$name + '=' + cookieval;
    if (this.$expiration)
        cookie += '; expires=' + this.$expiration.toGMTString();
    if (this.$path) cookie += '; path=' + this.$path;
    if (this.$domain) cookie += '; domain=' + this.$domain;
    if (this.$secure) cookie += '; secure';
//alert(cookie);
    this.$document.cookie = cookie;
}
function _Cookie_load() {
    var allcookies = this.$document.cookie;
    if (allcookies == "") return false;
    var start = allcookies.indexOf(this.$name + '='); // get this cookie
    if (start == -1) return false;   // Cookie not defined for this page.
    start += this.$name.length + 1;  // Skip name and equals sign.
    var end = allcookies.indexOf(';', start);
    if (end == -1) end = allcookies.length;
    var cookieval = allcookies.substring(start, end);
//alert(this.$name + '='+cookieval);    
    var a = cookieval.split('&');    // Break it into array of name/value pairs.
    for(var i=0; i < a.length; i++)  // Break each pair into an array.
        a[i] = a[i].split(':');
    for(var i = 0; i < a.length; i++) {
        this[a[i][0]] = unescape(a[i][1]);
    }
    return true;
}
function _Cookie_remove() {
    var cookie;
    cookie = this.$name + '=';
    if (this.$path) cookie += '; path=' + this.$path;
    if (this.$domain) cookie += '; domain=' + this.$domain;
    cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

    this.$document.cookie = cookie;
}
function _Cookie_show(){ // Just for debugging
  var s=this.$name+' =';
  for (var prop in this) {
        if (prop == '$name' || (typeof this[prop]) == 'function')  continue;
        if (prop == '$document') var value=this[prop].location;
        else value = this[prop];
        s += '\n' + prop + ': "' + value + '"';
  }
  alert(s);
}
function GetCookie(pName) {
// old-style cookie retrieval
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)  {
    var aCrumb = aCookie[i].split("=");
    if (pName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }
  return null;
}

new Cookie();
Cookie.prototype.Store = _Cookie_store;
Cookie.prototype.Load = _Cookie_load;
Cookie.prototype.Remove = _Cookie_remove;
Cookie.prototype.Show = _Cookie_show;
Cookie.prototype.SetExpiration = _Cookie_setExpiration;
Cookie.prototype.NeverExpire = function () {this.SetExpiration(100000)};

/********** PRIVILEGED PAGE & SIGNIN MGMT ******************************/
function GetSignInCookie() {
  if (!gGlobals.SignInCookie) {
    var signInCookie = gGlobals.SignInCookie = new Cookie('SignIn','/');
    // True == signin cookie exists == signed in and sign in data are properties of SignInCookie
    gGlobals.IsSignedIn = signInCookie.$IsSignedIn = signInCookie.Load();
  }
  return gGlobals.SignInCookie;
}
GetSignInCookie(); // get it every page

// Get paging info from Paging cookie
function GetPagingInfo() {
  if (!gGlobals.PagingCookie){ // not retrieved yet
    var paging = gGlobals.PagingCookie = new Cookie('Paging','/');
    paging.Load();
    if (!paging.CancelPage || !paging.CancelPageIsPrivilegedFlag) {
      paging.CancelPage="index.html"; // website home
      paging.CancelPageIsPrivilegedFlag = "F";
    }
    if (!paging.SignInPage) paging.SignInPage = "signin.html";
    if (!paging.RegistrationPage) paging.RegistrationPage = "registration.html"
    return paging;
  }
  else return gGlobals.PagingCookie;
}

// Declares that this is a Privileged Page and executes accordingly
// Optional args allow specification of non-standard signin HTML, signin page, and/or registration page
function PrivilegedPage(signInPreamble, signInPage, registrationPage) {
  gGlobals.IsPrivilegedPage = true;
  if (!gGlobals.IsSignedIn) { // if not signed-in
    var paging = GetPagingInfo();
    paging.TargetPage =  location.href;
    paging.TargetPageIsPrivilegedFlag = "T";
    if (signInPreamble)paging.SignInPreamble = signInPreamble
    if (signInPage) paging.SignInPage = signInPage;
    if (registrationPage) paging.RegistrationPage = registrationPage;
    paging.Store();
    location = gGlobals.PathToRoot+paging.SignInPage; // jump to signin page
  }
}
// Sets and saves paging information
function SetPagingInfo() {
  if (gGlobals.NoPageSet) return;
  var paging = GetPagingInfo();
  paging.TargetPage = paging.CancelPage = location.href;
  var isPrivilegedPageFlag = (gGlobals.IsPrivilegedPage) ? "T" : "F";
  paging.TargetPageIsPrivilegedFlag = paging.CancelPageIsPrivilegedFlag = isPrivilegedPageFlag;
  gGlobals.PagingCookie = paging;
  paging.Store();
}