<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="order.css" rel="stylesheet" type="text/css" />
</head>

<body bgcolor="black">
<?php
@session_start();

ini_set('default_charset','UTF-8');
mb_language('uni');
mb_internal_encoding('UTF-8');
ini_set('include_path',"../pear".PATH_SEPARATOR.ini_get("include_path"));
require_once( "HTML/QuickForm.php" );
require_once( "confirm_f.php" );

$form = new HTML_QuickForm( 'order', 'post');

$form->addElement( 'header', null, '<br>Common information:' );

$form->addElement( 'text', 'Имя',
    '<font class="formnotice">Your name</font>',
    array('class' => 'subject') );

$form->addElement( 'text', 'Телефон',
    '<font class="formnotice">Your phone number</font>',
    array('class' => 'subject') );

$form->addElement( 'text', 'email',
    '<font class="formnotice">Your e-mail</font>',
    array('class' => 'subject') );

$form->addElement( 'select', 'Тип_заказа',
    '<font class="formnotice">Type of order</font>',
    array('Разработка сайта целиком' => 'Site developing completely',
    'Разработка дизайна' => 'Design',
    'Редизайн сайта' => 'Redesign',
    'Разработка CMS' => 'Content Management System developing',
    'Разработка ПО с веб интерфейсом' => 'Web-based application',
    'Шаблон для популярной CMS (bitrix и т.п.)' => 'Template for popular CMS (bitrix, joomla etc.)',
    'Продвижение (раскрутка) сайта' => 'Site promotion',
    'Другое' => 'Other'
        ),
   array('class' => 'subject')
    );

$form->addElement( 'textarea', 'Комент',
    '<font class="formnotice">More</font>',
    array('class' => 'comment') );

$form->addElement( 'select', 'Сроки',
    '<font class="formnotice">Term</font>',
    array('не срочно' => 'no terms',
    '2 недели' => '2 weeks',
    '3 недели' => '3 weeks',
    '4 недели' => '4 weeks',
    '2 месяца' => '2 months',
    '3 месяца' => '3 months'),
   array('class' => 'subject') );

$form->addElement( 'select', 'Как_узнали',
    '<font class="formnotice">How did You know about us?</font>',
    array('' => '',
    'Реклама в сети' => 'Internet advertisment',
    'Нашли в поисковой системе' => 'Found at Internet',
    'Посоветовали знакомые' => 'Friends told',
    'Случайно' => 'By chance'
            ),
   array('class' => 'subject')
    );

$form->addElement( 'header', null, '<br>Site details:' );

$form->addElement( 'text', 'Доменное_имя',
    '<font class="formnotice">Domain name</font>',
    array('class' => 'subject') );

$form->addElement( 'text', 'Название',
    '<font class="formnotice">Site nanme</font>',
    array('class' => 'subject') );

$form->addElement( 'textarea', 'Тематика',
    '<font class="formnotice">Site theme (what about)</font>',
    array('class' => 'comment') );

$form->addElement( 'textarea', 'Понравившиеся_сайты',
    '<font class="formnotice">Your favourite sites examles</font>',
    array('class' => 'comment') );

