<?php
function itx_header(){
    extract(itx_get_option('header'));
    if ($head_type==2){
        if (!$image) $image=get_bloginfo('template_directory')."/images/head.jpg";
        echo'
        <div id="headerwrap">';
        if (!$scope) echo '<div id="header" class="wrap">';
            echo '<a href="'.get_option('home').'/" title="'.htmlspecialchars(get_bloginfo('name')).'">
                <img src="'.$image.'" alt="'.htmlspecialchars(get_bloginfo('name')).'" title="'.htmlspecialchars(get_bloginfo('name')).'" />
            </a>';
        if (!$scope) echo '</div>';
        echo '</div>';
    }else{
        echo'
        <div id="headerwrap">
        <div id="header" class="wrap">
            <h1><a href="'.get_option('home').'">'.get_bloginfo('name').'</a></h1>
            <span>'.get_bloginfo('description').'</span>
        </div>
        </div>';
    }
}

function itx_header_styles(){
	$halfwrap=$fullwrap=$imgalign='';
    extract(itx_get_option('header'));
    if ($head_type==1){
        if (!$image) {
            $style=itx_get_option('layout','style');
            if ($style=='dark') $image='root';
            elseif ($style=='rose'||$style=='apricot') $image='dusk';
            else $image='sea';
            $image=get_bloginfo('template_directory')."/images/$image.jpg";
        }
        $img="background:$bgcolor url($image) $repeat $position top;";
        if ($scope){$fullwrap=$img;}
        else {$halfwrap=$img;}
    } else {
        $fullwrap="background:$bgcolor;";
        if ($head_type==2){
            if ($position=='center') $position='margin:0 auto;';
            else $position="float:$position";
            $imgalign="#headerwrap img{ $position;}";
        }
    }
    if (itx_get_option('layout','wrapping')=='fixed') $maxw=itx_get_option('layout','wrap').'px';
    else $maxw='98%';
    echo "
#headerwrap{ $fullwrap }
#header{ $halfwrap min-height: 100px;min-height: 100px; text-align: $text_align;}
#header h1 {font-size: {$font_size};}
#header h1 a {color: $color;text-decoration: none;}
#header h1 a:hover {color: $hover_color;}
#header img{max-width:$maxw;}$imgalign
#header span {font-size: {$span_font_size};color: $span_color;}";
}
?>