<?php 
function formid(){
	return 	'contact-form';
}
function shortcodeContactForm(){
	global $emuTheme;
	$formid = formid();
	$includerAction = getperma(getThemeOption('contactpageslug'));

	$output = '';
	 ob_start();?>
		<div class="contact-form-widget sidebarbar">
			<h2>Request Your Appointment Now</h2>
			<form enctype="multipart/form-data" id="<?=$formid?>" class="contact-form" action="<?=$includerAction?>" method="post">
			<?php /*?><p>New patients only. Certificate will be sent<br />to your email. Please present upon arrival.</p><?php */?>
			<div class="styled name">
				<div class="icon"></div>
				<span><input type="text" name="firstName" class="text required" placeholder="Name" /></span>
			</div>
            <input type="hidden" class="styled" value="" name="honeypot">
			<div class="styled email">
				<div class="icon"></div>
				<span><input type="text" name="email_address" class="text required email" placeholder="Email"  /></span>
			</div>
            <?php 
			 echo  formTextarea(array('postname' => 'comments',  'placeholder' => 'Comments or Questions?', 'tabindex'=>'21', 'classes'=>'textarea required'    )   ) ;
			
			?>
			<input type="hidden" value="<?=$formid?>" name="formid" />
			<input type="hidden" value="1" name="cert01" />
			<input type="submit" value="SEND" id="subbutt" name="e-buttonx" />
			<input type="hidden" value="Submit" id="submit-e-button" name="e-button" />
	<?php 	
	$output .= ob_get_clean();	
	
	if(!is_home())
		$frompage =  $_SERVER['REQUEST_URI'];
	else
		$frompage = 'Home Page';
	
	$args = array('frompage' => $frompage,'maillist_list_id' => 'contactform','bindprocessor' => $formid);

	$output.= formHidden($args);//this has closing </form>
	$output.= validateForm($formid);
	$output .= '</div>';
	
	return stripnewlines($output);
}add_shortcode( 'contactwidget', 'shortcodeContactForm' );



//function action_emuP_Contact_afterformmail($oContact='',$tags=''){
//	$cert = ($_POST['cert01'])?true:false;
//	if(!$cert)
//		return;
//	global $emuTheme;
////	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx	d($oContact); object
////firstName 	adf
////email_address 	asdf@dsflkj.com
////requestconsult 	true
////frompageID 	5710
////frompage 	landingpage /brys_great_buys/100-off-coupon/
////maillist_list_id 	[empty string]
////forceemailsignup 	true
////maillist_list_name 	maillistname
////dateCreated 	2013-08-28 15:44:48
////dbID 	37
////	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx	d($tags); array
////from 	asdf@dsflkj.com
////emailto 	dougemailto@invalid.com
////cc 	dougcc@invalid.com
////bcc 	
////bool: FALSE
////subject 	Website Contact: adf - Form was filled out at page: landingpage /brys_great_buys/100-off-coupon/ page         //Brys-coupon-100-Dollar-Off.jpg
////body 	Greetings! adf has filled out your contact form on http://brys.target52.dev/.
//$cb = 2735;//content bit with resp
////$img = slashbetweennotend(gethost(),urltocustom.'images/form-certificate.jpg');//getDomain().urltocustom.'coupon_100-off.jpg';d($img);
//$img = getPostFeaturedImage($cb,'full');
//
//$subject = getPostHeaderOrTitle($cb);//$subject = "Here is the certificate for your visit to DDS!";
//
////$body = '<p>We all here at DDS would like to thank you for taking the time to request an xray.</p>
////<p>Here is your coupon:<BR>
////Simply print the coupon below or bring it in on your phone to redeem!:<br><a href="'.$img.'" style="border:none;"><img src="'.$img.'" style="border:none;"></a>
////<p><a href="'.$img.'" style="border:none;">Click here if you don\'t see the image.</a></p>
//
//$body = getPostContentFiltered($cb);
//$body = str_replace('%img%', $img, $body);//echo htmlentities($body); hr(); echo $body;
//
//if(dugdebug){
//	//d('dug');
//	$tags['cc'] = '';
//	$tags['bcc'] = getThemeOption('form_debug_email_cc');
//}
//  //$oEmuEmail = $emuTheme->mail( $tags['emailto'], $tags['from'], $tags['subject'], $body, 'html', $tags['cc'],  $tags['bcc'], $attachments = null, $important = true );//last param is importance
//  //$to, $from = '', $subject=''  , $message=''  , $type = null, $cc = null, $bcc = null, $attachments = null, $important = false 
//  $mailargs = array(
//					'to'		=> $oContact->email_address
//					, 'from'	=> getThemeOption('form_email_from')//$tags['emailto']
//					, 'subject'	=>$subject
//					, 'message'	=>$body
//					, 'type'	=>'html'
//					, 'cc'		=>''
//					, 'bcc'		=>$tags['cc']
//					//, 'attachments'		=> pathtocustom.'Brys-coupon-100-Dollar-Off.pdf'
//					, 'important'=>true				
//					);
//$oEmuEmail = $emuTheme->mail( $mailargs );
//
////d($tags);
////d($mailargs);
////d($oEmuEmail);
//}
// no not no moreeeeeeeeeeeeeeeeeeeeeeeeeee                      add_action('emuP_Contact_afterformmail', 'action_emuP_Contact_afterformmail', 10, 2);
// for testing the body 
//if(dugdebug)
//	add_action('wp', 'action_emuP_Contact_afterformmail', 10, 2);



?>