

advAJAX.setDefaultParameters({
    onInitialization : function(obj) 
    {
	//$('content').fade('out');
	//$('preloader').fade('in');
	document.getElementById ( 'preloader' ).style.visibility='visible';
    },
    onFinalization : function(obj) 
    {
	//$('content').fade('in');
	//$('preloader').fade('out');
	
	document.getElementById ( 'preloader' ).style.visibility='hidden';
    },
    onError : function(obj) { alert("Error: " + obj.status); }
});

function getContent ( Site, Navbar )
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_content', "site" : Site, "navbar" : Navbar },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			getNavbar();
			return true; 
		}
	});
}

function getMainGuide ( Site, Navbar )
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_content', "site" : Site, "navbar" : Navbar  },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			makeActiveTab('1');
			getNavbar();
			return true;
		}
	});
}

function getGuide ( Site )
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_guide', "site" : Site },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content2' ).innerHTML = obj.responseText;
			return true; 
		}
	});
}

function getNews ( id ) 
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_news_getOne', "id" : id },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			getNavbar();
			return true; 
		}
	});
}

function getMainNews ( ) 
{
	advAJAX.post({
		url: "ajax.php5",
		parameters : { "action" : "site_news_main" },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ("content").innerHTML = obj.responseText;
			getNavbar();
			return true; 
		}
	});
}

function getArch () 
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_news_arch' },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			getNavbar();
			return true; 
		}
	});
}

function getArchOne ( id ) 
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_news_arch_one', "id" : id },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'newsHolder' ).innerHTML = obj.responseText;
			return true; 
		},
		onInitialization : function(obj) { return true; },
		onFinalization : function(obj) { return true; }
	});
}

function submitJob ( ) 
{
	if ( document.getElementById ( 'FirstName' ).value != '' && document.getElementById ( 'LastName' ).value != '' )
	{
		advAJAX.submit ( document.getElementById ( 'form-job' ), {
			parameters : {
				"action" : "site_form_job",
				"EducationNum" : window.WorkForm['Education'],
				"WorkNum" : window.WorkForm['Work'],
				"ShipNum" : window.WorkForm['Ship'],
				"InlandNum" : window.WorkForm['Inland'],
				"CoursesNum" : window.WorkForm['Courses']
			},
			disableForm : true,
			onSuccess : function ( obj )
			{
				document.getElementById ( 'content' ).innerHTML = obj.responseText;
				return true; 
			}
		});
	}
	else
	{
		alert ( 'Ensure that all marked fields are properly filled' );
	}
}

function submitEmployer ( ) 
{

	advAJAX.submit ( document.getElementById ( 'form-job' ), {
		parameters : {
			"action" : "site_form_employer"
		},
		disableForm : true,
		onSuccess : function ( obj )
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			return true; 
		}
	});
}

function getNavbar ()
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_navbar' },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'navbar' ).innerHTML = obj.responseText;
			return true; 
		},
		onInitialization : function(obj) { return true; },
		onFinalization : function(obj) { return true; }
	});
}

function getWork ()
{
	advAJAX.post ({
		url: "ajax.php5",
		parameters : { "action" : 'site_work_joboffers' },
		headers : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" },
		onSuccess : function ( obj ) 
		{
			document.getElementById ( 'content' ).innerHTML = obj.responseText;
			getNavbar();
			return true; 
		}
	});
}




