<?php if(theme_get_option('footer','footer') || theme_get_option('footer','sub_footer')):?>
<?php
$footer_style = '';
if(is_home()){
	$footer_style = ' style="';
	$footer_color = theme_get_option('blog','footer_background_color');
	$footer_color = empty($footer_color) ? '' : 'background-color:'.$footer_color.';';
	$footer_style .= $footer_color;
	if(theme_get_option('blog','custom_background') == 'true'){
		$footer_image = theme_get_option('blog','footer_image');
		if(!empty($footer_image)){
			$footer_image = theme_parse_image($footer_image,null,true);
			$footer_image = empty($footer_image) ? 'background-image:none;' : 'background-image:url('.$footer_image['media'].');';
		}else{
			$footer_image ='background-image:none;';
		}
		$footer_position = theme_get_option('blog','footer_position');
		$footer_position = empty($footer_position) ? '':'background-position:'.$footer_position.';';
		$footer_repeat = theme_get_option('blog','footer_repeat');
		$footer_repeat = empty($footer_repeat) ? '':'background-repeat:'.$footer_repeat.';';
		$footer_style .= $footer_image.$footer_position.$footer_repeat;
	}
	$footer_style .= '"';
}else{
	global $post;
	$id = $post->ID;
	$footer_style = ' style="';
	$footer_color = get_post_meta($id,'_footer_background_color',true);
	$footer_color = empty($footer_color) ? '' : 'background-color:'.$footer_color.';';
	$footer_style .= $footer_color;
	if(get_post_meta($id,'_custom_background',true) == 'true'){
		$footer_image = get_post_meta($id,'_footer_image',true);
		if(!empty($footer_image)){
			$footer_image = theme_parse_image($footer_image,null,true);
			$footer_image = empty($footer_image) ? 'background-image:none;' : 'background-image:url('.$footer_image['media'].');';
		}else{
			$footer_image ='background-image:none;';
		}
		$footer_position = get_post_meta($id,'_footer_position',true);
		$footer_position = empty($footer_position) ? '':'background-position:'.$footer_position.';';
		$footer_repeat = get_post_meta($id,'_footer_repeat',true);
		$footer_repeat = empty($footer_repeat) ? '':'background-repeat:'.$footer_repeat.';';
		$footer_style .= $footer_image.$footer_position.$footer_repeat;
	}
	$footer_style .= '"';
}
if(theme_get_option('footer','stricky_footer')){
	echo '<div><div>';
}
?>
<footer id="footer" <?php echo $footer_style;?>>
<?php if(theme_get_option('footer','footer')):?>
<div id="footer-link-columns">
<div class="light-span">
<div id="footer-overlay">
	<div class="wrap-center">
<?php
$footer_column = theme_get_option('footer','column');
if(is_numeric($footer_column)):
	switch ( $footer_column ):
		case 1:
			$class = '';
			break;
		case 2:
			$class = 'one_half';
			break;
		case 3:
			$class = 'one_third';
			break;
		case 4:
			$class = 'one_fourth';
			break;
		case 5:
			$class = 'one_fifth';
			break;
		case 6:
			$class = 'one_sixth';
			break;
	endswitch;
	for( $i=1; $i<=$footer_column; $i++ ):
		if($i == $footer_column):
?>
			<div class="<?php echo $class; ?> last"><?php theme_generator('footer_sidebar'); ?></div>
<?php else:?>
			<div class="<?php echo $class; ?>"><?php theme_generator('footer_sidebar'); ?></div>
<?php endif;		
	endfor;
else:
	switch($footer_column):
		case 'third_sub_third':
?>
		<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
		<div class="two_third last">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
		case 'sub_third_third':
?>
		<div class="two_third">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
<?php
			break;
		case 'third_sub_fourth':
?>
		<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
		<div class="two_third last">
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
		case 'sub_fourth_third':
?>
		<div class="two_third">
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_fourth last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
<?php
			break;
		case 'half_sub_half':
?>
		<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
		<div class="one_half last">
			<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
		case 'half_sub_third':
?>
		<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
		<div class="one_half last">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
		case 'sub_half_half':
?>
		<div class="one_half">
			<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
<?php
			break;
		case 'sub_third_half':
?>
		<div class="one_half">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
<?php
			break;
		case 'sub_third_sub_half':
?>
		<div class="one_half">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_half last">
			<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
		case 'sub_half_sub_third':
?>
		<div class="one_half">
			<div class="one_half"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_half last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
		<div class="one_half last">
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third"><?php theme_generator('footer_sidebar'); ?></div>
			<div class="one_third last"><?php theme_generator('footer_sidebar'); ?></div>
		</div>
<?php
			break;
	endswitch;
endif;
?>
	
		   <div class="clear"></div>
	 </div>
	 </div>
</div>
<?php endif;?>
<?php if(theme_get_option('footer','sub_footer')):?>
<div id="footer-bottom">
	<div class="wrap-center">
<?php
$footer_right_area_type = theme_get_option('footer','footer_right_area_type');
if($footer_right_area_type == 'default'){
	echo '<div class="aligncenter copy"><center>';
	echo wpml_t(THEME_NAME, 'Copyright Footer Text',stripslashes(theme_get_option('footer','copyright')));
	echo '</center></div>';
}
else{
	echo '<div class="alignleft copy">';
	echo wpml_t(THEME_NAME, 'Copyright Footer Text',stripslashes(theme_get_option('footer','copyright')));
	echo '</div>';
}

	echo '<div class="alignright">';
	switch($footer_right_area_type){
	case 'html':
			echo do_shortcode(wpml_t(THEME_NAME, 'Footer Right Area Html Code',stripslashes( theme_get_option('footer','footer_right_area_html') )));
			break;
	case 'menu':
			wp_nav_menu(array( 
				'theme_location' 	=> 'footer-menu',
				'container' 		=> 'nav',
				'menu_id'			=> 'secnav',
				'container_id' 		=> 'bar-menu',
				'fallback_cb' 		=> '',
				'depth'			=> 1,		
				));
				break;
	case 'widget':
		echo '<div id="footer_right_area">';
		dynamic_sidebar(__('Sub Footer Widget Area',THEME_ADMIN_DOMAIN));
		echo '</div>';
		break;
	}
	echo '</div>';
?>
</div>
</div>
</div>
<?php endif;?>
</footer>
<?php endif; ?>
<?php
	if(theme_get_option('footer','stricky_footer')){
		echo '</div></div>';
	}
?>
<?php 
	if(theme_get_option('cufon','enable_cufon')){
		theme_add_cufon_code_footer();
	}
	wp_footer();
	if(theme_get_option('custom','analytics') && theme_get_option('custom','analytics_position')=='bottom'){
		echo '<script type="text/javascript">'.stripslashes(theme_get_option('custom','analytics')).'</script>';
	}
?>
<?php
	if(theme_get_option('custom','custom_js') && theme_get_option('custom','custom_js_position')=='bottom'){
		echo stripslashes(theme_get_option('custom','custom_js'));
	}
?>
<?php $boxed = theme_get_option('general','boxed_layout');
if($boxed =='true'):?>
</div>
<?php endif;?>
</body>
</html>
