﻿var podm;
var timerOnce;

$(document).ready(function()
{
	$('input').checkBox();
	$('.my-dropdown').sSelect();
	
	$(".cor").corner();
	$(".corne").corner();
	$(".other_t").corner();
	
	$('.inp_corner').corner({tl: { radius: 2 },tr: { radius: 2 },bl: { radius: 2 },br: { radius: 2 }, antiAlias: true, autoPad: true, validTags: ["div"]});
	$(".procent").corner({tl: { radius: 2 },tr: { radius: 2 },bl: { radius: 2 },br: { radius: 2 }, antiAlias: true, autoPad: true, validTags: ["div"]});
	$(".ric").corner({tl: { radius: 4 },tr: { radius: 4 },bl: { radius: 4 },br: { radius: 4 }, antiAlias: true, autoPad: true, validTags: ["div"]});

		$("input#svoii").focus(function () {
               $('input.v123').checkBox('changeCheckStatus', false);
       });

	   
 $("input[name='radio_r']").click( function() { 
if ($(this).attr("id") == "c1") {
$('.inv_hov').addClass("none");
$("input[name='j111']").parent().css({'background-color':'#e6e6e6'}); 
$("input[name='j111']").attr('disabled', 'disabled');
$("input[name='j112']").parent().css({'background-color':'#ffffff'});  
$("input[name='j113']").parent().css({'background-color':'#ffffff'});  
$("input[name='j114']").parent().css({'background-color':'#ffffff'});  
$("input[name='j115']").parent().css({'background-color':'#ffffff'});  
$("select[name='j116']").parent().removeClass("gr_sel");
$("select[name='j116']").parent().parent().css({'background-color':'#ffffff'});
$("input[name='j117']").parent().css({'background-color':'#ffffff'}); 
$("input[name='j112']").removeAttr('disabled');
$("input[name='j113']").removeAttr('disabled');
$("input[name='j114']").removeAttr('disabled');
$("input[name='j115']").removeAttr('disabled');
$("input[name='j116']").removeAttr('disabled');
$("input[name='j117']").removeAttr('disabled');
} else if ($(this).attr("id") == "c2") {
$('.inv_hov').removeClass("none");
$("input[name='j112']").parent().css({'background-color':'#e6e6e6'});  
$("input[name='j113']").parent().css({'background-color':'#e6e6e6'});  
$("input[name='j114']").parent().css({'background-color':'#e6e6e6'});  
$("input[name='j115']").parent().css({'background-color':'#e6e6e6'});  
$("select[name='j116']").parent().addClass("gr_sel");
$("select[name='j116']").parent().parent().css({'background-color':'#e6e6e6'});
$("input[name='j117']").parent().css({'background-color':'#e6e6e6'}); 
$("input[name='j112']").attr('disabled', 'disabled');
$("input[name='j113']").attr('disabled', 'disabled');
$("input[name='j114']").attr('disabled', 'disabled');
$("input[name='j115']").attr('disabled', 'disabled');
$("input[name='j116']").attr('disabled', 'disabled');
$("input[name='j117']").attr('disabled', 'disabled');
$("input[name='j111']").parent().css({'background-color':'#ffffff'});
$("input[name='j111']").removeAttr('disabled');
}
});

	   
       $("input[name='f32']").click( function() {
               if ($(this).attr("checked")) {
                       $("input[name='f29']").parent().css({'background-color':'#e6e6e6'});
                       $("input[name='f31']").parent().css({'background-color':'#e6e6e6'});
                       $("select[name='f30']").parent().addClass("gr_sel");
                       $("select[name='f30']").parent().parent().css({'background-color':'#e6e6e6'});
               } else {
                       $("input[name='f29']").parent().css({'background-color':'#ffffff'});
                       $("input[name='f31']").parent().css({'background-color':'#ffffff'});
                       $("select[name='f30']").parent().removeClass("gr_sel");
                       $("select[name='f30']").parent().parent().css({'background-color':'#ffffff'});
               }
       });
	   
				$(document).click(function(){
					$('.vhod').css({'display':'none'}); 
					$('.tel').css({'display':'none'}); 
					$('.imege_wiver').css({'display':'none'}); 
					$('.t_question').css({'display':'none'}); 
					$('.t_changes').css({'display':'none'}); 
					$('.t_error').css({'display':'none'}); 
					$('.resultat').css({'display':'none'}); 
					$('.mapa').css({'display':'none'}); 
				});
				$(".vhod").click(function(e){
					e.stopPropagation();
				});
				$(".tel").click(function(e){
					e.stopPropagation();
				});
				$(".imege_wiver").click(function(e){
					e.stopPropagation();
				});
				$(".t_question").click(function(e){
					e.stopPropagation();
				});
				$(".t_changes").click(function(e){
					e.stopPropagation();
				});								
				$(".t_error").click(function(e){
					e.stopPropagation();
				});
				$(".resultat").click(function(e){
					e.stopPropagation();
				});
				$(".mapa").click(function(e){
					e.stopPropagation();
				});
				
	 
	
	$('.menu2_item').click(function(e) {
        var id = $(this).attr('name');  
		$('.activ').removeClass("activ");
		$(this).addClass("activ");
		
		$('.box1').css({'display':'none'}); 		
		$('.box2').css({'display':'none'});  		
		$('.box3').css({'display':'none'});  
		$(id).css({'display':'block'});
    }); 
	
	$(".s_input").focus(function () {
         $(this).val("");
    });
	
	$('.tbut').click(function(e) {
		e.preventDefault();  
        var id = $(this).attr('name');  
		$('.curent').removeClass("curent");
		$(this).addClass("curent");
		
		$('.main_properties').addClass("none");
		$('.all_properties').addClass("none");
		$('.super_properties').addClass("none");		
		$(id).removeClass("none");
    }); 
	
	$('.kee > a').click(function(e) {
		e.preventDefault();  
		e.stopPropagation();
		$('.vhod').css({'display':'block'}); 
	});
	$('.header_top_r > a').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.tel').css({'display':'block'}); 
	});
	
	$('.big_telephone > a').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.tel').css({'display':'block'}); 
	});
	
	$('.zoom').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.imege_wiver').css({'display':'block'}); 
	});
	
	
	$('#question').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.t_question').css({'display':'block'}); 
	});
	$('#error').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.t_error').css({'display':'block'}); 
	});
	$('#change').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.t_changes').css({'display':'block'}); 
	});	
	$('.results').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.resultat').css({'display':'block'}); 
	});
	$('.shema').click(function(e) {
		e.preventDefault(); 
		e.stopPropagation();
		$('.mapa').css({'display':'block'}); 
	});
