/* mods
- 
*/

if (top != self && typeof top.frames['header'].header_pageNotLoaded != 'undefined')	top.frames['header'].header_pageNotLoaded();
pageLoaded = false;

function documentLoaded()
{
	pageLoaded = true;
	if (top != self)
	{
		if (typeof top.frames['header'].header_pageLoaded != 'undefined') top.frames['header'].header_pageLoaded();
		top.origRegionContents = top.frames['header'].header_getRegionContents();
	}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
	var obj = MM_findObj(objName);
	//alert(obj);
	if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
		if (theValue == true || theValue == false)
			eval("obj."+theProp+"="+theValue);
		else eval("obj."+theProp+"='"+theValue+"'");
	}
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf('#')!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 //if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_getProp(objName,x,theProp) { //v6.0
	var obj = MM_findObj(objName);
	if (obj && (theProp.indexOf("style.")==-1 || obj.style))
		return eval("obj."+theProp);
}

/*function MM_propEquals(objName,x,theProp,theValue) { //v6.0
	var obj = MM_findObj(objName);
	if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
		if (theValue == true || theValue == false)
			return eval("obj."+theProp+"=="+theValue);
		else return eval("obj."+theProp+"=='"+theValue+"'");
	}
}*/

function MM_jumpMenu(targ,selObj,restore,defaultlink){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != '')
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function toggleListItem(listItemId) {
	//alert(MM_findObj('navItem'+listItemId));
	//alert('navItem'+listItemId+' - '+document.all['navItem'+listItemId]);//['navItem'+listItemId]);
	//MM_changeProp('navItem'+listItemId,'','style.color','ff0000');
	//MM_changeProp('navItem'+listItemId,'','style.backgroundColor','FF0000');
	//MM_changeProp('navItem'+listItemId,'','style.visibility','hidden');
	//MM_changeProp('navItem'+listItemId,'','style.display','none');
	
	if (MM_propEquals('navItem'+listItemId,'','style.display','none'))
		MM_changeProp('navItem'+listItemId,'','style.display','block');
	else
		MM_changeProp('navItem'+listItemId,'','style.display','none');
}

function showPageProperties() {
	if (MM_getProp('panel_page_properties','','style.visibility') == 'hidden')
	{
		curTag = document.all['page_properties_panel_title'];
		curTag.innerHTML = 'Page Properties';
		//MM_changeProp('page_properties_title','','innerHTML','Page Properties');
		
		MM_changeProp('page_properties_commands_page_properties','','style.visibility','visible');
		MM_changeProp('page_properties_commands_new_page','','style.visibility','hidden');
		
		selectTemplateById(top.curPageTemplate);
		document.all.page_properties_name.value = top.cur_page_properties_name;
		document.all.page_properties_title.value = top.cur_page_properties_title;
		document.all.page_properties_keywords.value = top.cur_page_properties_keywords;
		document.all.page_properties_description.value = top.cur_page_properties_description;
		
		MM_changeProp('panel_page_properties','','style.visibility','visible');
		
		//cur_page_properties_name = document.all.page_properties_name.value;
		/*cur_page_properties_title = document.all.page_properties_title.value;
		cur_page_properties_keywords = document.all.page_properties_keywords.value;
		cur_page_properties_description = document.all.page_properties_description.value;*/
	}
	/*if (MM_getProp('panel_page_properties','','style.visibility') == 'hidden')
		MM_changeProp('panel_page_properties','','style.visibility','visible');
	else
		MM_changeProp('panel_page_properties','','style.visibility','hidden');*/
}

function hidePageProperties() {
	if (MM_getProp('panel_page_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_page_properties','','style.visibility','hidden');
		
		top.cur_page_properties_name = document.all.page_properties_name.value;
		top.cur_page_properties_title = document.all.page_properties_title.value;
		top.cur_page_properties_keywords = document.all.page_properties_keywords.value;
		top.cur_page_properties_description = document.all.page_properties_description.value;
		
		if (top.selectedPageTemplate != top.curPageTemplate)
		{
			top.curPageTemplate = top.selectedPageTemplate;
			top.frames['header'].header_save();
		}
	}
}

