cur_faq = 0;
faq_animation_speed = 500;
loading=0;

function toggle_faq(f)
{
	if(cur_faq != 0)
	{
		if(f==cur_faq){
			$('#faqd_'+f).show(faq_animation_speed);
			$('#faq_'+f).hide(faq_animation_speed);
			cur_faq = f;
		}else{
		$('#faqd_'+cur_faq).show(faq_animation_speed);
		$('#faq_'+cur_faq).hide(faq_animation_speed);
		$('#faqd_'+f).hide(faq_animation_speed);
		$('#faq_'+f).show(faq_animation_speed);
		cur_faq = f;
		}
	}else{
			$('#faqd_'+f).hide(faq_animation_speed);
			$('#faq_'+f).show(faq_animation_speed);
			cur_faq = f;
	}
	
}

function getfaq(page){
	$.post('/base/faq/get', {'page':page}, function (data){
		$('#faq_content').html(data);
		cur_faq = 0;
	})
}

function get_content(url)
{
	if(loading == 1) return false;
	loading = 1;
	$("#slicing_table").fadeOut(300, function(){
		$("#loading").fadeIn(300, function(){
			$.post(url, {'ahah':1},function(data){
				$("#content").html(data);
				$("#loading").fadeOut(300, function(){
					$("#slicing_table").fadeIn(300, function(){ loading=0; return false; });
				});
				
			});
		});
		
	});
}


function get_content2(url)
{
	if(loading == 1) return false;
	loading = 1;
	$("#slicing_table").fadeOut(300, function(){
		$("#loading").fadeIn(300, function(){
			$.post(url, {'ahah':1},function(data){
				$("#content").html(data);
				$("#loading").fadeOut(300, function(){
					$("#slicing_table").fadeIn(300, function(){ 
						//Get our elements for faster access and set overlay width
						var div = $('div.sc_menu'),
						ul = $('ul.sc_menu'),
						// unordered list's left margin
						ulPadding = 15;
						
						//Get menu width
						var divWidth = div.width();
						
						//Remove scrollbars
						div.css({overflow: 'hidden'});
						
						//Find last image container
						var lastLi = ul.find('li:last-child');
						
						//When user move mouse over menu
						div.mousemove(function(e){
						
						//As images are loaded ul width increases,
						//so we recalculate it each time
						var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
						
						var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
						div.scrollLeft(left);
						});
						
						loading=0;
						return false;
					});
				});
			});
		});
		
	});
}

function show_pimage(img)
{
	$('#image_conteiner').html('<img src="'+img+'" border="0" />');
	return 0;
}

function load_img(cont,img)
{
	$("#"+cont + " img").attr({ 
		src: img
	});
	return false;
	//alert("#"+cont).html());
}
