var marqueePos = -1;
var timeout = null;
var is_visible = true;
var marqueeText = [
   "I won in the slogan contest. Wow! I could not believe when I received the mail about it. This is for real. My slogan was -- Maigeta.com, winning the right way -- Within 2 days time I got Rs 500.00 Mobile recharge. -- by Mohan Reddy, Hyderabad",
        "I got my mobile rechage for free in guessing the unique number contest. I got 367 Rs of free mobile recharge. Lucky number for me :)-- by Deepak, U.P.",
        "the most honest site on internet. i got a small mp3 player for my promotional activity.i posted reviews on blogs n forums,invited friends n got a cool mp3 player with in 2 weeks.maigeta.com rocks!!!! thankyou maigeta.com.-- by Navneeth, Kerala",
        "Wow! I won a cool small mp3 player that I can carry anywhere with me. Thanks a lot Maigeta.com  -- by Kanu, Delhi",
	"Just found your site and I participated and won a Samsung mobile phone. I still can’t believe that there is a site like Maigeta which is   really giving winning gifts. Thanks a lot. I am looking forward to participate more.   -- by Rohit Gupta, Jodhpur, Rajasthan",		

	"My parents used to say that my biryani is good but now that I won the cooking contest on Maigeta.com I really believe it now. Thanks for the price money. I will buy something good for my parents and surprise them. It’s my first earning :)   -- by Abida, Hyderabad, AP",
	"You have started a very good site for fresh talents. Keep up the good work.   --by Dr. Amit Singh, Punjab ",
	"Though I didn’t win any contest till now on Maigeta.com but I collected lots of Maigeta points by referring my friends to this site. Hope soon I will get my gift :D -- by Vikas Arora, Delhi " ];

function changeMarqueeText () {
    var qText = "<i>" + marqueeText[marqueePos] + "</i>";


    document.getElementById("marquee").innerHTML = qText;
}

function setMarqueeOpacityForAllBrowsers ( alpha ) {
	document.getElementById ( "marquee" ).style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity:" + alpha + ")";	// MSIE
	document.getElementById ( "marquee" ).style.KHTMLOpacity = alpha / 100;	// Safari < 1.2, Konqueror
	document.getElementById ( "marquee" ).style.MozOpacity = alpha / 100;	// Older Mozilla & Firefox
	document.getElementById ( "marquee" ).style.opacity = alpha / 100;	// Safari 1.2+, newer Mozilla & Firefox, CSS3
}

function affectMarquee ( currentAlpha, increment, cbFuncName ) {

	var alpha = currentAlpha + increment;

	// have we gone beyond either threshold?
	if ( alpha < 0 || alpha > 95 )	// use 95 so code jumps from 95 -> 99; Mozilla flickers the div if 95 -> 100
	{
		// if so, cancel the operation by invoking callback
		if ( cbFuncName != null )
			cbFuncName ();
	} else {
		// else, adjust transparency and setup the next adjustment
		setMarqueeOpacityForAllBrowsers ( alpha );
		setTimeout ( "affectMarquee ( " + alpha + ", " + increment + ", " + cbFuncName + " )", 25 );
	}
}


function marqueeDisappear ()
{
	affectMarquee ( 100, -5, "marqueeDisappearCallback" );
}

function marqueeAppear ()
{
	affectMarquee ( 0, 5, "marqueeAppearCallback" );
}

function marqueeDisappearCallback ()
{
	is_visible = false;
	marqueeForward ();
	marqueeAppear ();
}

function marqueeAppearCallback ()
{
	is_visible = true;
	setMarqueeOpacityForAllBrowsers ( 99 );
	timeout = setTimeout ( "marqueeDisappear ()", 10000 );
}

function marqueeForward ()
{
	if ( timeout != null ) clearTimeout ( timeout ); // cancel the pending fade out
	marqueePos++;
	
	if ( marqueePos >= marqueeText.length ) marqueePos = 0;
	changeMarqueeText ();

	if ( is_visible )
		timeout = setTimeout ( "marqueeDisappear ()", 10000 ); // reschedule the fade out in another 10 s
}

function marqueeBackward ()
{
	if ( timeout != null ) clearTimeout ( timeout ); // cancel the pending fade out
	marqueePos--;
	if ( marqueePos < 0 ) marqueePos = marqueeText.length - 1;
	changeMarqueeText ();

	if ( is_visible )
		timeout = setTimeout ( "marqueeDisappear ()", 10000 ); // reschedule the fade out in another 10 s
}

function startMarquee () {
    debugger;
	marqueeDisappear ();
}