function cancelPageProperties() {
	if (MM_getProp('panel_page_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_page_properties','','style.visibility','hidden');
		
		document.all.page_properties_name.value = top.cur_page_properties_name;
		document.all.page_properties_title.value = top.cur_page_properties_title;
		document.all.page_properties_keywords.value = top.cur_page_properties_keywords;
		document.all.page_properties_description.value = top.cur_page_properties_description;
	}
}

function showPanelPageNew() {
	if (MM_getProp('panel_page_properties','','style.visibility') == 'hidden')
	{
		curTag = document.all['page_properties_panel_title'];
		curTag.innerHTML = 'New Page';
		//MM_changeProp('page_properties_title','','innerHTML','New Page');
		
		MM_changeProp('page_properties_commands_page_properties','','style.visibility','hidden');
		MM_changeProp('page_properties_commands_new_page','','style.visibility','visible');
		
		selectTemplateById(top.curPageTemplate);
		document.all.page_properties_name.value = '';
		document.all.page_properties_title.value = '';
		document.all.page_properties_keywords.value = '';
		document.all.page_properties_description.value = '';
		
		MM_changeProp('panel_page_properties','','style.visibility','visible');
	}
}

function panelPageNewCreate() {
	if (MM_getProp('panel_page_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_page_properties','','style.visibility','hidden');
		
		top.cur_page_properties_name = document.all.page_properties_name.value;
		top.cur_page_properties_title = document.all.page_properties_title.value;
		top.cur_page_properties_keywords = document.all.page_properties_keywords.value;
		top.cur_page_properties_description = document.all.page_properties_description.value;
		
		top.frames['header'].pageNewCreate();
		//top.frames['header'].pageNewCreate(document.all.page_properties_name.value, document.all.page_properties_title.value, document.all.page_properties_keywords.value, document.all.page_properties_description.value);
		//top.frames['header'].pageNewCreate('','','','');
	}
}

function cancelPanelPageNew() {
	if (MM_getProp('panel_page_properties','','style.visibility') != 'hidden')
		MM_changeProp('panel_page_properties','','style.visibility','hidden');
}

function showPanelImageProperties() {
	if (MM_getProp('panel_image_properties','','style.visibility') == 'hidden')
		MM_changeProp('panel_image_properties','','style.visibility','visible');
}

function hidePanelImageProperties() {
	if (MM_getProp('panel_image_properties','','style.visibility') != 'hidden')
		MM_changeProp('panel_image_properties','','style.visibility','hidden');
}

function cancelPanelImageProperties() {
	if (MM_getProp('panel_image_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_image_properties','','style.visibility','hidden');
		
		//top.frames['header'].pageNewCreate(document.all.panel_page_new_name.value, document.all.panel_page_new_title.value);
	}
}

