<?php 
class OCMX_mobile_Container
	{
		public function load_container($section_header, $ocmx_tabs = 0, $submit_text = "Save Changes", $note = "") {
			global $mobile_theme_options, $selected_tab, $changes_done, $ocmx_version;
			 if(isset($_GET["current_tab"])) :
				$selected_tab = $_GET["current_tab"];
			else :
				$selected_tab = 1;
			endif; ?>
			<link href="<?php echo OCMXMOBILEURL; ?>/admin/style.css" rel="stylesheet" type="text/css" />
            <form action="<?php echo esc_html( $_SERVER['REQUEST_URI'] ) ?>" name="ocmx-options" <?php if($_GET["page"] != "ocmx-gallery") : ?>id="ocmx-options"<?php endif; ?> method="post" enctype="multipart/form-data">
                <div class="ocmx-container">
                    <div class="wrap">
                        <h2>
                        	Obox Mobile
                            <span>
                            	Version <?php echo OCMXMOBILE_VER; ?> (<a href="http://www.obox-design.com/hotfixes.cfm?theme=<?php echo OCMXMOBILEID; ?>&plugin_direct=1">See what's new</a>)
                            </span>
						</h2>
                        
						<?php if(isset($_GET["changes_done"]) || $changes_done) : ?>
                            <div class="updated below-h2" id="ocmx-note"><p><?php _e("Your changes were successful.") ?></p></div>
                        <?php elseif(isset($_GET["options_reset"])) : ?>
                            <div class="updated below-h2" id="ocmx-note"><p><?php _e("These Options Have Been Reset.") ?></p></div>
                        <?php endif; ?>
                        
                        <!-- All the form buttons go here -->
                        <div id="header-block" class="clearfix">
    						<?php if($submit_text != "") :?>
	                            <input type="submit" class="button-primary" value="<?php _e($submit_text); ?>" />
								<?php if($_GET["page"] != "ocmx-gallery") : ?>
                                    <input type="button" id="ocmx-reset" class="button-primary" value="<?php _e("Reset"); ?>" />
                                <?php endif; ?>
                            <?php endif; ?>
                        
                            <!-- OCMX Tabs -->
                            <?php if(count($ocmx_tabs) >= 1) : 
                                $tab_i = 1;
                                foreach($ocmx_tabs as $tab => $taboption) : 
                                    if($taboption["top_button"] != null) :?>
                                        <div <?php if($selected_tab != $tab_i):?>style="display: none;"<?php endif; ?> id="tab-<?php echo $tab_i; ?>-href">
                                            <a href="<?php echo $taboption["top_button"]["href"]; ?>" id="<?php echo $taboption["top_button"]["id"]; ?>" rel="<?php echo $taboption["top_button"]["rel"]; ?>" class="button-primary"><?php _e($taboption["top_button"]["html"]); ?></a>                                            
                                        </div>
                                <?php endif;
                                    $tab_i++;
                                endforeach;
                            endif; ?>
                            <h3><?php echo $section_header; ?></h3>
                        </div>
                        
                        <!-- OCMX Tabs -->
                        <?php if(count($ocmx_tabs) > 1) : ?>
                            <?php $tab_i = 1; ?>
                            <div id="info-content-block">
                                <ul id="tabs" class="tabs clearfix">
                                    <?php foreach($ocmx_tabs as $tab) : ?>
                                        <li <?php if($selected_tab == $tab_i) : ?>class="selected" <?php endif; ?>>
                                            <a href="#" rel="#tab-<?php echo $tab_i; ?>"><?php echo $tab["option_header"]; ?></a>
                                        </li>
                                        <?php $tab_i++; ?>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                        <?php endif; ?>
                        
                        <!-- OCMX Form Content -->
                        <?php $tab_i = 1; ?>
                        <div id="content-block">
                        
							<?php if($note != "") : ?>
                                <p class="admin-note"><?php echo $note; ?></p>
                            <?php endif; ?>
                            
                            <?php foreach($ocmx_tabs as $tab => $taboption) : ?>
                                <ul class="<?php echo $taboption["ul_class"]; ?>" <?php if($selected_tab != $tab_i):?>style="display: none;"<?php endif; ?> id="tab-<?php echo $tab_i; ?>">
									<?php $use_options = $taboption["function_args"];
									if($mobile_theme_options[$use_options]) :
										foreach($mobile_theme_options[$use_options] as $use_theme_options => $which_array) :
											do_action($taboption["use_function"], $which_array);
										endforeach; 
									else :
										do_action($taboption["use_function"], $which_array);
									endif;?>
                                </ul>  
                                <?php $tab_i++; ?>
                            <?php endforeach; ?>
                            
                            <!-- Second row of form buttons go here -->
                            <div class="base-controls clearfix">
                            	<?php if($submit_text != "") :?>
	                                <input type="submit" class="button-primary" value="<?php _e($submit_text); ?>" />    
									<?php if($_GET["page"] != "ocmx-gallery") : ?>
                                        <input type="button" id="ocmx-reset-1" class="button-primary" value="<?php _e("Reset"); ?>" />
                                    <?php endif; ?>                                
                                <?php endif; ?>
                            	<?php if(count($ocmx_tabs) >= 1) : 
									$tab_i = 1;
									foreach($ocmx_tabs as $tab => $taboption) : 
										if($taboption["base_button"] != null) :?>
                                            <div <?php if($selected_tab != $tab_i):?>style="display: none;"<?php endif; ?> id="tab-<?php echo $tab_i; ?>-href-1">
                                                <a href="<?php echo $taboption["base_button"]["href"]; ?>" id="<?php echo $taboption["base_button"]["id"]; ?>" rel="<?php echo $taboption["base_button"]["rel"]; ?>" class="button-primary"><?php _e($taboption["base_button"]["html"]); ?></a>
                                            </div>
                                  	<?php endif;
										$tab_i++;
									endforeach;
                                endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                <input type="hidden" name="update_ocmx" value="<?php foreach($ocmx_tabs as $tab) : echo $tab['function_args'].", "; endforeach; ?>1" />
            </form>
<?php 	} 
	} ?>