

// ******************************************************************************************************************************* 

function dw(s)
{
  document.write(s);
}

// ******************************************************************************************************************************* 

function dw2(s)
{
  document.write(s + "<BR>");
}

// ******************************************************************************************************************************* 

function sP()
{

  dw("<P>");
}

// ******************************************************************************************************************************* 

function eP()
{

  dw("</P>");
}

// ******************************************************************************************************************************* 

function disk()
{

  if (location.pathname.search('d:') != -1) { 
    return 1;
  };

  if (location.pathname.search('D:') != -1) { 
    return 1;
  };

  return 0;
}

// ******************************************************************************************************************************* 

var wo_d_url = 'file:///D:/ftag/woodobjects/';
var wo_e_url = 'http://woodobjects.ca/';
var wo_f_url = 'http://objetsenbois.ca/';

// ******************************************************************************************************************************* 

function wo_url()
{

  if (disk()) { 
    return wo_d_url;
  };

  if (en_fr()) { 
    return wo_e_url;
  } else {
    return wo_f_url;
  };
}

// ******************************************************************************************************************************* 

function wo_url_e()
{
  if (disk()) { 
    return wo_d_url;
  };

  return wo_e_url;
}

// ******************************************************************************************************************************* 

function wo_url_f()
{
  if (disk()) { 
    return wo_d_url;
  };

  return wo_f_url;
}

// ******************************************************************************************************************************* 

function en_fr()
{
  
  if (disk()) {
    return 1;
  }

  if (location.host.search('objetsenbois') != -1) { 
    return 0;
  };

  if (location.host.search('ObjetsEnBois') != -1) { 
    return 0;
  };

  return 1;
}

// ******************************************************************************************************************************* 

function s_ef(e,f)
{
  if (en_fr() == 0) { 
    return f;
  } else {  
    return e;
  }
}

// ******************************************************************************************************************************* 

function dw_ef(e,f)
{
  dw(s_ef(e,f));
}

// ******************************************************************************************************************************* 

function member1(fName,lName,img) {

  this.firstName = fName;
  this.lastName  = lName;
  this.img       = img;

  this.webpage = 'no webpage';

  //dw(this.firstName);
  
  // *******************************************************************************

  this.getName = function() {
    return this.firstName + '&nbsp;' + this.lastName;
  }
  
  // *******************************************************************************

  this.getImg = function() {
    return this.img;
  }
  
  // *******************************************************************************

  this.setWebpage = function(s) {
    this.webPage = s;
  }

  // *******************************************************************************

  this.getWebpage = function() {
    return this.webPage;
  }
}

  var marty_schlosser = new member1('Marty','Schlosser','http://www.ottawawoodworking.ca/images/members/MartySchlosser.jpg');

  var richard_t_scott = new member1('Richard','Scott','http://www.ottawawoodworking.ca/images/members/richardtscott.jpg');



// ******************************************************************************************************************************* 

function random(a,b) {

  var rand_no = Math.random();

  rand_no = rand_no * (b - a);
  rand_no = Math.round(rand_no);
  rand_no = rand_no + a;

  debug('random ' + a + ' ' + b + ' ' + rand_no);
  return rand_no;
}

// ******************************************************************************************************************************* 


function showDebug() {

  window.top.debugWindow =

      window.open("",

                  "Debug",

                  "left=0,top=0,width=300,height=700,scrollbars=yes,"

                  +"status=yes,resizable=yes");

  window.top.debugWindow.opener = self;

  // open the document for writing

  window.top.debugWindow.document.open();

  window.top.debugWindow.document.write(

      "<HTML><HEAD><TITLE>Debug Window</TITLE></HEAD><BODY><PRE>\n");

}

function debug(text) {

  if (window.top.debugWindow && ! window.top.debugWindow.closed) {

    window.top.debugWindow.document.write(text+"\n");
  }

}


if (0) showDebug();

// ******************************************************************************************************************************* 

function set_title(name) {

  var e = 'Wood Objects';
  var f = 'Objets en bois';  

  var s = e;

  if (en_fr() == 0) { 
    s = f;
  }

  s = s + ' | ' + name;

  document.title=s;
}

// ******************************************************************************************************************************* 

