// JavaScript Document

function showLang (name) {
	if (document.getElementById(name).style.display == 'none') {
		document.getElementById(name).style.display = 'block';
		/*document.getElementById(name).style.height = '50px';*/
	} else if (document.getElementById(name).style.display == 'block') {
		document.getElementById(name).style.display = 'none';
	}
}
function getAnswer(faq_id,status)
{
/*	$('#answer_'+faq_id).css("display","block");*/
	if(status == 1) {
		$('#answer_'+faq_id).slideDown('fast');
		$('#a_'+faq_id).attr('onClick',"getAnswer('"+faq_id+"','2')");
	} else {
		$('#answer_'+faq_id).slideUp('fast');
		$('#a_'+faq_id).attr('onClick',"getAnswer('"+faq_id+"','1')");
	}
}

function menuLine()
{
	var menu = $('#horiz_nav');
	var items = $('#horiz_nav>li');
	var subItem = $('#horiz_nav>li>ul');
	var current = $('#horiz_nav>li[class="selected"]');
	var cur = $(current)[0] || $('.par_selected')[0];

	var setLeft = typeof(cur) !== 'undefined' ? cur.offsetLeft : 0;
	var setWidth = typeof(cur) !== 'undefined' ? cur.offsetWidth : 0;
	
	var line = $('#topMenuLine').css({
		left: setLeft,
		width: setWidth
	});
	if(typeof(cur) == 'undefined') {
		line.hide();
	}

	current.addClass('current');
	items.dequeue().each(function(){
		var me = $(this);
		me.mouseenter(function(){
			current.removeClass('current');
			line.stop().animate({
				left: me[0].offsetLeft,
				width: me[0].offsetWidth
			}, 'normal');
		});
	});
	menu.mouseleave(function(){
		line.stop().animate({
			left: setLeft,
			width: setWidth
		}, 'normal', function(){
			if(typeof(cur) == 'undefined') {
				line.hide();
			}
			current.addClass('current');
		});
	});
}

function centerSubMenu()
{
	var items = $('#horiz_nav>li');
	items.each(function(){
		var li = $(this);
		var ul = $(this).find('ul');
		//ul.css('left', '-' + ((ul.width()-li.width())/2) + 'px');
		ul.css('width', ul.width() + 'px');
	});
}
function showSubMenuHover() 
{
	var items = $('#horiz_nav>li');
	var itemsChild = $('#horiz_nav>li>ul>li');
	items.hover(function(){
		var ul = $(this).find('ul');
		ul.css('z-index',999);
		//ul.fadeIn('fast');
		ul.show();
		var ul = $(this).find('ul>li>ul');
		ul.hide();
		//ul.stop().animate({ bottom: '-' + (ul.height()+5) + 'px' }, 'normal');
	},
	function(){
		var ul = $(this).find('ul');
		ul.hide();
		//ul.stop().animate({ bottom: '13px' }, 'normal');
	});
	
	itemsChild.hover(function(){
		var ulChild = $(this).find('ul');
		ulChild.css('z-index',999);
		//ulChild.fadeIn('fast');
		
		ulChild.show();
		//ul.stop().animate({ bottom: '-' + (ul.height()+5) + 'px' }, 'normal');
	},
	function(){
		var ulChild = $(this).find('ul');
		ulChild.hide();
		//ul.stop().animate({ bottom: '13px' }, 'normal');
	});	
}
centerSubMenu();
showSubMenuHover();
$("a.lightbox").lightbox({
    fitToScreen: true
});
/*
$(menuLine);
$(centerSubMenu);
$(showSubMenuHover);
$('.rounded1').corner("4px");
$('.rounded5').corner("5px");
$('#pager span').corner("3px");
//$('.rounded10').corner("10px");
$('.rounded10').corner("round 7px").parent().css('padding', '2px').corner("round 7px")
$("#horiz_nav ul").corner("bottom 10px"); */