Подскажите как сделать что бы форма Задать вопрос о товаре открывалась в popup окне.
К примеру создал само окно таким образом:
<html>
<head>
<meta charset="utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
<script>
function open_pop_up(box) {
$("#overlay").show();
$(box).center_pop_up();
$(box).show(500);
}
function close_pop_up(box) {
$(box).hide(500);
$("#overlay").delay(550).hide(1);
}
$(document).ready(function(){
jQuery.fn.center_pop_up = function(){
this.css('position','absolute');
this.css('top', ($(window).height() - this.height()) / 2+$(window).scrollTop() + 'px');
this.css('left', ($(window).width() - this.width()) / 2+$(window).scrollLeft() + 'px');
}
});
</script>
<style>
#overlay {
position: absolute;
top: 0px;
left: 0px;
background: #000;
opacity: 0.7;
z-index: 9000;
width: 100%;
height: 100%;
display: none;
}
#subscribeCloseButton {
width: 29px;
height: 29px;
margin: 5px;
float: right;
}
#pop-up {
width: 400px;
height: 300px;
border: 1px solid #e8e8e8;
background: #fdfdfd;
display: none;
z-index: 9001;
background-color:#FFFFFF;
border:1px solid #CCCCCC;
border-bottom-left-radius:8px;
border-bottom-right-radius:8px;
border-top-left-radius:8px;
border-top-right-radius:8px;
box-shadow:rgba(0, 0, 0, 0.298039) 5px 5px 24px;
min-width:14.462em;
padding:1.5em 18px;
}
span, p {
cursor: pointer;
}
</style>
</head>
<body>
<span onclick="open_pop_up('#pop-up');">Открыть</span>
<div id="pop-up">
<p onclick="close_pop_up('#pop-up');"><img id="subscribeCloseButton" src="http://lipoo.com.ua/modules/mod_newsletter_subscriber/modal-close.jpg" title="закрыть" alt="закрыть"></p></br>
<form action="<?php echo $mm_action_url ?>index.php" method="post" name="emailForm" id="emailForm">
<label for="contact_name">Имя:</label>
<br /><input type="text" name="name" id="contact_name" size="20" class="inputbox"><br />
<label for="contact_mail">E-mail:</label>
<br /><input type="text" id="contact_mail" name="email" size="20" label="Your email" class="inputbox"><br />
<label for="contact_text">Комментарий:</label><br />
<textarea rows="2" cols="20" name="text" id="contact_text" class="inputbox"></textarea><br />
<input type="button" name="send" value="Отправить" class="button" onclick="validateEnquiryForm()" />
<input type="hidden" name="product_id" value="<?php echo $_GET['product_id']?>" />
<input type="hidden" name="product_sku" value="<?php echo shopMakeHtmlSafe($db_product->f("product_sku")) ?>
<input type="hidden" name="set" value="1" />
<input type="hidden" name="func" value="productAsk" />
<input type="hidden" name="page" value="shop.ask" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="flypage" value="<?php echo $flypage ?>" />
<input type="hidden" name="Itemid" value="<?php echo $Itemid ?>" />
<input type="hidden" name="<?php echo $validate ?>" value="1" />
</form>
<script type="text/javascript">
function validateEnquiryForm() {
if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
alert( "<?php echo $VM_LANG->_('CONTACT_FORM_NC',false); ?>" );
} else if ( ( document.emailForm.email.value.search(";")!= -1 ) || ( document.emailForm.email.value.search(",")!= -1 ) || ( document.emailForm.email.value.search(" ")!= -1 ) ) {
alert( "You cannot enter more than one email address" );
} else {
document.emailForm.action = "<?php echo sefRelToAbs(""); ?>"
document.emailForm.submit();
}
}
</script>
<?php
}
else { // if set==1 then we have sent the email to the vendor and say thank you here.
?>
Как только товар появится мы вам сразу сообщим!
<br /><br />
<?php
}
?>
</div>
<div id="overlay"></div>
</body>
</html>
Но выводятся только поля, при нажатии на Отправить ничего не происходит. Подскажите как доработать этот скрипт?