// JavaScript Routines for Wieskamp Nantucket Baskets

/* ----------------------------------------------------------------------------- */

// show-hide DIV layer taken from Justin Barlow's NetLobo site
// http://www.netlobo.com/div_hiding.html

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

// show-hide DIV layer taken from Justin Barlow's NetLobo site
// http://www.netlobo.com/media/examples/div_hiding_test.html

	function elemOn(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "block";
	}
	function elemOff(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "none";
	}
	function hideAll(){
		document.getElementById('subnavmenu').style.display = "none";
		for( var i = 1; i <= 8; i++ )
			elemOff( 'focalpoint'+i );
	}
	function showAll(){
		for( var i = 1; i <= 8; i++ )
			elemOn( 'focalpoint'+i );
	}
	function showOne(elem_id){
		hideAll( );
		elemOn( elem_id );
	}

// JavaScript Document
// JavaScript routine for displaying caption for selected picture developed by Rich Hephner, 2006 

function switchPic(pic){
	// Change the picture source.
	var picsrc = pic.src;
	if(picsrc.match('thmb_')){
		lgpicsrc = picsrc.replace('thmb_','');
	}
	document.getElementById('largerPic').src = lgpicsrc;
	
	// Change the caption.
	// Be sure to id='thumbs' in the table definition!!
	var thumbs = document.getElementById('thumbs').getElementsByTagName('img');
	var caption_number = 0;
	for(i=0;i < thumbs.length; i++){
		if(thumbs[i].src.search('thmb_') != -1){
			if(picsrc == thumbs[i].src){
				document.getElementById('caption').innerHTML = captions[caption_number];
			}
			caption_number++;
		}
	}
	var caption = document.getElementById('caption');
	alert(cap);
	caption.innerHTML = captions[cap];
}

function init(){
	var thumbs = document.getElementById('thumbs').getElementsByTagName('img');
	for(i=0;i < thumbs.length; i++){
		if(thumbs[i].src.search('thmb_') != -1){
			thumbs[i].onmousedown = function(){switchPic(this);}
		}
	}
}

// from support page for Jeroen Wijering's Media Players
// http://home5.inet.tele.dk/nyboe/flash/mediaplayer/linkplaylist.htm

	function createplayer(theFile, go) {
		var s = new SWFObject("flvplayer_dutch.swf","thePlayerId","480","470","7");
		s.addParam("allowfullscreen","true");
		s.addVariable("file",theFile);
		s.addVariable("width","480");
		s.addVariable("height","470");
		s.addVariable("shuffle","false");
		s.addVariable("displayheight","360");
		s.addVariable("overstretch","fit"); // original value was 'fit'
		s.addVariable("backcolor","0x000000");
		s.addVariable("frontcolor","0xfdfdf2");
		s.addVariable("lightcolor","0xFF9933");
		s.addVariable("autoscroll","true");
		s.addVariable("showicons","false");
		//s.addVariable("rotatetime","60");
		if (go) { s.addVariable("autostart","true"); }
		s.write("videoframe");
}

/* ----------------------------------------------------------------------------- */
