//////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////

// Returns formatted event string
function BuiltListingEntry( CompanyName, PositionPhrase, InfoPageUrl )
{
	var EventString = "";
	
	EventString = "<p class='text'><span class='texthead'>" + CompanyName + "</span> is hiring ";
	EventString += PositionPhrase + ".<br>";
	EventString += "For more information <a href='" + InfoPageUrl + "' ";
	EventString += "target='_blank' onClick='dpSmartLink(this.href,'newWin',800,600,'c:0','sc');return document.MM_returnValue'>Click Here</a></p>";		
	
	return EventString;
}

//////////////////////////////////////////////////
// CONTENT
//////////////////////////////////////////////////

// Variable Declaration
var Today = new Date();			
var Loop = 0;
var PositionPhraseWritten;
var JobListings = new Array();

PositionPhraseWritten = false;

// Job Listing Data
JobListings = 
[
	{
		CompanyName: "Mountain View Hospital",
		EntryDate: "2008/05/10",
		ExpirationDate: "2010/12/31", 
		PositionPhrase: "a full-time Occupational Therapist",		
		InfoPageUrl: "jobs/MT_VIEW_011309.html"
	},
	{
		CompanyName: "College of Southern Nevada",
		EntryDate: "2009/06/05",
		ExpirationDate: "2010/12/31", 
		PositionPhrase: "a full-time faculty member",		
		InfoPageUrl: "jobs/CSN_060509.html"
	},
	{
		CompanyName: "Lymphatic Therapy Services, Inc.",
		EntryDate: "2009/07/08",
		ExpirationDate: "2009/12/21", 
		PositionPhrase: "a full-time OTR/L and COTA/L to join our team of certified lymphedema therapists",		
		InfoPageUrl: "jobs/LTS_070709.html"
	},
	{
		CompanyName: "Andre Agassi College Preparatory Academy",
		EntryDate: "2009/11/10",
		ExpirationDate: "2009/12/21", 
		PositionPhrase: "a per diem OT to work for 4-6 hours every Tuesday",		
		InfoPageUrl: "jobs/AACP_111009.html"
	},
	{
		CompanyName: "SYNERTX Rehab",
		EntryDate: "2009/12/07",
		ExpirationDate: "2010/01/07", 
		PositionPhrase: "a full-time Occupational Therapist Assistant for their new client-facility in Fallon, Nevada",		
		InfoPageUrl: "jobs/SYNERTX_120709a.html"
	},
	{
		CompanyName: "SYNERTX Rehab",
		EntryDate: "2009/12/07",
		ExpirationDate: "2010/01/07", 
		PositionPhrase: "a full-time Lead Occupational Therapist for their new client-facility in Fallon, Nevada",		
		InfoPageUrl: "jobs/SYNERTX_120709b.html"
	},
	{
		CompanyName: "Concentra Inc.",
		EntryDate: "2009/12/21",
		ExpirationDate: "2010/02/21", 
		PositionPhrase: "full-time and PRN Hand Therapists in Las Vegas, Nevada",		
		InfoPageUrl: "jobs/CONCENTRA_122109.html"
	},
	{
		CompanyName: "Nightingale Home Health Care",
		EntryDate: "2010/01/25",
		ExpirationDate: "2011/01/25", 
		PositionPhrase: "a full-time or per diem Occupational therapist or a COTA",		
		InfoPageUrl: "jobs/NHHC_012510.html"
	},
	{
		CompanyName: "Mesa View Physical Therapy",
		EntryDate: "2010/02/12",
		ExpirationDate: "2010/03/12",
		PositionPhrase: "a full-time Occupational therapist or a COTA",		
		InfoPageUrl: "jobs/MVPT_021210.html"
	},
	{
		CompanyName: "Physiotherapy Associates",
		EntryDate: "2010/02/12",
		ExpirationDate: "2010/03/12",
		PositionPhrase: "pediatric occupational therapists",		
		InfoPageUrl: "jobs/PTA_021210.html"
    },
	{
	    CompanyName: "Physical Therapy Partners Nevada",
		EntryDate: "2010/03/16",
		ExpirationDate: "2010/04/16",
		PositionPhrase: "a full-time occupational therapist",		
		InfoPageUrl: "jobs/PTPN_031610.html"
	},
	{
	    CompanyName: "TUN Center for Autism and Developmental Disabilities",
		EntryDate: "2010/07/07",
		ExpirationDate: "2010/08/31",
		PositionPhrase: "a full-time occupational therapist",		
		InfoPageUrl: "jobs/TUNAC_070710.html"
	},
	{
	    CompanyName: "Evergreen Healthcare",
		EntryDate: "2010/07/19",
		ExpirationDate: "2011/07/31",
		PositionPhrase: "occupational therapists and assistants",		
		InfoPageUrl: "jobs/EGH_071910a.html"
	},
	{
	    CompanyName: "Mountain View Health and Rehabilitation Center",
		EntryDate: "2010/07/19",
		ExpirationDate: "2010/08/19",
		PositionPhrase: "a rehabilitation manager",		
		InfoPageUrl: "jobs/MT_VIEW_071910b.html"
	}
];

// Display the formatted listings (ordered from most recent listing to oldest listing)
for ( Loop = JobListings.length-1; Loop >= 0; Loop-- )
{
	if( Today <= new Date( JobListings[Loop].ExpirationDate ) )
	{	
		document.write( BuiltListingEntry( JobListings[Loop].CompanyName, JobListings[Loop].PositionPhrase, JobListings[Loop].InfoPageUrl ) );
		PositionPhraseWritten = true;
	}
}

// If all listings are expired, display a placeholder message
if( PositionPhraseWritten === false )
{
	document.write( "<span class='texthead'>More Job Listings Coming Soon!</span>" );
}

