<?php
/***************************************************
Desciption: include geral das áreas genéricas
File: /bsk/includes/innit.php
Project: Basikus.Net
Developers: João Vieira	
Start Date: 2009/11/26
***************************************************/

if (isset($_SERVER['QUERY_STRING'])) {
    $dBToDo = explode("/", $_SERVER['QUERY_STRING']);
    $dBToDo[0] = (int) $dBToDo[0];
    if (!isset($dBToDo[1])) $dBToDo[1] = "";
    $dBToDo[1] = addslashes($dBToDo[1]);
    if (!isset($dBToDo[2])) $dBToDo[2] = "";    
}

//campos BD a usar localmente
$erro                   = false;
$fieldId                = 0;
$fieldDataIn            = '';
$fieldDataOut           = '';
$fieldCategoria         = 0;
$fieldNome              = '';
$fieldTexto             = '';
$fieldDestaque          = 'NAO';
$fieldEstado            = 'NAO';
$fieldProtegido         = 'NAO';
$fieldMtitle            = '';
$fieldMkeywords         = '';
$fieldMdescription      = '';
$fieldMurl		= '';
$metaJSinTexto          = '';
$jsValidacoesRules      = '';
$jsValidacoesMessages   = '';

/* tratamento de form comin' */

if (isset($_POST['btProcessar'])) {
    
    #id
    $_POST['bxId']  = (int) $_POST['bxId'];
    
    #datain
    $fieldDataIn    = $_POST['bxDataIn'];
    
    #dataout
    $fieldDataOut   = $_POST['bxDataOut'];
    
    #categoria
    $fieldCategoria = (int)$_POST['bxCategoria'];
    if ( (int)$fieldCategoria < 1 ) $erro = true;
    
    #estado
    if (!isset($_POST['bxEstado'])) $_POST['bxEstado'] = "";
    $fieldEstado    = $_POST['bxEstado'];
    if ( $_POST['bxEstado'] == "" ) $fieldEstado = 'NAO';
    else $fieldEstado = 'SIM';
    
    #destaque
    if (!isset($_POST['bxDestaque'])) $_POST['bxDestaque'] = "";
    $fieldDestaque = $_POST['bxDestaque'];    
    if ( $_POST['bxDestaque'] == "" ) $fieldDestaque = 'NAO';
    else $fieldDestaque = 'SIM';

    #protegido
    if (!isset($_POST['bxProtegido'])) $_POST['bxProtegido'] = "";
    $fieldProtegido = $_POST['bxProtegido'];    
    if ( $_POST['bxProtegido'] == "" ) $fieldProtegido = 'NAO';
    else $fieldProtegido = 'SIM';
    
    #nome
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxNome' . $arrLinguas[$i][0]]);
        if ( strlen($var1) > 0 ) { 
            $fieldNome .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; 
        }else $erro = true;
    }	
    
    #descricao
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxTexto' . $arrLinguas[$i][0]]);
        if ( strlen($var1) > 0 ) { 
            $fieldTexto .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; 
        }else $erro = true;
    }	
    
    #metaTitle
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxMtitle' . $arrLinguas[$i][0]]);
        if ($var1) { 
            $fieldMtitle .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; }
    }	
    #metaKeywords
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxMkeywords' . $arrLinguas[$i][0]]);
        if ($var1) { 
            $fieldMkeywords .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; }
    }	
    #metaDescription
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxMdescription' . $arrLinguas[$i][0]]);
        if ($var1) { 
            $fieldMdescription .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; }
    }
    #metaUrl
    for ($i = 0; $i < count($arrLinguas); $i++) {
        $var1 = stripslashes($_POST['bxMurl' . $arrLinguas[$i][0]]);
        if ($var1) {
            $fieldMurl .= "[" . $arrLinguas[$i][0] . "]" . ereg_replace("<br />", "", $var1) . "[/" . $arrLinguas[$i][0] . "]\n"; }
    }	    
    
    if ( $_POST['bxId'] > 0 && !($erro) ) { # ou altera
        $sqlStmt = "UPDATE conteudos 
                SET 
                categorias_id = '" . $fieldCategoria . "',
                titulo = '" . safe($fieldNome) . "',
                texto = '" . safe($fieldTexto) . "',
                dataentrada = '" . safe($fieldDataIn) . "',     
                datasaida = '" . safe($fieldDataOut) . "',
                metatitle = '" . safe($fieldMtitle) . "',
                metakeywords = '" . safe($fieldMkeywords) . "',
                metadescription = '" . safe($fieldMdescription) . "',
		metaurl = '" . safe($fieldMurl) . "',
                estado = '" . safe($fieldEstado) . "',
                destaque = '" . safe($fieldDestaque) . "',
                protegido = '" . safe($fieldProtegido) . "'
                WHERE id = '" . $_POST['bxId'] . "'";
        $fieldId    = $_POST['bxId'];
        $resultDb   = $connectDb->pedido($sqlStmt);
        $fieldId    = 0;
    }elseif ( !$erro ) { # ou insere
    
        $sqlStmt = "INSERT INTO conteudos (
                            categorias_id, 
                            titulo, 
                            texto, 
                            dataentrada, 
                            datasaida, 
                            metatitle, 
                            metakeywords, 
                            metadescription,
			    metaurl,
                            estado, 
                            destaque,
                            protegido
                    ) 
                    VALUES (
                            '" . $fieldCategoria . "', 
                            '" . safe($fieldNome) . "', 
                            '" . safe($fieldTexto) . "', 
                            '" . safe($fieldDataIn) . "', 
                            '" . safe($fieldDataOut) . "', 
                            '" . safe($fieldMtitle) . "', 
                            '" . safe($fieldMkeywords) . "', 
                            '" . safe($fieldMdescription) . "',
			    '" . safe($fieldMurl) . "',
                            '" . $fieldEstado . "', 
                            '" . $fieldDestaque . "',
                            '" . $fieldProtegido . "'
                    )";
        $resultDb       = $connectDb->pedido($sqlStmt);
        #$fieldId        = $connectDb->registosUltimo();
    }


}

