$(document).ready(function(){
	$("tr[@id^=help]").hide();
	$("*[@id^=button]").bind("click",function(){
		var shit = $(this).attr('id').replace("button","");
		if($("#help" + shit).is(":hidden"))
		{
			$("#help" + shit).show();
			$(this).val("Скрыть");
		}
		else
		{
			$("#help" + shit).hide();
			$(this).val("Помощь");
		}	
	})
	
	$("#rasp").bind("click",function(){
		$("#clinks").hide();
		self.print();
		$("#clinks").show();
		
	});
	
	$("#calcform").bind("submit",function(){
		
		open('','_form_win','width=770,height=500');
		return true;
	})
	
	$("a[@id^=a]").each(function(){
		$(this).bind("mouseover",function(){
			var i = $(this).attr('id').replace("a","");
			$('#img' + i).attr('src','/images/dot2.gif');
			$('#dot' + i).css('background-color','#e60005');
			$('#menu' + i).css('background-color','#e60005');
		})
	});

		$("a[@id^=a]").each(function(){
		$(this).bind("mouseout",function(){
			var i = $(this).attr('id').replace("a","");
			$('#img' + i).attr('src','/images/dot.gif');
			$('#dot' + i).css('background-color','#FFF');
			$('#menu' + i).css('background-color','#FFF');
		})
	});

	$("#otpr").bind("click",function(){
		var subj = 'Расчет площади для покупки сайдинга Kaycan';
		var bod = $("#calcres").html();

		bod = bod.replace(/<TR>/gi,"");
		bod = bod.replace(/<\/TR>/gi,"");
		bod = bod.replace(/<TD>/gi,"");
		bod = bod.replace(/<\/TD>/gi,"");
		bod = bod.replace(/<\/TH>/gi,"");
		bod = bod.replace(/<TH noWrap>/gi,"");
		bod = bod.replace(/<B>/gi,"");
		bod = bod.replace(/<\/B>/gi,"");
		bod = bod.replace(/<FONT color=red>/gi,"");
		bod = bod.replace(/\*<\/FONT>/gi,"");
		bod = bod.replace(/<TBODY>/gi,"");
		bod = bod.replace(/<\/TBODY>/gi,"");
		bod = bod.replace(/шт\./gi,"шт."+escape("\n"));
		var sh = new RegExp("\"","gi");
		bod = bod.replace(sh,"");


		bod = bod.replace(/[\s]/g,"%20");
		$('<a href="mailto:info@kaycan.ru?subject=' + subj.replace(/[\s]/g,"%20") + '&body='+bod+'">asd</a>').appendTo('body').get(0).click();
//		$(this).attr('href',otpr_href);
		return true;
	})
	
});
