﻿/************************************************************************************************
Flashing Elements.
Version	- 3.1
Author	- Anoop Nair.
Company	- MKCL.
Usage	- * Spans with class "FlashIt" are made flashing.
		  * Spans with class "FlashItNoDec" are made flashing, without any decoration in
				content text.
Changes:
	1.0 - Initial release.
	2.0 - Major changes.
	2.5 - Major changes.
	3.0 - Image for "New" flash (Backward compatible).
	3.1 - Bug Fix for "New" Image for Mozilla.
# COPYRIGHT NOTICE
# Copyright (c) 2006-2007 MKCL, All rights reserved.
# This script may be used and modified free of charge for Non-profit purposes by anyone as long
# as this copyright notice and the comments above are kept in their original form.
************************************************************************************************/

var flashSpan= new Array();
function InitFlash()
{
	var spans = document.getElementsByTagName("SPAN");
	var numFlash= 0;
	for(i=0; i< spans.length; i++)
	{
		if(String(spans.item(i).className).substring(0,7).toLowerCase() == "flashit")
		{
			flashSpan[numFlash]= spans.item(i);
			if(flashSpan[numFlash].innerHTML.toLowerCase()== "new")
			{
				flashSpan[numFlash].innerHTML= "";
				var image= document.createElement("IMG");
				image.src= "../Images/new.gif";
				image.alt= "New";
				flashSpan[numFlash].appendChild(image);
			}
			else if(String(spans.item(i).className).substring(0,12).toLowerCase() != "flashitnodec")
			{
				SetFlashStyles(flashSpan[numFlash]);
				if(navigator.userAgent.indexOf("IE")!= -1)
				{
					flashSpan[numFlash].style.display= "inline-block";
					if(flashSpan[numFlash].style.filter != 'undefined')
					{
						flashSpan[numFlash].style.filter= "alpha(opacity=0)";
						setInterval("FilterFlashWork("+numFlash+")", 500);
					}
				}
				else
				{
					//flashSpan[numFlash].style.textDecoration= 'blink';
					if (flashSpan[numFlash].style.opacity != 'undefined')
					{
						flashSpan[numFlash].style.opacity= 0;
						FlashWork(numFlash);
					}
				}
			}
			numFlash++;
		}
	}
}
function SetFlashStyles(elem)
{
	elem.innerHTML= "&bull;"+ elem.innerHTML+ "&bull;";
	elem.style.backgroundColor= "#60C0EC";
	elem.style.background= "#60C0EC";
	elem.style.border= "1px solid red";
	elem.style.fontWeight= "normal";
	elem.style.fontStyle= "italic";
	elem.style.fontSize= "90%";
	elem.style.color= "red";
}
function FilterFlashWork(index)
{
	flashSpan[index].style.filter= "alpha(opacity="+(parseInt(flashSpan[index].style.filter.substring(14))+100)%200+")";
}
function FlashWork(index)
{
	flashSpan[index].style.opacity= (parseInt(flashSpan[index].style.opacity)+1)%2;
	setTimeout('FlashWork('+index+')', 500);
}
InitFlash();