﻿/*
 * SimpleForum.design.js
 *
 * 
 */
 
var Design = {

    ToolTip : {
        /* Show Tool tip. By Default all tooltips must be hide to save design if JS's off */
        Init : function() {
            function $(id){return document.getElementById(id);}
            
            for(var id=0;id<arguments.length;id++)
            {
                if($(arguments[id]))
                {   
	                if($(arguments[id]).getAttribute("for")||$(arguments[id]).getAttribute("htmlFor")){
                        if($($(arguments[id]).getAttribute("for")||$(arguments[id]).getAttribute("htmlFor")).value.length <= 0){
                            $(arguments[id]).style.display='block';
                        }
                    }
                }
            }
        },
        
        /* Hide Tooltip */
        Hide : function(current) {
            current.style.display = "none";
        },
        
        /* Show Tooltip if "current" still empty */
        Show: function(current, tooltip){
            if(current.value.length <= 0)
                tooltip.style.display = "block";
        }
    },
    
    Utils : {
        ForumChangeSort : function(dropdown, path)
        {
            document.location = path + (path.indexOf('?') > 0 ? '&' : '?') + 'period=' + dropdown.options[dropdown.selectedIndex].value;
        },
        
        ShowModalPopup : function(name, url)
        {
            
            GB_showCenter(name,url, 223, 470);
        },
        
        FindHiddenEmail : function(){
            var theHTML = document.getElementById("container_for_bots").innerHTML;
            var reg = /LOADEMAIL\[([^\]]*)\]DOMAIN\[([^\]]*)\]/;
            while(reg.test(theHTML))
            theHTML = theHTML.replace(reg, this.ShowEmail);
            document.getElementById("container_for_bots").innerHTML = theHTML;
        },
        
        ShowEmail : function(temp, login, domain){
            return "<a " + "href=\'mai" + "lto:" + login + "@" + domain + "\'>" + login + "@" + domain + "</a>";
        }
    }
}


