// stoo slideShow 1.1
// (c)2007 Stoo - http://www.glitch.co.nz
//
// Credit where credit is due: Inspiration from JonDesign's SmoothGallery (http://www.jondesign.net/)
// and of course Valerio's mootools (http://mootools.net/)
// --------------------------------------------------------------------------------------------------------------

// ---------------------------------------------------
// variables

// ---------------------------------------------------
// nav menu
function startList() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function sfHover() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
//if (window.attachEvent) window.attachEvent("onload", sfHover);

// ---------------------------------------------------
// bac image
function startGallery() {
	var myGallery = new gallery($('myGallery'), {
	timed: true,
	showArrows: false,
	showCarousel: false,
	embedLinks: false,
	showInfopane: false
});
}

// dropdown menu
function formHandler(form){
	var URL = document.form.nav.options[document.form.nav.selectedIndex].value;
	if (URL) { window.location.href = URL; }
}

/*
Onload Layer
*/

/*  Window.iGrowl, version 1.0: http://icebeat.bitacoras.com
 *  Daniel Mota aka IceBeat <daniel.mota@gmail.com>
--------------------------------------------------------------------------*/
/*var iGrowl = {
  init: function(img,duration) {
    iGrowl.src = img;
    iGrowl.msg = [];
    iGrowl.active = false;
    iGrowl.duration = (duration || 2)*1000;
    Window.onDomReady(iGrowl.create);
  },
  create: function() {
    var imgiGrowl = new Image();
    imgiGrowl.onload = iGrowl.box.pass(imgiGrowl);
    imgiGrowl.src = iGrowl.src;
  },
  box: function(img) {
    iGrowl.height = img.height/2;
    iGrowl.width = img.width/2;
    new Element('div').setProperty('id','growl').setStyles({
      'height':img.height+'px','width':img.width+'px',
  	  'display':'none','position':'absolute','opacity':'0','z-index':'999',
  	  'background': 'transparent url('+iGrowl.src+') no-repeat'
  	}).injectInside(document.body);
  	new Element('p').setProperty('id','growlmsg').setStyles({
  	  'width':img.width+'px',
  	  'display':'none','position':'absolute','opacity':'0','z-index':'1000','padding-top':'35px',
      'font':'18px/25px "Lucida Grande", Arial','color':'#fff','text-align':'center'
  	}).injectBefore($('growl'));
  },
  queue: function() {
    var msg = iGrowl.msg.pop();
    if(msg) iGrowl.show(msg);
  },
  show: function(msg) {
    if(iGrowl.active) {
      iGrowl.msg.push(msg);
      return;
    }
    iGrowl.active = true;
    var top = Window.getScrollTop(), left = Window.getScrollLeft(), h = Window.getHeight()/2 , w = Window.getWidth()/2;
		var he = top+h-iGrowl.height, we = left+w-iGrowl.width;
		$('growlmsg').setStyles({'top':he+'px','left':we+'px','display':'block'}).setHTML(msg).setOpacity(1);
		$('growl').setStyles({'top':he+'px','left':we+'px','display':'block'}).setOpacity(0.8);
		iGrowl.hide.delay(iGrowl.duration);
  },
  hide: function() {
    $('growlmsg').effect('opacity',{onComplete:iGrowl.display}).custom(1,0);
    $('growl').effect('opacity',{onComplete: function(e) {
      iGrowl.display(e);
      iGrowl.active = false;
      iGrowl.queue.delay(200);
    }}).custom(0.8,0);
  },
  display: function(e) {
    e.setStyle('display','none');
  }
};

iGrowl.init('imgs/growl.png',5);
//window.extend({Growl:iGrowl.show});*/


// ---------------------------------------------------
// init
function run() {
	//Window.disableImageCache(); // Trying to disable the imageCache to fix IE6 issues
	
	emailCloak();
	startList();
	//sfHover();
	
	startGallery();
	domRollover();
	//new Png();
	
	/*iGrowl.init('../imgs/growl.png',5);
	iGrowl.show('Example Window.Growl<br />2 seconds');
	//window.Growl('Example Window.Growl<br />2 seconds');
	
	MyBoxA = new PBBAcpBox({
                    BoxStyles: {
                            'width': 494
                    }                   
                });*/
                
    //MOOdalBox.init.bind(MOOdalBox)
    
    /*MyBoxA = new PBBAcpBox({
                    BoxStyles: {
                            'width': 494
                    }                   
             });
    MyBoxA.alert("Alert: Welcome to Three Bags Full Childrenswear.<br />Having just launched in the UK we are offering 15% off all purchases<br />
made before the 31st March 2008...giving you a chance to experience the<br />unique qualities of our stylish merino wool tops, at a price not to be missed.<br />Enjoy!<br />The Three Bags Full Team");*/
}

Window.onDomReady(run);

// --------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------
