var start_color = "#ffe6aa";
var end_color = "#e7eff8";
var interval = 1200;
if (!navigator.appName.match("Internet Explorer")) {
// convert into RGB for Firefox/Chorme etc...
start_color = "rgb(" + hexToR(start_color) + ", " + hexToG(start_color) + ", " + hexToB(start_color) + ")";
end_color = "rgb(" + hexToR(end_color) + ", " + hexToG(end_color) + ", " + hexToB(end_color) + ")";
}
var the_array = new Array();
window.onload = function ()
{
the_array = getElementsByClassName(document,'flashingtext');
for (i = 0; i < the_array.length; i++) {
setInterval('flashtext(' + i + ')', interval );
}
}
function flashtext(the_element) {
if (the_array[the_element].rel) {
var the_values = the_array[the_element].rel.split(","); // start_color,end_color,interval
if (the_values[0]) { start_color = "#" +the_values[0] }
if (the_values[1]) { end_color = "#" +the_values[1] }
if (the_values[2] > 0) { interval = the_values[2] }
// convert into RGB for Firefox/Chorme etc...
if (!navigator.appName.match("Internet Explorer")) {
if (the_values[0]) { start_color = "rgb(" + hexToR(the_values[0]) + ", " + hexToG(the_values[0]) + ", " + hexToB(the_values[0]) + ")"; }
if (the_values[1]) { end_color = "rgb(" + hexToR(the_values[1]) + ", " + hexToG(the_values[1]) + ", " + hexToB(the_values[1]) + ")"; }
}
//alert("STart color: " + start_color + " and end: " + end_color + " and interval: " + interval);
}
if (the_array[the_element].style['backgroundColor'] != start_color) {
the_array[the_element].style['backgroundColor'] = start_color;
} else {
the_array[the_element].style['backgroundColor'] = end_color;
}
}
function getElementsByClassName(node,classname) {
if (node.getElementsByClassName) {
return node.getElementsByClassName(classname);
} else {
return (function getElementsByClass(searchClass,node) {
if ( node == null )
node = document;
var classElements = [],
els = node.getElementsByTagName("*"),
elsLen = els.length,
pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"), i, j;
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
})(classname, node);
}
}
function hexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
function hexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
function hexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}
Bookmarks