

function print(id, content)	{
	document.getElementById(id).innerHTML = content;
	window.resizeBy(0,-1);window.resizeBy(0,1);	//	force window redraw for Firefox, Netscape
}

function dotName(name)	{
	var g = name.split(' ');
	var r = '';
	var first = true;
	
	for(var i in g)	{
		if(g[i])	{

			if(!first)	r += '.';
						r += g[i];
			first = false;
		
		}
	
	}
	return(r);
}


function undotName(dottedName)	{
	var g = dottedName.split('.');
	var r = '';
	var first = true;
	for(var i in g)	{
		if(g[i])	{

			if(!first)	r += ' ';
						r += g[i];
			first = false;
			
		
		}
	
	}
	return(r);
}


function email(address)	{
	var r = '<a onFocus="blur();" href="mailto:'+address+'?subject=Pure Upper Murray Valleys website inquiry">'+address+'</a>';
	return(r);
}


function website(address)	{
	var r = '<a onFocus="blur();" href="http://'+address+'" target="link">'+address+'</a>';
	return(r);
}


/*

 0 Name
 1 Section
 2 Address
 3 Town
 4 Postcode
 5 Phone
 6 Toll-free
 7 Mobile
 8 Fax
 9 email
10 website
11 Contact
12 Intro text
13 Large image
14 Small image
15 Hours
16 Payment
17 Activities
18 Facilities
19 Rooms
20 Policy
21 Description
22 Menu
*/






function addRecord(data)	{
	var g = data.split('|');
	this.name = 		g[0];
	this.section = 		escape(g[1]);
	this.address = 		g[2];
	this.town = 		g[3];
	this.postcode = 	g[4];
	this.phone = 		g[5];
	this.tollfree = 	g[6];
	this.mobile = 		g[7];
	this.fax = 			g[8];
	this.email = 		g[9];
	this.website = 		g[10];
	this.contact = 		g[11];
	this.intro = 		g[12];
	this.largeImage = 	g[13];
	this.smallImage = 	g[14];
	this.hours = 		g[15];
	this.payment = 		g[16];
	this.activities = 	g[17];
	this.facilities = 	g[18];
	this.rooms = 		g[19];
	this.policy = 		g[20];
	this.description = 	g[21];
	this.menu = 		g[22];
}



/*

Read data, load objects

*/

var database = new Array();

for(var i in data)	{
	var g = data[i].split('|');
	if(g[0] == '')	continue;
	var __NAME = dotName(g[0]);
	database[__NAME] = new addRecord(data[i]);
}



/////////////////////////////////////////////////////////////////////////////

function offer(s)	{


	return('<br/>');

	var i, g;
	var text = '';
	s = dotName(unescape(s));

	
	for(i in offers[s])	{
	
		g = offers[s][i].split('|');
		text += '<div class="offer">';
		text += '<div class="inner">';
		text += '<em>'+g[0]+'<br/>'+g[1]+'<br/><nobr>'+g[2]+'</nobr></em>';
		text += 'Website advertising<br/>';
		text += 'Offer ends '+closeDate+'<br/>';
		text += 'Phone 02 6076 2277</div>';
		text += '</div>';
	
	}
	
	return(text);

}

//////////////////////////////////////////////////////////////

var pageIntro = new Array();

pageIntro['all'] = '';

pageIntro['Hotels'] = '';
pageIntro['Motels'] = 'Enjoy your stay at one of the many motels in the Upper Murray Valleys.  They are comfortable, clean and make a great base to explore the region.';
pageIntro['Caravan.Parks'] = 'You can pack a tent and roll out the sleeping bag, or bring your first class motor home to the pure Upper Murray Valleys knowing that you will find a wonderful spot in a pristine natural environment.  Stay and play and discover  the many caravan parks throughout the Pure Upper Murray Valleys. ';
pageIntro['Bed.and.Breakfast'] = 'Select a bed and breakfast getaway that will suit every taste and budget &mdash; from luxurious retreats, guest homes and farm stays.  They can be historic, romantic, quaint or promote a sense of old fashioned country hospitality.';
pageIntro['Resorts'] = 'Wake up with the kangaroos a your doorstep while overlooking a picturesque golf course on the Murray River and relax.  The pure Upper Murray Valleys is host to the Upper Murray Holiday Resort; the ideal place for a romantic getaway, business function or group booking.';
pageIntro['Self-contained'] = 'Smell the toast pop up, spread on a great high-energy topping, run yourself a deep bath or put on a load of washing.  Self-contained accommodation caters for the independent traveller. Cook up a storm using local ingredients, throw a log on your fire and enjoy a sense of feeling like you are in your home away from home.';
pageIntro['Shared'] = 'Luxury tent accommodation with an Indian Jungle theme, or maybe a forestry commission Hut with all the mod cons is more your style?  Maybe you are looking for something you\'re your car club or motorcycling buddies will enjoy as a group? If you are a little more adventurous you can tackle an orientation camp and enjoy a horse ride. The shared accommodation options are not vast but the quality experiences on offer are superb.';

