function setGender(gender)
{
	if (gender.id == 'gender_option_female' || gender.id == 'gender_option_female_active')
	{
		gender.id = 'gender_option_female_active';
		document.getElementById('gender_option_male_active').id = 'gender_option_male';
	}
	else
	{
		gender.id = 'gender_option_male_active';
		document.getElementById('gender_option_female_active').id = 'gender_option_female';
	}
}



	$(document).ready(function() {

				$('input:checkbox').checkbox({cls:'jquery-safari-checkbox'});
			});



var lastOpenedNode;
function showSubmenu(caller)
{

	var rootNode = caller.parentNode.parentNode;

	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

	var menuBlock;

	if (isIE)
		menuBlock = rootNode.childNodes[0];
	else
		menuBlock = rootNode.childNodes[1];
		
	

	if (menuBlock.className != 'submenu_block')
	{
		menuBlock = caller.parentNode.childNodes[2];
	}

	lastOpenedNode = menuBlock;
	if (menuBlock.style.display == 'block')
	{
		$("#dim").fadeOut();
		menuBlock.style.display = 'none';
		
		
	}
	else
	{

	

		// right and left margins
		var rightSpace = ($(document).width() - 980)/2;
		
		$("#dim").fadeIn();
		menuBlock.style.display = 'block';


		var pp = $(menuBlock);
		var pos = $(menuBlock).offset();


		var sebMenuLeft = pos.left;


		var rightPoint = 701 + sebMenuLeft;
		var maxAllowedRightPoint = 980 + rightSpace - 10;

		if (rightPoint > maxAllowedRightPoint)
		{
			if (pp.css('margin-left') == "0px")
			{
				var marginNeg = rightPoint - maxAllowedRightPoint + 10;
				pp.css('margin-left', '-'+marginNeg+'px');
				pp.find('.curner_block').css('margin-left', marginNeg+'px');
			}
		}


	}
}



$(document).ready(function() {
	$("#dim").click(function () {
		$("#dim").fadeOut();
		lastOpenedNode.style.display = 'none';
	});

    	$("#dim").css("height", $(document).height());

});

$(window).bind("resize", function(){
	$("#dim").css("height", $(window).height());
});
