$(document).ready(function() {
	
	$("a.colorbox").colorbox({opacity: "0.85"});
	$(".b-menu p.withsub a").click( function() {
		var sh = $(this).hasClass("shob");
		if ( sh )
		{
			$(this).removeClass("shob");
			$(this).parent("p").next("div.sub").slideUp("fast");
		}
		else
		{
			$(".shob").removeClass("shob");
			$("div.sub:visible").slideUp("fast");
			$(this).addClass("shob");
			$(this).parent("p").next("div.sub").slideDown("fast");	
		}
		return false;
	});		
	$(".shownextp").parents("p").next("div").hide();
	$(".shownextp").click( function() {
		$(this).parents("p").next("div").slideToggle("middle");
		return false;
	});	
	
	/* Подписка */
	$("#f1").submit(function() { 
		$("#pe1").slideDown();
		$(this).ajaxSubmit({ 
			target:	"#pe1",    
			url:	"/proc.php?subscribe",
			type:	"post"
		}); 
		return false; 
	}); 
	$("#f2").submit(function() { 
		$("#pe2").slideDown();
		$(this).ajaxSubmit({ 
			target:	"#pe2",    
			url:	"/proc.php?unsubscribe",
			type:	"post"
		}); 
		return false; 
	}); 
	
	/* Форма на мыло */
	$("#form2mail").submit(function() { 
		$("#form2mail_target").slideDown();
		$(this).ajaxSubmit({ 
			target:	"#form2mail_target",    
			url:	"/proc.php?form2mail",
			type:	"post"
		}); 
		return false; 
	});
	
});

function InputHelperIn(obj,text){if ( obj.value == text ){$(obj).css({ color: '#000' }).val('');}}function InputHelperOut(obj,text){if ( obj.value == '' || obj.value == text ){$(obj).css({ color: '#b3b3b3' }).val(text);}}function InputHelperCreate(obj,text){$(obj).bind( 'focus', function (){InputHelperIn (this,text);}).bind( 'blur', function (){InputHelperOut (this,text);});InputHelperOut(obj,text );}
