﻿$(document).ready(function()
{
	var page = 'main';
	try
	{
		page = $.query.get('q');
	}
	catch (e) { }
	GetPage(page);
	CacheImages();
});

function CacheImages() {
    $('#imgstore').load('../data/Slideshow.ashx');
}

function GetPage(page)
{
    //location.href = '../Home/?q=' + page;
	$('#main').attr('page', page).fadeOut(function()
	{
		$('#main').load('../data/GetHtml.ashx?q=' + page, null, function()
		{
			$('#main').fadeIn();
		})
	});
}

function EditContent(link)
{
    location.href = '../Admin/EditContent.aspx?q=' + $('#main').attr('page');
}

function loadProjects()
{
	$('#main').hide().load('../data/Slideshow.ashx', null, function()
	{
		$('#main').fadeIn();
		$('#gallery a').lightBox({ fixedNavigation: true });
	});
}

function loadProjectsOld()
{
    //$('#main').empty();
    //$.init_slide('imgstore', 'main', 1, 1, 1000, 1, 5000, 1);
    //alert('loadProjects: done');
    //location.href = '../Home/Projects.aspx';

	$('<div id="dialog" title="PROJECT PHOTOS"><div id="imgstore" /><div id="imgnav" /></div>').appendTo("body");

	$('#imgstore').load('../data/Slideshow.ashx');
	
	$("#dialog")
		.dialog({
			modal: true,
			overlay: {
				opacity: 0.9,
				background: "#000"
			},
			width: '700',
			height: '515',
			show: 'drop',
			hide: 'drop',
			buttons:
				{
					"close": function()
					{
						$(this).dialog("close");
					}
				},
			close: function()
			{
				$('#dialog').remove();
			}
		})
		.show();


		$('#imgstore')
			.cycle({ 
				fx:     'fade', 
				speed:   300, 
				timeout: 3000, 
				next:   '#imgstore', 
				pause:   1,
				pager: '#imgnav'
			});
    //$.init_slide('imgstore', 'dialog', 0, 0, 1000, 1, 5000, 1);
}