function under_construction(text) 
{
	dw('<table width=100% border=1px>')
	dw('<tr>')
	dw('<td>')
	dw('<h1>')
	dw(s_ef('Important Notice','Notification importante'))
	dw('</h1>')
	dw('<ul>')
	dw('<h1>')
	dw
	(
		s_ef
		(
			'This page is under construction for the ' + c_year + ' event.',
			'Cette page est en construction pour l\'événement ' + c_year + '.'
		)
	)
	if (text != null) {
		dw(text)
	}
	dw('</ul>')
	dw('</table>')
	dw('<br>')
}

// ******************************************************************************************************************************* 

function set_logo(url) {

  var e = 'Wood Objects   <BR> Juried Woodwork Exhibition in the         <BR> National Capital Region';
  var f = 'Objets en bois <BR> Exposition de boiseries avec jury dans la <BR> Région de la capitale nationale';  
 
  var el = wo_e_url;
  var fl = wo_f_url;

  var s1 = e;
  var s2 = e;

  var l1 = el;
  var l2 = el;

  var kk;

  var ke = 'images/logos/image006x.jpg';
  var kf = 'images/logos/image005z.gif';


  if (en_fr() == 0) {
    s1 = f;
    l1 = el;
    kk =  ke;
  } else {
    s2 = f;
    l2 = fl;
    kk = kf;
  }
 
  dw("<DIV ALIGN='CENTER'>");
  dw('<TABLE>');
  dw('<TR>'); 
  dw("<TD colspan='3' align='center'>");
  dw("<A class='logo1'  HREF='" + l2 + url + "'>");
  dw("<img border='0' src='" + kk + "'>");
  dw("</A>");
  dw('</TABLE>');
  dw('</DIV>');
}


var mc = 0;
var mm = 0;
var ms = ' ';

var m1x = new Array()

function addm1x(a,b,c)
{
	var x = new Array()
	x.push(a)
	x.push(b)
	x.push(c)
	m1x.push(x)
}

// ******************************************************************************************************************************* 

function menu0() {

	var url = wo_url();

	mc = 0;

	m1(s_ef("Welcome","Accueil"),url + 'index.html');  
    m1(s_ef("2009 Entries & Prizes","2009 Entrées & Prix"),url + 'entries2009.html');  
 
	m1(s_ef("Guidelines","Lignes&nbsp;directrices"),url + 'index.html#G');  
	m1(s_ef("Application &nbsp;Form","Formulaire&nbsp;de&nbsp;participation"),url + 'index.html#A');  
	m1(s_ef("Awards","Prix"),url + 'awards2009.html');  
	m1(s_ef("Jury","Jury"),url + 'jury2009.html');  
	m1(s_ef("Sponsors","Commanditaires"),url + 'sponsors2009.html');
	m1(s_ef("Press&nbsp;Releases","Communiqué&nbsp;de&nbsp;Presse"),url + 'index.html#PR');  
	m1(s_ef("Contacts","Contacts"),url + 'contacts.html','contacts');
	m1("OWA",'http://www.ottawawoodworking.ca/',"target='owa'");
	m1(s_ef("Committee","Comité"),url + 'committee2009.html',"target='committee'");
	m1(s_ef("Fran&ccedil;ais","English"),s_ef(wo_f_url,wo_e_url) + 'index.html');  
	m1(s_ef("Email&nbsp;Webmaster","Email&nbsp;Webmaster"),'mailto:webmaster@woodobjects.ca?subject=Comments%20on%20Wood%20Objects%20Website&amp;body=I%20like%20the%20Wood%20Objects%20Website%20but%20..."');  
  
	m1(s_ef("2008 Entries & Prizes","2008 Entrées & Prix"),url + 'entries2008.html');  
 
	for (m in m1x) {
		var mm1 = m1x[m]
		m1(mm1[0],mm1[1],mm1[2])
	}
}

// ******************************************************************************************************************************* 

function menu1() {

  var url = wo_url();
  
  mm = 1;

  dw('<div class="menu">');
  dw('<img src="images/menuTop.gif"><BR>');
  menu0()
  dw('<img src="images/menuBottom.gif">');
  dw('</div>');
}


// ******************************************************************************************************************************* 

function menu2() {

  mc = 0;
  mm = 2;
  ms = ' ';
  
  dw('<br>');
  menu0() 
}

// ******************************************************************************************************************************* 

