
function hide_element(elid){
	var el = document.getElementById(elid);
	//if(el.style.display){
		el.style.display = 'none';		
	//}
	return true;
}


<!-- EDITOR HTML -->
var editor_window = false;
var editor_id = false;
function open_editor(id){
	editor_id = id;
	if(editor_window){
		//BUG: nao fecha no opera
		//editor_window.close();
	}
	editor_window = window.open("/libs/tiny_mce/editor.html","html_ed","status=no,top=100,left=100,height=600,width=800,resizable=yes");
	editor_window.focus();
}





<!-- TABS -->
//var mytab = new tabs({property:value,property:value});
function tabs(args){
	//var arg;
	//todo: objecto criado pode fazer multiplas instancias com init();
	this.main_div = null;
	
	this.start_tab = 0;
	
	this.tabs = new Array();
	
	this.ul_class = 'ui-tabs-nav';
	
	this.li_class = 'tab-li';
	this.li_active_class = 'tab-li-active';
	//this.li_disabled_class = 'tab-li-disabled';	
	
	this.content_class = 'tab-content';
	this.content_hide_class = 'tab-content-hide';

	//EXPRESSÕES REGULARES
	this.ul_regex = new RegExp('\\b' + this.ul_class + '\\b', 'gi');
	this.li_regex = new RegExp('\\b' + this.li_class + '\\b', 'gi');
	this.li_active_regex = new RegExp('\\b' + this.li_active_class + '\\b', 'gi');
	this.content_regex = new RegExp('\\b' + this.content_class + '\\b', 'gi');
	this.content_hide_regex = new RegExp('\\b' + this.content_hide_class + '\\b', 'gi');
	
	for(arg in args){ 
		this[arg] = args[arg]; 
	}
	
	if(this.main_div){
		this.init(this.main_div);
		this.main_div = null;	
	}
}

tabs.prototype.init = function(id){
	var i, k, a; 
	var nodes;
	var hash;	
	var tab_refs = {};
	var new_tab;

	if(!document.getElementById) return false;	
	
	if(typeof(id) != 'object'){
		this.main_div = document.getElementById(id);
	}
	
	if(!this.main_div) return false;
	
	nodes = this.main_div.childNodes;
	
	for(i=0; i < nodes.length; i++){
		if(nodes[i].nodeName == 'UL' && nodes[i].className.match(this.ul_regex)){
			for(k=0; k < nodes[i].childNodes.length; k++){
				if(nodes[i].childNodes[k].nodeName == 'LI'){
					a = nodes[i].childNodes[k].getElementsByTagName('A');
					if(typeof(a[0].hash) == 'string'){
						hash = a[0].hash.replace('#', '');
						tab_refs[hash] = {};
						tab_refs[hash][0] = nodes[i].childNodes[k];
						tab_refs[hash][1] = a[0];
					}
				}
			}
			break;			
		}		
	}
	
	//se tab_refs vazio retorna falso
	for(i=0; i < nodes.length; i++){
		if(nodes[i].nodeName == 'DIV' && nodes[i].id && tab_refs[nodes[i].id]){
			hash = nodes[i].id;
			new_tab = new Object();		
			new_tab.div = nodes[i];
			new_tab.li = tab_refs[hash][0];					
			new_tab.a = tab_refs[hash][1];

			//retirar hash:
			new_tab.a.hash = '';
			new_tab.a.href = "javascript:void(null);";;

			//aplicar classes:
			new_tab.div.className = this.content_class+' '+this.content_hide_class;
			new_tab.li.className = '';

			//aplica eventos:
			new_tab.a.onclick = this.tabClick; //todo: e se ja existir evento?
			new_tab.a.tabber = this;
			new_tab.a.tabIndex = this.tabs.length;
			
			this.tabs[this.tabs.length] = new_tab;		
		}			
	}
	if(this.start_tab){
		if(this.start_tab > this.tabs.length) this.start_tab = 0;
		this.showTab(this.start_tab);
	}
	return this;
}
tabs.prototype.hideTab = function(id){
	if(!this.tabs[id]) return false;
	if(!this.tabs[id].div.className.match(this.content_hide_regex)) {
		this.tabs[id].div.className += ' '+this.content_hide_class;	
	}
	this.tabs[id].li.className = '';
	return this;
}
tabs.prototype.showTab = function(id){
	if(!this.tabs[id]) return false;
	this.hideAllTabs();
	this.tabs[id].div.className = this.tabs[id].div.className.replace(this.content_hide_class, '');
	this.tabs[id].li.className = this.li_active_class;
	return this;	
}
tabs.prototype.hideAllTabs = function(){
	for(var i = 0; i < this.tabs.length; i++){
		this.hideTab(i);
	}
}
tabs.prototype.tabClick = function(event){	
	var a = this;
	if(!a.tabber) return false; 
	a.blur();
	a.tabber.showTab(a.tabIndex);
	return this;
}
	






