/**
* Вставка мотивационного блока в хидер
*/
function refresh_header_about_block(){
about_text_index++;
t = about_texts.length-1;
if (about_text_index>t) about_text_index = 0;
$('#header_about_block').html(about_texts[about_text_index]);
}
function auth_callback(){
$('#login_email').focus();
}
function check_auth_form(){
//tb_remove();
if ((jQuery.trim($('#login_email').val()) == '')){
alert("Введите email");
$('#login_email').val('');
$('#login_email').focus();
return false;
}
if ((jQuery.trim($('#login_password').val()) == '')){
alert("Введите пароль");
$('#login_password').val('');
$('#login_password').focus();
return false;
}
return true;
}
function check_login_password(){
if ((jQuery.trim($('#login_email').val()) == '')){
alert("Введите email");
$('#login_email').val('');
$('#login_email').focus();
return false;
}
if ((jQuery.trim($('#login_password').val()) == '')){
alert("Введите пароль");
$('#login_password').val('');
$('#login_password').focus();
return false;
}
$('#auth_result').html('
Секундочку...');
var req = new JsHttpRequest();
req.caching = false;
req.onreadystatechange = function() {
if (req.readyState == 4) {
if ( req.responseJS.q == 'error' ){
$('#auth_result').html('
Неправильные логин и пароль');
}
else {
$('#auth_result').html('
Заходим...');
$('#auth_form').submit();
}
}
}
req.open(null, '/include/ajax/check_login_password.php', true);
req.send( { email: $('#login_email').val(), password: $('#login_password').val()} );
}
function comapre_products(product_id, type){
var req = new JsHttpRequest();
req.caching = false;
if (type == 'del'){
$('#compare_'+product_id).html('Удаляем...');
} else {
$('#compare_'+product_id).html('Добавляем...');
}
req.onreadystatechange = function() {
if (req.readyState == 4) {
if ( req.responseJS.q == 'ok' ){
if (type == 'del'){
$('#compare_'+product_id).html('Добавить к стравнению ');
} else {
$('#compare_'+product_id).html('Уже в списке сравнения [x]');
}
}
else {
$('#compare_'+product_id).html('Произошло какое-то свинство. Попробуйте сделать это позже.');
}
}
}
req.open(null, '/include/ajax/compare.php', true);
req.send( { product_id: product_id, type: type} );
}
function add_product(){
if ($('#product_id').val() > 0){
tmp_pic_src = document.getElementById('basket_pic').src;
document.getElementById('basket_pic').src = basket_process_pic.src;
product_id = $('#product_id').val();
var req = new JsHttpRequest();
req.caching = false;
req.onreadystatechange = function() {
if (req.readyState == 4) {
document.getElementById('cart_header_block').innerHTML = req.responseJS.basket;
$('#add_product_result').html('Товар успешно добавлен в корзину.
Вы можете перейти в корзину или продолжить выбор товара.');
document.getElementById('basket_pic').src = tmp_pic_src;
}
}
req.open(null, '/include/ajax/add_product.php', true);
req.send( { product_id: product_id } );
return false;
} else {
show_hide_buttons();
$('#to_basket').animate( { 'opacity' : 0 }).animate( { 'opacity' : 100 });
$('#to_basket').html(''+$('#to_basket').html()+'');
return false;
}
return false;
///////////////////////////////////////
product_id = document.getElementById('product_id').value;
if (product_id == -1){
alert('Выберите размер, пожалуйста');
return false;
}
}