$(document).ready(function(){
	//$(".draggable").css({cursor: "move"}).draggable();
	$("#rightMenu li.empty > a").click(function(){
			var p = $(this).parent()
			//alert(p.html());
			if(p.is('.opened')){
				p.removeClass('opened');
			}else{
				p.addClass('opened');
			}
			return false;
		}
	);
	
	// Преключатели
		$("#cText dt.switcher")
			.hover( function(){ $(this).addClass('hover'); }, function(){$(this).removeClass('hover');} )
			.each(function(i){					
					var t = $(this);
					if( ! t.is('.selected') ){
						t.next('dd').hide();
					}
					
					t.click(function(){
					if( t.is('.selected')){
						t.next('dd').hide();
						t.removeClass('selected');
						//alert( this.className );
					}else{
						t.next('dd').show();
						t.addClass('selected');
						//alert( this.className );
					}				
				});
			});
		
		var switcher_id = window.location.hash;
		if(switcher_id){
			$("dt"+switcher_id).click();
		} 
		
		if( window.location.hash.match(/^#select-.+/) ){
			var sid = window.location.hash.replace('#select-', '');
			$("#"+sid).addClass('current');
		}
		
	// Версия для печати
	$('<div id="printversion" style="text-align: right; padding-top: 1.5em">[ <a href="#" onclick="printVersion(); return false;">Версия для печати</a> ]</div>').appendTo("#cText");
		
});

function printVersion()
{
	var txt = $("#cText").html();
	var title = document.title
	var url = document.location.href;

	var win = window.open();

	with(win.document)
	{
		open();
		write('<html><head><title>');
		write(title);
		write('</title>');
		write('<link rel="stylesheet" type="text/css" media="all" href="/_css/printversion.css" />');
		write('</head><body>');
		write('<div id="header">');
		write('<div id="url">'+ url +'</div>');
		write('<div id="contact">');
		write('<b>Санкт-Петербург:</b>  (812) 448-33-94,  Санкт-Петербург, ул. Жуковского 10/2<br />');
		write('<b>Новосибирск:</b> (383) 201-15-25, (383) 220-19-06 Ул. Фрунзе, д. 5, Офис 439  <br />');
		write('<b>E-mail:</b> Info@iqconsultancy.ru ');
		write('</div></div>');
		write(txt);
		write('</body></html>');
		close()
	}
}