/*******************************************************
Author:					Tim Miller
Date:					05/23/2007
Filename:				changeNrContent.js

Description:			This file gets the current netReturns module from the page URL and 
						inserts content into a document element according to a value set in an
						array of netReturns modules.
						
-Change variables in Content container, Default content and Change content sections.
-Edit module array for module specific content.
-Add call to the BODY tag of document: onload="changeNrContent();"
*******************************************************/

function changeNrContent(){
	//Content container.
	var contentContainer = "secBannerWrapper";

	//Default content
	var dType = "Image";//Image OR Flash
	var dWidth = 750;
	var dHeight = 100;
	var dSrc = "/Client_Files/yakimamemorial/sec_banr2.jpg";
	
	//************************
	var changeItObj = document.getElementById(contentContainer);
	var revStr = "";
	var x;
	
	locationStr = document.location.pathname.toString();
	
	a = locationStr.split("/");
	aPos = a.length-2;
	
	CreateModuleArray();
	
	
	if(a[aPos].toLowerCase() == "jobposting"){
		window.location = "https://www.healthcaresource.com/yakimavalley/index.cfm?fuseaction=search.categoryList&template=dsp_job_categories.cfm&CFID=15353111&CFTOKEN=10cdeb31c367f7a9-1A63AE32-5056-9E1E-21642C3904A84C29&jsessionid=c83039a2fb6d1a551a14";	
		}


	for(i=0; i<ModuleArray.length; i++){
		if(ModuleArray[i][0].toLowerCase() == a[aPos].toLowerCase()){
			x = i;
		}
	}
	
	if(x && ModuleArray[x][1] != ""){
		//Load revised content.
		if(ModuleArray[x][2] == "Image"){
			revStr += '<img src="' + ModuleArray[x][1] + '" width="' + ModuleArray[x][3] + '" height="' + ModuleArray[x][4] + '" />';
		}else if(ModuleArray[x][2] == "Flash"){
			changeItObj.style.height = ModuleArray[x][4] + "px";
			/*changeItObj.style.marginTop = "4px";
			changeItObj.style.marginBottom = "4px";*/
			document.body.style.backgroundImage = "url('/Client_Files/yakimamemorial/bk_green.gif')";
			revStr += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + ModuleArray[x][3] + '" height="' + ModuleArray[x][4] + '">';
			revStr += '<param name="movie" value="' + ModuleArray[x][1] + '" />';
			revStr += '<param name="allowScriptAccess" value="sameDomain" />';
			revStr += '<param name="quality" value="high" />';
			revStr += '<param name="wmode" value="opaque" />';
			revStr += '<embed src="' + ModuleArray[x][1] + '" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" width="' + ModuleArray[x][3] + '" height="' + ModuleArray[x][4] + '"></embed>';
			revStr += '</object>';
		}
	}else{
		//Load default content.
		if(dType == "Image"){
			revStr += '<img src="' + dSrc + '" width="' + dWidth + '" height="' + dHeight + '" />';
		}else if(dType == "Flash"){
			revStr += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + dWidth + '" height="' + dHeight + '">';
			revStr += '<param name="movie" value="' + dSrc + '" />';
			revStr += '<param name="allowScriptAccess" value="sameDomain" />';
			revStr += '<param name="quality" value="high" />';
			revStr += '<param name="wmode" value="opaque" />';
			revStr += '<embed src="' + dSrc + '" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" width="' + dWidth + '" height="' + dHeight + '"></embed>';
			revStr += '</object>';
		}
	}
	
	changeItObj.innerHTML = revStr;
}

