if (!GRAPHO) var GRAPHO = {};
if (!GRAPHO.WordPress) GRAPHO.WordPress = {};
if (!GRAPHO.WordPress.PaginaBase) GRAPHO.WordPress.PaginaBase = {};
if (!GRAPHO.WordPress.Home) GRAPHO.WordPress.Home = {};
if (!GRAPHO.WordPress.Solucoes) GRAPHO.WordPress.Solucoes = {};
if (!GRAPHO.WordPress.Oportunidades) GRAPHO.WordPress.Oportunidades = {};
if (!GRAPHO.WordPress.PaginaPadrao) GRAPHO.WordPress.PaginaPadrao = {};
if (!GRAPHO.WordPress.Software) GRAPHO.WordPress.Software = {};
if (!GRAPHO.WordPress.Cursos) GRAPHO.WordPress.Cursos = {};


GRAPHO.WordPress.PaginaBase = function() {

    var iptBusca = null;

    iptBusca = document.getElementById("s");
    iptBusca.setAttribute('class', 'nohasfoco');
    iptBusca.setAttribute('className', 'nohasfoco'); //IE
    iptBusca.value = '';

    iptBusca.onfocus = function() {
        this.setAttribute('class', '');
        this.setAttribute('className', '');
        this.value = '';
    }

    iptBusca.onblur = function() {
        if (this.value.length < 1) {
            this.setAttribute('class', 'nohasfoco');
            this.setAttribute('className', 'nohasfoco'); //IE
            this.value = '';
        }
    }


    var _solucoes = GRAPHO.Util.elementosPorNome('ul', 'software_set');
    var _botoes = GRAPHO.Util.elementosPorNome('a', 'botao_set');

    var hasMenuSolucoes = _solucoes.length > 0 ? true : false;

    if (hasMenuSolucoes) {
        var menuSolucoes = new GRAPHO.Controles._PainelSlideShow(false, false, true, 'selecionado');
        for (i = 0; i < _solucoes.length; i++) {
            menuSolucoes.addSlide(_solucoes[i], _botoes[i], new Array(_botoes[i].parentNode));
        }
        menuSolucoes.ini();
    }

    return {
        _inputBuscar: iptBusca,
        _hasMenuSolucoes: hasMenuSolucoes,
        _menuSolucoes: hasMenuSolucoes ? menuSolucoes : null
    };
};

GRAPHO.WordPress.Home = {

    base: function() { },
    _painelTutoriais: null,
    _painelDestaques: null,
    _painelNoticias: null,

    inicializa: function() {
	
        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();

        if (document.getElementById('painelTutotiais_centro')){
            this._painelTutoriais = new GRAPHO.Controles._PainelSlider(
                        document.getElementById('painelTutotiais_centro'),
                        document.getElementById('painelTutotiais_recuar'),
                        document.getElementById('painelTutotiais_avancar'),
                        'h',
                        160,
                        true,
                        'btTutoDis');

            this._painelTutoriais.ini();
        }

        this._painelNoticias = new GRAPHO.Controles._PainelSlider(
                    document.getElementById('painelNoticias_centro'),
                    document.getElementById('painelTutotiais_subir'),
                    document.getElementById('painelTutotiais_decer'),
                    'v',
                    100,
                    true,
                    'btNotDis');

        this._painelNoticias.ini();

        this._painelDestaques = new GRAPHO.Controles._PainelSlideShow(true, false, true, 'selecionado');
        var _destaques = document.getElementsByName('destaque_slide');
        var _botoes = document.getElementsByName('destaque_botao');

        for (i = 0; i < _destaques.length; i++) {
            this._painelDestaques.addSlide(_destaques[i], _botoes[i]);
        }

        this._painelDestaques.ini();

    }

};

GRAPHO.WordPress.PaginaPadrao = {

    base: function() { },
    inicializa: function() {

        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();

    }

};

GRAPHO.WordPress.Software = {

    base: function() { },
    _painelAreas: null,
    inicializa: function() {

        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();
        this._painelAreas = new GRAPHO.Controles._PainelSlideShow(false, true, true, 'selecionado');

        this._painelAreas.addSlide(GRAPHO.Util.elementosPorClass('div', 'software_descricao')[0], document.getElementById('bt_software_descricao'));
        this._painelAreas.addSlide(GRAPHO.Util.elementosPorClass('div', 'software_requisitos')[0], document.getElementById('bt_software_requisitos'));
        this._painelAreas.addSlide(document.getElementById('software_imagens'), document.getElementById('bt_software_imagens'));

        this._painelAreas.ini();
        this._painelAreas.mudaSlide(GRAPHO.Util.elementosPorClass('div', 'software_descricao')[0]);
    }

};