function showSnippetProperties()
{
	//alert('showSnippetProperties');
	if (MM_getProp('panel_snippet_properties','','style.visibility') == 'hidden')
	{
		contentTag = document.all[top.selectedContentName];
		snippetProperties = Array();
		if (typeof contentTag != 'undefined')
		{
			divs = contentTag.getElementsByTagName("div");
			//alert('divs.length: '+divs.length);
			for (var k=0; k<divs.length; k++)
			{
				//alert(k+' contentTag: '+contentTag);
				curDiv = divs[k];
				divIdAttribute = curDiv.attributes.getNamedItem('id');
				divPersonalIdAttribute = curDiv.attributes.getNamedItem('personalId');
				divTypeAttribute = curDiv.attributes.getNamedItem('type');
				divValueAttribute = curDiv.attributes.getNamedItem('value');
				
				if (divIdAttribute != null && divPersonalIdAttribute != null && divTypeAttribute != null && divValueAttribute != null)
				{
					if (divTypeAttribute.value == 'property')
					{
						//alert(divPersonalIdAttribute.value+', '+divValueAttribute.value);
						snippetProperties.push(Array(divIdAttribute.value, divPersonalIdAttribute.value, divValueAttribute.value));
					}
				}
			}
		}
	
		if (snippetProperties.length > 0)
		{
			contentTag = document.all['panel_snippet_properties_content'];
			newInnerHTML = '<table border="0" cellspacing="0" cellpadding="0">';
			for(var i=0; i<snippetProperties.length; i++)
			{
				var curSnippetPropertyId = snippetProperties[i][0];
				var curSnippetPropertyName = snippetProperties[i][1];
				var curSnippetPropertyValue = snippetProperties[i][2];
				
				if (curSnippetPropertyName.length > 1)
					curSnippetPropertyTitle = curSnippetPropertyName.substr(0,1).toUpperCase()+curSnippetPropertyName.substr(1);
				else
					curSnippetPropertyTitle = curSnippetPropertyName;
				
				newInnerHTML += '<tr><td><div class="label">'+curSnippetPropertyTitle+':</div></td><td><input class="field" id="snippet_properties_'+curSnippetPropertyName+'" name="snippet_properties_'+curSnippetPropertyName+'" propertyTag="'+curSnippetPropertyId+'" type="text" size="72" value="'+curSnippetPropertyValue+'"></td></tr>';
			}
			newInnerHTML += '</table>';
			
			contentTag.innerHTML = newInnerHTML;
			//alert(contentTag.innerHTML);
			
		}
		
		for (var i=0; i<=numSnippetSets; i++)
		{
			if (i == top.snippetSet)
				MM_changeProp('panel_snippet_properties_template_set_'+i,'','style.display','block');
			else
				MM_changeProp('panel_snippet_properties_template_set_'+i,'','style.display','none');
			
			/*MM_changeProp('panel_snippet_properties_template_set_'+i,'','style.visibility','hidden');
			
			snippetSetTag = document.all['panel_snippet_properties_template_set_'+i];
			if (typeof snippetSetTag != 'undefined')
			{
				snippetSetTagSetIdAttribute = snippetSetTag.attributes.getNamedItem('setId');
				if (snippetSetTagSetIdAttribute != null && snippetSetTagSetIdAttribute.value == 0)
					MM_changeProp('panel_snippet_properties_template_set_'+i,'','style.visibility','visible');
			}*/
		}
		
		selectSnippetTemplate(top.snippetTemplateId);
		
		MM_changeProp('panel_snippet_properties','','style.visibility','visible');
		
		//cur_page_properties_name = document.all.page_properties_name.value;
		/*cur_page_properties_title = document.all.page_properties_title.value;
		cur_page_properties_keywords = document.all.page_properties_keywords.value;
		cur_page_properties_description = document.all.page_properties_description.value;*/
	}
}

function acceptSnippetProperties() {
	if (MM_getProp('panel_snippet_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_snippet_properties','','style.visibility','hidden');
		
		contentTag = document.all['panel_snippet_properties_content'];
		if (typeof contentTag != 'undefined')
		{
			inputs = contentTag.getElementsByTagName("input");
			//alert('divs.length: '+divs.length);
			for (var k=0; k<inputs.length; k++)
			{
				//alert(k+' contentTag: '+contentTag);
				curInputs = inputs[k];
				inputPropertyTagAttribute = curInputs.attributes.getNamedItem('propertyTag');
				inputValueAttribute = curInputs.attributes.getNamedItem('value');
				
				if (inputPropertyTagAttribute != null && inputValueAttribute != null)
				{
					//alert(inputPropertyTagAttribute.value+', '+inputValueAttribute.value);
					propertyTag = document.all[inputPropertyTagAttribute.value];
					//alert(propertyTag);
					if (typeof propertyTag != 'undefined')
					{
						propertyTagValueAttribute = propertyTag.attributes.getNamedItem('value');
						if (propertyTagValueAttribute != null)
						{
							//alert(propertyTagValueAttribute.value);
							propertyTagValueAttribute.value = inputValueAttribute.value;
						}
					}
				}
			}
		}
	}
}

