var _obj_tinyMCE_GZ = {
  plugins : 'style,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras',
  themes : 'advanced',
  languages : 'en',
  disk_cache : true,
  debug : false
};

var _obj_tinyMCE = {
  // General options
  mode : "textareas",
  theme : "advanced",
  editor_selector : "mceEditor",
  plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

  // Theme options
  theme_advanced_buttons1 : "save,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
  theme_advanced_buttons2 : "cut,copy,paste,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
  theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
  theme_advanced_toolbar_location : "top",
  theme_advanced_toolbar_align : "left",
  theme_advanced_statusbar_location : "bottom",
  theme_advanced_resizing : true,

  // Example content CSS (should be your site CSS)
  content_css : "css/content.css",

  // Drop lists for link/image/media/template dialogs
  template_external_list_url : "lists/template_list.js",
  external_link_list_url : "lists/link_list.js",
  external_image_list_url : "lists/image_list.js",
  media_external_list_url : "lists/media_list.js",
  // Style formats
  style_formats : [
    {title : 'Bold text', inline : 'b'},
    {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
    {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
  ],
  // Replace values for the template plugin
  template_replace_values : {
    username : "Some User",
    staffid : "991234"
  }
};

function onBodyLoad() 
{
  initFormHandlers();
}

function NVL(value, defaultValue) 
{
  if(typeof(value) == "undefined" || value == null) {
    return defaultValue;
  }
  return value;
}

function show_div(div_id) 
{
	document.getElementById(div_id).style.display = 'block';
}
function hide_div(div_id) 
{
	document.getElementById(div_id).style.display = 'none';
}

function showWithdraw(record) 
{
	var y ='withdraw_form'+record[record.selectedIndex].value;
	var tmp = new String;
	for (var i=0; i < record.length; i++) {
		tmp='withdraw_form'+record[i].value;
		document.getElementById(tmp).style.display = 'none';
	}
	document.getElementById(y).style.display = 'block';

}
function manageGroup(groupListId) 
{
    if (document.getElementById) {
	    var el = document.getElementById (groupListId);
        var groupId = el.options[el.selectedIndex].value;
        window.location = "groups.php#" + groupId;
    }
    return;
}


function checkForm(form, action, subaction) {
	var res = true;
	eval("res = check_" + form + "()");
	if (res && NVL(action, false)) {
		document.forms[form].elements['action'].value = action;
	}
	if (res && NVL(subaction, false)) {
		document.forms[form].elements['subaction'].value = subaction;
	}	
	return res;
}

function setFormAction(action, form) 
{
    document.forms[form].elements['action'].value = action;
}

function setFormSubAction(action, form) 
{
    document.forms[form].elements['subaction'].value = action;
}


function highlightFormsElement() {
    var h_elem_ids = new Array; 
    h_elem_ids  = getHighlightElementsId();    
    if (h_elem_ids != null) {
        for (var i=0; i<h_elem_ids.length; i++) {
          selectElementBackgroundById(h_elem_ids[i]); 
        }
    }
}

function getHighlightElementsId() { 
    get = new String(window.location);
    var res = null;
    var x = get.indexOf('?');
    if(x!=-1) {
        var tmp = get.substr(x+1, get.length-x);  
        var getparam = tmp.split('&');
        for(var i=0; i<getparam.length; i++)
        {
          tmp = getparam[i].split('=');
          if (tmp[0]=='highlight') 
          {
            res = tmp[1].split(":");
          }
        }

    }
    return res;    
}

function selectElementBackgroundById(element_id, bgcolor) {
   var element = document.getElementById(element_id);
   if (element != null) {
        element.className = "highlight";   
        element.title = "Please modify this option";
   }
   return;

}
