function reversCatalogImg(direction) 
{
	
}

function showStylePicture(styleid, goodid){
    $.get("/ajax/?action=getstylepicture&id=" + styleid, function(resp){
        $("#picture" + goodid + '_main').hide();
        $("#picture" + goodid).attr('src', resp).show();
    });
}

function showGoodPicture(goodid){
    $("#picture" + goodid + '_main').show();
    $("#picture" + goodid).hide();
}

function showBig(big, obj){

    var imgName = eval("big" + big);
    
    if (imgName.length != 0 && imgName != "undefined") {
        var pic = $(obj).parent().children(".foto");
        var des = $(obj).parent().children(".descr");
        var ico = $(obj).parent().children(".icons");
        
        $(des).hide();
        $(ico).hide();
        
        oldSrc = $(pic).attr("src");
        
        $(pic).css("height", "184px");
        $(pic).attr("src", imgName);
    }
}

function hideBig(big, obj){

    var imgName = eval("big" + big);
    
    if (imgName.length != 0 && imgName != "undefined") {
        var pic = $(obj).parent().children(".foto");
        var des = $(obj).parent().children(".descr");
        var ico = $(obj).parent().children(".icons");
        
        $(pic).css("height", "140px");
        $(pic).attr("height", "140");
        $(pic).attr("src", oldSrc);
        
        $(des).show();
        $(ico).show();
        
        oldSrc = "";
    }
}

function priceRecount(id, obj){
    var q = parseInt($(obj).val());
    var p = parseInt($('#hp_' + id).val());
    var tp = q * p;
    $('#p_' + id).text(tp);
}

function showHiddenPosititions(id, obj){
    if ($(obj).text() == 'Показать') 
        $(obj).text('Скрыть');
    else 
        $(obj).text('Показать');
    $('#positions' + id).slideToggle();
    return false;
}

$(document).bind("ready", main);

jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

function showCatPic(pic_id, obj){
    
    $(".cat_pic").removeClass("cat_pic_active");
    
    $(obj).addClass("cat_pic_active");
    $(obj).blur();

    $.get("/modules/quickAjax.php", { 'task': "getcatalogpicture", 'pid': pic_id }, function(data){
        if (data != "no") {        
            $("#pictureContainer").empty();
            $(data).appendTo($("#pictureContainer"));
        }
    });
    
//    return false;
}

function zoomPic(pic) {
	tb_show('', "/gallery/zoom/" + pic + "/?width=660&height=500");
	return false;
}

function main(){

	$('.sliderGallery').serialScroll({
					items:'li',
					offset:-150, //when scrolling to photo, stop 230 before reaching it (from the left)
					start:1, //as we are centering it, start at the 2nd
					duration:0,
					force:true,
					stop:true,
					lock:false,
					cycle:true, //don't pull back once you reach the end
					easing:'easeOutQuart', //use this easing equation for a funny effect
					jump: true //click on the images to scroll to them
	});
}