


function ip_createRequestObject() {
    var ro;

  try { ro = new XMLHttpRequest(); }
  catch (e) {
      try { ro = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e) {
          try { ro = new ActiveXObject("Msxml2.XMLHTTP"); }
          catch (e) { ro = false; }
      }
  }

  return ro;
}


function update_image_handle_response()
{
  

}

function update_gs_image_preview(ono)
{
  ////////TEMPORARY HACK///////////////
  ///////YUK!/////////////////////////
  var fqs = formToQS(window.document.forms[0]);
  aj_sndReq('saveAndDoGSP', '&docid=67975' + fqs);


}

function ip_encode(str) {
	var result = "";
  if( encodeUri ){
      return encodeUri( str );
  }
  else{
      result = str.replace(/\+/g, "%2B");

      return escape(result);
  }
}


function ip_extract_content(node)
{
	data = '';

	children = node.childNodes;
	
	for(var i=0; i < children.length; i++)
	{
		data += children[i].nodeValue;
	}

  
	return data;	
}

function tx_set_thing(viewer, tfno, field, val)
{
}

var tx_set_bold = tx_set_thing;
var tx_set_italic = tx_set_thing;
var tx_set_align = tx_set_thing;
var tx_set_size = tx_set_thing;
var tx_set_face = tx_set_thing;
var tx_set_x = tx_set_thing;
var tx_set_y = tx_set_thing;
var tx_set_col = tx_set_thing;

function do_tx_field(field, callback, val)
{
  return val;  
}

var ip_update_this_ono, ip_update_this_ono_bk;

function f_tx_after_update()
{
  if(ip_update_this_ono)
  {
    update_image_preview(ip_update_this_ono);
  }
}

function set_image( idx, path )
{
  if(ip_update_this_ono)
  {
      update_image_preview(ip_update_this_ono, {'gfxoverride': [idx,  path]});
  }
}

function ip_add_prefix( key, val, opts ){

    if( ! window.ip_prefix ){
        window.ip_prefix = [];
    }
    
    window.ip_prefix.push( { "key" : key, "val" : val } );

    if( ip_update_this_ono && ! opts.noupdate ){
        update_image_preview( ip_update_this_ono );
    }
}

function pause_ip_updates()
{
    if( ip_update_this_ono ){
        ip_update_this_ono_bk = ip_update_this_ono;
    }
    ip_update_this_ono = false;
}
function resume_ip_updates()
{
    if( ip_update_this_ono_bk ){
        ip_update_this_ono = ip_update_this_ono_bk;
        f_tx_after_update();
    }
}
    

