var clientcodes = new Array(); 
var clientnames= new Array(); 
var clientimages=new Array(); 
var fileclient=new Array(); 
var filenames=new Array(); 
var filedesc=new Array(); 
var imagearray=new Array();
var thisurl=""; thisclient=""; 
var imagecount=0;
var imagepath="images/portfolio/";
var grxpath="images/grx/";
var mainimages="";
var varload="";
var thumbimages="";
var itimer = new Array();
scrfps=24; // animation speed, fps
scrduration=.5; // animation duration, secs

function dump(dumpvar) // for debugging
	{
	top.window.DUMP=window.open('','DUMP','');
	if (top.window.DUMP)
		top.window.DUMP.document.write(dumpvar+"<BR>");
	} 

function buildclients(fbclientcode,fbclientname)
	{
	clientcodes[clientcodes.length]=fbclientcode;
	clientnames[clientnames.length]=fbclientname;
	clientimages[clientimages.length]=0;
	}
function buildfiles(fbclientcode,fbname,fbdesc)
	{
	fileclient[fileclient.length]=fbclientcode;
	var ftname="";
	for (i=0;i<fbname.length;i++) //parse spaces in file names and replace
		{
		if (fbname.charAt(i)==" ")
			ftname=ftname+"%20";
		else
			ftname=ftname+fbname.charAt(i);
		}
	filenames[filenames.length]=ftname;
	filedesc[filedesc.length]=fbdesc;
	}

//modify this section as required
buildclients('arthur','Arthur Andersen LLP');
buildclients('bell','Bell Intrigna, Hongkong Bank Building');
buildclients('bdo','BDO Dunwoody, Cathedral Place');
buildclients('blanche','Blanche McDonald Institute, City Square');
buildclients('burnt','Burntsand, West Georgia');
buildclients('citi','Citigroup Private Bank');
buildclients('nl','Consulate of the Netherlands, Bentall Three');
buildclients('continuum','Continuum Medical Care, Hollyburn Medical Centre');
buildclients('ddb','DDB Canada');
buildclients('dundee','Dundee Securities');
buildclients('fletcher','Fletcher Challenge');
buildclients('goldcorp','Goldcorp');
buildclients('gthorn','Grant Thornton');
buildclients('hammer','Hammerberg and Company');
buildclients('haywood','Haywood Securities');
buildclients('hewitt','Hewitt');
// buildclients('hewitt','Hewitt'); Images supplied but not listed as client...add to full client listing
buildclients('incognito','Incognito Software');
buildclients('healing','Integrative Healing Arts');
buildclients('maritime','Maritime Life, Bentall Four');
buildclients('odlum','Odlum Brown');
buildclients('placer','Placer Dome, Harbour Centre'); // does not light up placer
buildclients('royal','Royal LePage Commercial, Howe Street');
buildclients('vcha','Vancouver Coastal Health, IMIS');
buildclients('west','West Fraser Timber, Beatty Street');

buildfiles('arthur','arthur.lobby','Lobby');
buildfiles('arthur','arthur.entrance','Entrance');

