
/*
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', '2010-09-01T09:09:04');
	publicationMetadata = new MakePublicationMetadata('Business Wire');

	title = 'Wall Street Banks Lure Small Businesses with Free Checking';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Wall Street Banks Lure Small Businesses with Free Checking',
		'According to a recent Moebs Services survey of 2,300 banks and credit unions, 91 percent of Wall Street Banks (greater than $50B in Assets) now offer free checking for businesses, up from 64 percent in 2009 -- a 42% increase.',
		'Wall Street Banks Lure Small Businesses with Free Checking',
		'',
		'Copyright Business Wire 2010',
		'LAKE BLUFF, Ill.',
		'',
		'pr'
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_09_01_comtex_149301733.anpa',
		'01283352283508',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2010-08-26T08:01:08');
	publicationMetadata = new MakePublicationMetadata('PRNewswire-FirstCall');

	title = 'PNC\'s Virtual Wallet?? Adds New Features for Budgeting, Smart Spending and Saving';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'PNC\'s Virtual Wallet?? Adds New Features for Budgeting, Smart Spending and Saving',
		'PITTSBURGH, Aug. 26 /PRNewswire-FirstCall/ -- PNC Bank, a member of The PNC Financial Services Group, Inc. , today announced enhancements to Virtual Wallet????, the online and mobile money management tool, for budgeting and smart spending as many consumers...',
		'PNC\'s Virtual Wallet?? Adds New Features for Budgeting, Smart Spending and Saving',
		'',
		'Copyright PRNewswire-FirstCall 2010',
		'PITTSBURGH',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_08_27_comtex_149090570.anpa',
		'01282933334084',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2010-08-25T11:04:07');
	publicationMetadata = new MakePublicationMetadata('PRNewswire');

	title = 'New Survey Finds Forty Percent of Middle Market Banking Executives Would Consider Adopting Mobile Banking Solutions for Their...';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'New Survey Finds Forty Percent of Middle Market Banking Executives Would Consider Adopting Mobile Banking Solutions for Their...',
		'NEW YORK, Aug. 25 /PRNewswire/ -- TNS, the world\'s largest custom research company, today released results of its latest survey related the use of web-based tools, mobile banking and social networking in the middle market banking segment. The survey,...',
		'New Survey Finds Forty Percent of Middle Market Banking Executives Would Consider Adopting Mobile Banking Solutions for Their...',
		'',
		'Copyright PRNewswire 2010',
		'NEW YORK',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_08_25_comtex_149050182.anpa',
		'01282932717659',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2010-08-31T08:30:17');
	publicationMetadata = new MakePublicationMetadata('PrimeNewswire');

	title = 'BankServ to Acquire NetDeposit From Zions Bancorporation';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'BankServ to Acquire NetDeposit From Zions Bancorporation',
		'SALT LAKE CITY, Aug. 31, 2010 (GLOBE NEWSWIRE) -- BankServ and NetDeposit, leaders in remote deposit capture and electronic payment technologies, announced today the signing of a definitive agreement wherein BankServ will acquire substantially all of...',
		'BankServ to Acquire NetDeposit From Zions Bancorporation',
		'',
		'Copyright PrimeNewswire 2010',
		'SALT LAKE CITY, Aug. 31',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_08_31_comtex_149262747.anpa',
		'01283350676866',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2010-09-01T09:14:06');
	publicationMetadata = new MakePublicationMetadata('PRNewswire');

	title = 'Experian Helps Provide Greater Awareness and Protection for Small-Business Owners With Its New Business Monitoring Alerts';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Experian Helps Provide Greater Awareness and Protection for Small-Business Owners With Its New Business Monitoring Alerts',
		'COSTA MESA, Calif., Sept. 1 /PRNewswire/ -- Experian????, the global information services company, today announced the addition of new email alerts as part of its already-robust Business Credit Advantage(SM) monitoring plan. The alerts provide small-business...',
		'Experian Helps Provide Greater Awareness and Protection for Small-Business Owners With Its New Business Monitoring Alerts',
		'',
		'Copyright PRNewswire 2010',
		'COSTA MESA, Calif.',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_09_01_comtex_149301885.anpa',
		'01283351576659',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2010-08-31T12:00:23');
	publicationMetadata = new MakePublicationMetadata('PRNewswire');

	title = 'Equifax Announces Suite of Industry-Leading Fraud Mitigation Solutions to Help Businesses Combat Identity Fraud';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'Equifax Announces Suite of Industry-Leading Fraud Mitigation Solutions to Help Businesses Combat Identity Fraud',
		'ATLANTA, Aug. 31 /PRNewswire/ -- Equifax Inc. today announced the expansion of their identity fraud management suite of solutions, providing businesses with a more complete approach to fighting both true-name and synthetic identity fraud. Identity fraud...',
		'Equifax Announces Suite of Industry-Leading Fraud Mitigation Solutions to Help Businesses Combat Identity Fraud',
		'',
		'Copyright PRNewswire 2010',
		'ATLANTA',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'comtex_yb_2010_08_31_comtex_149268654.anpa',
		'01283352283508',
		'article',
		'en-US',
		'',
		article
		);

		
	

//////////////////////// End PER ARTICLE section

	contentSetId = '7363_Website';
	contentSetName = 'Website';
	contentSetLanguage = '';
	contentSetPublishedDate = '2010-09-01T10:09:40';

	id = '7363_Website';
	contentType = '';

} // End data initialization block.

if (typeof ContentIndex == "undefined") {
	ContentIndex = -1;
}

SMContentSet[++ContentIndex] = new MakeContentSet(contentSetId, contentSetName, contentSetLanguage, contentSetPublishedDate, contents);
