
var style = new Hash({'Grey':'#2C2C29','Light':'url(http://cdn.mangafox.com/media/texturebg.3.png)','Crowd':'#000 url(http://www.talentcake.com/media/pics/site/bodyBackground.jpg) center -130px  no-repeat','Rock & Roll':'#656565 url(http://www.mmowebs.com/blog/wp-content/uploads/tileb.jpg) repeat-x fixed bottom center','Green Chi':'url(http://shizoo-design.de/stuff/patterns/127.jpg)','Cut':'url(http://shizoo-design.de/stuff/patterns/83.jpg)' });


window.addEvent('load', function(){	
if (Cookie.read('background'))
 var mys = style.get(Cookie.read('background'));
 else 
 var mys = style.get('Light');
 $(document.body).setStyle('background',mys);
});

window.addEvent('domready', function(){	

var randomQoute = function() { 
    var l = $$('.textwidget div').getRandom();
    l.getParent().getChildren('div').erase(l).fade('out');
    l.fade('in');
    l.getParent().tween('height',l.getSize().y+'px');
}
randomQoute();
randomQoute.periodical(20000);

$$('.input').each(function(el) {
    el.set('value',el.get('alt'));
    el.addEvents({
         'focus': function(){
                if( el.get('value') == el.get('alt')) el.set('value','');
                
          },
          'blur': function(){
                if( el.get('value') == "" ) el.set('value',el.get('alt'));
          } 
    });
});
 $$('.post:odd').setStyle('background-color', '#f3f3f3');	
$$('.blogroll li a').each(function(el) {
 el.set('href','http://www.mmowebs.com/blog/demo/'+el.get('href').replace(/http\:\/\//i,''));
   el.addEvents({
     'mouseenter': function(e) {
         el.tween('margin-left','2px');
     },
    'mouseleave': function(e) {
          el.tween('margin-left','0px');
     }
   });
  });
$$('a[href^=http://www.mmowebs.com/]').each(function(e) {
      if (!e.get('href').contains('/blog')) {
           e.set('href','http://www.mmowebs.com/blog/demo/'+e.get('href').replace(/http\:\/\//i,''));
           e.addClass('demo');
       }
}); 
var tr =  document.id('top_cufon');
var ul = new Element('div').inject(tr);
style.each(function(v,k) {
    var li = new Element('a',{'href':'#'+k,'class':'tipz','title':'Theme Changer :: '+ k}).set('html',k).inject(ul);
       li.setStyle('background',v);        
       if (k == Cookie.read('background')) li.addClass('active');
       li.addEvents({
       'mouseenter': function() {
         
           this.set('tween', {duration: 'long'});
           this.tween('border',['2px solid #ff0','2px solid #aaa']);
     
       },
       'mouseleave': function() {
          
       },

            'click': function(e) {
                e.stop();
                ul.getElements('a').tween('border',['2px solid #ff0','2px solid #aaa']);
                this.tween('border',['2px solid #aaa','2px solid #ff0']);
                $(document.body).setStyle('background',v);
                var myCookie  = Cookie.write('background', k, {duration: 1});
            }
        });
});
var last = '';
$$('.post').addEvents({
    'mouseenter': function(e) {
        var tr = this.getElements('.continue a');
        last = tr.get('html');
        tr.set('html','Read More...');
        
    },
    'mouseleave': function() {
        var tr = this.getElements('.continue a');
        tr.set('html',last);
    },
    'dblclick': function() {
        var tr = this.getElements('.continue a');
        window.location.href = tr.get('href');
    }
});
$$('.cat-item').addEvents({
     'mouseenter': function() { 
        this.highlight('#fe4100','#ff0');
    }
});

( function() {
    var rd = $$('#top_cufon div a').getRandom();
    var bg = rd.getStyle('background');
    rd.getParent().getElements('a').tween('border',['2px solid #ff0','2px solid #aaa']);
    rd.tween('border',['2px solid #aaa','2px solid #ff0']);
    $(document.body).setStyle('background',bg);
}).periodical(60000);

$$('div.promote').addEvents({
    'mouseenter': function() {
        this.tween('opacity',1);
    },
    'mouseleave': function() {
        this.tween('opacity',0.6);
    }
});
$$('div.sociable ul li a').addEvents({
    'mouseenter': function() {
        this.tween('background-position','0px -50px');
    },
    'mouseleave': function() {
        this.tween('background-position','0 0');
    }
});


});

