if (typeof CHUMS == "undefined" || !CHUMS) {
    /**
     * The C2 global namespace object.  If C2 is already defined, the
     * existing C2 object will not be overwritten so that defined
     * namespaces are preserved.
     * @class C2
     * @static
     */
    var CHUMS = {};
}

/**
 * Returns the namespace specified and creates it if it doesn't exist
 * <pre>
 * YAHOO.namespace("property.package");
 * YAHOO.namespace("YAHOO.property.package");
 * </pre>
 * Either of the above would create YAHOO.property, then
 * YAHOO.property.package
 *
 * Be careful when naming packages. Reserved words may work in some browsers
 * and not others. For instance, the following will fail in Safari:
 * <pre>
 * YAHOO.namespace("really.long.nested.namespace");
 * </pre>
 * This fails because "long" is a future reserved word in ECMAScript
 *
 * @method namespace
 * @static
 * @param  {String*} arguments 1-n namespaces to create 
 * @return {Object}  A reference to the last namespace object created
 * 
 * - FROM YAHOO.js YUI 2.6.0
 */
CHUMS.namespace = function() {
    var a=arguments, o=null, i, j, d;
    for (i=0; i<a.length; i=i+1) {
        d=a[i].split(".");
        o=CHUMS;

        // CHUMS is implied, so it is ignored if it is included
        for (j=(d[0] == "CHUMS") ? 1 : 0; j<d.length; j=j+1) {
            o[d[j]]=o[d[j]] || {};
            o=o[d[j]];
        }
    }

    return o;
};

CHUMS.oMenuBar = null;

CHUMS.initMenu = function() {
	CHUMS.oMenuBar = new YAHOO.widget.MenuBar("nav_top", { 
		autosubmenudisplay: true, 
		hidedelay: 750, 
		lazyload: false,
		minscrollheight: 150}
	);
	CHUMS.oMenuBar.render();
	// YAHOO.util.Dom.setStyle(['ym_2','ym_3','entertainment','information'], 'opacity', 0.8 );
}

YAHOO.util.Event.onContentReady("nav_top", CHUMS.initMenu);
CHUMS.oMenuBar = null;

var tabView = new YAHOO.widget.TabView('ProductTabs');
var PageTabView = new YAHOO.widget.TabView('PageTabs');
//
//function init() {
//	// Instantiate a Panel from markup
//	YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1", { width:"320px", visible:false, constraintoviewport:true } );
//	YAHOO.example.container.panel1.render();
//
//	YAHOO.util.Event.addListener("show1", "click", YAHOO.example.container.panel1.show, YAHOO.example.container.panel1, true);
//	YAHOO.util.Event.addListener("hide1", "click", YAHOO.example.container.panel1.hide, YAHOO.example.container.panel1, true);
//}
//
//YAHOO.util.Event.addListener(window, "load", init);



function SwitchProductImage(image)
{
	var img = document.getElementById('ProductImage-img');
	img.src = image;
}
 
CHUMS.wait = new YAHOO.widget.Panel("wait", { 
	width: "240px",  
	fixedcenter: true,  
	close: false,
	draggable: false,  
	zindex: 999, 
	modal: true, 
	visible: false 
});

CHUMS.init_imagePanel = function()
{
	CHUMS.imagePanel = new YAHOO.widget.Panel("imagepanel", {
		visible:false,
		modal: true,
		close: true
	} );
	CHUMS.imagePanel.render();
	//CHUMS.imagePanel.show();
	//alert(CHUMS.imagePanel.toString());
}
YAHOO.util.Event.addListener(window, "load", CHUMS.init_imagePanel);

CHUMS.imagePanel_display = function(filename,paneltitle)
{
	CHUMS.imagePanel.setHeader(paneltitle);
	CHUMS.imagePanel.setBody("<img src=\"" + (filename) + "\">");
	CHUMS.imagePanel.show();
}
CHUMS.imagePanel_displayText = function(bodyText,paneltitle)
{
	CHUMS.imagePanel.setHeader(paneltitle);
	CHUMS.imagePanel.setBody(bodyText);
	CHUMS.imagePanel.show();
}

CHUMS.activeColorSet = 0;
CHUMS.switchColor = function(colorId)
{
	if(CHUMS.activeColorSet > 0)
	{
		document.getElementById('colorset-' + CHUMS.activeColorSet).className = 'colorset';
		document.getElementById('colorlink-' + CHUMS.activeColorSet).className = 'colorlink';
	}
	document.getElementById('colorset-' + colorId).className = 'colorset colorset-default';
	document.getElementById('colorlink-' + colorId).className = 'colorlink colorlink-active';
	CHUMS.activeColorSet = colorId;
}
CHUMS.setActiveColor = function(colorId)
{
	CHUMS.activeColorSet = colorId;
}