pageIntro['History'] = '';
pageIntro['Community.Events'] = '';
pageIntro['Entertainment'] = '';
pageIntro['Adventure'] = '';
pageIntro['Art.and.Craft'] = '';
pageIntro['Gardens'] = '';
pageIntro['Food.and.Wine'] = '';

pageIntro['Festivals'] = 'Discover the life, diversity and fun of festivals throughout the Upper Murray Valleys and along the Snowy Valleys Way.';


//////////////////////////////////////////////////////////////


function index(department, section)	{

	var align = 1;
	var record;
	var intro, r, i, j;
	var text;
	var image;
	
	var d = dotName(unescape(department));
	var s = dotName(unescape(section));


	
	if(section == 'all')	text = '<h1>'+unescape(department)+'</h1>';
	else					{
							text = '<h1>'+unescape(section)+'</h1>';
							if(pageIntro[s] != '')	text += '<div class="panelOuter"><div class="panelInner">'+pageIntro[s]+'</div></div>';
							}
	
	for(i in database)	{
		record = database[i];
		intro = '';

		if(-1 != record.section.indexOf(section) || section == 'all')	{
		

		r = record.intro.split('%');
		for(j in r)	{
			if(r[j] == 'name')	intro += record.name.bold() + ' ';
			else				intro += r[j] + ' ';
		}
	
		if(record.smallImage == '1')	image = dotName(record.name);
		else							image = 'default';
		
		if(align)	{
			text += '<table class="thumbnail"><tr>';
			text += '<td class="text">'+intro+' <nobr><a onFocus="blur();" href="_page.htm?name='+escape(record.name)+'">[More info ...]</a></nobr></td>';
			text += '<td class="picture"><a onFocus="blur();" href="_page.htm?name='+escape(record.name)+'"><img src="../images/'+image+'_s.jpg" alt="'+record.name+'" border="0"></a></td>';
			text += '</tr></table>';
		}
		else	{
			text += '<table class="thumbnail"><tr>';
			text += '<td class="picture"><a onFocus="blur();" href="_page.htm?name='+escape(record.name)+'"><img src="../images/'+image+'_s.jpg" alt="'+record.name+'" border="0"></a></td>';
			text += '<td class="text">'+intro+' <nobr><a onFocus="blur();" href="_page.htm?name='+escape(record.name)+'">[More info ...]</a></nobr></td>';
			text += '</tr></table>';
		}
		align ^= 1;
		
		}	
	}
	
	text += offer(section);
	text += '<p>&nbsp;</p>'
	print('middle', text);

}



//////////////////////////////////////////////////////////////



/*

BUILD MENUS

*/

var menu = new Array();

menu['Accommodation'] = new Array(
'Hotels',
'Motels',
'Caravan Parks',
'Bed and Breakfast',
'Resorts',
'Self-contained',
'Shared'
);


menu['Attractions'] = new Array(
'Festivals',
'Community Events',
'History',
'Entertainment',
'Adventure',
'Art and Craft',
'Gardens',
'Food and Wine'
);



function showMenu()	{
	var i, j;
	for(i in menu)	{
//		document.writeln('<a onFocus="blur();" href="../database/'+i+'.htm">'+i.bold()+'</a>');
		document.writeln('<span>'+i.bold()+'</span>');
		for(j in menu[i])	{
			document.writeln('<a class="indent" onFocus="blur();" href="../database/_index.htm?department='+escape(i)+'&section='+escape(menu[i][j])+'"><img class="bullet" src="../images/clrx2.gif" border="0" align="middle" />'+menu[i][j]+'</a>');
		}
	}
document.writeln('<div style="text-align:right;">');
	document.writeln('<br><a class="bold" onFocus="blur();" href="../news/index.htm">Media Releases &raquo;</a>');
	document.writeln('<a class="bold" onFocus="blur();" href="../events/index.htm">Festivals, Events &raquo;</a>');
	document.writeln('<a class="bold" onFocus="blur();" href="../info/index.htm">Information &raquo;</a>');
	document.writeln('<br><a class="bold" onFocus="blur();" href="../home/index.htm"><img src="../images/home.gif" alt=" HOME " width="150" border="0" align="middle" /></a>');
document.writeln('</div>');

}