buildfiles('arthur','arthur.office','Office');
buildfiles('arthur','arthur.office2','Office');
buildfiles('arthur','arthur.staff','Staffroom');
buildfiles('bell','BellElevLobby','Elevator lobby');
buildfiles('bell','BellEntrance','Entrance');
buildfiles('bell','BellLobby1','Lobby');
buildfiles('bell','BellBoardroom','Board room');
buildfiles('bell','BellPanelDetail','Panel detail');
buildfiles('bell','BellDoorDetail','Door detail');
buildfiles('unknown','insignia2006.1',''); //cannot identify client
buildfiles('unknown','insignia2006.2',''); //cannot identify client
buildfiles('unknown','insignia2006.4',''); //cannot identify client
buildfiles('blanche','blanche.entrance','Entrance');
buildfiles('blanche','blanche.reception','Reception');
buildfiles('burnt','BurntElevatorLobby','Elevatorlobby');
buildfiles('burnt','BurntReception-BR','Reception');
buildfiles('burnt','BurntReception','Reception');
buildfiles('burnt','BurntBoardroom','Boardroom');
buildfiles('burnt','BurntStaff','Staff');
buildfiles('citi','Citigroup.1','');
buildfiles('citi','Citigroup.2','');
buildfiles('citi','Citigroup.3','');
buildfiles('citi','Citigroup.4','');
buildfiles('citi','Citigroup.5','');
buildfiles('continuum','Continuum.3','');
buildfiles('continuum','Continuum.1','');
buildfiles('continuum','Continuum.2','');
buildfiles('continuum','Continuum.4','');
buildfiles('ddb','DDB2006.1','');
buildfiles('ddb','DDB2006.2','');
buildfiles('ddb','DDB2006.3','');
buildfiles('ddb','DDB2006.4','');
buildfiles('ddb','DDB2006.5','');
buildfiles('dundee','dundee.lobby','Lobby');
buildfiles('dundee','dundee.staff.alt.','Staffroom');
buildfiles('dundee','arthur.corridor','Corridor'); // note file misnamed
buildfiles('fletcher','fletcher.entrance','Entrance');
buildfiles('fletcher','fletcher.reception','Reception');
buildfiles('fletcher','fletcher.boardroom','Boardroom');
buildfiles('fletcher','fletcher.corridor','Corridor');
buildfiles('fletcher','fletcher.corridor2','Corridor');
buildfiles('goldcorp','Goldcorp.1','');
buildfiles('goldcorp','Goldcorp.2','');
buildfiles('goldcorp','Goldcorp.3','');
buildfiles('goldcorp','Goldcorp.4','');
buildfiles('goldcorp','Goldcorp.5','');
buildfiles('goldcorp','Goldcorp.6x','');
buildfiles('goldcorp','Goldcorp.IMG_4915','');
buildfiles('goldcorp','Goldcorp.IMG_5003','');
buildfiles('gthorn','Gthornton.1','');
buildfiles('gthorn','Gthornton.2','');
buildfiles('gthorn','Gthornton.3','');
buildfiles('gthorn','Gthornton.4','');
buildfiles('hammer','hammer.reception','Reception');
buildfiles('hammer','hammer.corridor1','Corridor');
buildfiles('hammer','hammer.corridor2','Corridor');
buildfiles('hammer','HammerStaff','Staff');
buildfiles('haywood','Haywood.entrance','Entrance');
buildfiles('haywood','Haywood.reception','Reception');
buildfiles('haywood','Haywood.Reception2','Reception');
buildfiles('haywood','haywood.bar','Bar');
//buildfiles('haywood','Haywood.corridor','Corridor');
buildfiles('haywood','Haywood.office','Office');
buildfiles('haywood','Haywood.staff','Staffroom');
buildfiles('haywood','Haywood.bath','Bath');
buildfiles('healing','HealingArts.1','');
buildfiles('healing','HealingArts.2','');
buildfiles('healing','HealingArts.3','');
buildfiles('healing','HealingArts.4','');
buildfiles('hewitt','Hewitt.1','');
buildfiles('hewitt','Hewitt.2','');
buildfiles('hewitt','Hewitt.3','');
buildfiles('hewitt','Hewitt.4','');
buildfiles('hewitt','Hewitt.5','');
buildfiles('homestake','homestake.04','');
buildfiles('incognito','incognito.reception.alt.May6','Reception');
//buildfiles('incognito','incognito.reception.May9','Reception');
buildfiles('incognito','incognito.corridor.pref.May5','Corridor');
buildfiles('incognito','incognito.entrance.May4','Entrance');
buildfiles('kumon','kumon.reception.07','Reception'); // not requested to be shown
buildfiles('maritime','maritime.lobby','Lobby');
buildfiles('maritime','maritimeCorridor','Corridor');
buildfiles('maritime','maritime.corridor.DSCN0613','Corridor');
buildfiles('maritime','maritime.corridor2.DSCN0615','Corridor');
buildfiles('newbridge','newbridge.reception.06','Reception'); // not requested to be shown
buildfiles('nl','NL.001','');
buildfiles('nl','NL.002','');
buildfiles('nl','NL.003','');
buildfiles('nl','NL.004','');
buildfiles('nl','NL.005','');
buildfiles('nl','NL.006','');
buildfiles('odlum','Odlum2006.1','');
buildfiles('odlum','Odlum2006.2','');
buildfiles('odlum','Odlum2006.3','');
buildfiles('odlum','Odlum2006.4','');
buildfiles('odlum','Odlum2006.5','');
buildfiles('placer','PlacerDome2006.1','');
buildfiles('placer','PlacerDome2006.2','');
buildfiles('placer','PlacerDome2006.3','');
buildfiles('placer','PlacerDome2006.4','');
buildfiles('placer','PlacerDome2006.5','');
buildfiles('prime','prime.corridor.9912e','Corridor');
buildfiles('prime','Prime.IMG_4877','');
buildfiles('prime','Prime.IMG_4880','');
buildfiles('prime','Prime.IMG_4882','');
buildfiles('prime','Prime.IMG_4887','');
buildfiles('prime','PrimeMisc.Reception.Newbridge','Reception');
buildfiles('royal','royal.reception.9912c','Reception');
buildfiles('royal','royal.lobby.9912a','Lobby');
buildfiles('royal','royal.corridor.9912b','Corridor');
buildfiles('unknown','unknown.lobby.05','Unknown');
buildfiles('unknown','unknown.lobby.20','Unknown');
buildfiles('unknown','unknown.staff.19','Unknown');
buildfiles('vcha','VCHA2006.4','');
buildfiles('vcha','VCHA2006.5','');
buildfiles('vcha','VCHA2006.1','');
buildfiles('vcha','VCHA2006.2','');
buildfiles('vcha','VCHA2006.3','');