<!-- CLONE DE FORMULARIOS -->
var form_count = 0;
var form_name = 'element';
function delete_form(id){
	var e = document.getElementById(id);
	if(e != 'undefined'){
		e.parentNode.removeChild(e);
	}	
}
function clone_form(id, clone, level){
	var e;
	var new_form;
	var elems;
	
	e = document.getElementById(id);
	if(typeof(e) == 'undefined') return false;	
	form_count++;
	new_form = e.cloneNode(true);
	new_form.id = form_name + form_count;  
	
	elems = new_form.getElementsByTagName('*');
	for(k in elems){
		if(elems[k].nodeName == 'IMG'){	
			if(elems[k].className == 'icon-fmore'){
				elems[k].onclick = function(){
					clone_form(new_form.id, false, level);
				}
			}
			if(elems[k].className == 'icon-fclone'){
				elems[k].onclick = function(){
					clone_form(new_form.id, true, level);
				}
			}
			else if(elems[k].className == 'icon-fdelete'){
				elems[k].onclick = function(){
					delete_form(new_form.id);
				}
			}
		}
		
	}
	//console.log(elems);
	e = e.parentNode.insertBefore(new_form,e.nextSibling);
}	
	




function toogle(args){
	this.main_div = null;
	this.hide = false;
	

	this.link_class = 'tab-li';
	this.link_hide_class = 'tab-li-active';
	
	this.content_class = 'content';
	this.content_hide_class = 'tab-content-hide';

	//EXPRESSÕES REGULARES
	this.link_regex = new RegExp('\\b' + this.ul_class + '\\b', 'gi');
	this.link_hide_regex = new RegExp('\\b' + this.li_class + '\\b', 'gi');
	
	this.li_active_regex = new RegExp('\\b' + this.li_active_class + '\\b', 'gi');
	this.content_regex = new RegExp('\\b' + this.content_class + '\\b', 'gi');
	this.content_hide_regex = new RegExp('\\b' + this.content_hide_class + '\\b', 'gi');
	
	for(arg in args){ 
		this[arg] = args[arg]; 
	}
	
	if(this.main_div){
		this.init(this.main_div);
		this.main_div = null;	
	}
}
toogle.prototype.init = function(id){
	var nodes, i, k; 
	var tab_a;
	var new_tab;
	var tab_refs = {};
	var hash;
	
	if(typeof(id) != 'object'){
		if(!document.getElementById) return false;
		this.main_div = document.getElementById(id);
	}
	
	if(!this.main_div) return false;
	
	nodes = this.main_div.childNodes;
	
	for(i=0; i < nodes.length; i++){
		if(nodes[i].nodeName == 'UL' && nodes[i].className.match(this.ul_regex)){
			for(k=0; k < nodes[i].childNodes.length; k++){
				if(nodes[i].childNodes[k].nodeName == 'LI'){
					tab_a = nodes[i].childNodes[k].getElementsByTagName('A');
					if(typeof(tab_a[0].hash) == 'string'){
						hash = tab_a[0].hash.replace('#', '');
						tab_refs[hash] = {};
						tab_refs[hash][0] = nodes[i].childNodes[k];
						tab_refs[hash][1] = tab_a[0];

					}
				}
			}
			break;			
		}		
	}
	//se tab_refs vazio retorna falso
	for(i=0; i < nodes.length; i++){
		if(nodes[i].nodeName == 'DIV' && nodes[i].id && tab_refs[nodes[i].id]){
			hash = nodes[i].id;
			new_tab = new Object();		
			new_tab.div = nodes[i];
			new_tab.li = tab_refs[hash][0];					
			new_tab.a = tab_refs[hash][1];

			//retirar hash:
			new_tab.a.hash = '';
			new_tab.a.href = "javascript:void(null);";;

			//aplicar classes:
			new_tab.div.className = this.content_class+' '+this.content_hide_class;
			new_tab.li.className = '';

			//aplica eventos:
			new_tab.a.onclick = this.tabClick; //todo: e se ja existir evento?
			new_tab.a.tabber = this;
			new_tab.a.tabIndex = this.tabs.length;
			
			this.tabs[this.tabs.length] = new_tab;		
		}			
	}
	if(this.start_tab){
		if(this.start_tab > this.tabs.length) this.start_tab = 0;
		this.showTab(this.start_tab);
	}
	return this;
}










function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


