var AjaxURL = "";

function initAjaxURL(url) {
	AjaxURL = url;
}


function removeSideMenu() {
	$('#childPageMenuContainer').remove();
}


function initExpandibleFooter() {
	/*$('span#toggle_footer').click(function() {
		if ($(this).attr("class") == "toggle_down") {
			$('#collapsible_footer_content').slideDown(500);
			$('span#toggle_footer').removeClass('toggle_down').addClass('toggle_up');
		} else {
			$('#collapsible_footer_content').slideUp(500);
			$('span#toggle_footer').removeClass('toggle_up').addClass('toggle_down');
		}
	});*/
	$('span.toggle_down').click(function() {
		$('#collapsible_footer_content').slideDown(500);
		$('span.toggle_down').hide();
		$('span.toggle_up').show();
	});
	$('span.toggle_up').click(function() {
		$('#collapsible_footer_content').slideUp(500);
		$('span.toggle_up').hide();
		$('span.toggle_down').show();
	});
}

function getAlignPos(width)
{
	var browX = screen.width;
	var newBrowX = (browX - width)/2;
	return newBrowX;
}

function getValignPos(height)
{
	var browY = screen.height;
	var newBrowY = (browY - height)/2;
	return newBrowY;
}

function addFavourites()
{
    window.external.AddFavorite(location.href, document.title);
}

function printPage()
{
    window.print();  
}

function loadMovie(file_name)
{
    window.open("/video/video.aspx?file_name=" + file_name,"flashmovie",'toolbar=no,menubar=no,width=360,height=360,top=' + getValignPos("370") + ',left=' + getAlignPos("360"));
}

function createSideMenu(page_id) {
	$.post(AjaxURL,
		{
			action: "GetSideMenu",
			pageId: page_id
		},
		function(data) {
			$('#childPageMenuContainer').html(data);
			initSideMenu();
		}
	);
}

function initSideMenu() {
	$("ul#side_menu li div").click(function() {
		if ($(this).attr("class") == "expand") {
			$(this).removeClass("expand");
			$(this).addClass("collapse");
			$(this).parent().children("ul").show();
		} else {
			$(this).removeClass("collapse");
			$(this).addClass("expand");
			$(this).parent().children("ul").hide();
		}
	});
}
