
/*
SMMiLe JavaScript Object Model
Version 1.0
By Daryl Beattie
Copyright 2000, ScreamingMedia

SAMPLE USAGE [note that "script" tag is broken as "sc ript" so that it does not end this script]:

The code blow goes in the <HEAD> section of your HTML file
replace "JSDir/ContentSetID" with your JavaScript file path and name

	<sc ript language="JavaScript" src="JSDir/ContentSetID.js"></sc ript>
	<sc ript language="JavaScript">
		if(typeof SMChosenContent != \'undefined\') {
			document.write("<scri" + "pt language=\"JavaScript\" src=\"JSDir/ContentSetID" + SMChosenContent + ".js\"></sc" + "ript>");
		}
	</scr ipt>

The JavaScript objects are modelled after the SMMiLe XML structure:

<content-set>
	<content>
		<article>
			<title>...</title>
			<metadata>...</metadata>
			<core>...</core>
			<body>...</body>
		</article>
	</content>
</content-set>

As for the JavaScript, it is structured like this:

contentSet[0](id, name, language, publishedDate, contents)
|--	contents[i](id, revisionId, type, language, role, article) 
	|
	|--	article(title, metadata, core, body)
		|
		|--	metadata(documentMetadata, publicationMetadata, structuralMetadata, subjectMetadata, relatedContentMetadata, processingMetadata)
		|	|--	documentMetadata(storage, publisherReleaseDate)
		|	|--	publicationMetadata(publicationName)
		|	|--	structuralMetadata()
		|	|--	subjectMetadata()
		|	|--	relatedContentMetadata()
		|	|--	processingMetadata()
		|
		|--	core(summaryHeadline, docAbstract, headline, author, copyright, dateLine, dateTime, type)

An example of using this object model to print out the body of the second
article is:

	document.write(SMContentSet[0].contents[1].article.body);

*/


function displayContentPage(url, contentNum) {
	window.location = url + "?SMContentIndex=" + contentNum + "&SMContentSet=" + 0;
}

function displayContentPage(url, contentNum, contentSetNum) {
	window.location = url + "?SMContentIndex=" + contentNum + "&SMContentSet=" + contentSetNum;
}

function getParamValue(matchString, defaultValue) {
	var thisURL = window.location.toString();
	var value = defaultValue;
	if ((thisURL.indexOf("?") != -1) &&
	    (thisURL.indexOf(matchString) != -1) &&
	    (thisURL.charAt(thisURL.indexOf(matchString) + matchString.length) != "&")) {
		start = thisURL.indexOf(matchString) + matchString.length;
		if (thisURL.indexOf("&", start) > -1) {
			value = thisURL.substring(start, (thisURL.indexOf("&", start)));
		}
		else {
			value = thisURL.substring(start, thisURL.length);
		}
	}
	if (value == "NaN") {
		value = devaultValue;
	}
	return value;
}

var SMChosenContent = Number(getParamValue("SMContentIndex=", -1));
var SMChosenContentSet = Number(getParamValue("SMContentSet=", 0));

function prettyDate(date) {
	var result;
	if (date.substring(5,7) == "01") {result = "January ";}
	else if (date.substring(5,7) == "02") {result = "February ";}
	else if (date.substring(5,7) == "03") {result = "March ";}
	else if (date.substring(5,7) == "04") {result = "April ";}
	else if (date.substring(5,7) == "05") {result = "May ";}
	else if (date.substring(5,7) == "06") {result = "June ";}
	else if (date.substring(5,7) == "07") {result = "July ";}
	else if (date.substring(5,7) == "08") {result = "August ";}
	else if (date.substring(5,7) == "09") {result = "September ";}
	else if (date.substring(5,7) == "10") {result = "October ";}
	else if (date.substring(5,7) == "11") {result = "November ";}
	else {result = "December ";}
	if (date.charAt(8) == "0") {result += date.charAt(9);}
	else {result += date.substring(8,10);}
	return result + ", " + date.substring(0,4);
}

