var over   = new Array( "./images/buttons/home-over.gif", "./images/buttons/about-over.gif", "./images/buttons/specials-over.gif", "./images/buttons/contact-over.gif", "./images/buttons/bookmark-over.gif" );

var images = new Array( "homeImg", "aboutImg", "specialsImg", "contactImg", "bookmarkImg" );
var out     = new Array(); 

initEvents.push( function()
{
    var preload = new Array();
    

    for (var i = 0; i < over.length; i++)
    {
        var ov  = $( images[i] );
	
        out[i] = ov.src

        ov.over = over[i];
        ov.out  = out[i];

        addEvent( ov, "mouseover", function() { this.src=this.over; } );
        addEvent( ov, "mouseout", function() { this.src=this.out; } );
        preload[i] = new Image;
        preload[i].src = over[i];
    }

    addEvent( $( "bookmark" ), "click", function()
    {
     if (window.sidebar) // firefox
	window.sidebar.addPanel("Cocoboo - kid\'s boutique", 'http://www.cocoboo.com.au', "");
     else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href','http://www.cocoboo.com.au');
	elem.setAttribute('title',"Cocoboo - kid\'s boutique");
	elem.setAttribute('rel','sidebar');
	elem.click();
    } 
    else if(document.all)// ie
	window.external.AddFavorite('http://www.cocoboo.com.au', "Cocoboo - kid\'s boutique");
    }
    );

    addEvent( $( "selCat" ), "change", function() { window.location = "./?action=listCategoryItems&catId=" + this.value } );
    addEvent( $( "selBran" ), "change", function() { window.location = "./?action=listBrandItems&brndId=" + this.value } );
    addEvent( $( "selPri" ), "change", function() { window.location = "./?action=listPriceItems&priceId=" + this.value } );


    var a    = document.body.getElementsByTagName( "a" );

    for (var i = 0; i < a.length; i++)
    {
        if (a[i].className == "popupLink")
        {
	    
            addEvent( a[i], "click", function(e) {
			   
	    window.open( "./popup.php?itemId=" + this.rel, "_blank", "height=600,width=780,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no" );e.returnValue = false;
    
	    /*var i = $( "frame" );

	    i.style.display = "block";
	    i.src     = "./popup.php?itemId=" + this.rel;
	    i.style.top    = ((document.documentElement.clientHeight - 500)/2)+"px";
	    i.style.left    = ((document.documentElement.clientWidth - 780)/2)+"px";
	    i.style.position = "fixed";

	    $("blocker").style.display = "block";
	    $("blocker").style.overflow = "hidden";
            $("blocker").style.height = (document.body.offsetHeight +50) + "px";*/

	    if (e.preventDefault) e.preventDefault();
    
	    if (e.cancelBubble) e.cancelBubble = true;

	    return false; 
	    
	    } );
            a[i].href = window.location + "#";
	}
    }

} );


function closePage()
{
    $( "frame" ).style.display = "none";
    $("blocker").style.display = "none";
}