function m1(name,url,aux) {
 
	mc++;
	if (aux == null) aux==" ";
	if (mm == 1) {
		dw('<a class="menuButton"  href="' + url + '" ' + aux + '>' + name + '</a>')
	}
	if (mm == 2) {
		dw(ms);
		dw(' <a "  href="' + url + '" ' + aux + '>' + name + ' </a>');
	ms='|';
	}
}

// ******************************************************************************************************************************* 

function ctr(counter) 
{

  if (counter == null) {
    counter='default';
  }

  counter = 'counter.' + counter + '.' + s_ef('english','french');

  if (disk() == 0) {
    dw('<BR><iframe src ="http://woodobjects.ca/cgi-bin/counter1.php?&counter=' + counter +'" height=150 width="40%" frameborder="0" ></iframe>');
  } else {
    dw("<BR>tesing on disk. " + counter);
  } 
}

function linkc2(counter,name,url,target) 
{
	if (target == null) {
		target=" "
	} else {
		target=' TARGET=' + target + ' '
	}
	var t = '<A' + target + 'HREF="http://woodobjects.ca/cgi-bin/counter2.php?&counter=counter.' + counter + '&u=' + url+ '">' + name + '</A>'
	
	return t
}

// ******************************************************************************************************************************* 

function ctr2(counter,url) 
{

  if (counter == null) {
    counter='default';
  }

  counter = 'counter.' + counter + '.' + s_ef('english','french');

  dw('<BR><A target="_blank" href="http://woodobjects.ca/cgi-bin/counter2.php?&counter=' + counter + '&u=' + url +'">');

}

// ******************************************************************************************************************************* 

var now = new Date()

function imgn(a,c)
{
	return a[(now.getSeconds() + 1 + c) % a.length];
}

// ******************************************************************************************************************************* 

function simgACYx(a,c,y,x)
{
	var i = imgn(a,c)
	
	var t = '<A target=' + y + ' HREF="' + i + '">'
		+	'<IMG SRC="' + i + '" ' + x
		+	' ALT="' + i + '" '
		+	' title="' + i + '" '
		+ '>'
		+	'<br>' + y + '<br><br>'
		//+	i
		+	'</A>'
	
	return t
}

// ******************************************************************************************************************************* 

function imgACYx(a,c,y,x)
{
	dw(simgACYx(a,c,y,x))
}

// ******************************************************************************************************************************* 

var imgWO2008 = new Array()

var imgWO2008c = 0

var t = 'entries2008/entries1/woodshow-'

var x = new Array (
	'13','13b',
	'18','18a',
	'22','22a',
	'24','24a',
	'27','27a','27b',
	'33',
	'37','38',
	'46a'
)
	
	for (i in x) {
		imgWO2008.push(t + x[i] + '.jpg')
	}
	
	
var imgWO2009 = new Array()
	
var imgWO2009c = 0
	
var t = 'entries2009/reduced/'
	
var x = new Array (
	'hanging cupboard full',
	'hanging cupboard door open',
	'hanging cupboard drawers with dovetail',
	
	'chair front',
	'chair side',
	'chair front inlay and leather',
	'chair inlay and joinery',
	
	'wood and aluminum side table',
	'wood and aluminum side table front view',
	'wood and aluminum side table detail',
	
	'console table small',
	'console table joinery',
	'console table under side',
	
	'hanging cupboard full'
)
	
	for (i in x) {
		imgWO2009.push(t + x[i] + '.jpg')
	}
	
function img_WO2008(x)
{
	imgACYx(imgWO2008,imgWO2008c++,'Wood Objects 2008',x)
}

function img_WO2009(x)
{
	imgACYx(imgWO2009,imgWO2009c++,'Wood Objects 2009',x)
}

	
// ******************************************************************************************************************************* 

function sPage3(name,url,counter) 
{
  dw('<LINK href="styles.css" rel="stylesheet" type="text/css">');

  if (en_fr()) {
    dw('<LINK href="styles_e.css" rel="stylesheet" type="text/css">');
  } else {
    dw('<LINK href="styles_f.css" rel="stylesheet" type="text/css">');
  }
  set_title(name);
  
  
}

// ******************************************************************************************************************************* 

