function stopcopy() { return false;}
function startcopy() { return true;}
//document.ondragstart = stopcopy;
//document.onselectstart = stopcopy;
//document.oncontextmenu = stopcopy;
document.oncopy=stopcopy;
//document.onmousedown=stopcopy;

		$(document).ready(function(){
			$('#leftmenu li a, #topmenu a').textShadow();	
	
	
	$("#searchinput").attr("value", "Поиск ...");

var text = "Поиск ...";
 
$("#searchinput").focus(function() {
$(this).addClass("active");
if($(this).attr("value") == text) $(this).attr("value", "");
});
 
$("#searchinput").blur(function() {
$(this).removeClass("active");
if($(this).attr("value") == "") $(this).attr("value", text);
});




  });
 //////////////////////////////////////////
 


//////////////////////////////////////////

	function desaturate(img) {
		var img2 = Pixastic.process(img, "desaturate");
		img2.onmouseover = function() {
			img2 = Pixastic.revert(this);
		}
	}
	
//////////////////////////////////////////

	
	    $(window).load(function() {
        $('#slider').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:3000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:false, //Next & Prev
        directionNavHide:false, //Only show on hover
        controlNav:true, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs

        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.8
    });
    });
	
	//function animateDiv(){ $('#order').animate({ "height": "toggle" }, 600 ); } 
	

        $(document).ready(function() { 
		
		
	$("#rec").validate({
		   errorLabelContainer: "#messageErrorRecall",
   			wrapper: "li",
		rules: {
			'recall[fio]': {
				required: true,
				minlength: 3
			},
			'recall[phone]': {
				required: true,
				minlength: 3
			}
		},
		messages: {
			'recall[fio]': "Укажите ФИО",
			'recall[phone]': "Укажите телефон"
		}
	});
	
	$("#submail").validate({
		   errorLabelContainer: "#messageErrorSub",
   			wrapper: "li",
		rules: {
			po4ta: {
				required: true,
				email: true
			}
		},
		messages: {
			po4ta: "Укажите E-mail"
		}
	});
	
	$('#rec').ajaxForm({ 
        target: '#datarecall', 
        success: function() { 
            $('#datarecall').fadeIn('slow'); 
        } 
    }); 	
	
	
		$('#submail').ajaxForm({ 
        target: '#submaildiv',  
        success: function() { 
            $('#submaildiv').fadeIn('slow'); 
        } 
    }); 
	
 	function opl() {
		
		if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
		}else{
			$(".urtr").hide();
		}
			
	}
	

	
	
	$("#ordform").validate({
		   errorLabelContainer: "#messageError",
   			wrapper: "li",
		rules: {
			'order[fio]': {
				required: true,
				minlength: 3
			},
			'order[oplata]': {
				required: true
			},
			'order[phone]': {
				required: true
			},
			'order[kak]': {
				required: true
			},
			'order[otch]': {
				required: true,
				email: true
			},
			'order[urlico]': {
				required: function(element) {
					if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
			return true;
		}else{
			$(".urtr").hide();
			return false;
		}       
      },
				minlength: 4
			},
			
			'order[uradres]': {
				required: function(element) {
					if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
			return true;
		}else{
			$(".urtr").hide();
			return false;
		}       
      }
			},
			
			'order[urpochta]': {
				required: function(element) {
					if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
			return true;
		}else{
			$(".urtr").hide();
			return false;
		}       
      }
			},
			
			'order[inn]': {
				required: function(element) {
					if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
			return true;
		}else{
			$(".urtr").hide();
			return false;
		}       
      },
				rangelength: [10, 10],
      			digits: true
			},
			
			
			'order[kpp]': {
				required: function(element) {
					if ( $("#opur").is(":checked") ) {
			$(".urtr").show();
			return true;
		}else{
			$(".urtr").hide();
			return false;
		}       
      },
				rangelength: [9, 9],
      			digits: true
			}
			
			
			
		},
		messages: {
			'order[oplata]': "Выберите форму оплаты",
			'order[fio]': {
				required: "Укажите ФИО",
				minlength: "ФИО должно быть более 2 символов"
			},
			'order[urlico]': {
				required: "Укажите юридическое название",
				minlength: "Юридическое название должно быть более 3 символов"
			},
			'order[uradres]': "Укажите юридический адрес",
			'order[urpochta]': "Укажите почтовый адрес",
			'order[inn]': {
				required: "Укажите ИНН",
				rangelength: "ИНН должно содержать 10 цифр",
				digits: "ИНН должно содержать только цифры"
			},
			'order[kpp]': {
				required: "Укажите КПП",
				rangelength: "КПП должно содержать 9 цифр",
				digits: "КПП должно содержать только цифры"
			},
			'order[otch]': "Укажите рабочий e-mail",
			'order[phone]': "Укажите телефон",
			'order[kak]': "Укажите как вы узнали о нас"
		}
	});

	
	
	$('#ordform').ajaxForm({ 
        target: '#forma',  
        success: function() { 
            $('#forma').fadeIn('slow'); 
        } 
    }); 
	
	
	
	$("#voprform").validate({
		   errorLabelContainer: "#messageErrorVopr",
   			wrapper: "li",
		rules: {
			'vopr[fio]': {
				required: true,
				minlength: 3
			},
			'vopr[phone]': {
				required: true
			},
			'vopr[vopros]': {
				required: true
			},
			'vopr[otch]': {
				required: true,
				email: true
			}		
		},
		messages: {
			'vopr[fio]': {
				required: "Укажите ФИО",
				minlength: "ФИО должно быть более 2 символов"
			},
			'vopr[otch]': "Укажите рабочий e-mail",
			'vopr[phone]': "Укажите телефон",
			'vopr[vopros]': "Укажите описание заказа или ваш вопрос"
		}
	});
	
	
	$('#voprform').ajaxForm({ 
        target: '#vopros',  
        success: function() { 
            $('#vopros').fadeIn('slow'); 
        } 
    }); 
	
	
        }); 

	
	$(document).ready(function() {
	
	$("a#inline").fancybox({
		'hideOnOverlayClick': true
	});
	
	$("a#ord").fancybox({
		'hideOnOverlayClick': true
	});
	
	        $(function(){
            $("#myScroll1").mbScrollable({
                dir:"vertical",
                width:228,
                height:312,
                elementsInPage:2,
                elementMargin:6,
                slideTimer:700,
                autoscroll:true,
                scrollTimer:3000
            });

        });



     
    $('#nav li').hover(
        function () {
            //show its submenu
            $('ul', this).show();
 
        },
        function () {
            //hide its submenu
            $('ul', this).hide();        
        }
    );
	
	    $('#nav2 li').hover(
        function () {
            //show its submenu
            $('ul', this).show();
 
        },
        function () {
            //hide its submenu
            $('ul', this).hide();        
        }
    );



	
});

