<!-- <?=filenamecomment(__FILE__)?> -->
<?php //d($oTheme->getSessionData( 'contact-form-sent'  ));//die('dead at: '.__FILE__.':'.__LINE__);?> 
<div id="contactpage"> <?php
$title = getPostHeaderOrTitle($post);
$showMainform = true;
$errorOrSuccessmsg = false;
$formid = "contact-form";

	if( $emuTheme->getSessionData( 'contact-form-sent',true  ) === true ){
	   $errorOrSuccessmsg =   $emuTheme->getMessages($formid);
	   $showMainform = false;
	   $success = true;
		//
	}else{
		$success = false;
		if($formmsg = $emuTheme->getMessages($formid))
	   		$errorOrSuccessmsg =   '<div class="req">'.$formmsg.'</div>';
	}//if( $oTheme->getSessionData( 'contact-form-sent', true ) === true 
	//d($success);
	//do we have a thank you page? child of contact.
	if($success)
		$thanks = getOnlyDirectChildrenOfPost($post);
	if($thanks and $success)
		echo getPostContentFiltered($thanks[0]);
	else
		echo $errorOrSuccessmsg ;

if ($showMainform){
	if($src = getPostFeaturedImage($post->ID,'original'))
		$contactheaderimg = img($src, 'id="contactheader"');
		
?>
<?=$contactheaderimg?>

<form enctype="multipart/form-data" id="<?php  echo $formid  ?>" action="<?=$includerAction?>" method="post">
<div class="row clearfix"> 
	<?php  echo  formInput(array('postname' => 'firstName', 'label' => 'First Name*', 'tabindex'=>'1','classes'=>'text required'   )   );					enl();
            echo  formInput(array('postname' => 'lastName', 'label' => 'Last Name', 'tabindex'=>'2' ,'classes'=>'last'   )   ) ;							enl();	
            echo  formInput(array('postname' => 'phone', 'label' => 'Phone Number', 'tabindex'=>'7'  )   ) ;												enl();	
            echo  formInput(array('postname' => 'email_address', 'label' => 'Your Email*', 'tabindex'=>'8','classes'=>'text email required last'    )   );	enl(); 	
    ?>
</div><!-- //class="row clearfix"  -->
 
<div class="rowspacer"></div>

<div id="row2_5" class="row clearfix">
    <div id="preffedcontact">    
        <div class="floatleft" style="margin-right:15px;">Preferred Contact Method: </div>
        <div class="styledcheckbox"><input type="checkbox" tabindex="9" class="styled" name="preferphone" <?= post_val('preferphone') ? ' checked="checked"' : '' ?>   >Telephone and/or</div>
        <div class="styledcheckbox"><input type="checkbox" tabindex="10" class="styled" name="preferemail" <?= post_val('preferemail') ? ' checked="checked last"' : '' ?>   >E-mail</div>
    </div>
    <div id="howdidyouhear">
		<?=getThemeOption('howdidyouhearaboutus')?>
            <select class="inputselect text  " tabindex="20" name="referral">
            <?php $s = post_val('referral'); $$s = ' selected="selected" ';if (post_val('referral')== ''){$not =  ' selected="selected" ';} /*   <?=$AL?>  */ ?>
            <option  <?=$not?> value="" >Select</option>
            <option  <?=$Friend?> value="Friend">Friend</option>
            <option  <?=$Magazine?> value="Magazine">Magazine</option>
            <option <?=$Mailing?>  value="Mailing">Mailing</option>
            <option  <?=$Radio?> value="Radio">Radio</option>
            <option  <?=$SearchEngine?> value="SearchEngine">Search Engine</option>
            <option  <?=$Television?> value="Television">Television</option>
            <option <?=$YellowPages?>  value="YellowPages">Yellow Pages</option>
            <option <?=$reffacebook?>  value="reffacebook">Facebook</option>
            <option <?=$search?>  value="web_search">Web Search</option>
            </select>
     </div>
</div><!-- //class="row clearfix"  id="row3" --> 

<div class="rowspacer"></div>

<div id="row4" class="row clearfix">
           <?php echo  formTextarea(array('postname' => 'comments',  'label' => 'Comments or Questions?', 'tabindex'=>'21', 'classes'=>'textarea required'    )   ) ?>
</div><!-- //class="row clearfix"  id="row4" --> 
       
<div class="rowspacer"></div>

<div id="row4_5" class="row clearfix">
    <?php if(apply_filters('doyouwantnewsletteroverride', true, $post)){ ?>
    <div class="col2">
     <div class="styledcheckbox newsletter"><input type="checkbox" tabindex="20" class="styled" name="newsletter"  <?= post_val('newsletter') ? ' checked="checked"' : '' ?>  ><?=str_replace('recieve','receive',getThemeOption('doyouwantnewsletter'))?></div>
    </div><!-- /class="col2" -->
    <?php } ?>
</div>

<div class="rowspacer"></div>

<div id="row5" class="row clearfix">
	<div class="col1">
		<input type="submit" tabindex="22" value="Submit" name="e-button">
	</div><!-- /class="col1" -->
</div><!-- // id="row5"class="row clearfix"  --> 
    <input type="hidden" value="<?=$formid?>" name="formid" />
    <?php 
    
    $frompage = apply_filters('contactpageFrompage', 'contact', $post, $includer);
    $args = array('frompage' => $frompage,'maillist_list_id' => 'contactform','bindprocessor' => $formid);
    echo formHidden($args);//this has closing </form>
    echo validateForm($formid); ?>         
    
    
<?php 
} //if ($showMainform)
?>
</div> <!-- //<div id="contactpage"> -->      