function CreateModuleArray()
{
	ModuleArray = new Array(12);
	
	ModuleArray[0] = new Array(2);
	ModuleArray[0][0] = "General"; //module
	ModuleArray[0][1] = ""; //desired content src file for module
	ModuleArray[0][2] = ""; //content type (Image or Flash)
	ModuleArray[0][3] = ""; //width
	ModuleArray[0][4] = ""; //height
	
	ModuleArray[1] = new Array(2);
	ModuleArray[1][0] = "JobPosting";
	ModuleArray[1][1] = "/Client_Files/yakimamemorial/shell_banners_hr.swf";
	ModuleArray[1][2] = "Flash";
	ModuleArray[1][3] = 750;
	ModuleArray[1][4] = 180;
	
	ModuleArray[2] = new Array(2);
	ModuleArray[2][0] = "NewsReleases";
	ModuleArray[2][1] = "/Client_Files/yakimamemorial/sec_banr3.jpg";
	ModuleArray[2][2] = "Image";
	ModuleArray[2][3] = 750;
	ModuleArray[2][4] = 100;
	
	ModuleArray[3] = new Array(2);
	ModuleArray[3][0] = "Providers";
	ModuleArray[3][1] = "/Client_Files/yakimamemorial/sec_banr4.jpg";
	ModuleArray[3][2] = "Image";
	ModuleArray[3][3] = 750;
	ModuleArray[3][4] = 100;
	
	ModuleArray[4] = new Array(2);
	ModuleArray[4][0] = "HealthInfo";
	ModuleArray[4][1] = "/Client_Files/yakimamemorial/sec_banr5.jpg";
	ModuleArray[4][2] = "Image";
	ModuleArray[4][3] = 750;
	ModuleArray[4][4] = 100;
	
	ModuleArray[5] = new Array(2);
	ModuleArray[5][0] = "Events";
	ModuleArray[5][1] = "/Client_Files/yakimamemorial/sec_banr3.jpg";
	ModuleArray[5][2] = "Image";
	ModuleArray[5][3] = 750;
	ModuleArray[5][4] = 100;
	
	ModuleArray[6] = new Array(2);
	ModuleArray[6][0] = "GiftShop";
	ModuleArray[6][1] = "/Client_Files/yakimamemorial/sec_banr2.jpg";
	ModuleArray[6][2] = "Image";
	ModuleArray[6][3] = 750;
	ModuleArray[6][4] = 100;
	
	ModuleArray[7] = new Array(2);
	ModuleArray[7][0] = "CheerCards";
	ModuleArray[7][1] = "/Client_Files/yakimamemorial/sec_banr1.jpg";
	ModuleArray[7][2] = "Image";
	ModuleArray[7][3] = 750;
	ModuleArray[7][4] = 100;
	
	ModuleArray[8] = new Array(2);
	ModuleArray[8][0] = "Nursery";
	ModuleArray[8][1] = "/Client_Files/yakimamemorial/sec_banr2.jpg";
	ModuleArray[8][2] = "Image";
	ModuleArray[8][3] = 750;
	ModuleArray[8][4] = 100;
	
	ModuleArray[9] = new Array(2);
	ModuleArray[9][0] = "Enewsletter";
	ModuleArray[9][1] = "/Client_Files/yakimamemorial/sec_banr1.jpg";
	ModuleArray[9][2] = "Image";
	ModuleArray[9][3] = 750;
	ModuleArray[9][4] = 100;
	
	ModuleArray[10] = new Array(2);
	ModuleArray[10][0] = "Giving";
	ModuleArray[10][1] = "/Client_Files/yakimamemorial/sec_banr1.jpg";
	ModuleArray[10][2] = "Image";
	ModuleArray[10][3] = 750;
	ModuleArray[10][4] = 100;
	
	ModuleArray[11] = new Array(2);
	ModuleArray[11][0] = "Newsletters";
	ModuleArray[11][1] = "/Client_Files/yakimamemorial/sec_banr1.jpg";
	ModuleArray[11][2] = "Image";
	ModuleArray[11][3] = 750;
	ModuleArray[11][4] = 100;
	
	//for events registration and job application - they both have to have this same one. k.s.
	ModuleArray[12] = new Array(2);
	ModuleArray[12][0] = "Forms";
	ModuleArray[12][1] = "/Client_Files/yakimamemorial/sec_banr3.jpg";
	ModuleArray[12][2] = "Image";
	ModuleArray[12][3] = 750;
	ModuleArray[12][4] = 100;
	
	//for events registration and job application - they both have to have this same one. k.s.
	ModuleArray[13] = new Array(2);
	ModuleArray[13][0] = "Search";
	ModuleArray[13][1] = "/Client_Files/yakimamemorial/sec_banr3.jpg";
	ModuleArray[13][2] = "Image";
	ModuleArray[13][3] = 750;
	ModuleArray[13][4] = 100;

}