<?php
	if($_POST['pp']=='**'){
		$str="";
		$str.="<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\">";
		$str="<tr><td>Name:</td><td>{$_POST['first-name']}</td></tr>";
		$str="<tr><td>Email:</td><td>{$_POST['email']}</td></tr>";
		$str="<tr><td>Company:</td><td>{$_POST['CompanyName']}</td></tr>";
		$str="<tr><td>Address:</td><td>{$_POST['Address']}</td></tr>";
		$str="<tr><td>City:</td><td>{$_POST['City']}</td></tr>";
		$str="<tr><td>Country:</td><td>{$_POST['Country']}</td></tr>";
		$str="<tr><td>Tel:</td><td>{$_POST['Tel']}</td></tr>";
		$str="<tr><td>Fax:</td><td>{$_POST['Fax']}</td></tr>";
		$str="<tr><td>Comments:</td><td>".str_replace("\n","<br />",$_POST['Comments'])."</td></tr>";
		$str="</table>";
		if(sendMail($str)){
			$go=true;
		}else{
			$go=false;
		}
		
		
	}
	function sendMail($str){
		$r=mysql_query("select usr_email2 from users where usr_username='admin';");
		if(mysql_errno()==0){
			if($row=mysql_fetch_assoc($r)){
				$mailto=$row['usr_email2'];
			}
		}
		$to ="Contact us <$mailto>";
		$subject = "Salsabil - Contact application ".date('Y-m-d')."";
		$message ="<html><head><title>Contact us application</title></head><body>$str</body></html>";
		$headers ="MIME-Version: 1.0\r\n";
		$headers.="Content-type: text/html; charset=iso-8859-1\r\n";
		$headers.="From: Contact us <$mailto>\r\n";
		if(mail($to, $subject, $message, $headers)){
			return true;
		}else{
			return false;
		}
		return false;
	}

?>
<p align="center"><strong><?php if($glang==2){ ?>اتصل بنا:<?php }else{?>Contact SALSABIL Co. <?php }?></strong></p>
<table border="0" bordercolor="#111111" cellpadding="0" cellspacing="0" width="100%" style="font-size:1em">
  <tbody>
    <tr>
      <td valign="top" width="30%">
	  	<?php if($glang==2){ ?>
        <p> دمشق - سورية<br /><br />هاتف.:<span dir="ltr"> +963 11 392 17 35&nbsp;</span><br /> <br />
          فاكس:<span dir="ltr"> +963 11 392 17 32&nbsp;</span><br /> <br />البريد الالكتروني: <a href="mailto:info@salsabil.com?subject=From%20Salsabil.com"> info@salsabil.com</a></p>
        <?php }else{?>
        <p> Damascus - Syria<br /><br />Tel.:<span dir="ltr"> +963 11 392 17 35&nbsp;</span><br /> <br />
          Fax: + 963 11 392 17 32<br /> <br />Eail: <a href="mailto:info@salsabil.com?subject=From%20Salsabil.com"> info@salsabil.com</a></p>
         <?php }?>
      </td>
      <td width="50%"><div align="center">
		<?php if($go!=true){?>
        	<?php if($glang==2){ ?>
        	<form action="<?php echo $pagefolder; ?>/" method="post"><input type="hidden" name="pp" value="**" /><table border="0" bordercolor="#111111" cellpadding="2" cellspacing="2" width="100%" style="font-size:1em"><tbody><tr><td width="22%"> الاسم:</td><td width="78%"><input name="first-name" size="20" /></td></tr><tr><td width="22%"> البريد الالكتروني:</td><td width="78%"><input name="email" size="20" /></td></tr><tr><td width="22%"> الشركة:</td><td width="78%"><input name="CompanyName" size="20" /></td></tr><tr><td width="22%"> العنوان:</td><td width="78%"><input name="Address" size="30" /></td></tr><tr><td width="22%"> المدينة:</td><td width="78%"><input name="City" size="20" /></td></tr><tr><td width="22%"> البلد:</td><td width="78%"><input name="Country" size="20" /></td></tr><tr><td width="22%"> الهاتف:</td><td width="78%"><input name="Tel" size="20" /></td></tr><tr><td width="22%"> الفاكس:</td><td width="78%"><input name="Fax" size="20" /></td></tr><tr><td width="22%"> تعليقات:</td><td width="78%"><textarea cols="30" name="Comment" rows="4"></textarea></td></tr><tr><td width="22%"> </td><td width="78%"><input value="إرسال" type="submit" /><input value="مسح" type="button" /></td></tr></tbody></table></form>
      		<?php }else{?>
        	<form action="<?php echo $pagefolder; ?>/" method="post"><input type="hidden" name="pp" value="**" /><table border="0" bordercolor="#111111" cellpadding="2" cellspacing="2" width="100%" style="font-size:1em"><tbody><tr><td width="22%"> Name:</td><td width="78%"><input name="first-name" size="20" /></td></tr><tr><td width="22%"> Email:</td><td width="78%"><input name="email" size="20" /></td></tr><tr><td width="22%"> Company:</td><td width="78%"><input name="CompanyName" size="20" /></td></tr><tr><td width="22%"> Address:</td><td width="78%"><input name="Address" size="30" /></td></tr><tr><td width="22%"> City:</td><td width="78%"><input name="City" size="20" /></td></tr><tr><td width="22%"> Country:</td><td width="78%"><input name="Country" size="20" /></td></tr><tr><td width="22%"> Tel:</td><td width="78%"><input name="Tel" size="20" /></td></tr><tr><td width="22%"> Fax:</td><td width="78%"><input name="Fax" size="20" /></td></tr><tr><td width="22%"> Comments:</td><td width="78%"><textarea cols="30" name="Comment" rows="4"></textarea></td></tr><tr><td width="22%"> </td><td width="78%"><input value="Send" type="submit" /><input value="clear" type="button" /></td></tr></tbody></table></form>
            <?php }?>
		<?php }else{?>
            <table border="0" bordercolor="#111111" cellpadding="2" cellspacing="2" width="100%" style="font-size:1em"><tbody>
                <tr>
                    <td>Thank you for your time, your message sent successfully to us.</td>
                </tr>
            </tbody></table>      
		<?php }?>
      </div></td>
    </tr>
  </tbody>
</table>