function cancelSnippetProperties() {
	if (MM_getProp('panel_snippet_properties','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_snippet_properties','','style.visibility','hidden');
		
		//document.all.page_properties_name.value = cur_page_properties_name;
		/*document.all.page_properties_title.value = cur_page_properties_title;
		document.all.page_properties_keywords.value = cur_page_properties_keywords;
		document.all.page_properties_description.value = cur_page_properties_description;*/
	}
}

function showItemSource() {
	if (MM_getProp('panel_source','','style.visibility') == 'hidden')
	{
		contentTag = document.all[top.selectedContentName];
		if (typeof contentTag != 'undefined')
		{
			panel_source_text.value = contentTag.innerHTML;
			MM_changeProp('panel_source','','style.visibility','visible');
		}
	}
}

function hideItemSource() {
	if (MM_getProp('panel_source','','style.visibility') != 'hidden')
		MM_changeProp('panel_source','','style.visibility','hidden');
}

function acceptPanelSource() {
	hideItemSource();
	
	contentTag = document.all[top.selectedContentName];
	if (typeof contentTag != 'undefined')
		contentTag.innerHTML = panel_source_text.value;
}

function cancelPanelSource() {
	hideItemSource();
}

/*function imageImport() {
	alert(top.frames['header'].document.all.formSave);
	top.frames['header'].document.all.formSave.file_browse.click();
	//document.all.formFile.file_browse.click();
}*/

/*function body_init()
{
	//top.contentRegionNames = contentRegionNamesString.split(',');
}

function snippet_save(snippetRegions)
{
	top.frames['header'].snippet_save(snippetRegions);
}*/

function body_init(newPagePath)
{
	alert('body init');
	curPagePath = 'events';//newPagePath;
	top.curPagePath = newPagePath;
}

function selectSnippet(snippetIndex, snippetRegionName, snippetTemplateId, snippetSet, regionParentId)
{
	//alert(snippetIndex+', '+snippetRegionName+', '+snippetSet+', '+regionParentId);
	if (navigator.appName == "Microsoft Internet Explorer"){
		clickX = event.clientX;
		clickY = event.clientY;
	}
	else {
		clickX = e.pageX;
		clickY = e.pageY;
	}
	//if (top.selectedContent != contentName)
	if (typeof clickLastXa == 'undefined' || (clickX != clickLastXa && clickY != clickLastYa))
	{
		top.snippetRegionName = snippetRegionName;
		top.snippetIndex = snippetIndex;
		top.snippetSet = snippetSet;
		top.snippetTemplateId = snippetTemplateId;
		top.regionParentId = regionParentId;
		
		//top.frames['header'].selectContent(contentId, contentName, contentType);
	}
	clickLastXa = clickX;
	clickLastYa = clickY;
	
	//top.snippetRegionName = snippetRegionName;
	//top.snippetIndex = snippetIndex;
	
	//alert(top.snippetIndex+','+top.snippetRegionName);
	//top.frames['header'].selectSnippetRegion(snippetRegionId);
}

function selectContent(contentId, contentName, contentType) {
	if (navigator.appName == "Microsoft Internet Explorer"){
		clickX = event.clientX;
		clickY = event.clientY;
	}
	else {
		clickX = e.pageX;
		clickY = e.pageY;
	}
	//if (top.selectedContent != contentName)
	if (typeof clickLastX == 'undefined' || (clickX != clickLastX && clickY != clickLastY))
		top.frames['header'].selectContent(contentId, contentName, contentType);
	clickLastX = clickX;
	clickLastY = clickY;
	
	//alert(contentType+': '+contentName);
}