/* /tratamento de form comin' */

/* busca de conteudo a gerir */
if ($dBToDo[1] == 'alterar') {
    $sqlStmt = "SELECT 
		categorias_id, 
		titulo, 
		texto, 
		dataentrada, 
		datasaida, 
		metatitle, 
		metakeywords, 
		metadescription,
		metaurl, 
		estado, 
		destaque,
		protegido
            FROM conteudos
            WHERE id = '" . $dBToDo[0] . "'";
#dbg($sqlStmt);                
    $resultDb       = $connectDb->pedido($sqlStmt);
    if ( $rowResultDb = $resultDb->fetch(PDO::FETCH_ASSOC) ) {
        $fieldId            = $dBToDo[0];
        $fieldCategoria     = $rowResultDb['categorias_id'];
        $fieldDataIn        = $rowResultDb['dataentrada'];
        $fieldDataOut       = $rowResultDb['datasaida'];
        $fieldDestaque      = $rowResultDb['destaque'];
        $fieldEstado        = $rowResultDb['estado'];
        $fieldProtegido     = $rowResultDb['protegido'];
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldNome" . $arrLinguas[$i][0]} = trd($rowResultDb['titulo'], $arrLinguas[$i][0]);
        }
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldTexto" . $arrLinguas[$i][0]} = trd($rowResultDb['texto'], $arrLinguas[$i][0]);
        }
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldMtitle" . $arrLinguas[$i][0]} = trd($rowResultDb['metatitle'], $arrLinguas[$i][0]);
        }
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldMkeywords" . $arrLinguas[$i][0]} = trd($rowResultDb['metakeywords'], $arrLinguas[$i][0]);
        }
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldMdescription" . $arrLinguas[$i][0]} = trd($rowResultDb['metadescription'], $arrLinguas[$i][0]);
        }
        for ($i = 0; $i < count($arrLinguas); $i++){
            ${"fieldMurl" . $arrLinguas[$i][0]} = trd($rowResultDb['metaurl'], $arrLinguas[$i][0]);
        }
    }else exit();
}
/* /busca de conteudo a gerir */