GRAPHO.WordPress.Solucoes = {
    base: function() { },
    _painelSolucoes: null,

    inicializa: function() {

        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();

        this._painelSolucoes = new GRAPHO.Controles._PainelSlideShow(false, true, true, 'selecionado');
        var _solucoes = GRAPHO.Util.elementosPorNome('div', 'categoria_mais');
        var _botoes = GRAPHO.Util.elementosPorNome('a', 'link_mais');

        for (i = 0; i < _solucoes.length; i++) {
            this._painelSolucoes.addSlide(_solucoes[i], _botoes[i]);
        }

        this._painelSolucoes.ini();
        this._painelSolucoes.mudaSlide(_solucoes[0]);

    }
};

GRAPHO.WordPress.Cursos = {
    base: function() { },
    _painelCursos: null,
    _painelCadaCurso: null,

    inicializa: function() {

        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();

        this._painelCursos = new GRAPHO.Controles._PainelSlideShow(false, true, true, 'selecionado');
        var _cursos = GRAPHO.Util.elementosPorNome('div', 'categoria_mais');
        var _botoes = GRAPHO.Util.elementosPorNome('a', 'link_mais');

        for (i = 0; i < _cursos.length; i++) {
            this._painelCursos.addSlide(_cursos[i], _botoes[i]);
        }

        this._painelCursos.ini();
        this._painelCursos.mudaSlide(_cursos[0]);

        this._painelCadaCurso = new GRAPHO.Controles._PainelSlideShow(false, true, true, 'selecionado');
        var _cursos = GRAPHO.Util.elementosPorNome('div', 'curso_descr');
        var _botoes = GRAPHO.Util.elementosPorNome('a', 'curso_title');

        for (i = 0; i < _cursos.length; i++) {
            this._painelCadaCurso.addSlide(_cursos[i], _botoes[i]);
        }

        this._painelCadaCurso.ini();

    }
};

GRAPHO.WordPress.Oportunidades = {
    base: function() { },

    //_menuSolucoes: null,

    _uploadForms: null,

    inicializa: function() {

        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
        this.base = new this.base();

        //        this._menuSolucoes = new GRAPHO.Controles._PainelSlideShow(false, false, true, 'selecionado');
        //        var _solucoes = GRAPHO.Util.elementosPorNome('ul', 'software_set');
        //        var _botoes = GRAPHO.Util.elementosPorNome('a', 'botao_set');

        //        for (i = 0; i < _solucoes.length; i++) {
        //            this._menuSolucoes.addSlide(_solucoes[i], _botoes[i], new Array(_botoes[i].parentNode));
        //        }

        //        this._menuSolucoes.ini();

        this._uploadForms = new GRAPHO.Controles._PainelSlideShow(false, false, true, 'selecionado');
        var _forms = GRAPHO.Util.elementosPorNome('div', 'fgsuploader');
        var _botoes = GRAPHO.Util.elementosPorNome('a', 'bt_form');

        for (i = 0; i < _forms.length; i++) {
            this._uploadForms.addSlide(_forms[i], _botoes[i]);
        }

        this._uploadForms.ini();

    }
};

GRAPHO.WordPress.FeirasEventos = {

	    base: function() { },
	    _painelNoticias: null,
	    _painelTwitter: null,
		_painelDestaques: null,
	    inicializa: function() {
	        this.base.prototype = new GRAPHO.WordPress.PaginaBase();
	        this.base = new this.base();

	        this._painelNoticias = new GRAPHO.Controles._PainelSlider(
	                    document.getElementById('painelNews_centro'),
	                    document.getElementById('painelNews_subir'),
	                    document.getElementById('painelNews_decer'),
	                    'v',
	                    100,
	                    true,
	                    'btNotDis');

	        this._painelNoticias.ini();

	        this._painelTwitter = new GRAPHO.Controles._PainelSlider(
	                    document.getElementById('painelTwitter_centro'),
	                    document.getElementById('painelTwitter_subir'),
	                    document.getElementById('painelTwitter_decer'),
	                    'v',
	                    100,
	                    true,
	                    'btNotDis');

	        this._painelTwitter.ini();
			
			this._painelDestaques = new GRAPHO.Controles._PainelSlideShow(true, true, true, 'selecionado');
			var _forms = GRAPHO.Util.elementosPorNome('div', 'feira_destaque');
	        var _botoes = GRAPHO.Util.elementosPorNome('a', 'feira_destaque_bt');

	        for (i = 0; i < _forms.length; i++) {
	            this._painelDestaques.addSlide(_forms[i], _botoes[i]);
	        }

	        this._painelDestaques.ini();
	    }
};