function highlightContent(contentId, contentName, contentType) {
	//alert(contentType+': '+contentName+', '+contentId);
	//MM_changeProp(contentName,'','style.border','1px solid #993333');
	//MM_changeProp(contentName,'','class','editableContentSelected');
	/*bodyDivs = document.body.getElementsByTagName("div");
	for (i=0; i<bodyDivs.length; i++)
	{
		curBodyDiv = bodyDivs[i];
		curBodyDiv.className = 'editableContent';
	}*/
	
	if (typeof top.selectedContentName != 'undefined')
		MM_changeProp(top.selectedContentName,'','className','editableContent');
	
	top.selectedContentName = contentName;
	top.selectedContentId = contentId;
	MM_changeProp(contentName,'','className','editableContentSelected');
	//alert(contentName+': '+document.all[contentName].className);
	
}

function showDialog(messageText, title, buttons)
{
	if (MM_getProp('panel_dialog','','style.visibility') == 'hidden')
	{
		MM_changeProp('panel_dialog','','style.visibility','visible');
	}
}

function panelImageOpen(imageFilename, imageId)
{
	if (imagesLoaded[imageId])
	{
		imageFilename += imageId+'.jpg';
		
		MM_swapImage('student_image','', '/images/loading_project_image.gif',1);
		
		var nextImage = new Image();
		nextImage.onload = function() {
			MM_swapImage('student_image','', nextImage.src,1);
		}
		nextImage.src = imageFilename;
	}
	
	//imageFilename = siteRoot+'/images/projects/full/'+imageFilename+'.jpg';
	
	//imageFileName = '/images/projects/'+curPagePathSections[curPagePathSections.length-3]+'/'+curPagePathSections[curPagePathSections.length-2]+'/'+curPagePathSections[curPagePathSections.length-1]+'_';
	
	
	//alert(1);
	/*if (MM_getProp('panel_image','','style.visibility') == 'hidden') //pageLoaded &&
	{
		//alert(2);
		MM_changeProp('info','','style.visibility','hidden');
		//MM_changeProp('info','','style.visibility','visible');
		
		//imageFilename = 'http://www.resn.co.nz/dev/cms/images/projects/full/'+imageFilename+'.jpg';
		imageFilename = siteRoot+'/images/projects/full/'+imageFilename+'.jpg';
		
		//alert(3);
		//MM_swapImage('panel_image_image','','',1);
		//alert(4);
		//alert(5);
		//alert(6);
		
		//MM_swapImage('panel_image_image','','http://www.resn.co.nz/dev/cms/images/loading_project_image.gif',1);
		MM_changeProp('panel_image','','style.visibility','visible');
		//MM_swapImage('panel_image_image','',imageFilename,1);
		
		MM_swapImage('panel_image_image','', siteRoot+'/images/loading_project_image.gif',1);
		
		//panel_image = document.getElementById('panel_image_image');
		//panel_image_obj = MM_findObj('panel_image_image');
		
		var nextImage = new Image();
		nextImage.onload = function() {
			//panel_image.src = nextImage.src;
			//alert(nextImage.src);
			MM_swapImage('panel_image_image','', nextImage.src,1);
		}
		nextImage.src = imageFilename;
	}
	//alert(7);
	//return void(0);
	//return 0;*/
}

function panelImageClose()
{
	if (MM_getProp('panel_image','','style.visibility') != 'hidden')
	{
		MM_changeProp('panel_image','','style.visibility','hidden');
		MM_changeProp('info','','style.visibility','visible');
	}
}

function overNavItem(pageLocation, selectGraphic)
{
	//alert(pageLocation+', '+selectGraphic);
	MM_swapImgRestore();
	MM_swapImage('navItem'+pageLocation,'',selectGraphic,0);
}

function offNavItem(pageLocation)
{
	MM_swapImgRestore();
}