for ($i = 0; $i < count($arrLinguas); $i++){
    $jsValidacoesRules      .= "\n bxNome" . $arrLinguas[$i][0] . ": {required: true, minlength: 4},";
    //$jsValidacoesRules      .= "\n bxTexto" . $arrLinguas[$i][0] . ": {required: true},";
    $jsValidacoesMessages   .= "\n bxNome" . $arrLinguas[$i][0] . ": {required: \"" . $bngCampoInvalido . "\",minlength: jQuery.format(\"" . $bngCampoMinimode . " {0} " . $bngCcaracteres . "\")},";
    //$jsValidacoesMessages   .= "\n bxTexto" . $arrLinguas[$i][0] . ": {required: \"" . $bngCampoInvalido . "\"},";
    $metaJSinTexto  .= '\'cbxTexto' . $arrLinguas[$i][0] . '\',';
}
$metaJSinTexto          = substr($metaJSinTexto, 0, strlen($metaJSinTexto)-1);
$jsValidacoesRules      = substr($jsValidacoesRules, 0, strlen($jsValidacoesRules)-1);
$jsValidacoesMessages   = substr($jsValidacoesMessages, 0, strlen($jsValidacoesMessages)-1);

$metaTitle  = $ondeTouTi;
$metaJS     = '	jQuery(document).ready(function(){ 
	    
	$("#formConteudos").validate({
	    rules: {
		bxCategoria: {required: true},
		bxDataIn: {required: true},
		bxDataOut: {required: true},
		' . $jsValidacoesRules . '
	    },
	    messages: {
		bxCategoria: {required: "' . $bngTemEscolherOpcao . '"},
		bxDataIn: {required: "' . $bngCampoInvalido . '"},
		bxDataOut: {required: "' . $bngCampoInvalido . '"},
		' . $jsValidacoesMessages . '
	    },
	    errorPlacement: function(error, element) {
	        var errEl = \'#erR\' + element.attr("name");
                $(errEl).css({\'color\' : \'red\', \'width\' : \'520px\', \'padding-left\' : \'10px\'});
	        error.appendTo(errEl);
	    },
	    submitHandler: function(form) {
		form.submit();
	    },
	    success: function(label) {
		//label.html("&nbsp;").addClass("checked");
	    }
	});
	    
	    var lastsel;	
	    jQuery("#listaG").jqGrid({
		url:\'/bsk/artigos/registos/lista/?xuta=' . $ondeId . '\',
		height: 130,
		datatype: \'json\',
		mtype: \'GET\',    
		colNames:[\'' . $bngData . '\',\'' . $bngNome . '\',\'' . $bngCategoria . '\',\'' . $bngActivo . '\',\'' . $bngDestaque . '\'],
		colModel :[ 
		{name:\'eddata\', index:\'eddata\', width:100, align:\'center\', editable: false, edittype:"text", formatter: \'showlink\',  formatoptions: {baseLinkUrl: \'/bsk/artigos/\', showAction: \'\', addParam:\'\'}}, 
		{name:\'ednome\', index:\'ednome\', width:280, align:\'left\', editable: false, edittype:"text"},
		{name:\'edcategoria\', index:\'edcategoria\', width:180, align:\'center\', editable: false, edittype:"text"},
		{name:\'edactivo\', index:\'edactivo\', width:80, align:\'center\', sortable:false, editable: true, edittype:"select", editoptions:{value:"XX:' . $bngAmbos . ';NAO:' . $bngNao . ';SIM:' . $bngSim . '"}},
		{name:\'eddestaque\', index:\'eddestaque\', width:100, align:\'center\', sortable:false, editable: true, edittype:"select", editoptions:{value:"XX:' . $bngAmbos . ';NAO:' . $bngNao . ';SIM:' . $bngSim . '"}}
		],
		rowNum:100,
		rowList:[100,200,400],
		pager: jQuery(\'#listaP\'),
		sortname: \'edid\',
		sortorder: "desc",
		toolbar : [true,"top"],
		onSelectRow: function(id){ 
		    if(id && id!==lastsel){ 
			jQuery(\'#listaG\').restoreRow(lastsel); 
			jQuery(\'#listaG\').editRow(id,true); 
			lastsel=id; 
		    } 
		},
		editurl: "/bsk/artigos/registos/editar/?' . md5($pwdWord . Date('Ymd')) . '",
		viewrecords: true,
		caption: \'' . $bngListaRegistos . ' ' . $ondeTouTi . '\',
		loadError : function(xhr,st,err) { 
		    jQuery("#listaErr").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText); 
		}
		
	    }); 
	    jQuery("#t_listaG").height(25).hide().filterGrid("listaG",{gridModel:true,gridToolbar:true});
	    jQuery("#listaG").navGrid(\'#listaP\',{edit:false,add:false,del:true,search:false,refresh:true});
	    jQuery("#listaG").navButtonAdd("#listaP",{caption:"' . $bngPesquisar . '",title:"' . $bngPesquisa . '\'", 
	       onClickButton:function(){ 
		    if(jQuery("#t_listaG").css("display")=="none") { 
			jQuery("#t_listaG").css("display",""); 
		    }else { 
			jQuery("#t_listaG").css("display","none"); 
		    } 
		} 
	    });
	    
	    function pickdates(id){ 
		jQuery("#" + id + "_udia","#listaG").datepicker({dateFormat:"yy-mm-dd"}); 
	    } 
	   
	    $.datepicker.regional["pt"] = {clearText: "Limpar", clearStatus: "Apagar a data corrente",
		    closeText: "Fechar", closeStatus: "Fechar sem alterar",
		    prevText: "<Ant", prevStatus: "Mostrar mês anterior",
		    nextText: "Dep>", nextStatus: "Mostrar mês seguinte",
		    currentText: "Hoje", currentStatus: "Mostrar mês corrente",
		    monthNames: ["Janeiro","Fevereiro","Março","Abril","Maio","Junho",
		    "Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],
		    monthNamesShort: ["Jan","Fev","Mar","Abr","Mai","Jun",
		    "Jul","Ago","Set","Out","Nov","Dez"],
		    monthStatus: "Mostrar mês diferente", yearStatus: "Mostrar ano diferente",
		    weekHeader: "Sm", weekStatus: "Semana do ano",
		    dayNames: ["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],
		    dayNamesShort: ["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],
		    dayNamesMin: ["Do","Se","Te","Qa","Qi","Se","Sa"],
		    dayStatus: "Usar DD como primeiro dia da semana", dateStatus: "Escolher DD, MM d",
		    dateFormat: "yy-mm-dd", firstDay: 0, 
		    initStatus: "Escolher data", isRTL: false};
	    $.datepicker.setDefaults($.datepicker.regional["pt"]);
	   
	   $("#cbxDataIn").datepicker({dateFormat:"yy-mm-dd"});
	   $("#cbxDataOut").datepicker({dateFormat:"yy-mm-dd"});

	});//jquery function start
	
        xinha_editors = xinha_editors ? xinha_editors :
        [
            ' . $metaJSinTexto . '
        ]; 
        Xinha.startEditors(xinha_editors);



	';

include($_SERVER['DOCUMENT_ROOT'] . '/bsk/includes/md.topo.php');

$sqlStmtTmp = '';
if ( $ondeId > 0 ) {
    $camRes = new BD_Categorias($connectDb);
    $camRes->CaminhoSubs($ondeId);
    $strIds = implode(",", $camRes->resSubs);
    $sqlStmtTmp .= " OR (categorias.id IN (" . $strIds . ")  )";
}
$dbListCategorias = New DB_List($connectDb);
$dbListCategorias->designList['name']    =   "bxCategoria";
$dbListCategorias->designList['css']    =   "element select medium";
$dbListCategorias->sqlStmt("SELECT id, pai, nome FROM categorias WHERE id = " . $ondeId . " " . $sqlStmtTmp);
$dbListCategorias->showLikeTree(True);
$dbListCategorias->recordSelected($fieldCategoria);

if ( strlen($fieldDataIn) < 10 ) $fieldDataIn   = date('Y-m-d');
if ( strlen($fieldDataOut) < 10 ) $fieldDataOut = "2100" . date('-m-d');

?>
	<div id="middle">
		
	    <div id="center-column">
		    <div class="top-bar">
			    <h1><?php print $ondeTouTi;?></h1>
			    <div class="breadcrumbs"><a href="/bsk/"><?php print $bngInicial;?></a> / <a href="/bsk/<?php print $ondeTou;?>/"><b>+</b><?php print $bngInserir;?>&nbsp;<?php print $ondeTouTi;?></a></div>
		    </div>
		    <br />
		<div class="select-bar">
		&nbsp;
		</div>
	    <!-- tabela -->
	    <table id="listaG" class="scroll"></table> 
	    <div id="listaP" class="scroll" style="text-align:center;"></div> 
	    <span id="listaErr" style="color:red"></span>  
	    <!-- /tabela -->
	<a name="formPos"></a> 
	<!-- form -->

	<div id="form_container" >
	   
	    <form id="formConteudos" class="appnitro"  method="post" action="">
		<ul >				
		    <li id="liDataIn" >
			<label class="description" for="cbxDataIn"><?php print $bngDataInicio;?> </label>
			<span>
			    <input id="cbxDataIn" name="bxDataIn" class="element text" size="12" maxlength="10" value="<?php print $fieldDataIn;?>" type="text"/>
			</span>
		    </li>		
		    <li id="liDataOut" >
			<label class="description" for="cbxDataOut"><?php print $bngDataFim;?> </label>
			<span>
			    <input id="cbxDataOut" name="bxDataOut" class="element text" size="12" maxlength="10" value="<?php print $fieldDataOut;?>" type="text"/>
			</span>
		    </li>		
		<li id="liCategoria" >
		<label class="description" for="cbxCategoria"><?php print $bngCategoria;?> </label>
        
		<div>
		  <?php $dbListCategorias->Make();    ?>
		</div> <span id="erRbxCategoria"></span>
		</li>		
		
		
		</ul>

		<div id="tabs" style="margin-top:10px;width:100%;"><!-- main div tabs -->
		
<?php			
	for ($i = 0; $i < count($arrLinguas); $i++){
	   if ( !isset(${"fieldNome" . $arrLinguas[$i][0]}) ) ${"fieldNome" . $arrLinguas[$i][0]} = '';
	   if ( !isset(${"fieldTexto" . $arrLinguas[$i][0]}) ) ${"fieldTexto" . $arrLinguas[$i][0]} = '';
	   if ( !isset(${"fieldMtitle" . $arrLinguas[$i][0]}) ) ${"fieldMtitle" . $arrLinguas[$i][0]} = '';
	   if ( !isset(${"fieldMkeywords" . $arrLinguas[$i][0]}) ) ${"fieldMkeywords" . $arrLinguas[$i][0]} = '';
	   if ( !isset(${"fieldMdescription" . $arrLinguas[$i][0]}) ) ${"fieldMdescription" . $arrLinguas[$i][0]} = '';
	   if ( !isset(${"fieldMurl" . $arrLinguas[$i][0]}) ) ${"fieldMurl" . $arrLinguas[$i][0]} = '';
?>		
                <div id="tabs-<?php print $arrLinguas[$i][0];?>" style="margin-bottom:10px;"><!-- div tab -->
                <ul>
                
		    <li id="liNome<?php print $arrLinguas[$i][0];?>" >
		    <label class="description" for="cbxNome<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;<?php print $bngTitulo;?></label>     
		    <div>
		    <input id="cbxNome<?php print $arrLinguas[$i][0];?>" name="bxNome<?php print $arrLinguas[$i][0];?>" class="element text medium" type="text" maxlength="80" value="<?php print (${"fieldNome" . $arrLinguas[$i][0]});?>"/> 
		    </div> <span id="erRbxNome<?php print $arrLinguas[$i][0];?>"  ></span>
		    </li>	
			
		    <li id="liTexto<?php print $arrLinguas[$i][0];?>" >		    		    
		    <label id="lblTexto<?php print $arrLinguas[$i][0];?>" class="description" for="cbxTexto<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;<?php print $bngTexto;?></label>
		    <div id="erRbxTexto<?php print $arrLinguas[$i][0];?>"></div>
		    <div>
		    <textarea class="blue" id="cbxTexto<?php print $arrLinguas[$i][0];?>" name="bxTexto<?php print $arrLinguas[$i][0];?>" rows="10" cols="50" style="margin:0px;padding:0px;width: 100%"><?php print htmlspecialchars(${"fieldTexto" . $arrLinguas[$i][0]});?></textarea> 
		    </div>		    
		    </li>
			
		    <li id="liMtitle<?php print $arrLinguas[$i][0];?>" >
		    <label class="description" for="cbxMtitle<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;Meta Title</label>
		    <div>
			    <input id="cbxMtitle<?php print $arrLinguas[$i][0];?>" name="bxMtitle<?php print $arrLinguas[$i][0];?>" class="element text medium" type="text" maxlength="255" value="<?php print (${"fieldMtitle" . $arrLinguas[$i][0]});?>"/> 
		    </div> 
		    </li>		
		    
		    <li id="liMkeywords<?php print $arrLinguas[$i][0];?>" >
		    <label class="description" for="cbxMkeywords<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;Meta Keywords</label>
		    <div>
			    <input id="cbxMkeywords<?php print $arrLinguas[$i][0];?>" name="bxMkeywords<?php print $arrLinguas[$i][0];?>" class="element text medium" type="text" maxlength="255" value="<?php print (${"fieldMkeywords" . $arrLinguas[$i][0]});?>"/> 
		    </div> 
		    </li>		
			
		    <li id="liMdescription" >
		    <label class="description" for="cbxMdescription<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;Meta description </label>
		    <div>
			<textarea id="cbxMdescription<?php print $arrLinguas[$i][0];?>" name="bxMdescription<?php print $arrLinguas[$i][0];?>" class="element textarea smaller"><?php print (${"fieldMdescription" . $arrLinguas[$i][0]});?></textarea> 
		    </div> 
		    </li>

		    <li id="liMurl" >
		    <label class="description" for="cbxMurl<?php print $arrLinguas[$i][0];?>"><img src="/bsk/media/img/icon.bandeira.<?php print $arrLinguas[$i][0];?>.png" align="left" border="0"/>&nbsp;URL </label>
		    <div>
			<input id="cbxMurl<?php print $arrLinguas[$i][0];?>" name="bxMurl<?php print $arrLinguas[$i][0];?>" class="element text medium" type="text" maxlength="255" value="<?php print (${"fieldMurl" . $arrLinguas[$i][0]});?>"/>
		    </div>
		    </li>
			
		</ul>
		</div><!-- div tab -->
<?php
	}
?> 		
                </div><!-- /main div tabs -->
                <ul>
                

				
		<li id="liAccoes" >
		<label class="description" for="nenhum"><?php print $bngAccoes;?> </label>
		<span>
		    <input id="cbxDestaque" name="bxDestaque" class="element checkbox" type="checkbox"
		        <?php 
			if ($fieldDestaque=='SIM') { 
			     print "checked"; 
			}
			?>
		     value="SIM" />
		    <label class="choice" for="cbxDestaque"><?php print $bngDestaque;?></label>
		    <input id="cbxEstado" name="bxEstado" class="element checkbox" type="checkbox" 
		        <?php 
			if ($fieldEstado=='SIM') { 
			     print "checked"; 
			}
			?>
		    value="SIM"/>
		    <label class="choice" for="cbxEstado"><?php print $bngActivo;?></label>
		    <input id="cbxProtegido" name="bxProtegido" class="element checkbox" type="checkbox" 
		        <?php 
			if ($fieldProtegido=='SIM') { 
			     print "checked"; 
			}
			?>
		    value="SIM"/>
		   <label class="choice" for="cbxProtegido"><?php print $bngProtegido;?></label>
		</span> 
		</li>
			
		<li class="buttons">
		    <input type="hidden" id="cbxId" name="bxId" value="<?php print $fieldId;?>" />
		    <input type="hidden" id="cbtProcessar" name="btProcessar" value="<?php print $bngProcessar;?>" />
		    <input id="cbtProcessarB" class="button_text" type="submit" name="btProcessarB" value="<?php print $bngProcessar;?>" />
		</li>
		</ul>
		</form>	
	</div>

	<!-- /form -->
	    
	    
	    
	    </div>

<?php include( $_SERVER['DOCUMENT_ROOT'] . "/bsk/includes/md.direita.php" );?>
	
	</div>