﻿$(document).ready(function(){
	var obj = $('.block_tabs .title');
	var total = obj.find('li').length;
	obj.find('li').not('.current').each(function (i) {
        $(this).css('z-index', total-i)
      });
});
function switchTabs(tabBlockId, current){
	var total = $('#'+tabBlockId+current).find('li').length;
	for (i=0; i<total; i++){
		$('#'+tabBlockId+i).hide()
	}
	$('#'+tabBlockId+current).show();
	return false;
}
$.fn.alignCenter = function() {
	var marginLeft = - $(this).width()/2 + 'px';
	return $(this).css('margin-left', marginLeft);
};

function showPopUp(popUpBlock){
	if($.browser.msie){
		$('#opaq').height($(document).height()).toggleClass('hidden');
	}
	else{
		$('#opaq').height($(document).height()).toggleClass('hidden').fadeTo('fast', 0.7);
	}
	$('#'+popUpBlock).alignCenter().toggleClass('hidden').css({'z-index': 5100});
	return false;	
}	

function closePopUp(popUpBlock){
	$('#opaq').toggleClass('hidden').removeAttr('style');
	$('#'+popUpBlock).toggleClass('hidden');
	return false;
}