
/*
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', '2011-09-29T08:33:30');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'FDA APPROVES NEW INDICATIONS FOR PROLIA?? DENOSUMAB FOR THE TREATMENT OF BONE LOSS IN PATIENTS WITH PROSTATE OR BREAST CANCER...';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'FDA APPROVES NEW INDICATIONS FOR PROLIA?? DENOSUMAB FOR THE TREATMENT OF BONE LOSS IN PATIENTS WITH PROSTATE OR BREAST CANCER...',
		'Amgen (NASDAQ: AMGN) announced that the U.S. Food and Drug Administration (FDA) approved two new indications for Prolia?? (denosumab) as a treatment to increase bone mass in women at high risk for fracture receiving adjuvant aromatase inhibitor therapy for breast cancer and as a treatment to increase bone mass in men at high risk for fracture receiving androgen deprivation therapy for non-metastatic prostate cancer. In patients with prostate cancer, Prolia also reduced the incidence of vertebral fractures. Prolia is the first-and-only therapy approved by the FDA for cancer treatment-induced bone loss in patients undergoing hormone ablation therapy.',
		'FDA APPROVES NEW INDICATIONS FOR PROLIA?? DENOSUMAB FOR THE TREATMENT OF BONE LOSS IN PATIENTS WITH PROSTATE OR BREAST CANCER...',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Women\'s Health Weekly via NewsRx.com',
		'October 6, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_083330_5189126108679371478',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T08:55:59');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'STUDY REVEALS RISE IN PROSTATE BIOPSY COMPLICATIONS AND HIGH POST-PROCEDURE HOSPITALIZATION RATE';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'STUDY REVEALS RISE IN PROSTATE BIOPSY COMPLICATIONS AND HIGH POST-PROCEDURE HOSPITALIZATION RATE',
		'In a study of complication rates following prostate biopsy among Medicare beneficiaries, Johns Hopkins researchers have found a significant rise in serious complications requiring hospitalization. The researchers found that this common outpatient procedure, used to diagnose prostate cancer, was associated with a 6.9 percent rate of hospitalization within 30 days of biopsy compared to a 2.9 percent hospitalization rate among a control group of men who did not have a prostate biopsy. The study, which will be published in the November 2011 issue of The Journal of Urology, was posted early online',
		'STUDY REVEALS RISE IN PROSTATE BIOPSY COMPLICATIONS AND HIGH POST-PROCEDURE HOSPITALIZATION RATE',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Cancer Weekly via NewsRx.com',
		'October 4, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_085559_4125314287429345284',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T12:35:11');
	publicationMetadata = new MakePublicationMetadata('Associated Press');

	title = 'ILL. MAN ACCUSED IN RI \'ERECTILE PUMPS\' SCHEME';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'ILL. MAN ACCUSED IN RI \'ERECTILE PUMPS\' SCHEME',
		'An Illinois man plans to plead guilty in Rhode Island to charges he shipped unwanted "erectile pumps" to diabetes patients as part of a Medicare fraud scheme, federal prosecutors said Thursday. Gary Winner, 49, is accused of purchasing $26 penis enlargers from an adult website, repackaging them and shipping them to patients with information claiming the devices helped "bladder control, urinary flow and prostate comfort."',
		'ILL. MAN ACCUSED IN RI \'ERECTILE PUMPS\' SCHEME',
		'By LAURA CRIMALDI (Associated Press)',
		'Copyright 2011 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_2011_09_29_ap.online.all_D9Q2AOJ00_news_ap_org.anpa',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T08:39:15');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'GENETIC DIFFERENCES MAY CAUSE HIGHER RATES OF PROSTATE CANCER IN AFRICAN-AMERICAN MEN';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'GENETIC DIFFERENCES MAY CAUSE HIGHER RATES OF PROSTATE CANCER IN AFRICAN-AMERICAN MEN',
		'Genetic differences in prostate cells seem to be a root cause of the prostate cancer disparities between African-American men and white men, according to findings presented at the Fourth AACR Conference on The Science of Cancer Health Disparities, held here Sept. 18-21, 2011. "There are a lot of socioeconomic and environmental factors that create differences in levels of prostate cancer in these two groups," said Bi- Dar Wang, Ph.D., assistant research professor of pharmacology and physiology at the George Washington University. "We\'ve found that genetic elements play a role in these disparities as well."',
		'GENETIC DIFFERENCES MAY CAUSE HIGHER RATES OF PROSTATE CANCER IN AFRICAN-AMERICAN MEN',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Medical Devices & Surgical Technology Week via NewsRx.com',
		'October 9, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_083915_6039817241734048567',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T08:50:31');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'REPORT SUMMARIZES PROSTATE CANCER STUDY FINDINGS FROM GLAXOSMITHKLINE';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'REPORT SUMMARIZES PROSTATE CANCER STUDY FINDINGS FROM GLAXOSMITHKLINE',
		'"In the present review we discuss expenditure on prostate cancer diagnosis, treatment and follow- up and evaluate the cost of prostate cancer and its management in different countries. Prostate cancer costs were identified from published data and internet sources," scientists in Research Triangle Park, North Carolina report.In the USA, the total estimated expenditure on prostate cancer was 9.862 billion US dollars ($) in 2006. The mean annual costs per patient in the USA were $ 10 612 in the initial phase after diagnosis, $ 2134 for continuing care and $ 33 691 in the last year of life.',
		'REPORT SUMMARIZES PROSTATE CANCER STUDY FINDINGS FROM GLAXOSMITHKLINE',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Cancer Weekly via NewsRx.com',
		'October 4, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_085032_6163800114745174132',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T08:49:51');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'PREDICTION MODELS HELP DETERMINE LIKELIHOOD OF ERECTILE FUNCTION AFTER TREATMENT FOR PROSTATE CANCER';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'PREDICTION MODELS HELP DETERMINE LIKELIHOOD OF ERECTILE FUNCTION AFTER TREATMENT FOR PROSTATE CANCER',
		'The development of prediction models that included variables such as pretreatment sexual function, patient characteristics and treatment factors appear to be effective at predicting erectile function 2 years after prostatectomy, external radiotherapy, or brachytherapy for prostate cancer, according to a study in the September 21 issue of JAMA. "Because most patients survive early-stage prostate cancer after treatment, health-related quality of life (HRQOL) outcomes have emerged as a major emphasis in treatment decisions. Erectile dysfunction is commonplace after prostate cancer treatment and has significant consequences for HRQOL. Among urinary, bowel, vitality, and sexual HRQOL domains-outcomes commonly impaired by prostate cancer treatment- sexual function in previously potent men is the most commonly impaired and is closely related to outcome satisfaction," the authors write.',
		'PREDICTION MODELS HELP DETERMINE LIKELIHOOD OF ERECTILE FUNCTION AFTER TREATMENT FOR PROSTATE CANCER',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Clinical Trials Week via NewsRx.com',
		'October 3, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_084951_8209048703212253206',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-22T09:36:23');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'MASSACHUSETTS LEGISLATORS, ADVOCATES AND PHYSICIANS TO DECLARE PROSTATE CANCER A PUBLIC HEALTH PRIORITY AT STATE HOUSE EVENT';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'MASSACHUSETTS LEGISLATORS, ADVOCATES AND PHYSICIANS TO DECLARE PROSTATE CANCER A PUBLIC HEALTH PRIORITY AT STATE HOUSE EVENT',
		'Massachusetts leaders will gather at the State House today for Prostate Cancer Awareness Day to proclaim prostate cancer as a public priority in Massachusetts and a health care crisis in African American men, and discuss recent advances in early diagnosis and treatment. Senate President Therese Murray will announce a Governor\'s Proclamation of September 15 as a Massachusetts Prostate Cancer Awareness Day for the first time in the history of the state',
		'MASSACHUSETTS LEGISLATORS, ADVOCATES AND PHYSICIANS TO DECLARE PROSTATE CANCER A PUBLIC HEALTH PRIORITY AT STATE HOUSE EVENT',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Cancer Weekly via NewsRx.com',
		'September 27, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_22_eng-newsrx_eng-newsrx_093623_2915623431127096842',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	documentMetadata = new MakeDocumentMetadata('internal', '2011-09-29T08:48:48');
	publicationMetadata = new MakePublicationMetadata('NewsRx.com');

	title = 'IT\'S MOUSTACHE SEASON -- ANNUAL MOVEMBER CAMPAIGN KICKS OFF FOR CANCERS AFFECTING MEN';
	metadata = new MakeMetadata(documentMetadata, publicationMetadata, '', '', '', '');

	core = new MakeCore(
		'IT\'S MOUSTACHE SEASON -- ANNUAL MOVEMBER CAMPAIGN KICKS OFF FOR CANCERS AFFECTING MEN',
		'Movember kicks off its 5th annual world-wide campaign in the US, challenging men across the country to show their support by growing a Mo (slang for moustache) this November. To help support Prostate Cancer Awareness Month, today men and women across the country can raise funds and awareness for men\'s health by registering at www.Movember.com.',
		'IT\'S MOUSTACHE SEASON -- ANNUAL MOVEMBER CAMPAIGN KICKS OFF FOR CANCERS AFFECTING MEN',
		'',
		'??? 2007 NewsRx.com. All Rights Reserved.;;??Copyright 2011, Cancer Weekly via NewsRx.com',
		'October 4, 2011',
		'',
		''
		);

	article = new MakeArticle(title, metadata, core, '');

	contents[++Index] = new MakeContent(
		'newsrx_2011_09_29_eng-newsrx_eng-newsrx_084848_2534023939944705838',
		'01317327915837',
		'article',
		'en-US',
		'',
		article
		);

		
	

//////////////////////// End PER ARTICLE section

	contentSetId = '890_PROSTATE';
	contentSetName = 'PROSTATE';
	contentSetLanguage = '';
	contentSetPublishedDate = '2011-09-29T15:25:44';

	id = '890_PROSTATE';
	contentType = '';

} // End data initialization block.

if (typeof ContentIndex == "undefined") {
	ContentIndex = -1;
}

SMContentSet[++ContentIndex] = new MakeContentSet(contentSetId, contentSetName, contentSetLanguage, contentSetPublishedDate, contents);