//////////////////////////////////////////////////////////////


function showRecord(name)	{
	
	var record = database[name];
	
	var text = '<h1>'+undotName(name)+'</h1>';
	
	text += table1(record);

	if(record.largeImage == '1')	{
		text += '<div class="image"><img src="../images/'+name+'.jpg" alt="'+undotName(name)+'" border="0" align="middle" /></div>';
	}
	
	text += '<div class="description">'+record.description+'</div>';
//	if(record.policy)	text += '<div class="policy"><p><b>Refund policy:</b> '+record.policy+'</p></div>';
	if(record.policy)	text += '<div class="policy"><p> '+record.policy+'</p></div>';
	text += table2(record);
	
	
	print('middle', text);

}

//////////////////////////////////////////////////////////////

function table1(record)	{

	var text = '';
	var row=0;
	
	var address = '';
	if(record.address)	address += record.address + ',<br/>';
	if(record.town)		address += record.town + ', ';
	if(record.postcode)	address += record.postcode;
	
	var phone = '';
	if(record.phone)	phone += record.phone;
	if(record.tollfree)	phone += '; toll free ' + record.tollfree;
	
	
	
	text += '<table class="user" cellpadding="5" cellspacing="2" border="1">';
	
	if(address)	{
		text += '<tr class="r'+row+'"><td class="c1">Address</td><td class="c2">'+address+'</td></tr>';
		row ^= 1;
	}

	if(phone)	{
		text += '<tr class="r'+row+'"><td class="c1">Phone number</td><td class="c2">'+phone+'</td></tr>';
		row ^= 1;
	}


	if(record.mobile)	{
		text += '<tr class="r'+row+'"><td class="c1">Mobile number</td><td class="c2">'+record.mobile+'</td></tr>';
		row ^= 1;
	}

	if(record.fax)	{
		text += '<tr class="r'+row+'"><td class="c1">Fax number</td><td class="c2">'+record.fax+'</td></tr>';
		row ^= 1;
	}

	if(record.email)	{
		text += '<tr class="r'+row+'"><td class="c1">Email address</td><td class="c2">'+email(record.email)+'</td></tr>';
		row ^= 1;
	}

	if(record.website)	{
		text += '<tr class="r'+row+'"><td class="c1">Website</td><td class="c2">'+website(record.website)+'</td></tr>';
		row ^= 1;
	}

	if(record.contact)	{
		text += '<tr class="r'+row+'"><td class="c1">Contact</td><td class="c2">'+record.contact+'</td></tr>';
		row ^= 1;
	}


	text += '</table>';
	
	
	
	return(text);

}



//////////////////////////////////////////////////////////////


function table2(record)	{

	var text = '';
	var row=0;
	
	text += '<table class="user" cellpadding="5" cellspacing="2" border="1">';

	
	if(record.hours)	{
		text += '<tr class="r'+row+'"><td class="c1">Hours</td><td class="c2">'+record.hours+'<br/><br/></td></tr>';
		row ^= 1;
	}

	if(record.payment)	{
		text += '<tr class="r'+row+'"><td class="c1">Payment options</td><td class="c2">'+record.payment+'<br/><br/></td></tr>';
		row ^= 1;
	}

	if(record.activities)	{
		text += '<tr class="r'+row+'"><td class="c1">Activities</td><td class="c2">'+record.activities+'<br/><br/></td></tr>';
		row ^= 1;
	}

	if(record.facilities)	{
		text += '<tr class="r'+row+'"><td class="c1">Facilities</td><td class="c2">'+record.facilities+'<br/><br/></td></tr>';
		row ^= 1;
	}

	if(record.rooms)	{
		text += '<tr class="r'+row+'"><td class="c1">Rooms</td><td class="c2">'+record.rooms+'<br/><br/></td></tr>';
		row ^= 1;
	}

	if(record.menu)	{
		text += '<tr class="r'+row+'"><td class="c1">Menu</td><td class="c2">'+record.menu+'<br/><br/></td></tr>';
		row ^= 1;
	}


	text += '</table>';
	
	return(text);

}