function ePage(counter) 
{
	
	
	var w = 'width=250 xheight=100'
	
	dw('<table>')
	
	dw('<tr><td>')
	img_WO2009(w)
	
	dw('<tr><td>')
	img_WO2008(w)
	
	dw('<tr><td>')
	img_WO2009(w)
	
	dw('<tr><td>')
	img_WO2008(w)
	
	dw('<tr><td>')
	img_WO2009(w)
	
	dw('<tr><td>')
	img_WO2008(w)
	
	dw('<tr><td>')
	img_WO2009(w)
	
	dw('<tr><td>')
	img_WO2008(w)
	dw('</table>')
	
	dw('<div class="footer">');  
	dw("<P><B><span style='color:#a14b16; font-weight:bold'>&copy;&nbsp;" + s_ef("Wood Objects 2009 ","Obect en Bois 2009") + "</span><BR>");
	
	//dw('xxxxx')
	menu2();
	
	dw("<P>" + s_ef("This document was last modified on ","Ce document était dernier modifié sur ") + document.lastModified);
	
	dw('<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>');
	
	ctr(counter);
	
	dw('<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>');
	dw('</div>');
}

// ******************************************************************************************************************************* 

var c_year = 2009

function page3(name,url,counter) 
{
	sPage3(name,url,counter);
	
	dw('<body>');
	if (0) {
		dw('<div class=logo1>')
		dw('<img height=130 src="images/logos/image007a.gif"></img>')
		dw('<br>Juried Woodwork Exhibit')
		dw('</div>')
	}

	dw('<div class="mainContain">')
	menu1()
	
	dw('<div class="content">');
	dw('<h1>' + s_ef('Wood Objects','Objets en bois') + ' ' + c_year + '</h1>')
	page3_main(); 
	dw('<br><font color=#aaaaaa>[end of page]</font>')
	dw('</div>');
	ePage(counter); 
	dw('</div>');
}

function showDomTree(topElement,topCode) {
	var outStr = ''; topCode = topCode ? topCode : '0';
	if( !topElement ) { outStr = 'Error, no top level element supplied.'; }
	else if( typeof( topElement.nodeType) == 'undefined' ) { outStr = 'Error, browser is not DOM compliant.'; }
	else {
		if( topElement.attributes ) {
			var elAttr = '';
			if( topElement.className ) { elAttr += 'this.totalInfo[\'className\']=unescape(\''+escape(topElement.className)+'\');'; }
			for( var x = 0; topElement.attributes[x]; x++ ) { if(topElement.attributes[x].nodeValue){
					elAttr += 'this.totalInfo[unescape(\''+escape(topElement.attributes[x].nodeName)+'\')]=unescape(\''+escape(topElement.getAttribute(topElement.attributes[x].nodeName))+'\');';
			} }
			for( var x in topElement.style ) { if(topElement.style[x]&&topElement.style[x]!='false'){
					elAttr += 'this.totalInfo[unescape(\'style.'+escape(x)+'\')]=unescape(\''+escape(topElement.style[x])+'\');';
			} }
		} else { var elAttr = 'this.totalInfo.nodeValue=unescape(\''+escape(topElement.nodeValue)+'\');'; }
		if( topCode == '0' ) { outStr += '<ul>'; }
		outStr += '<li>'+(topElement.firstChild?('<a href="#" onclick="disTog(\''+topCode+'\',this);return false;">[+]</a> '):'')+'<span onclick="if(window.MWJactEl){window.MWJactEl.className=\'\';}window.MWJactEl=this;this.className=\'highlighted\';this.totalInfo = new Object();'+elAttr+'if(window.handleAttributes){handleAttributes(this.totalInfo);}">'+((topElement.nodeName=='!')?'#comment':topElement.nodeName)+'</span>';
		if( topElement.firstChild ) {
			outStr += '<ul id="'+topCode+'" style="display:none;">';
			for( var x = 0; topElement.childNodes[x]; x++ ) {
				outStr += showDomTree( topElement.childNodes[x], topCode+'_'+x );
			}
			outStr += '</ul>';
		}
		outStr += '</li>';
		if( topCode == '0' ) { outStr += '</ul>'; }
	}
	return outStr;
}
function disTog(id,el) 
{
	el.innerHTML = ( el.innerHTML.indexOf( '+' ) + 1 ) ? '[-]' : '[+]'; 
	document.getElementById(id).style.display = document.getElementById(id).style.display ? '' : 'none';
}

function handleAttributes(ob) 
{ 
	var theStr = ''; 
	for( var x in ob ) 
	{
		theStr += ( theStr ? '\n' : '' ) + x + ' = ' + ob[x]; 
	} 
	dw('xxx' + theStr)
	//alert(theStr); 
}