// Metadata sub-type element objects.
function MakeDocumentMetadata(myStorage, myPublisherReleaseDate) {
	this.storage = myStorage;
	this.publisherReleaseDate = myPublisherReleaseDate;
}
function MakePublicationMetadata(myPublicationName) {
	this.publicationName = myPublicationName;
}
function MakeStructuralMetadata() { }
function MakeSubjectMetadata() { }
function MakeRelatedContentMetadata() { }
function MakeProcessingMetadata() { }

// Metadata element object (made up of the sub-types).
function MakeMetadata(myDocumentMetadata, myPublicationMetadata, myStructuralMetadata, mySubjectMetadata, myRelatedContentMetadata, myProcessingMetadata) {
	this.documentMetadata = myDocumentMetadata;
	this.publicationMetadata = myPublicationMetadata;
	this.structuralMetadata = myStructuralMetadata;
	this.subjectMetadata = mySubjectMetadata;
	this.relatedContentMetadata = myRelatedContentMetadata;
	this.processingMetadata = myProcessingMetadata;
}

// Core element object
function MakeCore(mySummaryHeadline, myAbstract, myHeadline, myAuthor, myCopyright, myDateLine, myDateTime, myType) {
	this.summaryHeadline = mySummaryHeadline;
	this.docAbstract = myAbstract;
	this.headline = myHeadline;
	this.author = myAuthor;
	this.copyright = myCopyright;
	this.dateLine = myDateLine;
	this.dateTime = myDateTime;
	this.type = myType;
}

// Article element object
function MakeArticle(myTitle, myMetadata, myCore, myBody) {
	this.title = myTitle;
	this.metadata = myMetadata;
	this.core = myCore;
	this.body = myBody;
}

// Content element object
function MakeContent(myId, myRevisionId, myType, myLanguage, myRole, myArticle) {
	this.id = myId;
	this.revisionId = myRevisionId;
	this.type = myType;
	this.language = myLanguage;
	this.role = myRole;
	this.article = myArticle;
}

// Content-set master element object
function MakeContentSet(myId, myName, myLanguage, myPublishedDate, myContents) {
	this.id = myId;
	this.name = myName;
	this.language = myLanguage;
	this.publishedDate = myPublishedDate;
	this.contents = myContents;
}

