function rendernav1(categoryid)
{
navtoupdate = 'navlevel1';


// render nav 1
	new Effect.Fade(navtoupdate, {
			duration: 1.0,
			afterFinish: function()
			{
				
			$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render_nav.php?level=1&categoryid=' +categoryid;

			//new Effect.Appear('mainbody',{});
			//alert ("ok");
			Element.hide(navtoupdate);
			new Ajax.Updater(navtoupdate, tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear(navtoupdate,{duration: 1.0,queue:'back'});
			}
			
}
)

// end render nav
	
	
// render body

	new Effect.Fade('mainbody', {
			duration: 2.0,
			afterFinish: function()
			{
				
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render.php?level=1&categoryid=' +categoryid;
			
			//new Effect.Appear('mainbody',{});
			//alert ("ok");
			Element.hide('mainbody');
			new Ajax.Updater('mainbody', tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear('mainbody',{duration: 1.0,queue:'back'});
			}
			
}
)

// end render body

}

function rendernav2(categoryid,level)
{


// if clicking on level 2 items - update porducts listed but don't fade list of level 2 subcategories'
// this is called three times essentially - when first level item is selected and when the second level and third levels are - hence the required conditons
if (level==3)
 {
 	//level 3 - just render the body and leave it at that
 }

else if (level==2)
 {
 	// render body and nav level 3
 	
 	navtoupdate = 'navlevel3';
 	// render nav3 
	new Effect.Fade(navtoupdate, {
			duration: 2.0,
			afterFinish: function()
			{
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render_nav.php?level=3&categoryid=' +categoryid;
			//new Effect.Appear('mainbody',{});
			
			Element.hide(navtoupdate);
			new Ajax.Updater(navtoupdate, tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear(navtoupdate,{duration: 1.0,queue:'back'});
			}
			
}
)
// end render nav 2
 }
else
{
//fade nav 3 if open
new Effect.Fade('navlevel3',{duration: 1.0,queue:'back'});
navtoupdate = 'navlevel2';	
	// render nav 
	new Effect.Fade(navtoupdate, {
			duration: 2.0,
			afterFinish: function()
			{
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render_nav.php?level=2&categoryid=' +categoryid;
			//new Effect.Appear('mainbody',{});
			
			Element.hide(navtoupdate);
			new Ajax.Updater(navtoupdate, tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear(navtoupdate,{duration: 1.0,queue:'back'});
			}
			
}
)
// end render nav 2
}


// render body 
	new Effect.Fade('mainbody', {
			duration: 1.0,
			afterFinish: function()
			{
				
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render.php?level=2&categoryid=' +categoryid;
			
			//new Effect.Appear('mainbody',{});
			//alert ("ok");
			Element.hide('mainbody');
			new Ajax.Updater('mainbody', tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear('mainbody',{duration: 1.0,queue:'back'});
			}
			
}
)

// end render body
}

//function to render content on generic pages

function renderpage(pagename)
{
// fade out the nave if open
new Effect.Fade('navlevel1',{duration: 1.0,queue:'back'});
new Effect.Fade('navlevel2',{duration: 1.0,queue:'back'});
new Effect.Fade('navlevel3',{duration: 1.0,queue:'back'});


	new Effect.Fade('mainbody', {
			duration: 2.0,
			afterFinish: function()
			{
				
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = pagename;
			//tgurl = 'events.php'
			//new Effect.Appear('mainbody',{});
			//alert (pagename);
			Element.hide('mainbody');
			new Ajax.Updater('mainbody', tgurl, {asynchronous:false, evalScripts:false});
			//Element.show('mainbody');
			new Effect.Appear('mainbody',{duration: 2.0,queue:'back'});
			}
			
}
)
return false;
}


function renderpreviousnext(categoryid,offset)
{

	
// render body 
	new Effect.Fade('mainbody', {
			duration: 1.0,
			afterFinish: function()
			{
				
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'render.php?categoryid=' + categoryid + '&offset=' + offset;

			Element.hide('mainbody');
			new Ajax.Updater('mainbody', tgurl, {encoding:'html', asynchronous:false, evalScripts:true});
			//Element.show('mainbody');
			new Effect.Appear('mainbody',{duration: 1.0,queue:'back'});
			}
			
}
)
// end render body
}


function renderproductinfo(productid,showroomdisplay)
{

			tgurl = 'productdetail.php?action=snippet&productid=' + productid;
			Element.hide('productinfo');
			new Ajax.Updater('productinfo', tgurl, {encoding:'html', asynchronous:false, evalScripts:true});
			new Effect.Appear('productinfo',{duration: 1.0,queue:'back'});

	if (showroomdisplay > 0)
	{

				return overlib('click to enlarge <br>On display at Mico');
	}
	else
	{
				return overlib('click to enlarge');
	}
}

function popup(URL) 
	{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=820,height=780,left = 262,top = -16');");
	}
	
	
function rendersearchpreviousnext(productname,manufacturer,supplier,designer,category,offset)
{

	
// render body 
	new Effect.Fade('mainbody', {
			duration: 1.0,
			afterFinish: function()
			{
				
			//$('mainbody').innerHTML = '<table width="100%" height="100%"><tr align="center"><td valign="middle" align="center"><img src="images/indicator_verybig.gif"></td></tr></table>';
			tgurl = 'searchresults.php?action=browseresults&productname=' + productname + '&manufacturer=' + manufacturer + '&supplier=' + supplier+ '&designer=' + designer + '&category=' + category + '&offset=' + offset;
			//alert (tgurl);
			Element.hide('mainbody');
			new Ajax.Updater('mainbody', tgurl, {encoding:'html', asynchronous:false, evalScripts:true});
			//Element.show('mainbody');
			new Effect.Appear('mainbody',{duration: 1.0,queue:'back'});
			}
			
}
)
// end render body
}	
