//www.crystyl.com
//JavaScript Document
_separator_dot='.';
_separator_subdir='/';
_separator_underscore='_';
_validids='intro writings comments shop services lifeline';

function mainmenu_getid(){
	url=window.document.URL;
	if(url.indexOf('\\')!=-1) // page is in a local drive if '\\' detected
		_separator_subdir='\\';
	mark2=url.lastIndexOf(_separator_subdir,url.length);
	mark1=url.lastIndexOf(_separator_subdir,mark2-1);
	return url.substring(mark1+1,mark2);
}

function mainmenu_roll(id,tag){
	if(id==mainmenu_getid()&&tag!='2')
		return;
	img=eval('window.document._'+id);
	source=img.src;
	img.src=source.substr(0,source.length-5)+tag+'.gif';
}

function mainmenu_name2id(name){
	return name.substr(1,name.length-1);
}

function mainmenu_rollover(id){
	mainmenu_roll(mainmenu_name2id(id.name),'2');
}

function mainmenu_rollout(id){
	mainmenu_roll(mainmenu_name2id(id.name),'1');
}

function set_navi(){
	if(_validids.indexOf(id=mainmenu_getid())!=-1) // -1 for this page is not among the 6 main categories
		mainmenu_roll(id,'2');
}

function digits(n,d,z){
	if(!z)
		z='0';
	s=String(n);
	while(s.length<d)
		s=z+s;
	return s;
}

function gen_thumb(){
	document.write('<table width="120"  border="0" cellspacing="0" cellpadding="5">');
	for(n=1;n<_quantity;n++){
		document.write('  <tr>');
		for(m=0;m!=2;m++){
			n+=m;
			n2=digits(n,2,'0');
			document.write('<td>');
			if(n<=_quantity)
				document.write('<a href="'+n2+'.htm" target="windowphoto"><img src="t'+n2+'.jpg" width="50" height="50" border="0" class="image-left"></a>');
			else
				document.write('&nbsp;');
			document.write('</td>');
		}
		document.write('  </tr>');
	}
	document.write('</table>');
}
