<?php /**
 * @author madars.bitenieks
 * @copyright 2011
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>><head>
<meta name="author" content="madars bitenieks" />
<meta name="language" content="english" />                     
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />


<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone'))
 {
  echo '<meta name="viewport" content="width=device-width, initial-scale=0.30, maximum-scale=1.0, user-scalable=yes"/> ';
}
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPad'))
 {
  echo '<meta name="viewport" content="width=device-width, initial-scale=0.7, maximum-scale=1.0, user-scalable=yes"/> ';
}
?>

<title><?php 
        global $page, $paged; wp_title( '', true, 'right' ); bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' );
        if ( $site_description && ( is_home() || is_front_page() ) )
        echo " | $site_description";
 ?></title>
<?php wp_head(); ?>
</head>
<body <?php if (is_page_template('contact-page.php') && get_option("of_contact_map")=="true"){ echo 'onload="initialize()"';} ?> <?php body_class(); ?>>
<?php 
$search_form .= '<!--SEARCH FORM --><div id="title-right"><form method="get" id="searchform" action="'. home_url(). '/">';
$search_form .= '<div id="search-icon"></div>';
$search_form .= '<input type="text" onfocus="if(this.value=='; 
$search_form .= "'". $d. "";
$search_form .= __('Search', 'madza_translate');  
$search_form .= "')this.value=''"; 
$search_form .= ';"'; 
$search_form .= ' onblur="if(this.value=='; 
$search_form .= "'')this.value='";
$search_form .= __("Search", "madza_translate");  
$search_form .= "'";
$search_form .= ';" value="';
$search_form .= __("Search", "madza_translate");  
$search_form .= '" name="s" id="s3" class="search_input3" /> ';
$search_form .= '<div id="searchsubmit_div_3"><input type="submit" id="searchsubmit3" value="" class="search_submit3"/> </div>';
$search_form .= '</form> <div class="clear"></div></div><!--END SEARCH FORM -->';

$title_key="madza_title_type"; 
$title=get_post_meta($post->ID, $title_key, true); 
$custom_key="madza_custom_text";
$custom_text=get_post_meta($post->ID, $custom_key, true);
$title_type_simple="Title only";
$title_type_custom="SubTitle only";
$title_type_simple_custom="Title & SubTitle text";
$key="madza_header_type"; 
$header=get_post_meta($post->ID, $key, true); 
$url="madza_header_url";
$img_url=get_post_meta($post->ID, $url, true);
$image_slider="Nivo Slider";
$image_url="Image from URL";
$anything_slider="Anything Slider";
$beeCodes_slider="beeCodes Slider";

if(get_option('slides')) {
	$slides = get_option('slides');
} else {
	$slides = false;	
}
?>
<div id="all-div">

<!-- ******************** HEAD START ******************** -->

<div id="texture">

<div id="head-layout">

    <!--TOP AREA --> 
    <div id="top-area">
            
             <!--TOP HEADER --> 
             <div id="header">
               
                <?php if (get_option('of_enable_logo_image')=="true" && get_option("of_logo_image")){?>
                
                    <div id="logo" <?php if ( get_option('of_logo_image') ) { ?> style="background:  no-repeat center left url(<?php { echo get_option('of_logo_image'); } }?>);">
                        
                         <a href="<?php echo home_url();?>"></a>
                    
                    </div><!--END LOGO IMG -->
                
                <?php } else {?>
                
                    <div id="logo"> <h1><a href="<?php echo home_url();?>"><?php echo bloginfo( 'name' ); ?></a></h1> </div><!--END LOGO TEXT -->
                
                <?php } ?>
                
                <div class="nav">  
                
                    <?php wp_nav_menu( array('theme_location'  => "header_menu", 'container' =>false, 'menu_class' => 'menu', 'menu_id' => 'menu','echo' => true,'before' => '','after' => '','link_before' => '','link_after' => '','depth' => 0,'walker' => new description_walker())); ?>
                
                </div><!--END MENU -->
      
                <div class="clear"></div>  
            
            </div><!--END HEADER -->  
       
    </div><!-- END TOP AREA --> 
    <?php
    
    
    
     
    ####################################################################################################################
    # HEADER SLIDER DEFAULT PAGE ---------------------------------------------------------------------------------------
    ####################################################################################################################
    if ($header==$image_slider or $header==$anything_slider or $header==$beeCodes_slider) { 
    
                    if ($header==$image_slider){ 
                        
                                    include (TEMPLATEPATH . '/includes/sliders/nivo-slider.php'); 
                    
                    }  else if($header==$anything_slider ) { 
                            
                                    include (TEMPLATEPATH . '/includes/sliders/anything-slider.php');  
                            
                    }  else if($header==$beeCodes_slider ) { 
                            
                                    include (TEMPLATEPATH . '/includes/sliders/beeCodes-slider.php');  
                            
                    } 
    
    }
    
    
    
    
    ####################################################################################################################
    # HEADER SLIDER FRONT PAGE -----------------------------------------------------------------------------------------
    ####################################################################################################################
    if (is_front_page()){
        
                    if (get_option("of_homepage_slider")=="homepage_nivo_slider"){
                    
                                    include (TEMPLATEPATH . '/includes/sliders/nivo-slider.php');      
                            
                    } else if(get_option("of_homepage_slider")=="homepage_anithing_slider") { 
                    
                                    include (TEMPLATEPATH . '/includes/sliders/anything-slider.php'); 
                        
                    }  else if(get_option("of_homepage_slider")=="homepage_beecodes_slider") { 
                        
                                    include (TEMPLATEPATH . '/includes/sliders/beeCodes-slider.php');  
                        
                    } 
            
    } 
    
    
    
    
    ####################################################################################################################
    # HEADER SLIDER OTHER ----------------------------------------------------------------------------------------------
    ####################################################################################################################
    if(is_page_template('contact-page.php') && get_option("of_contact_map")=="true") { ?>
            
                                    <div id="map_canvas" style="width:100%; height:<?php echo get_option("of_contact_map_height"); ?>px;"></div>
                        
                <?php } else if($header==$image_url) { ?>
                
                                    <div id="image-from-url" <?php if ($img_url=""){ } else {  ?> style="background-image: url(<?php echo get_post_meta($post->ID, $url, true);?>);<?php } ?> height:<?php echo get_option("of_image_from_url_height"); ?>px;"></div>
                
                <?php } else if(!(is_front_page())) { ?>
                
                                    <div id="header-midle-line"></div>
                
                <?php } ?>





<!-- ******************** TITLE START ******************** -->

<div id="title-layout">

    <?php if (get_option("of_homepage")=="true" && is_front_page()){ ?>
    
        <div class="title-frame-top">
        
            <?php if (get_option("of_homepage_tagline")=="true") { ?>
            
                <div id="header-title">
                
                    <div id="title-left-home"><h1><?php echo get_option("of_homepage_tagline_text"); ?></h1></div>
                    
                    <?php if (get_option("of_homepage_tagline_first_button_text") OR get_option("of_homepage_tagline_first_button_link") OR get_option("of_homepage_tagline_second_button_text") OR get_option("ofof_homepage_tagline_second_button_link")){ ?>
                        
                        <div id="title-left-buttons">
                            
                            <?php if(get_option("of_homepage_tagline_first_button_text") && get_option("of_homepage_tagline_first_button_link")){ ?>
                            
                                <a id="title-button" href="<?php echo get_option("of_homepage_tagline_first_button_link"); ?>"><?php echo get_option("of_homepage_tagline_first_button_text"); ?></a>    
                                
                            <?php } ?>
                            
                        </div>
                        
                    <?php } ?>
                    
                <div class="clear"></div>
                
                </div> 
                
              <?php } ?>
                
            </div>
    
    <?php } else if (is_page_template('portfolio-full-images.php') OR is_page_template('portfolio-small-images.php')) {  ?>
    
        <div class="title-frame-top">
        
            <div id="header-title">
            
               <div id="title-left-portfolio"><h1><?php the_title(); ?></h1></div>
               
               <?php $categorys = get_post_meta($post->ID, "madza_portfolio_cat", true);
               
               if($categorys=="Select..." OR $categorys=="All" OR $categorys=="" ){ ?>
               
                   <div id="title-right-portfolio">
                   
                   <?php $term_obj =  get_terms('portfolio_taxonomy',$args); ?>
                   
                      <ul id="filter">
                      
                            <li class="current"><a href="#"><?php _e( 'All', "madza_translate" ); ?></a></li>
                            
                            <?php foreach ($term_obj as $term) { ?>
                            
                                <li><a href="#"><?php echo $term->name; ?></a></li>
                                
                            <?php } ?>
                      
                      </ul>
                    
                    </div> 
                
                <?php } ?>
                
            <div class="clear"></div>
            
            </div>
                    
        </div>
        
    <?php } else { ?>
    
    <div class="title-frame-top">
    
        <?php if ($title==$title_type_simple) {  ?>
        
            <div id="header-title">
            
               <div id="title-left"><h1><?php the_title(); ?></h1></div>
                
               <?php if (get_option("of_search")=="true" ) { echo $search_form; } ?>
                
            <div class="clear"></div>
            
            </div>        
        
        <?php } else if (get_option("of_homepage")=="false" && is_front_page()){ ?>
    
        <div class="title-frame-top">
        
            <?php if (get_option("of_homepage_tagline")=="true") { ?>
            
                <div id="header-title">
                
                    <div id="title-left-home"><h1><?php echo get_option("of_homepage_tagline_text"); ?></h1></div>
                    
                    <?php if (get_option("of_homepage_tagline_first_button_text") OR get_option("of_homepage_tagline_first_button_link") OR get_option("of_homepage_tagline_second_button_text") OR get_option("ofof_homepage_tagline_second_button_link")){ ?>
                        
                        <div id="title-left-buttons">
                            
                            <?php if(get_option("of_homepage_tagline_first_button_text") && get_option("of_homepage_tagline_first_button_link")){ ?>
                            
                                <a id="title-button" href="<?php echo get_option("of_homepage_tagline_first_button_link"); ?>"><?php echo get_option("of_homepage_tagline_first_button_text"); ?></a>    
                                
                            <?php } ?>
                            
                        </div>
                        
                    <?php } ?>
                    
                <div class="clear"></div>
                
                </div> 
                
              <?php } ?>
                
            </div>
    
    <?php } else if (is_single("single-portfolio.php")) {  ?>
        
            <div id="header-title">
            
               <div id="title-left"><h1><?php the_title(); ?></h1></div>
                
               <?php if (get_option("of_search")=="true" ) { echo $search_form; } ?>
                
            <div class="clear"></div>
            
            </div>        
        
        <?php } else if ($title==$title_type_custom) {  ?>          
        
            <div id="header-title">
            
                <div id="header-subtitle"><?php echo get_post_meta($post->ID, $custom_key, true);?></div>
                
            <div class="clear"></div>
            
            </div>  
        
        <?php } else if ($title==$title_type_simple_custom) {   ?> 
        
            <div id="header-title">
            
                <div id="title-left"><h1><?php the_title(); ?></h1></div>
                
                <?php if (get_option("of_search")=="true" ) { echo $search_form;} ?>
                
                <div class="clear"></div>
                
                <div id="header-subtitle" ><?php echo get_post_meta($post->ID, $custom_key, true);?></div>
                
            <div class="clear"></div>
            
            </div>  
       
         <?php }  else if (is_single()){ ?> 
        
            <div id="header-title">
            
                <div id="title-left"><h1><?php the_title(); ?></h1></div>
                
                <?php if (get_option("of_search")=="true" ) { echo $search_form; } ?>
                
            <div class="clear"></div>
            
            </div>  
        
         <?php }   else if (is_search()){ ?> 
        
            <div id="header-title">
            
                <div id="title-left"><h1><?php printf( __( 'Search Results for: %s', "madza_translate"  ), '' . get_search_query() . '' ); ?></h1></div>
                
                <?php if (get_option("of_search")=="true" ) { echo $search_form; } ?>
                    
            <div class="clear"></div>
            
            </div>  
        
         <?php } else { ?> 
        
            <div id="header-title">
            
                <div id="title-left"><h1><?php the_title(); ?></h1></div>
                
                <?php if (get_option("of_search")=="true" ) { echo $search_form; } ?>
                
            <div class="clear"></div>
            
            </div>  
        
         <?php } if ( is_front_page() ) {} else { ?>
                
            <div id="title_frame_bottom_objects"> 
              
                    <div id="title_left">
                    
                            <?php if ( is_front_page() ) { ?>
                            			
                                <?php } else { edit_post_link( __( 'Edit This Page', 'madza_translate' ), '<div id="edit-link"><span class="edit-link">', '</span></div>' );  ?>
                               
                                <?php if ( get_option('of_breadcrumb')=="true"){
                                    
                                        if ( function_exists('breadcrumbs_plus')){?>
                                    
                                            <div id="breadcrumb">
                                                
                                                <?php breadcrumbs_plus( $args ); ?>
                                            
                                                <div class="clear"></div>
                                            
                                            </div><!--END BREADCRUMB -->
                               
                                <?php  } } ?><!--END breadcrumb_on -->
                                       
                            <?php } ?>
                            
                    </div>
                
                <div class="clear"></div>  
                
            </div>
            
        <?php }  ?>    
       
    </div><!--END TITLE FRAME -->
    
    <?php } ?>

</div>

</div><!--END TEXTURE -->

</div><!-- HEAD END -->

<!-- ******************** CONTENT START ******************** -->

<div id="content-full">

<div id="texture-content">         

<div id="content">