/*	
	$('.s_button').click(function(e) {
		e.preventDefault();  
		$('.golos').css({'display':'none'}); 
		$('.resultat2').css({'display':'block'}); 
	});
*/	
	$('.vopros > a').click(function(e) {
		e.preventDefault();  
		if ($(this).parent().parent().children(".ansver").hasClass("none")) { 
			$(this).parent().parent().children(".ansver").removeClass("none");
		} else {
			$(this).parent().parent().children(".ansver").addClass("none");
		}
	});
	$('.checkbox').click(function(e) {
		if ($(this).hasClass("false")) { 
			$(this).removeClass("false");
			$(this).parent().parent().children("td").removeClass("disable");
		} else {
			$(this).addClass("false");
			$(this).parent().parent().children("td").addClass("disable");
		}
	});
	
	$('.za1 > a').click(function(e) {
		e.preventDefault();  
		if ($(this).parent().hasClass("minus")) { 
			$(this).parent().removeClass("minus");
			$(this).parent().parent().children(".zakaz").addClass("none");
		} else {
			$(this).parent().addClass("minus");
			$(this).parent().parent().children(".zakaz").removeClass("none");
		}
	});
	
	
	/*$('.cat > a').click(function(e) {
		e.preventDefault();  
		if ($(this).parent().parent().children(".bloc_vopros2").hasClass("none")) { 
			$(this).parent().parent().children(".bloc_vopros2").removeClass("none");
		} else {
			$(this).parent().parent().children(".bloc_vopros2").addClass("none");
		}
	});*/
	
	$('.gr_tabl > tbody > tr').mouseover(function(e) {
			$(this).addClass("gray_tr");
	 });
	$('.gr_tabl > tbody > tr').mouseout(function(){
			$(this).removeClass("gray_tr");
	 });
	
	$('.iks').click(function(e) {
		$(this).parent().parent().parent().parent().css({'display':'none'}); 
	});
	
	
	$('.pod').bind("mouseenter",function(){
        podm = $(this).attr('name');  
		$('.podmenu').css({'display':'none'});  
		window.clearTimeout(timerOnce);
		$(podm).css({'display':'block'});  
    });  
	$('.pod').bind("mouseleave",function(){
		timerOnce = window.setTimeout(function () {
			$(podm).css({'display':'none'});  
		},100);
    }); 
	$('.podmenu').bind("mouseleave",function(){
		$(podm).css({'display':'none'});  
    });  
	$('.podmenu').bind("mouseenter",function(){
		window.clearTimeout(timerOnce);
		$(podm).css({'display':'block'}); 
		
    });
	
	
	$("input[name='radio_v']").click( function() {
	 	if ($(this).val()=='unhide') {
			$('#vakancii').removeClass("none");
		} else {
			$('#vakancii').addClass("none");
		}
	});
	
	
});



function trim( str, charlist ) {    
    charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');
    var re = new RegExp('^[' + charlist + ']+|[' + charlist + ']+$', 'g');
    return str.replace(re, '');
}

function numbersonly(myfield, e, dec) {
  var key;
  var keychar;

  if (window.event)
    key = window.event.keyCode;
  else if (e)
    key = e.which;
  else
    return true;
  keychar = String.fromCharCode(key);

  // control keys
  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
    return true;
  // numbers
  else if ((("0123456789").indexOf(keychar) > -1))
    return true;

  // decimal point jump
  else if (dec && (keychar == ".")) {
    myfield.form.elements[dec].focus();
    return false;
  } else
    return false;
}