/*
	This script is used by the "Good To Know" box which is active in the Business Shop, Broadband Shop, Add On Page and the Tab Campaign Page
*/

var GTK = 
{
	_activeId:null,
	
	Init:function()
	{
		// Position the popups and hook on event on the browser-resize
		GTK.PositionGTKPopups();
		
		$j(window).bind("resize", function() {
			GTK.PositionGTKPopups();
		});
		
		// For the FAQ's in the GTK-box
		$j('.faq_questions_gtk').children().each(function() {
			
		});		
	},
	
	FirePopup:function(id)
	{
		if(GTK._activeId != null)
		{
			jQuery('#info_popup' + GTK._activeId).hide();
		}
		
		jQuery('select').css('visibility', 'hidden');
		GTK._activeId = id;
		jQuery('#info_popup' + id).show();		
	},
	
	ClosePopup:function()
	{
		jQuery('select').css('visibility', 'visible');
		jQuery('#info_popup' + GTK._activeId).hide();
		GTK._activeId = null;
	},
	
	Toggle:function(x)
	{
		if($j(x).hasClass('active'))
			$j(x).removeClass('active');
		else
			$j(x).addClass('active');
		
		// Get answer and toggle
		var y = $j(x).children('.answer_holder');
		
		if($j(y).hasClass('hide'))
			$j(y).removeClass('hide');
		else
			$j(y).addClass('hide');
	},	

	PositionGTKPopups:function()
	{
		$j('.info_popup').css("left", $j('.main_top').offset().left + 60);
		$j('.info_popup').css("top", $j('.info_box_header').offset().top + 35);
	}
}

var $j = jQuery.noConflict();
$j(document).ready(function () {
	GTK.Init();
});
