
function initSite()
{
	setupSendToFriendLinks();
	setupApplyForJobLinks();
	setupDateTimePickerFields();
}

function setupSendToFriendLinks()
{
	// Find each link type drop down field
	$$('a.modal_friend').each
	(
		function(item)
		{
			// Show send to friend modal
			Event.observe(item, 'click', function(e)
			{
				e.stop();
				
				var tempLink = Event.findElement(e, 'A');
				
				Lightview.show
				({
					href:		tempLink.href,
					rel: 		'iframe',
					title:		'Send This Job to a Friend',
					caption:	'Share this job with someone you know.',
					options: 
					{
						autosize:	false,
						topclose:	false,
						width:		450,
						height:		400
					}
				});
				
				return false;
			});
		}
	);
}

function setupApplyForJobLinks()
{
	// Find each link type drop down field
	$$('a.modal_apply').each
	(
		function(item)
		{
			// Show send to friend modal
			Event.observe(item, 'click', function(e)
			{
				e.stop();
				
				var tempLink = Event.findElement(e, 'A');
				
				Lightview.show
				({
					href:		tempLink.href,
					rel: 		'iframe',
					title:		'Image:',
					caption:	'',
					options: 
					{
						autosize:	false,
						topclose:	false,
						width:		450,
						height:		450
					}
				});
				
				return false;
			});
		}
	);	
}

function setupDateTimePickerFields()
{
	// Find each link type drop down field
	$$('input.date_selector').each
	(
		function(item)
		{
			// Add the confirmation message
			Event.observe(item, 'click', function(e)
			{
				var tempField = Event.findElement(e, 'INPUT');
				tempField.blur();
				
				new CalendarDateSelect( tempField, {time:false, year_range:10} );
			});
			
			Event.observe(item, 'keypress', function(e)
			{
				e.stop();
				
				var tempField = Event.findElement(e, 'INPUT');
				tempField.blur();
				
				return false;
			});
		}
	);
}

// Initialize all the admin scripts
document.observe('dom:loaded', initSite);
