$(document).ready(function(e){

	//$('input[type=checkbox]').attr('checked','');
	//$('input[type=radio]').attr('checked','');

	$('.calc_step').click(function(){
		$(this).next().next().show('normal');
		$(this).next().show();
		$(this).hide();
	});
	$('.calc_step').hover(
		function(){ $(this).css('background', 'url(img/arrow_down1.gif) no-repeat 470px 50%'); },
		function(){ $(this).css('background', 'url(img/arrow_down.gif) no-repeat 470px 50%'); }
	);
	$('.act_calc_step').click(function(){
		$(this).next().hide('fast');
		$(this).prev().show();
		$(this).hide();
		x = $(this).next();
		$(".closemore", x).hide();
		$(".more", x).show();
		$(".more_info_block", x).hide();

		$(".closeexamples", x).hide();
		$(".examples", x).show();
		$(".examples_info_block", x).hide();

	});
	$('.act_calc_step').hover(
		function(){ $(this).css('background', 'url(img/arrow_up1.gif) no-repeat 470px 50%'); },
		function(){ $(this).css('background', 'url(img/arrow_up.gif) no-repeat 470px 50%'); }
	);

	//radio
	$('.radio_inp').click(function(){
		if( $(this).attr('checked') == true )
		{
			num = $(this).attr('num');
			$('.s'+num).css({'background-color':'#E9E9E9'});
			$(this).parent().css({'background-color':'#FF6600'});
		}
	});
	//

	//checkbox
	$('.check_inp').click(function(){
		if( $(this).attr('checked') == true )
			$(this).parent().css({'background-color':'#FF6600'});
		else $(this).parent().css({'background-color':'#E9E9E9'});
	});
	//


    
    //checkbox worktypes
    $('.check_worktype').click(function(){
        cell = $(this).parent().parent().next();
        num = $(this).attr("num");
        if( $(this).attr('checked') == true )
        {
            $(this).parent().css({'background-color':'#FF6600'});
            cell.css({'color':'#FF6600', 'font-weight':'bold'});
            $("#wtype"+num).show('fast');

        }
        else
        {
            $(this).parent().css({'background-color':'#E9E9E9'});
            cell.css({'color':'#666666', 'font-weight':'normal'});
            $("#wtype"+num).hide('fast');
        }
    });

    //checkbox worktypes on history back
    $('.check_worktype').each(function() {
        num = $(this).attr("num");
        if ($(this).attr('checked') == true && $("#wtype"+num).css('display') == 'none') {
//            document.location = document.location; //+'?rand='+Math.random()
            window.location.reload();
        }
    });



	$('.more').click(function()
	{
		num = $(this).attr('num');
		$('#more'+num).show('normal');
		$(this).hide();
		$('#bclosemore'+num).show();
	});
	$('.closemore').click(function()
	{
		num = $(this).attr('num');
		$('#more'+num).hide('normal');
		$(this).hide();
		$('#bmore'+num).show();
	});

	$('.examples').click(function()
	{
		num = $(this).attr('num');
		$('#examples'+num).show('normal');
		$(this).hide();
		$('#bcloseexamples'+num).show();
	});
	$('.closeexamples').click(function()
	{
		num = $(this).attr('num');
		$('#examples'+num).hide('normal');
		$(this).hide();
		$('#bexamples'+num).show();
	});

/*	$('.pic3').click(function()
	{
		num = $(this).attr('num');
		$('.exampic'+num).css({'border':'5px solid #92C2C7'});
		$(this).css({'border':'5px solid #FF6600'});
	});*/
	$('.pic3').hover(
		function(){ $(this).css({'border':'5px solid #FF6600'}); },
		function(){ $(this).css({'border':'5px solid #92C2C7'}); }
	);


	$('.b_order').hover(
		function(){ $(this).attr('src', 'img/b_order_site1.gif'); },
		function(){ $(this).attr('src', 'img/b_order_site.gif'); }
	);

	$('#b_send').hover(
		function(){ $(this).attr('src', 'img/b_send1.gif'); },
		function(){ $(this).attr('src', 'img/b_send.gif'); }
	);

});

function bookmarksite(title,url)
{
	/*if (window.sidebar && !window.opera) // firefox
	{
		window.sidebar.addPanel(title, url, "");
		return false;
	}
	else if(window.opera && window.print) // opera
	{
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}*/
	if(document.all && !window.opera)// ie
	{
		window.external.AddFavorite(url, title);
		return false;
	}

	return true;
}
