/* Codename Rainbows */
/* April 14, 2009 Version */

/* Changelog */
/* April 14: Fixed the fact that it didn't actually work, line of debug code was breaking it */

/*

Copyright (c) 2009 Dragon Interactive

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

/* Concept and styles by Anand Sharma, coded by Yuri Vishnevsky. Special thanks to John Resig & the jQuery team for being so awesome. */

/* Dependencies: jQuery, stylesheet with auxiliary styles (see bottom of page) */

rainbows={init:function(a){$(function(){if(typeof a=="string"){a={selector:a}}var b={selector:".rainbows"};$.extend(b,a);if(b.from||b.to){rainbows.gradient(b)}if(b.shadow||b.highlight){rainbows.makeSnafucated(b)}})},gradient:function(b){var a={selector:".rainbows",from:"#ffffff",to:"#000000"};$.extend(a,b);$(a.selector).each(function(){$(this).css({position:"relative",overflow:"hidden"});var e=$(this).height();var g=$(this).css("height");var l=[];var j;var k=[parseInt(a.from.substring(1,3),16),parseInt(a.from.substring(3,5),16),parseInt(a.from.substring(5,7),16)],o=[parseInt(a.to.substring(1,3),16),parseInt(a.to.substring(3,5),16),parseInt(a.to.substring(5,7),16)];if(this.initHTML){j=this.initHTML}else{j=this.innerHTML}this.initHTML=j;for(var d=0;d<e*1;d++){var m=1-(e-Math.min(d,e))/e;var n=[Math.round(k[0]*(1-m)+o[0]*m),Math.round(k[1]*(1-m)+o[1]*m),Math.round(k[2]*(1-m)+o[2]*m)];l.push('<span class="rainbow rainbow-'+d+'" style="color: rgb('+n[0]+","+n[1]+","+n[2]+');"><span style="top: '+(-d)+'px;">'+j+"</span></span>")}this.innerHTML=l.join("");$(this).css("height",g)})},makeSnafucated:function(a){$(a.selector).each(function(){$(this).css("position","relative");if(this.initHTML){html=this.initHTML}else{html=this.innerHTML}var b="",c="";if(a.shadow){c='<span class="rainbows-shadow">'+html+"</span>"}if(a.highlight){b='<span class="rainbows-highlight">'+html+"</span>"}this.innerHTML=this.innerHTML+c+b})}};rainbows.init({highlight:true,shadow:true,from:"#ffffff",to:"#000000"});