{ // This block intializes the data objects.

	var Index = -1;
	if (typeof SMContentSet == "undefined") {
		var SMContentSet = new Array();
	}
	var contents = new Array();
//////////////////////// This section is made PER CONTENT (because the actual data is written in here)

	
	documentMetadata = new MakeDocumentMetadata('internal', '2009-09-09T10:24:00');
	publicationMetadata = new MakePublicationMetadata('Xinhua News Agency');

	title = 'Hiring Plans Strongest in India, Brazil: Survey';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Hiring Plans Strongest in India, Brazil: Survey',
		'Hiring plans are the strongest in India and Brazil in the coming quarter while job prospects remain weak in the United States, according to a survey conducted by the Global Manpower Employment Outlook. "The fourth quarter of 2009 will continue to challenge job seekers in labor markets around the world, though employer hiring expectations have improved somewhat from three months ago in nearly two-thirds of the countries and territories surveyed," the report, released by Manpower Inc on Wednesday, said...',
		'Hiring Plans Strongest in India, Brazil: Survey',
		'',
		'Copyright 2009 XINHUA NEWS AGENCY',
		'NEW DELHI, Sep 09, 2009 (Xinhua via COMTEX)',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_2009_09_09_xh_0000-8180-india-hiring-plans',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-09-04T09:37:07');
	publicationMetadata = new MakePublicationMetadata('Associated Press');

	title = 'U.S. Jobless Rate at 9.7 Percent.; 216K Jobs Lost in August';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'U.S. Jobless Rate at 9.7 Percent.; 216K Jobs Lost in August',
		'The unemployment rate jumped almost half a point to 9.7 percent in August, the highest since 1983, reflecting a poor job market that will make it hard for the economy to begin a sustained recovery. While the jobless rate rose more than expected, the economy shed a net total of 216,000 jobs, less than July\'s revised 276,000 and the fewest monthly losses in a year, according to Labor Department data released Friday. Economists had expected the unemployment rate to rise to 9.5 percent from July\'s 9.4 percent and job reductions to total 225,000...',
		'U.S. Jobless Rate at 9.7 Percent.; 216K Jobs Lost in August',
		'By CHRISTOPHER S. RUGABER (AP Economics Writer)',
		'Copyright 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.',
		'',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'ap_2009_09_04_ap.online.all_D9AGIC500_news_ap_org.anpa',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-09-04T08:19:00');
	publicationMetadata = new MakePublicationMetadata('United Press International');

	title = 'Canada\'s Unemployment Hits 8.7 Percent';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Canada\'s Unemployment Hits 8.7 Percent',
		'Canada\'s unemployment rate nudged up 0.1 percent to 8.7 percent in August, Statistics Canada reported from Ottawa Friday. The agency said part-time employment rose by 31,000 in August and employment among private sector employees increased by 49,000. "Total employment gains were partially offset by losses in business, building and other support services, as well as educational services," StatsCan said. "Employment in the manufacturing sector continued its downward trend in August, while construction rose slightly..."',
		'Canada\'s Unemployment Hits 8.7 Percent',
		'',
		'Copyright 2009 by United Press International',
		'OTTAWA, Sep 4, 2009 (UPI via COMTEX)',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_2009_09_04_up_0000-5301-bc-canada-employment',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-08-20T10:03:24');
	publicationMetadata = new MakePublicationMetadata('Rough Notes');

	title = '"I Don\'t Want to Sell Insurance"';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'"I Don\'t Want to Sell Insurance"',
		'While recruiting talented sales professionals for the property/casualty insurance industry, we have sorted through thousands of online r&eacute;sum&eacute;s. The thing we find most striking is that there is only one industry about which candidates ask not to be contacted. It is not medical sales, not pharmaceutical sales, not even used car sales. It is insurance sales. "No insurance, please!" is a request that is often posted on a job seeker\'s r&eacute;sum&eacute; and commonly accompanies the person\'s cover letter. How did we get here, and why is insurance a dirty word in the job search market?',
		'"I Don\'t Want to Sell Insurance"',
		'Betancourt, Art',
		'(C) 2009 Rough Notes. via ProQuest Information and Learning Company; All Rights Reserved',
		'Aug 2009',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'bhsgml_2009_08_20_22286_1836257861-0020-KEYWORD.Missing',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-08-15T10:03:25');
	publicationMetadata = new MakePublicationMetadata('Florida Trend');

	title = 'Hire Calling';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Hire Calling',
		'...Inktel utilizes an exhaustive vetting process called TopGrading, developed by author and industrial psychologist Bradford Smart, to hire and retain only the highest performers available at a particular salary level - the "A" players, or top 10% of the designated workforce. At Inktel, TopGrading means extremely long interviews, including behavioral-based interviews, interviews with multiple executives, managers or peers and patience in hiring. Inktel corporate recruiter Carlos Morgan says the company went through more than 200 candidates for his slot before settling on him...',
		'Hire Calling',
		'Vogel, Mike',
		'(C) 2009 Florida Trend. via ProQuest Information and Learning Company; All Rights Reserved',
		'Aug 2009',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'bhsgml_2009_08_15_27824_1829617091-0052-KEYWORD.Missing',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-08-12T14:40:57');
	publicationMetadata = new MakePublicationMetadata('Associated Press');

	title = 'Some Pockets of Hiring Exist Amid Slowdown';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Some Pockets of Hiring Exist Amid Slowdown',
		'Even with most U.S. businesses still reluctant to add new employees, some pockets of hiring are emerging in industries such as accounting, information technology and restaurants, government data show. Signs of hope are also evident in some private surveys. Nearly a third of manufacturing companies plan to add employees in August, the highest proportion since October, according to a survey by the Society for Human Resource Management. Still, the percentages of both manufacturing and service-sector companies planning to hire is down from a year ago, the group said...',
		'Some Pockets of Hiring Exist Amid Slowdown',
		'By CHRISTOPHER S. RUGABER (AP Economics Writer)',
		'Copyright 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.',
		'',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'apdigital_2009_08_13_ap.online.biz.general_D9A1HLHG0_news_ap_org.anpa',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-08-07T18:50:01');
	publicationMetadata = new MakePublicationMetadata('Chicago Tribune');

	title = 'U.S. Unemployment Dips to 9.4%; Seen as Sign Economy May be Shifting Toward Recovery';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'U.S. Unemployment Dips to 9.4%; Seen as Sign Economy May be Shifting Toward Recovery',
		'Losses in the job market are finally showing real signs of moderating. But as with most other economic data these days, Friday\'s employment report sent mixed messages, suggesting that while the economy may be bottoming out, recovery will likely be slow, fitful and frustrating. The Department of Labor reported that the U.S. economy lost 247,000 jobs in July while the unemployment rate dipped to 9.4 percent from 9.5 percent. That was the smallest monthly decline in jobs since last August and provided clear evidence that the longer-term pace of job erosion is slowing markedly...',
		'U.S. Unemployment Dips to 9.4%; Seen as Sign Economy May be Shifting Toward Recovery',
		'Michael Oneal',
		'(c) 2009, Chicago Tribune. Distributed by Mclatchy-Tribune News Service.',
		'',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'krt_2009_08_07_knigt_2786-0074-ECONOMY-JOBS.TB.ew',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-08-07T08:44:00');
	publicationMetadata = new MakePublicationMetadata('United Press International');

	title = 'Canada Sheds 45,000 Jobs in July';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Canada Sheds 45,000 Jobs in July',
		'Canadian employment fell by 45,000 jobs in July, which wasn\'t enough to change the unemployment rate of 8.6 percent, Statistics Canada reported Friday. The agency said the bulk of job losses were in Quebec, Saskatchewan and Newfoundland/Labrador. Since October, total job losses stand at 414,000, or 2.4 percent. The 8.6 percent national unemployment rate is the highest since 1998, StatsCan said...',
		'Canada Sheds 45,000 Jobs in July',
		'',
		'Copyright 2009 by United Press International',
		'OTTAWA, Aug 7, 2009 (UPI via COMTEX)',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_2009_08_07_up_0000-6209-bc-canada-employment',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-07-20T06:22:03');
	publicationMetadata = new MakePublicationMetadata('Associated Press');

	title = 'Company Forecasters Less Pessimistic';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Company Forecasters Less Pessimistic',
		'With the U.S. economy expected to emerge this year from the longest recession since World War II, business forecasters are feeling a bit less gloomy about the future. The latest outlook from a quarterly survey being released Monday by the National Association for Business Economics finds that companies are still looking at job cuts in the coming months, though they may be scaling back. Twenty-eight percent of those surveyed expect their companies to cut jobs through attrition or layoffs in the coming six months, the survey found, compared with 33 percent in April and 39 percent in January...',
		'Company Forecasters Less Pessimistic',
		'By ALAN ZIBEL (AP Business Writer)',
		'Copyright 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.',
		'',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'apdigital_2009_07_20_ap.online.biz.general_D99I56M80_news_ap_org.anpa',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-06-30T10:03:28');
	publicationMetadata = new MakePublicationMetadata('Accountancy Ireland');

	title = 'Competency-Based Interviews: Finding the Right Candidate Faster';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Competency-Based Interviews: Finding the Right Candidate Faster',
		'Believe it or not, evidence of job interviews being conducted by employers dates back as far as the late 16th century. Traditionally professionals were hired on the basis of their technical expertise but today\'s increasingly competitive environment demands further skillsets in addition to technical ability. Success in the workplace is no longer measured solely by performance in professional examinations; it is also determined by the candidate\'s ability to demonstrate \'core competencies\' relevant to the position for which they are applying. Because of this, competency- based interviews were introduced to focus on the candidate\'s past performance in the workplace as a way of predicting likely future performance...',
		'Competency-Based Interviews: Finding the Right Candidate Faster',
		'Rooney, Nikki',
		'(C) 2009 Accountancy Ireland. via ProQuest Information and Learning Company; All Rights Reserved',
		'Apr 2009',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'bhsgml_2009_06_30_21498_1767862591-0105-KEYWORD.Missing',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-06-30T07:05:03');
	publicationMetadata = new MakePublicationMetadata('The Bradenton Herald, Fla.');

	title = 'From Sending Cakes to Crafting Paper Birds, Job Seekers Get Creative';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'From Sending Cakes to Crafting Paper Birds, Job Seekers Get Creative',
		'Hoveround\'s human resources staff will never forget the shiny, red Chinese takeout box a job seeker sent them. The candidate, who was going after an art director\'s position, sent the department the box with his resume inside. It was folded into an origami bird. "This was obviously a very creative individual," said Sam Porcelli, human resources assistant at Hoveround, a Manatee County, Fla., manufacturer of power chairs. "He made a great impression on us. While he didn\'t get the job, because we interviewed someone earlier that day we fell in love with, we will not forget this guy. The impression was significant..."',
		'From Sending Cakes to Crafting Paper Birds, Job Seekers Get Creative',
		'Grace Gagliano',
		'(c) 2009, Bradenton Herald (Bradenton, Fla.). Distributed by Mclatchy-Tribune News Service.',
		'',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'krt_2009_06_30_knihm_2685-0047-WRK-CREATIVEPITCH.BR',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-06-13T10:03:26');
	publicationMetadata = new MakePublicationMetadata('BusinessWest');

	title = 'Watching and Collecting';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Watching and Collecting',
		'In a time of economic freefall, it seems people appreciate a good safety net. As the job market has soured nationally, Massachusetts has seen its unemployment rate soar from 4.3% in April 2008 - and just 5.4% as recently as October - to 8.2% this past March. Typically, a trend like that translates to a rush of new applications at employment agencies, as the ranks of the newly laid-off scramble for available work opportunities. But in that regard, this recession has been somewhat different than others...',
		'Watching and Collecting',
		'Bednar, Joseph',
		'(C) 2009 BusinessWest. via ProQuest Information and Learning Company; All Rights Reserved',
		'May 11, 2009',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'bhsgml_2009_06_13_12076_1745248821-0071-KEYWORD.Missing',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2009-06-13T10:03:26');
	publicationMetadata = new MakePublicationMetadata('BusinessWest');

	title = 'Avoiding Hiring Mistakes in a Down Economy';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Avoiding Hiring Mistakes in a Down Economy',
		'With layoffs, downsizing, and stressed-out employees, it is more important than ever for employers to focus on the legal aspects of hiring, managing, and terminating workers. At a recent seminar sponsored by Invensure Insurance Brokers of Irvine, Calif. for HR managers, business owners, and others responsible for hiring and monitoring new employees, we explored issues that should be on every employer\'s mind when it comes to hiring practices, tracking employee performance, use of an employee handbook, and areas of litigation...',
		'Avoiding Hiring Mistakes in a Down Economy',
		'Torres, David A',
		'(C) 2009 BusinessWest. via ProQuest Information and Learning Company; All Rights Reserved',
		'May 11, 2009',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'bhsgml_2009_06_13_12076_1745248791-0068-KEYWORD.Missing',
		'01252593061291',
		'article',
		'en-US',
		'',
		article
		);

		
	

//////////////////////// End PER ARTICLE section

	contentSetId = '236_RECRUIT';
	contentSetName = 'RECRUIT';
	contentSetLanguage = '';
	contentSetPublishedDate = '2009-09-10T09:31:07';

	id = '236_RECRUIT';
	contentType = '';

} // End data initialization block.

if (typeof ContentIndex == "undefined") {
	ContentIndex = -1;
}

SMContentSet[++ContentIndex] = new MakeContentSet(contentSetId, contentSetName, contentSetLanguage, contentSetPublishedDate, contents);
