/*
Fx.Slide=new Class({
    Extends:Fx,
    options:{
        mode:"vertical"
    }
    ,initialize:function(B,A){
        this.addEvent("complete",function(){
            this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);
            if(this.open&&Browser.Engine.webkit419){
                this.element.dispose().inject(this.wrapper);
            }
        }
        ,true);
        this.element=this.subject=$(B);
        this.parent(A);
        var C=this.element.retrieve("wrapper");
        this.wrapper=C||new Element("div",{
            styles:$extend(this.element.getStyles("margin","position"),{
                overflow:"hidden"
            })
        }).wraps(this.element);
        this.element.store("wrapper",this.wrapper).setStyle("margin",0);
        this.now=[];
        this.open=true;
    }
    ,vertical:function(){
        this.margin="margin-top";
        this.layout="height";
        this.offset=this.element.offsetHeight;
    }
    ,horizontal:function(){
        this.margin="margin-left";
        this.layout="width";
        this.offset=this.element.offsetWidth;
    }
    ,set:function(A){
        this.element.setStyle(this.margin,A[0]);
        this.wrapper.setStyle(this.layout,A[1]);
        return this;
    }
    ,compute:function(E,D,C){
        var B=[];
        var A=2;
        A.times(function(F){
            B[F]=Fx.compute(E[F],D[F],C);
        });
        return B;
    }
    ,start:function(B,E){
        if(!this.check(arguments.callee,B,E)){
            return this;
        }
        this[E||this.options.mode]();
        var D=this.element.getStyle(this.margin).toInt();
        var C=this.wrapper.getStyle(this.layout).toInt();
        var A=[[D,C],[0,this.offset]];
        var G=[[D,C],[-this.offset,0]];
        var F;
        switch(B){
            case"in":
                F=A;
                break;
            case"out":
                F=G;
                break;
            case"toggle":
                F=(this.wrapper["offset"+this.layout.capitalize()]==0)?A:G;
                //alert(G)
        }
        return this.parent(F[0],F[1]);
    }
    ,slideIn:function(A){
        return this.start("in",A);
    }
    ,slideOut:function(A){
        return this.start("out",A);
    }
    ,hide:function(A){
        this[A||this.options.mode]();
        this.open=false;
        return this.set([-this.offset,0]);
    }
    ,show:function(A){
        this[A||this.options.mode]();
        this.open=true;
        return this.set([0,this.offset]);
    }
    ,toggle:function(A){
        return this.start("toggle",A);
    }
});

window.addEvent('domready', function(){
    var elsSlide = $('menu').getElements('div[id^=vertical_slide]');
    for(i=0;i<elsSlide.length;i++){
        myVerticalSlide = new Fx.Slide(elsSlide[i].id);
        myVerticalSlide.hide();
    }
});

function toggleMenu(id){
    aElem = $('v_toggle'+id);
    
    myVerticalSlide = new Fx.Slide('vertical_slide'+id);
    aElem.addEvent('click', function(e){
        e.stop();
        myVerticalSlide.toggle();
    });
}
*/
/* Контекстные меню раздичного рода. */

function submenu(id, hideObjects, hideByPrefix){
    if($(id).getStyle('display')=="none") $(id).setStyle("display", "block"); else $(id).setStyle("display", "none");
    if(hideObjects){
        var els = new Array();
        els = hideObjects.split(",");
        for(i=0;i<els.length;i++){
            $(els[i]).setStyle("display", "none");
        }
    }
    if(hideByPrefix){
        var els = $('menutree').getElements('div[id^='+hideByPrefix+']');
        for(i=0;i<els.length;i++){
            if(els[i].id!=id){
                $(els[i]).setStyle("display", "none");
            }
        }
    }
}

function active(el, id, cats){
    Cookie.dispose('cat');
    Cookie.write('cat', id, {path:'/'});
}

function changeImage(src, pid, id){
    $('mainImage').src = src;
    $('mainImage').width = 250;
    var json_request = new Request.JSON({url: '/utils/ajax/changeImage.php?pid='+pid+'&id='+id, onSuccess: update}).get();
}

function update(responseJSON, responseText){
    $('changeImage').innerHTML = responseJSON.photos;
    $('mainImage').getParent().onclick = function(event){window.open("/utils/show.php?src="+responseJSON.show+"&alt=image", "_blank", "width="+responseJSON.showWidth+",height="+responseJSON.showHeight+",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no"); return false;};
}

/* Order Form */

function checkValue(el, value){
    if(el.value=='' || el.value==value){
        el.value = value;
    }
}

function goOrder(){
if($('name_').value!=='' && $('name_').value!=='Как к Вам обращаться'){
	
		if($('phone').value!=='' && $('phone').value!=='Телефон'){
			if($('delivery').value!=='' && $('delivery').value!=='Адрес доставки'){
				if($('agree').checked==true){
					
					if($('city_delivery').value!=='0'){
					
						if($('card_is').checked==true){
							
						$('orderForm').submit();
						
						}else{
							
							if($('card_no').checked==true){
							$('orderForm').submit();
							}else{
							alert('Пожалуйста, отметьте есть ли у Вас наша карта');
							}
							
						}
					
					}else{
					alert('Пожалуйста выберите город доставки');
					}
					
				}else{
				alert('Поставьте галочку, что Вы ознакомлены с условиями доставки');	
				}
			}else{
			alert('Заполните пожалуйста поле "Адрес доставки"');	
			}
		}else{
		alert('Заполните пожалуйста поле "Телефон"');	
		}
	
}else{
alert('Заполните пожалуйста поле "ФИО"');	
}

}

function getCats(arr){
    var objs = new Array();
    for (i=0; i<cats.length; i++){
        objs[i] = "v_toggle"+cats[i];
    }
    return objs;
}

