//<script language="Javascript" type="text/javascript">
//<!-- Copyright 1999-2003 Alexa Internet, Inc.  All Rights Reserved.
var g_sBackgroundPath = RESOURCE_URI + "IMAGE/";
function Popup(oElement) {
	var o = new AlxObj();
	o.oType = "Popup";
	o.width = new Number(oElement.width);
	o.height = new Number(oElement.height);
	o.file = new String(oElement.file);
	o.name = new String(oElement.name);
	o.parent = oElement;
	o.bb = null;
	o.browser = null;
	o.build = Popup_build;
	o.hide = Popup_hide;
	o.update = Popup_update;
	o._destroy = o.destroy;
	o.destroy = Popup_destroy;
	o.onBeforeNavigate = Popup_onBeforeNavigate;
	o.et = et;
	o.host = BrowserProxy.Host;
	o.bp = BrowserProxy;
	o.dsn = oElement.dsn;
	o.create();
	et.register(EVT_BEFORENAVIGATE,o);
	return o;
	function Popup_destroy() {
		if (this.bb!=null) { this.hide(); try { this.br = null; this.bb.destroy(); this.bb = null;delete this.parent;CollectGarbage(); } catch (ex) { g_oLogger.out(this, "Report: " + ex.message); } }
	}
	function Popup_update() {
		this.bb.bblHTML.Browser.document.all['_display'].innerHTML = "";
		this.bb.bblHTML.Browser.document.all['_display'].insertAdjacentHTML("beforeEnd",this.dsn._parser.transform(this.bb.bblHTML.Browser.document.all["xsl_"+this.name].XMLDocument));
	}
	function Popup_build(bContinue) {
		bContinue = ( (this.br) && (this.br.document) ) ? true : false;
		if (!bContinue) {
			this.bb = BrowserProxy.bubbles.CreateFloatingTop();
			this.br = this.bb.bblHTML.Browser;
			this.bb.Visible = false; this.bb.Left = 0; this.bb.Top = 0; this.bb.Width = 249;
			this.bb.Caption = ''; 
			this.bb.AlwaysOnTop = true; 
			this.bb.BackgroundColor = '0xff00ff'; 
			this.bb.TransparentColor = '0xff00ff'; 
			this.bb.ToleranceColor = '0xff00ff';
			this.bb.BorderWidth = 0; this.bb.EventSink.onDocumentComplete = Popup_OnDocComplete;
			this.bb.bblHTML.Width=249;
			this.bb.External = alxAll.objects.Popup[this.oID];
			this.bb.bblHTML.Browser.navigate2(this.file.toString());
		} else {
			// got signal for continue from onreadystatechange from bubble
			this.bwLeft = parseInt(this.parent.m_tgt.previousSibling.offsetLeft)+parseInt(BrowserProxy.Container.ClientToScreenX(0));
			if (this.bwLeft >= parseInt(window.screen.availWidth - 249)) { 
				this.bwLeft = parseInt(BrowserProxy.Container.ClientToScreenX(0)) + parseInt((this.parent.m_tgt.offsetLeft+this.parent.m_tgt.offsetWidth)-249);
			}
			this.bb.Left = this.bwLeft;
			this.bb.Top = BrowserProxy.Container.ClientToScreenY(0)+parseInt(this.parent.m_tgt.offsetTop+this.parent.m_tgt.offsetHeight)-1;
			this.bb.bblHTML.Width=249;
			this.bb.bblHTML.Top=0;
			this.bb.bblHTML.Left=0;
			this.update();
			this.bb.bblHTML.Height=this.br.document.all._display.clientHeight+1;
			this.bb.Height=this.br.document.all._display.clientHeight +2;
			this.bb.ClearBackgrounds();
			var bgCount = ((this.br.document.all._display.clientHeight))-17;
			bgCount = (bgCount < 1) ? 1 : bgCount;
			this.bb.AddBackgroundImage(g_sBackgroundPath+"window_sliver.gif", bgCount);
			this.bb.AddBackgroundImage(g_sBackgroundPath+"bg_popup.gif",1);
			this.bb.Visible=true;
			this.parent.inproc = false;
			try {
				this.br.document.parentWindow.focus();
			} catch(ex) {
				// browser object went away
			}
		}
	}
	function Popup_onBeforeNavigate() { this.hide(); }
	function Popup_hide() {
		if (this.bb) { this.bb.Visible = false; }
		try { 
			if (this.parent.btn) { 
				this.parent.btn.clicked = false; 
				this.parent.m_tgt.previousSibling.btn.clicked=false; 
				this.parent.btn.onmouseout(); 
			}
		} catch (ex) {}
		try {
			this.host.Browser.document.parentWindow.focus();
		} catch (ex) { 
			// host browser went away or never existed
		}
	}
	return true;
}
function Pop_onBlur() {}
function Popup_OnDocComplete(vSecond, oBrowser) { 
	try { 
		oBrowser.document.parentWindow.external.build(true); 
	} catch(ex) {
		// externel doesn't exist.
	}
}
function HintPopup(oElement) {
	var o = new Popup(oElement);
	o.oType = "HintPopup";
	o._build = o.build;
	o.build = HintPopup_build;
	o._update = o.update;
	o.update = HintPopup_update;
	o.body = window.document.body;
	o._hide = o.hide;
	o.hide = HintPopup_hide;
	o.dsn = oElement.dsn;
	o.bp = BrowserProxy;
	o.setPref = HintPopup_setPref;
	//o.imgpth = "res://AlxRes.dll/";
	o.imgpth= "IMAGE/";
	o.create();
	et.unregister(EVT_BEFORENAVIGATE,o);
	
	return o;
	function HintPopup_setPref(bEnable) {
		g_oCookie.writePersist("showhints",bEnable.toString());
		return true;
	}
	function HintPopup_update() {
		this.bb.bblHTML.Browser.document.all['_display'].innerHTML = "";
		var sResult = this.dsn._parser.transform(this.bb.bblHTML.Browser.document.all["xsl_"+this.name].XMLDocument);
		while (sResult.indexOf("{{") > -1) {
			sResult = sResult.replace("{{","<");
			sResult = sResult.replace("}}",">");
		}
		while (sResult.indexOf("&lt;") > -1) {
			sResult = sResult.replace("&lt;","<");
		}
		while (sResult.indexOf("&gt;") > -1) {
			sResult = sResult.replace("&gt;",">");
		}
		this.bb.bblHTML.Browser.document.all['_display'].insertAdjacentHTML("beforeEnd",sResult);
		this.bwLeft = parseInt(BrowserProxy.Container.ClientToScreenX(0)) + parseInt(elmSIClick.m_tgt.offsetLeft);
		this.bwTop = parseInt(BrowserProxy.Container.ClientToScreenY(0)) + parseInt(this.parent.m_tgt.clientTop)-50; // offset 50px above toolbar.
		this.bb.Left = this.bwLeft; 
		this.bb.Top = this.bwTop; 
		this.bb.bblHTML.Top=0;
		this.bb.bblHTML.Left=0; 
		this.bb.bblHTML.Width=318;
		this.bb.bblHTML.Height=this.br.document.all._display.clientHeight+1; 
		this.bb.Height = this.br.document.all._display.clientHeight+1; 
		this.bb.Width = 318; 
		this.bb.ClearBackgrounds();
		var bgCount = ((this.br.document.all._display.clientHeight))-20;
		bgCount = (bgCount < 1) ? 1 : bgCount;
		this.bb.AddBackgroundImage(g_sBackgroundPath+"window_sliver.gif",1);
		this.bb.AddBackgroundImage(g_sBackgroundPath+"hints_bg_top_mask.gif",1);
		this.bb.AddBackgroundImage(g_sBackgroundPath+"about_window_sliver.gif",(bgCount));
		this.bb.AddBackgroundImage(g_sBackgroundPath+"hints_bg_bottom_mask.gif",1);
		this.bb.Visible=true;
		try {
			this.br.document.parentWindow.focus();
		} catch(ex) {
			// browser object went away
		}
	}
	function HintPopup_build(bContinue) {
		if (!bContinue) { 
			this.file = RESOURCE_URI + "CHTML/hints.html";
			this._build();
		} else {
			this.update();
		}
	}	
	function HintPopup_setPref(bShow) {
		g_oCookie.write("showhints",(bShow) ? "true" : "false","persist");
	}
	function HintPopup_hide() {
		this._hide();
	}	
}
function AboutPopup(oElement) {
	var o = new Popup(oElement);
	o.oType = "AboutPopup";
	o._build = o.build;
	o.build = AboutPopup_build;
	o.update = AboutPopup_update;
	o.body = window.document.body;
	o._hide = o.hide;
	o.hide = AboutPopup_hide;
	o.dsn = dsndad;
	o.bp = BrowserProxy;
	o.imgpth= "IMAGE/";
	o.getVersionInfo = new Function("return new Array(g_AlexaVersion,BrowserProxy.Version,g_ReleaseNum,g_ReleaseDate,BrowserProxy.ResourceVersion);");
	o.create();
	return o;
	function AboutPopup_update() {
		this.bwLeft = parseInt(window.screen.availWidth/2) - parseInt(335/2);
		this.bwTop = parseInt(window.screen.availHeight/2) - parseInt(209/2);
		this.bb.Left = this.bwLeft; this.bb.Top = this.bwTop; this.bb.bblHTML.Top=2; this.bb.bblHTML.Left=0; this.bb.bblHTML.Width=335;
		this.bb.bblHTML.Height=212; this.bb.Height = 173; this.bb.Width = 335; this.bb.ClearBackgrounds();
		this.bb.ClearBackgrounds();
		this.bb.AddBackgroundImage(g_sBackgroundPath+"window_sliver.gif",1);
		this.bb.AddBackgroundImage(g_sBackgroundPath+"about_mask_top.gif",1);
		this.bb.AddBackgroundImage(g_sBackgroundPath+"about_window_sliver.gif",182);
		this.bb.AddBackgroundImage(g_sBackgroundPath+"about_mask_bottom.gif",1);
		this.bb.Visible=true;
		try {
			this.br.document.parentWindow.focus();
		} catch (ex) {
			// browser object went away
		}
	}
	function AboutPopup_build(bContinue) {
		if (!bContinue) {
			this.file = RESOURCE_URI + "CHTML/about.html";
			this._build();
		} else {
			this.update();
		}
	}

	function AboutPopup_hide() {
		this._hide();
		if (this.br) { this.br = null; }
		if (this.bb) { this.bb.destroy(); this.bb = null; }
		CollectGarbage();
	}
}
if ( typeof(oScriptReport) == 'object' )
	oScriptReport.load('pop.class.js');