<!-- // Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}


function loadflash()
	{
	if (imagecount==0)
		{
		var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		if(hasRightVersion) 
			{  // if we've detected an acceptable version
    		var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    		+ 'width="960" height="499"'
    		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    		+ '<param name="movie" value="prime_intro_20.swf" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="autohigh" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#000000" />'
    		+ '<embed src="prime_intro_20.swf" loop="false" menu="false" quality="autohigh" scale="noscale" wmode="transparent" bgcolor="#000000" '
    		+ 'width="960" height="499" name="prime_intro_20" align="middle"'
    		+ 'play="true"'
    		+ 'loop="false"'
    		+ 'quality="high"'
    		+ 'allowScriptAccess="sameDomain"'
    		+ 'type="application/x-shockwave-flash"'
    		+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    		+ '<\/embed>'
    		+ '<\/object>';
    		document.write(oeTags);   // embed the flash movie
  			} 
		else 
			{  // flash is too old or we can't detect the plugin
    		var alternateContent = 'This site requires Javascript enabled.'
  			+ 'To view the home page introduction, get the Macromedia Flash Player.'
   		+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
    		document.write(alternateContent);  // insert non-flash content
  			}
		}
	}

function countfiles()
	{
	for (f=0;f<filenames.length;f++)
		{
		for (c=0;c<clientnames.length;c++)
			{
			if (fileclient[f]==clientcodes[c]) 
				{
				clientimages[c]=clientimages[c]+1;
				}
			}
		}
	}


