

window.addEvent('domready', function() {
    
    myPamoorama = new pamoorama('pamoorama', {'width': 920, 'activateSlider': true, 'captioncolor': '#888', 'footercolor': '#232323', 'autoscrollOnLoad' : true, 'autoscrollSpeed': 21000});
    
    
    var szNormal = 172, szSmall  = 172, szFull   = 172;
     
    var kwicks = $$("#kwicks .kwick");
    var fx = new Fx.Elements(kwicks, {wait: false, duration: 250, transition: Fx.Transitions.Back.easeOut});
    kwicks.each(function(kwick, i) {
	    kwick.addEvent("mouseenter", function(event) {
		    var o = {};
		    o[i] = {width: [kwick.getStyle("width").toInt(), szFull]}
		    kwicks.each(function(other, j) {
			    if(i != j) {
				    var w = other.getStyle("width").toInt();
				    if(w != szSmall) o[j] = {width: [w, szSmall]};
			    }
		    });
		    fx.start(o);
	    });
    });
     
    $("kwicks").addEvent("mouseleave", function(event) {
	    var o = {};
	    kwicks.each(function(kwick, i) {
		    o[i] = {width: [kwick.getStyle("width").toInt(), szNormal]}
	    });
	    fx.start(o);
    })
     
  function showtips() { 
    var Tips2 = new Tips($$('.Tips2'), {
	    initialize:function(){
		    this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 400, wait: false}).set(0);
	    },
	    onShow: function(toolTip) {
		    this.fx.start(1);
	    },
	    onHide: function(toolTip) {
		    this.fx.start(0);
	    }
    });
   }

    $('start').addEvent('click', function(e) {
	    e = new Event(e).stop();
     
	    var url = "featured.php";
     
	    /**
	     * The simple way for an Ajax request, use onRequest/onComplete/onFailure
	     * to do add your own Ajax depended code.
	     */
	    new Ajax(url, {
		    method: 'get',
		    update: $('log'),
		    evalScripts: true,
		    onComplete: featured
	    }).request();
    });
    
    
    $('start1').addEvent('click', function(e) {
	    e = new Event(e).stop();
     
	    var url = "inventory.php";

	    new Ajax(url, {
		    method: 'get',
		    update: $('log'),
		    evalScripts: true,
        onComplete: TB_init
	    }).request().chain(featured);
    });    

    $('start2').addEvent('click', function(e) {
	    e = new Event(e).stop();
     
	    var url = "options.php";
     
	    /**
	     * The simple way for an Ajax request, use onRequest/onComplete/onFailure
	     * to do add your own Ajax depended code.
	     */
	    new Ajax(url, {
		    method: 'get',
		    update: $('log'),
		    evalScripts: true,
		    onComplete: showtips
	    }).request().chain(options);
    });    

    $('start3').addEvent('click', function(e) {
	    e = new Event(e).stop();
     
	    var url = "contact.php";
     
	    /**
	     * The simple way for an Ajax request, use onRequest/onComplete/onFailure
	     * to do add your own Ajax depended code.
	     */
	    new Ajax(url, {
		    method: 'get',
		    update: $('log'),
		    evalScripts: true,
		    onComplete: contact
	    }).request();
    });

    
    var featured = function() {
	    var box = $(this.options.update);
	    var fx = new Fx.Style(box, 'background-color', {
		    duration: 4000,
		    transition: Fx.Transitions.linear
	    }).start('#f8f174', '#fffff0');
    }

    var inventory = function() {  
	    var box = $(this.options.update);
	    var fx = new Fx.Style(box, 'background-color', {
		    duration: 2800,
		    transition: Fx.Transitions.linear
	    }).start('#f8f174', '#fffff0');
    }
    
    var options = function() {
	    var box = $(this.options.update);
	    var fx = new Fx.Style(box, 'background-color', {
		    duration: 2800,
		    transition: Fx.Transitions.linear
	    }).start('#f8f174', '#fffff0');
    }
    
    var contact = function() {
	    var box = $(this.options.update);
	    var fx = new Fx.Style(box, 'background-color', {
		    duration: 4800,
		    transition: Fx.Transitions.linear
	    }).start('#f8f174', '#fffff0');
    }

});
