# ****************************************************************************
# Surgeweb javascript - Various things that should not be in the final product
# Note: sw.js is the primary surgeweb javascript code
# ----------------------------------------------------------------------------
#  - Stuff for demoing
#  - Experimental stuff that I'm not ready to delete yet
# ****************************************************************************



function beta_testers_init()
{
	class_add(panel_correct(document.getElementById('contacts')),'hidden');

	var a=new_anchor_before("foobar", "contacts");
	a.className="left_pane";
	a.id="beta_panel";
	a.innerHTML='<div style="background:#FFFFD1;text-align:center;"><b>Beta Testers</b><br> Take a look at some of the <a href="||help_url||||iftrue(help_context)||/intro.htm||help_extra||||endif||" target="popup">capabilities</a> of the Surgeweb webmail,<br>also <a href="http://netwinsite.com/surgeweb/help/updates.htm" target="popup">change history</a><br><span id="compat"></span></div>';
#	setTimeout("document.getElementById('compat').innerHTML=' ['+document.compatMode+']';",200);
	document.getElementById('compat').innerHTML=' [mode='+document.compatMode+']';
	panelise_round(a,enBoth);
	
	var beta=||if(and(show_beta_panes,istrue(show_beta_panes)))||true||else||false||endif||;
	if (!beta)
		class_add(panel_correct(a),"hidden");
}

function beta_showpane()
{
	new_win = open_popup('cmd=show&page=beta_info.htm');
	if (!new_win) return;
	document.set_sid=set_sid;
	new_win.focus();
}
function beta_showchanges()
{
	new_win = open_popup('cmd=show&page=beta_history.htm');
	if (!new_win) return;
	document.set_sid=set_sid;
	new_win.focus();
}


function beta_hook_msg_show(){
	var oldMsgfn=M;
	M=function(item){
		alert("my custom message submission function about to call the orig function :-)");
		oldMsgfn(item);
	}
}
function beta_hook_msg_show_cb(){
	var oldMsgfn=M_cb;
	M_cb=function(txt){
		if(http.readyState == 4)
			alert("my custom data callback hook eg allows client side data manipulation, before message passed to the orig function :-)");
		oldMsgfn(txt);
	}
}


# --- Experimental ---


var xdoc;
function foo_fn()
{
	var eframe=document.getElementById('eframe');
	xdoc=eframe.contentWindow.document;

	include_dom('/swm/ajax/editor.css');
	return;
#	xdoc.body.innerHTML="foo";
	var node = xdoc.createElement('style');
	node.innerHTML="body {background:red;}";
  	
  	var xx = xdoc.getElementsByTagName('head').item(0);
   	xx.appendChild(node);
	
}