function parseclient()
	{
	// parse parameters out of url
	thisurl=window.location.href; // the url for this page as variable 
	if (thisurl.indexOf("#")>0)
		thisurl=thisurl.substring(0,thisurl.length-1); 
	if (thisurl.indexOf("?")>0)
		{
		thisurl=thisurl.substring(0,thisurl.indexOf("?"));
		thisclient=window.location.href.substring(window.location.href.indexOf("?")+1,window.location.href.length);
		if (thisclient.indexOf("#")>0)
			thisclient=thisclient.substring(0,thisclient.length-1); 
		}
	else
		thisclient="";
	// count images related to client
	if (!(thisclient==""))
		{
		for (i=0;i<filenames.length;i++)
			{
			imagearray[imagecount]=i; //record index of valid client image record
			if (thisclient==fileclient[i]) 
				imagecount=imagecount+1;
			}
		}
	if (imagecount>7)
		imagecount=7; // max 7 images for this design
	}	

function writeclients()
	{
	document.write("<table width='100%' padding='0' border='0'>");
	for (c=0;c<clientnames.length;c++)
		{
		if (clientimages[c]!=0)
			{
			tclienthref=thisurl+"?"+clientcodes[c];
			document.write("<tr><td><a href=\"");
			document.write(tclienthref);
			document.write("\"");
			document.write(" >"+clientnames[c]+"</a></td></tr>");
			if (thisclient==clientcodes[c])
				document.title="Prime Interiors: Portfolio: "+clientnames[c]; //re-sets page title to include client name
			}
		}
	document.write("</table>");
	}

function scrollanim(fpsn,fmove,fdelay,curstep,fsteps) // fpsn = current position 	scrollanim(curscrpsn,scrmove,scrtimer,1,scrsteps); 
	{
	var newpsn=(fpsn+(curstep*fmove));
	var newdelay=(curstep*fdelay);
	tfunc="MM_changeProp('imagediv','','style.left','"+newpsn+"px','DIV')"; //function MM_changeProp(objName,x,theProp,theValue)
	if (curstep<=fsteps)
		{
		itimer[itimer.length]=setTimeout(tfunc,Math.round(newdelay));
		scrollanim(fpsn,fmove,fdelay,curstep+1,fsteps); // self referencing allows browser refresh
		}
	}

function goimage(imagenum)
	{
	thisfile=filenames[imagearray[imagenum]];
	thisalt=""; //avoid null error
	thisalt=filedesc[imagearray[imagenum]];
	gocmd="MM_swapImage(\'";
	gocmd=gocmd+"mainimage"+imagenum; // id
	gocmd=gocmd+"\',\'\',\'"+imagepath;
	gocmd=gocmd+thisfile;
	gocmd=gocmd+".nx535.jpg\',1);";
	eval(gocmd);
	var curscrpsn=0;
	var scrollpsn=0;
	var thiswidth=0;
	for (i=0;i<=imagenum;i++)
		{
		imageid="mainimage"+i;
		if(document.layers)	   //NN4+
			{
			thiswidth=+document.layers[imageid].width;
			curscrpsn=document.layers['imagediv'].style.left;
       		}
    	else if(document.getElementById)	  //gecko(NN6) + IE 5+
       		{ 		  
        	var obj = document.getElementById(imageid);
			thiswidth=+obj.width;
			obj = document.getElementById('imagediv');
			curscrpsn=obj.style.left;
       		}
    	else if(document.all)	// IE 4
       		{
        	thiswidth=+document.all[imageid].width;
			curscrpsn=document.all['imagediv'].style.left;
       		}
		scrollpsn=scrollpsn+thiswidth+4; // allows for 4 pixel divider
		if (i==imagenum)
			scrollpsn=scrollpsn-(thiswidth/2)-4; // delete 4 pixel right divider for last image
		}
	if (curscrpsn.indexOf("px")>0)
		{
		curscrpsn=curscrpsn.substring(0,curscrpsn.length-2);
		curscrpsn=parseInt(curscrpsn);
		}
	scrollpsn=(480-scrollpsn); 
	if (scrollpsn>0)
		scrollpsn=0;
	scrsteps=(scrfps*scrduration);
	scrtimer=(Math.round(scrduration*1000/scrsteps)); 
	scrmove=(scrollpsn-curscrpsn)/scrsteps;
	scrollanim(curscrpsn,scrmove,scrtimer,1,scrsteps); 
	}
	
