<?php
$this->load_template('_header.php');
$this->load_template('_top.php');
?>
<script type="text/javascript" src="<?php echo $C->SITE_URL?>themes/<?php echo $C->THEME ?>/js/js_dashboard.js"></script>
<div id="generalspace">
        
    <div id="container">
    
    	<div id="column1"><?php $this->load_template('_verticalmenu-dashboard.php'); ?></div>
        
        <div id="column2">

			<div id="dashboard2">
                
                <div id="listgroups">
                
                	<div class="boxdash">
                
                        <div class="title"><?php echo $this->lang('dashboard_groups_title')?></div>
                        
                        <div class="spaceinfo">
                        
                        	<?php $this->load_template('__dashboard-smenu-groups.php');?>
                            
                            <div class="mrg20T mrg30B">
                            
                                <div id="formadd" class="hide">                                
                                
									<div class="editarea">
                                    
                                    	<div class="subtitle"><?php echo $this->lang('dashboard_groups_txt_creategroup'); ?></div>
                    
			                            <div id="form01" class="mrg30B">
            			            		<form id="form1" name="form1" method="post" action="">
                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_namegroup')?>:</div>
                        					<div><input name="namegroup" type="text" id="namegroup" class="boxinput withbox"/></div>
                        
                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_urlgroup')?>:</div>
                        					<div><input name="urlgroup" type="text" id="urlgroup" class="boxinput withbox" /></div>

                        					<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_descriptiongroup')?>:</div>
                        					<div><textarea name="descriptiongroup" rows="4" class="boxinput withbox" id="descriptiongroup"></textarea></div>

											<div class="mrg10T grey1"><?php echo $this->lang('dashboard_groups_txt_privacy')?></div>
                                            <div><select name="privacygroup" id="privacygroup" class="boxinput withbox" onchange="loadDetails(this.value, '#msgprivacy');">
                                            	<option value="0"><?php echo $this->lang('dashboard_groups_txt_public')?></option>
                                            	<option value="1"><?php echo $this->lang('dashboard_groups_txt_closed')?></option>
                                            	<option value="2"><?php echo $this->lang('dashboard_groups_txt_secret')?></option>
                                            </select></div>
                                            <div id="msgprivacy" class="mrg5T"></div>

                                            <div id="msgerror" class="redbox"></div>
                                            <div class="mrg20T mrg5B">
                                                <span><input type="submit" name="bsave" id="bsave" value="<?php echo $this->lang('dashboard_groups_txt_buttonsave')?>" class="bblue hand"/></span> <span id="lcancelf" class="mrg20L onlyblue hand"><?php echo $this->lang('dashboard_groups_txt_bcancel'); ?></span>
                                            </div>
                      
					                      </form>
                                        </div>
                                
                                    </div>

                                
                                </div>
                                
                                <?php if (empty($D->htmlGroups)) { ?>
                                <div id="spacelink" class="mrg50T">
                                    <div class="txtsize00 centered">
                                        <div><?php echo $this->lang('dashboard_groups_txt_nogroups'); ?></div>
                                        <div class="mrg20T"><span id="linkadd" class="btn btn-blue"><?php echo $this->lang('dashboard_groups_txt_creategroup'); ?></span></div>
                                    </div>
                                </div>
                                <?php } else { ?>
                                
                                <div id="spacelink" class="tright"><span id="linkadd" class="btn btn-blue mrg10R"><?php echo $this->lang('dashboard_groups_txt_creategroup'); ?></span></div>
                                <div class="mrg10T"><?php echo $D->htmlGroups?></div>
                                
                                <?php } ?>                            
                            
								<script>
								function loadDetails(idmsg, divmsg) {
									idmsg = parseInt(idmsg);
									switch (idmsg) {
										case 0:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgpublic');?>');
											break;	
										case 1:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgclosed');?>');
											break;	
										case 2:
											$(divmsg).html('<?php echo $this->lang('dashboard_groups_txt_msgsecret');?>');
											break;
									}
								}
								
                                $('#linkadd').click(function(){
                                    $('#spacelink').slideUp('low',function(){
                                        $('#formadd').slideDown('low');
                                    });
                                })

                                $('#lcancelf').click(function(){
                                    $('#formadd').slideUp('low',function(){
                                        $('#spacelink').slideDown('low');
                                    });
                                })
                                
                                loadDetails(0, '#msgprivacy');
                                var txt_enter_name='<?php echo $this->lang('dashboard_groups_error_entername')?>';
                                var txt_enter_url='<?php echo $this->lang('dashboard_groups_error_enterurl')?>';
                                var txt_url_invalid='<?php echo $this->lang('dashboard_groups_error_urlnovalid')?>';
                                $('#bsave').click(function(){
                                    createGroup('#msgerror', '#bsave');
                                    return false;
                                });
    
                                </script>
                                
                            </div>
                        
                    	</div>
                
                	</div>
        
        		</div>
        
        	</div>
        
        </div>
        
        <div id="divseparator" class="sh"></div>
        
        <div id="column3"><?php $this->load_template('_accessories-dashboard.php'); ?></div>
        
        <div class="sh"></div>
    
    </div>
            
</div>    

<?php
$this->load_template('_foot.php');
$this->load_template('_footer.php');
?>