<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<script language="JavaScript" type="text/javascript">
		<!--
			function validateForm(AForm)
			       {
				   	 document.getElementById('_imieInfo').innerHTML = '';
				   	 document.getElementById('_emailInfo').innerHTML = '';
			         document.getElementById('_formInfo').innerHTML = '';
					   
				       if(AForm.imie.value=='' && AForm.email.value=='' && AForm.wiadomosc.value=='')  
					   {
							alert('Wszytskie pola tekstowe są wymagane');
				         return false;					   	
					   }
					   else
				       {
				        //1. Imię
				        valid = true;
						
				        wyn = document.getElementById('imie').value;//AForm.imie.value;
				        if (wyn == '') {
				         document.getElementById('_imieInfo').innerHTML = 'Pole jest wymagane';
				         valid = false;
				        }
				        
				        
				        //2. Email
				        reg = /^[a-zA-Z0-9ąćęłńóśżźĄĆĘŁŃÓŚŻŹ.]{1,30}@[a-zA-Z0-9ąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+(\.[a-zA-Z0-9ąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+)+$/;
				        wyn = AForm.email.value.match(reg);
				        if (wyn == null) {
				         document.getElementById('_emailInfo').innerHTML = 'Podaj poprawny adres e-mail!';
				         valid = false;
				        }
				        
				        
				        //3. Wiadomosc
				        
				        wyn = document.getElementById('wiadomosc').value;;
				        if (wyn == '') {
				         document.getElementById('_formInfo').innerHTML = 'Pole wiadomość jest wymagane';
				         valid = false;
				        }
						
						if(valid == false)
							return false;
				       }
					   alert('ok');
			           return true;
			       }		
		//-->
	</script>
<title>admin - networds</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <script type="text/javascript" src="/files/js/js_checker.js"></script>
<script type="text/javascript">
    function toggleFieldset(el,id) {
        $("#fieldset_content_"+id).slideToggle("fast",toggleFieldsetClass(id));
        }
    function toggleFieldsetClass(id)
    {
        $("#filters_"+id).toggleClass("collapsed");
    }
</script>
	<link rel="stylesheet" type="text/css" href="/files/style.css" />
    <link rel="Shortcut icon" href="http://panel.networds.pl/files/favicon.ico" />
</head>
	<body>
         <div id="js_checker"> </div>
        <script type="text/javascript">
            check_js();
        </script>
		<div class="footer_bg">
		<center>
			<table id="Table_01" width="960" border="0" cellpadding="0" cellspacing="0" >
				<tr>
					<td id="background_top" width="960" align="center" valign="top" colspan="2">
						<?php $this->load->view('banner'); ?>
					</td>
				</tr>
				<tr>
					<td valign="top" align="left">
						
						<?php
						
						if(isset($user)) 
							$this->load->view('menu');
						else
							echo '<div id="mainMenu">
									<table border="0" cellpadding="0" cellspacing="0" class="mainMenu_table">
										<tr style="padding:0px; margin:0px;">
											<td><img height="17" width="236" alt="" src="/files/leftMenuTop.jpg"/></td>
										</tr>
										<tr>
											<td valign="top" style="background-image: url(/files/leftMenuMiddle.jpg); width: 236px; height: 141px;  background-repeat: no-repeat;padding:0px;">
											<div id="mainMenu_content">		
												<div class="mainMenu_item"><a href="/">Strona główna</a></div>
											</div>	
											</td>
										</tr>
										<tr>	
											<td>
												<img height="17" width="236" alt="" src="/files/leftMenuBottom.jpg"/>
											</td>
										</tr>
									</table>
									</div>';
									
						?>
									
					</td>					
					<td>
						<div id="rightBox">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td><img src="/files/contentBoxTop.jpg" alt="" width="690" height="16"/></td>
								</tr>
								<tr>
									<td valign="top" style="background-image: url(/files/contentBoxMiddle.jpg); width: 690px; height: 547px; background-position: center top; background-repeat: no-repeat;">
										<div id="rightBox_content">
									<?php
									
									if (isset($_POST['email'])) 
									{
									if (empty($_POST['email'])) 
									{
											echo 'Formularza nie wysłano';
											
									}
									elseif(!empty($_POST['email']))
									{							
										require_once "swift_mailer/Swift.php";
									    require_once "swift_mailer/Swift/Connection/SMTP.php";
									    require_once "swift_mailer/Swift/Authenticator/LOGIN.php";
										
										$conn =& new Swift_Connection_SMTP("post.pl");
										$conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
										$conn->setUsername("formularz@post.pl");
										$conn->setPassword("ebl67aic");
																						    
										$swift =& new Swift($conn);
									    							
									    $tresc = '';							
										
										if(isset($_POST['imie'])) 		$tresc.= '<b>Imie i nazwisko:</b> '.$_POST['imie'].'<br/>';		
										if(isset($_POST['email'])) 		$tresc.= '<b>E-mail:</b> '.$_POST['email'].'<br/>';	
										if(isset($_POST['wiadomosc'])) 			$tresc.= '<b>Zapyatnie:</b> '.$_POST['wiadomosc'].'<br/>';			
										
										$message = &new Swift_Message("Formularz kontaktowy",  $tresc, 'text/html');
										$message->headers->set("Reply-To", "jarek@labmatic.com");
										
										try
										{
										   if (@$swift->send($message, "jarek@labmatic.com", "formularz@post.pl"))							
										   {
												echo "<b>Formularz wysłany. Dziękujemy.</b>";
										   }
										   else
										   {
										   		echo "<b>Formularz nie wysłany, spróbuj później</b>";
										   }
										}catch (Exception $e){
											echo '<b>Formularz nie wysłany, spróbuj później</b>';
										}
									}
									else
									{
										echo '<b>Formularz nie wysłany, spróbuj później</b>';
									}
									
									}
									else
									{
									?>
									<div style="font-size:11px;font-weight:bold;color:#BF1416;">Formularz</div><br/>
											<form name="form" action="/admin/problem" method="post" onsubmit="return validateForm(this);">
									
												<table cellspacing="0" border="0" class="request-form">
													<tr style="height:40px;">
														<td>
															Imię i nazwisko<br />
															<input class="inp" size="41" name="imie" id="imie" value="" />
															<span id="_imieInfo" style="color:#ff0000;"></span>
														</td>
													</tr>
													<tr style="height:40px;">
														<td>E-mail<br />
															<input  class="inp"  size="41" name="email" id="email" value="" />
															<span id="_emailInfo" style="color:#ff0000;"></span>
														</td>
													</tr>
													<tr style="height:40px;">
														<td>Wiadomość<br />
															<textarea name="wiadomosc" id="wiadomosc" style="border:1px solid #e0e0e0" cols="70" rows="10"></textarea>
														</td>
													</tr>	
													<tr>
														<td>
															<div id="_formInfo" style="line-height:20px;color:#ff0000;"></div>
														</td>			
													</tr>
													<tr style="height:30px;">
														<td align="left" >
															<input type="submit" class="submit" value="Submit"/>
														</td>
													</tr>
												</table>
												<br />
											</form>
									<?php }; ?>							
							
							
										</div>
									</td>	
								</tr>
								<tr>
									<td><img src="/files/contentBoxBottom.jpg" alt="" width="690" height="17"/></td>
								</tr>
							</table>
						</div>	
						<!-- end -->
					</td>
				</tr>
				<tr>
					<td  align="center" valign="top"  colspan="2">
						<?php $this->load->view('footer.php'); ?>
					</td>
				</tr>
			</table>
		</center>
		</div>
	</body>
</html>