function parseimages()
	{	
	if (imagecount>0)
		{
		MM_showHideLayers('flashdiv','','hide');
		varload="";
		// varload="MM_preloadImages(\'"; PRELOAD UNNECESSARY
		thumbimages="<div id=\"filmstrip\"><img src=\"images/grx/Filmstrip.gif\" />";
		mainimages="<div id=\"imagediv\">";
		for (i=0;i<imagecount;i++)
			{ 
			thisfile=filenames[imagearray[i]];
			thisalt=""; //avoid null error
			thisalt=filedesc[imagearray[i]];
			//varload=varload+imagepath;
			//varload=varload+thisfile+".nx535.jpg\',\'";
			mainimages=mainimages+"<a href=\"#\" onclick=\"goimage("+i+");\"><img src=\""+imagepath;
			mainimages=mainimages+thisfile;
			//mainimages=mainimages+".320x535.jpg\" name=\""; preview 1/3 grid image deleted
			mainimages=mainimages+".nx535.jpg\" name=\""; // preview images now full crop image, preload unnecessary
			mainimages=mainimages+"mainimage"+i;
			mainimages=mainimages+"\" border=\"0\" id=\"";
			mainimages=mainimages+"mainimage"+i;
			mainimages=mainimages+"\" alt=\"";
			mainimages=mainimages+thisalt;
			mainimages=mainimages+"\" /></a>";
			mainimages=mainimages+"<img src=\"images/grx/DividerVertical.gif\" alt=\"divider\" width=\"4\" height=\"535\" />";
			thumbimages=thumbimages+"<div id=\"";
			thumbimages=thumbimages+"thumb";
			thumbimages=thumbimages+i;
			thumbimages=thumbimages+"\"><a href=\"#\" onclick=\"goimage(";
			thumbimages=thumbimages+i;  
			thumbimages=thumbimages+");\"><img src=\""+imagepath;
			thumbimages=thumbimages+thisfile;
			thumbimages=thumbimages+".68x45.jpg\" name=\"";
			thumbimages=thumbimages+"thumbimage"+i;
			thumbimages=thumbimages+"\" border=\"0\" id=\"";
			thumbimages=thumbimages+"thumbimage"+i;
			thumbimages=thumbimages+"\" alt=\"";
			thumbimages=thumbimages+thisalt;
			thumbimages=thumbimages+"\" /></a></div>";
			}
		mainimages=mainimages+"</div>";
		thumbimages=thumbimages+"</div>";
		//varload=varload.substring(varload,varload.length-2);
		//varload=varload+");";
		varload=varload+"MM_changeProp(\'filmstrip\',\'\',\'style.left\',((960-((imagecount*72)))+\"px\"),\'DIV\');";
		}
	else
		{
		thumbimages="";
		mainimages="<div id=\"imagediv\">";
		mainimages=mainimages+"<img src=\"images/portfolio/Prime.title.Kx535.jpg\" width=\"960\" height=\"535\">"
		mainimages=mainimages+"</div>";
		}
	varload=varload+" MM_timelinePlay(\'titleanimation\');";
	}
	
function writetitle()
	{
	document.write("<img src=\"images/grx/title.");
	if (imagecount!=0)
		document.write(thisclient);
	else
		document.write("prime"); // this image is a transparent  gif holder
	document.write(".gif\" name=\"TitleImg\" width=\"960\" height=\"65\" />");
	}

function writeaddie(fdom,fsite,fnick)
	{
	var mkey="@";
	var maddie="mai"+"lto:"+fnick+mkey+fsite+"."+fdom;
	document.write("<a href=\"");
	document.write(maddie);
	document.write("\">");
	document.write(maddie);
	document.write("</a>");
	}

countfiles();
parseclient();
parseimages();
if (top.window.DUMP)
	top.DUMP.document.close();