function selectTemplateById(templateId)
{
	top.selectedPageTemplate = templateId;
	//alert(templateId+', panel_page_properties_template_icon_'+templateIconIndex+', '+templateIconCount);
	
	//alert(curPageTemplate+', '+numPageTemplates);
	
	for (var i=0; i<numPageTemplates; i++)
	{
		MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon');
		
		templateTag = document.all['panel_page_properties_template_icon_'+i];
		if (typeof templateTag != 'undefined')
		{
			templateTagIdAttribute = templateTag.attributes.getNamedItem('templateId');
			if (templateTagIdAttribute != null && templateTagIdAttribute.value == templateId)
				MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon_sel');
		}
		
	}
}

function selectTemplateByIndex(templateIndex, templateId)
{
	top.selectedPageTemplate = templateId;
	//alert(templateId+', panel_page_properties_template_icon_'+templateIconIndex+', '+templateIconCount);curPageTemplate
	//alert(templateIndex);
	
	for (var i=0; i<numPageTemplates; i++)
	{
		if (i == templateIndex)
			MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon_sel');
		else
			MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon');
	}
}

/*function selectTemplate(templateId, templateIconIndex, templateIconCount)
{
	//alert(templateId+', panel_page_properties_template_icon_'+templateIconIndex+', '+templateIconCount);
	
	for (var i=0; i<templateIconCount; i++)
	{
		if (i == templateIconIndex)
			MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon_sel');
		else
			MM_changeProp('panel_page_properties_template_icon_'+i,'','className','template_icon');
	}
}*/

function selectSnippetTemplate(templateId)
{
	top.selectedSnippetTemplate = templateId;
	
	for (var i=0; i<numSnippetTemplates; i++)
	{
		MM_changeProp('panel_snippet_properties_template_icon_'+i,'','className','template_icon');
		
		snippetTemplateTag = document.all['panel_snippet_properties_template_icon_'+i];
		if (typeof snippetTemplateTag != 'undefined')
		{
			snippetTemplateTagIdAttribute = snippetTemplateTag.attributes.getNamedItem('templateId');
			if (snippetTemplateTagIdAttribute != null && snippetTemplateTagIdAttribute.value == templateId)
				MM_changeProp('panel_snippet_properties_template_icon_'+i,'','className','template_icon_sel');
		}
		
	}
}

function initSlideshow(baseFilename)
{
	slideshowBaseFilename = baseFilename;
	
	if (baseFilename == 'domestic_bliss')
	{
		curSlideshowLinks = ['fusion', 'element', 'range', 'cube', 'hub', 'project'];
		resetSlideshowInterval();
	}
	else if (baseFilename == 'energising_water')
	{
		curSlideshowLinks = ['tidal', 'kapil', 'pulse', 'miyabi', 'flo', '5sidedsquare', 'proud'];
		resetSlideshowInterval();
	}
	else if (baseFilename == 'inside_out')
	{
		curSlideshowLinks = ['arc', 'core', 'batch', 'duel', 'implant'];
		resetSlideshowInterval();
	}
}

function resetSlideshowInterval() {
	if (typeof slideshowInterval != "undefined")
		clearInterval(slideshowInterval);
	
	curSlideshowImageIndex = 0;
	slideshowInterval = setInterval('nextSlideshowImage()', 3000);
	
	nextSlideshowImage();
}

function nextSlideshowImage()
{
	if (curSlideshowImageIndex < curSlideshowLinks.length)
		curSlideshowImageIndex++;
	else
		curSlideshowImageIndex = 1;
	
	curImageName = curSlideshowLinks[curSlideshowImageIndex-1];
	curImageLink = '/portfolio/'+slideshowBaseFilename+'/'+curImageName;
	
	nextImage = new Image();
	nextImage.onload = function() {
		MM_swapImage('slideshow_image','', nextImage.src,1);
		MM_changeProp('slideshow_link','','href',curImageLink);
	}
	nextImage.linkName = curImageLink;
	nextImage.src = '/images/content/'+slideshowBaseFilename+'_'+curImageName+'.jpg';
}