$form->addElement( 'checkbox', 'Логотип_в_исходниках',
    '<font class="formnotice">Have you a logo,<br>
   corporate style in sources<br>
    in base of them,<br>we can create design</font>' );

$form->addElement( 'select', 'Количество_эскизов',
    '<font class="formnotice">Nums of sketch<br>
    (site\'s design variants)
    </font>',
    array('2' => '2',
    '3' => '3',
    '4' => '4',
    '5' => '5'       ),

    array('class' => 'subject') );

$form->addElement( 'header', null, '<br>Site reqirements:' );

$form->addElement( 'textarea', 'Структура',
    '<font class="formnotice">Main menu<br>(structure)</font>',
    array('class' => 'comment') );

$form->addElement( 'checkbox', 'Подменю',
    '<font class="formnotice">Submenu</font>' );

$form->addElement( 'checkbox', 'Выпадающее_меню',
    '<font class="formnotice">Dropdown menu</font>' );

$form->addElement( 'checkbox', 'Гостевая',
    '<font class="formnotice">Guest book</font>' );

$form->addElement( 'checkbox', 'Отсылка_почты',
    '<font class="formnotice">E-mail seding from site</font>' );

$form->addElement( 'checkbox', 'Форум',
    '<font class="formnotice">Forum</font>' );

$form->addElement( 'checkbox', 'Каталог',
    '<font class="formnotice">Catalog of the goods</font>' );

$form->addElement( 'checkbox', 'Автозаполнение_каталога',
    '<font class="formnotice">Catalog auto-filling</font>' );

$form->addElement( 'checkbox', 'Корзина_заказа',
    '<font class="formnotice">Cart and ordering</font>' );

$form->addElement( 'checkbox', 'Галерея',
    '<font class="formnotice">Gallery</font>' );

$form->addElement( 'checkbox', 'Случайное_изображение',
    '<font class="formnotice">Random image</font>' );

$form->addElement( 'checkbox', 'Информационные_блоки',
    '<font class="formnotice">News block,<br>last incoming,<rb></font>' );

$form->addElement( 'checkbox', 'Полное_наполнение',
    '<font class="formnotice">Full filling of a site contents</font>' );

$form->addElement( 'checkbox', 'Обучение_персонала',
    '<font class="formnotice">Personal studying</font>' );

$form->addElement( 'checkbox', 'Хостинг',
    '<font class="formnotice">Hosting</font>' );

$form->addElement( 'checkbox', 'Чужой_хостинг',
    '<font class="formnotice">Installation to<br>another hosting</font>' );

$form->addElement( 'checkbox', 'Раскрутка',
    '<font class="formnotice">Promotion</font>' );

$form->addElement( 'checkbox', 'Реклама',
    '<font class="formnotice">Advertisment</font>' );

$form->addElement( 'checkbox', 'Аналог_на_другом_языке',
    '<font class="formnotice">Another language support<br>(site copy with another language)</font>' );

$form->addElement( 'header', null, '<br>WEB browsers support:' );

$form->addElement( 'checkbox', 'IE',
    '<font class="formnotice">Internet Explorer</font>' );

$form->addElement( 'checkbox', 'Opera',
    '<font class="formnotice">Opera</font>' );

$form->addElement( 'checkbox', 'FireFox',
    '<font class="formnotice">FireFox</font>' );

$form->addElement( 'checkbox', 'Safari',
    '<font class="formnotice">Safari</font>' );

$form->addElement( 'checkbox', 'Chrome',
    '<font class="formnotice">Google Chrome</font>' );

$form->addElement( 'checkbox', 'Поддержка_старых_версий_IE',
    '<font class="formnotice">Old version of Internet Explorer</font>' );

$form->addElement( 'checkbox', 'Работа_с_отключенным_js',
    '<font class="formnotice">When the javascript<br>turned off - <br>saving of capacity</font>' );

$form->addElement( 'checkbox', 'Работа_с_отключенным_флешем',
    '<font class="formnotice">When the flash <br>is not support -<br>alternative functionality</font>' );

$form->addElement( 'text', 'confirmcode',
    '<img class="codeimg" src="confirm_f.php?webi_code=1">',
    array('class' => 'codeline'));

$form->addElement( 'submit', null, 'Send order', array('class' => 'baton') );

$form->applyFilter('__ALL__', 'trim');
$form->addRule('Имя', 'Enter Your name please.', 'required', null, 'client');
$form->addRule('Телефон', 'Enter Your phone number please.', 'required');
$form->addRule('email', 'Enter Your e-mail address please.', 'required');
$form->addRule('email', 'Enter CORRECT e-mail address please.', 'email');


$email="";

if ( $form->validate() &&  webi_confirm_pict("confirm", $_POST['confirmcode']) )
{
	global $email;
	$email = "Customer <".$form->exportValue( 'email' ).">";
    $form->freeze();
    $form->process("process_data", false);
    echo "<br>Thank you, your order is accepted. We'll contact with you soon.";
}else {
    echo '<p class="formnotice">
    <a href="order_rus.php">RUS</a> / <b>ENG</b><br><br>
    In base of the information that you entered we will define terms and project budget</p>';
    $html = str_replace('denotes required field','',$form->toHtml());
    $html = str_replace('background-color: #CCCCCC;','',$form->toHtml());
    echo $html;
}

function process_data ($values) {
    $body = "На английском!!!\r\n";
    foreach ($values as $key=>$value) {
      if ($key != 'submit') {
        // replaces underscores with spaces 
        // and capitalizes the resulting words
        $body .= ucwords(ereg_replace('[_]', ' ', $key));
        $body .= ": ";
        if ($value == '') {
          $value = '(пусто)';
        }
        elseif ($value == '1') {
          $value = 'да';
        }

        $body .= $value;
        $body .= "\r\n\r\n";
      }
    }
   	global $email;
  	$subject = "Новый заказ!";

//   $header= "From: hosting@magicfreedom.com\n";
//   $header.= "Subject: $subject\n";
//   $header.= "Content-type: text/plain; charset=\"utf-8\"\n";
     mail( "slaytor@gmail.com", $subject, $body/*,$header*/);}

?>

</body>
</html>
