function disableAddToCart(elementId, mode, text)
{
var element = document.getElementById(elementId);
if (!element)
return;
if (mode == "detail")
$(element).html("" + text + "").toggleClass("disabled")
.removeAttr("href").unbind('click').css("cursor", "default");
else if (mode == "list")
$(element).html(text).removeClass("catalog-item-buy").addClass("catalog-item-in-the-cart")
.unbind('click').css("cursor", "default");
}
function addToCart(element, imageToFlyId, mode, text)
{
if (!element || !element.href)
return;
var button = $(element);
if (mode == "detail")
button.toggleClass("disabled").unbind('click').css("cursor", "default");
else if (mode == "list")
button.removeClass("catalog-item-buy").addClass("catalog-item-in-the-cart").unbind('click').css("cursor", "default");
$.get(
element.href + "&ajax_buy=1",
$.proxy(
function(data) {
if (this.mode == "detail")
this.button.removeAttr("href").html("" + text + "");
else if (this.mode == "list")
this.button.removeAttr("href").html(text);
var imageElement = document.getElementById(this.imageToFlyId);
if (!imageElement)
{
$("#cart_line").html(data);
return;
}
var hoverClassName = "";
var wrapper = null;
if (this.mode == "detail")
{
hoverClassName = "catalog-detail-hover";
wrapper = this.button.parents("div.catalog-detail");
}
else if (this.mode == "list")
{
hoverClassName = "catalog-item-hover";
wrapper = this.button.parents("div.catalog-item");
}
wrapper.unbind("mouseover").unbind("mouseout").removeClass(hoverClassName);
var imageToFly = $(imageElement);
var position = imageToFly.position();
var flyImage = imageToFly.clone().insertBefore(imageToFly);
flyImage.css({ "position": "absolute", "left": position.left, "top": position.top });
flyImage.animate({ width: 0, height: 0, left: 948, top: -58 }, 600, 'linear');
flyImage.data("hoverClassName", hoverClassName);
flyImage.queue($.proxy(function() {
this.flyImage.remove();
$("#cart_line").html(data);
if (this.wrapper.data("adminMode") === true)
{
var hoverClassName = "";
if (this.mode == "detail")
hoverClassName = "catalog-detail-hover";
else if (this.mode == "list")
hoverClassName = "catalog-item-hover";
this.wrapper.addClass(hoverClassName).bind({
mouseover: function() { $(this).removeClass(hoverClassName).addClass(hoverClassName); },
mouseout: function() { $(this).removeClass(hoverClassName); }
});
}
}, {"wrapper" : wrapper, "flyImage" : flyImage, "mode": this.mode}));
}, { "button": button, "mode": mode, "imageToFlyId" : imageToFlyId }
)
);
return false;
}
function disableAddToCompare(elementId, text)
{
var element = document.getElementById(elementId);
if (!element)
return;
$(element)
.removeClass("catalog-item-compare").addClass("catalog-item-compared")
.text(text)
.unbind('click').removeAttr("href")
.css("cursor", "default");
return false;
}
function addToCompare(element, text)
{
if (!element || !element.href)
return;
var href = element.href;
var button = $(element);
button.removeClass("catalog-item-compare").addClass("catalog-item-compared").unbind('click').removeAttr("href").css("cursor", "default");
$.get(
href + '&ajax_compare=1&backurl=' + decodeURIComponent(window.location.pathname),
$.proxy(
function(data) {
var compare = $("#compare");
compare.html(data);
this.text(text);
if (compare.css("display") == "none") {
compare.css({ "display": "block", "height": "0" });
compare.animate({ "height": "22px" }, 300);
}
}, button
)
);
return false;
}
//ôóíêöèÿ ñðàáîòàåò åæåëè òîëüêî âûáðàí èíäåêñ
function befSub(formData, jqForm, options)
{
var value = $('#delivery').val();
//console.log(value);
//console.log('0000');
var value_bool=$('#delivery').length;
var val_zip=$('#ORDER_PROP_4').val();
var val_city=$('#ORDER_PROP_6').val();
var val_tarea=$('#ORDER_PROP_7').val();
//console.log(val_zip);
//console.log(val_city);
//console.log(val_tarea);
//if(value_bool==0)
if(val_zip=='eee123' || val_city=='eee123' || val_tarea=='eee123' )
{
//console.log('2222');
//console.log(value);
//console.log(value_leng);
//console.log(select_index);
return false;
}
else{
//console.log(value);
//console.log('1111');
submitForm('Y');
return false;
}
}
function submitForm(val)
{
if(val != 'Y')
document.getElementById('confirmorder').value = 'N';
var orderForm = document.getElementById('ORDER_FORM_ID_NEW');
jsAjaxUtil.InsertFormDataToNode(orderForm, 'order_form_div', false);
orderForm.submit();
return true;
}
/**
* ilya - ôóíêöèÿ çàïðåòà ââîäà íå ÷èñåë
*/
var only_num = function(event){
var key_pr=event.which;
if( key_pr!=8 && key_pr!=0 && (key_pr<48 || key_pr>57))
{
//event.target.value=event.target.value; // 'array'
return false;
}
}
$(document).ready(function(){
$('#ORDER_PROP_4').live("keypress",only_num);
var options = {
//target: '#output1', // target element(s) to be updated with server response
beforeSubmit:befSub // pre-submit callback
//success: showResponse // post-submit callback
// other available options:
//url: url // override for form's 'action' attribute
//type: type // 'get' or 'post', override for form's 'method' attribute
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
//clearForm: true // clear all form fields after successful submit
//resetForm: true // reset the form after successful submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
$('#but_zak').live("click",function(event) {
//submitForm('Y');
event.preventDefault();
// inside event callbacks 'this' is the DOM element so we first
// wrap it in a jQuery object and then invoke ajaxSubmit
$('#ORDER_FORM_ID_NEW').ajaxSubmit(options);
// !!! Important !!!
// always return false to prevent standard browser submit and page navigation
return false;
});
$('#index_confirm').live("click",function(event){
submitForm();
//console.log($('#fine').attr('value'));
});
//$('#fine').trigger('click');
//console.log($('#fine').attr('value'));
$('#buy').click(function(){
var ch = $('#buy').attr("checked")
if(!ch)
$('#but_zak').attr("disabled","disabled")
else $('#but_zak').removeAttr("disabled")
})
/*$('ul#left_menu > li > a').click(function(){
var ul = $(this).next('ul');
if(ul.size() != 0){
ul.slideToggle(200);
return false;
}
});
//$('div#left-column ul#left-menu li ul li a').unbind();
$('ul#left_menu > li > ul > li > a').click(function(){
var ul = $(this).next('ul');
if(ul.size() != 0){
ul.slideToggle(200);
return false;
}
});
//$('div#left-column ul#left-menu li ul li ul li a').unbind();
$('ul#left_menu > li > ul > li > ul > li > a').click(function(){
var ul = $(this).next('ul');
if(ul.size() != 0){
ul.slideToggle(200);
return false;
}
});*/
/*rarus add*/
if(!$('#left-column').length)
$('#middle-column-content').css('margin-left', 0);
if(!$('#right-column').length)
$('#middle-column-content').css('margin-right', 0);
$('.box-vote .vote').click(function(e){
var thisBox = $(this);
$.post('/ajaxVote.php',{vote:$(this).attr('id')}, function(data){
$(thisBox).parents('.box-vote').replaceWith(data);
});
e.stopPropagation();
});
/*END rarus add*/
});