var objTivi = new Array();
var iTiviTxt = new Array();
var iTiviTTL = new Array();
var iIndex = new Array();
var indTV = 0;


iTiviTTL['weekly-pit-preview'] = 'The Weekly Pit Review';
iTiviTTL['premium-trade-service'] = 'Premium Trade Recs';
iTiviTTL['http://blog.pitguru.com'] = 'PitGuru Blogs';
iTiviTTL['pitguru-tv'] = 'PitGuru TV';
iTiviTTL['pit-radio'] = 'PitGuru Radio';
iTiviTTL['free-futures-stuff'] = 'Free Futures Tools';

iTiviTxt['weekly-pit-preview'] = '<div class="embed" style="float:left; width:150px; text-align:right;">\
                                    <div id="weekly-pit-previe-flash">\
                                    </div>\
						          </div>\
						          <div class="fleft c0" style="float:left; width:200px; padding-left:5px;">\
							        <div class="lst pit" style="padding:0;">\
								        <dl>\
									        <dt class="f_b">Free!</dt>\
									        <dt style="text-align:left;">This incredible weekly report offers insight from our Gurus, with recaps and market outlooks.</dt>\
								        </dl>\
							        </div>\
							      </div>\
							      <div style="padding:5px 0 0 0; clear:both;">\
							        <p class="btstart">\
							            <a href="javascript:;" onclick="SignUp(); return false;">\
							                <img src="Resources/System/Images/Icon/icon_email.png" alt=""border="0" />\
							            </a>\
							            <a href="Article.aspx">\
							                <span class="chkimg">\
							                    <img src="Resources/System/Images/Button/_bt_getitnow-fix.gif" border="0" alt="" />\
							                </span>\
							            </a>\
							        </p>\
						         </div>';
iTiviTxt['premium-trade-service'] = '<div class="ilft"><div class="fleft"><div id="premium-trade-service-flash">\
                        </div></div>\
							<p class="lst">\
								<dl>\
							        <dt>Live Trade Alerts Texted Straight to your Cell Phone & Email Address - Direct from the Trading Pit!</dt>\
							        <dt>Daily Trade Commentaries, Ask the Gurus, Podcasts and More!</dt>\
							        <dt>Special Introductory Offer!</dt>\
						        </dl>\
							</p>\
						</div><div class="clear">\
							<p class="btstart"><a href="premium-trade-service.aspx"><span class="chkimg"><img src="Resources/System/Images/Button/_bt_getitnow.gif" border="0" alt="" /></span></a></p>\
						</div>';
iTiviTxt['http://blog.pitguru.com'] = '<div class="ilft">\
                        <img src="Resources/System/Images/Button/_bt_blogs_large.gif" border="0" alt="" height="120" align="left" style="margin-bottom: 0px; height:120px;" />\
							<p class="lst">\
								<dl>\
							        <dt>Ever Wish You Could Get Inside the Mind of a Floor Trader?</dt>\
							        <dt>Wish Granted.</dt>\
							        <dt>Confessions from Floor Traders, Market Insight & Trading Tips</dt>\
							        <dt>Free Access</dt>\
						        </dl>\
							</p>\
						</div><div class="clear">\
							<p class="btstart"><a href="http://blog.pitguru.com"><span class="chkimg"><img src="Resources/System/Images/Button/_bt_getitnow.gif" border="0" alt="" /></span></a></p>\
						</div>';
iTiviTxt['pitguru-tv'] = '<div class="ilft">\
							<div class="lst tv">\
								<dl>\
								<dt class="tvicon">See TV appearances, Trader Podcasts, YouTube Videos and More!</dt>\
                                    <dt><a class="show-a" href="PitGuru-3D-Wall.aspx">Check out our Revolutionary 3-D Video Wall</a></dt>\
                                    <dt style=\"padding-top:0px;padding-bottom:0px;\"><a class="show-a" href="http://www.youtube.com/pitgurutv" target="_bank" style="text-decoration:none;"><span style="font-weight:bold;vertical-align:top">Or Visit our YouTube Channel</span> <a class="show-a" href="http://www.youtube.com/pitgurutv" target="_bank" style=\"text-decoration:none;\"><img src="Resources/System/Images/Icon/youtube-logo-55x24.png" style="border:none;"/></a></dt>\
                                </dl>\
							</div>\
						</div>';
iTiviTxt['pit-radio'] = '<div class="ilft">\
                            <div class="fleft" style="padding-left:5px;">\
                                <div id="pit-radio-flash">\
                                </div>\
                            </div>\
                            <div style="float:left; width:240px;">\
								<dl>\
                                    <dt style="text-align:center;">Hear trading tips from the floor<br/>FREE</dt>\
                                    <dt>PitGuru Radio brings you real time floor commentary throughout the day in Grains, Financials, Metals, Energies & Softs</dt>\
                                </dl>\
							</div><div class="clear">\
							<p class="btstart"><a href="javascript:;"  onclick="javascript:window.callPopUp(\'PitGuru - Sector Audio Commentary\', \'Popup-Login.aspx?Popup=1\');"><span class="chkimg"><img src="Resources/System/Images/Button/btn_register-fix.gif" border="0" alt="" width="110"/></span></a></p>\
						</div></div>';
iTiviTxt['free-futures-stuff'] = '<div class="embed">\
						<div class="fleft c2">\
							<div class="lst">\
								<dl>\
							        <dt>Get your necessary survival kit on trading</dt>\
							        <dt>Receive Futures Strategy Guides and Methods</dt>\
						        </dl>\
							</div>\
							<span class="btstart"><a href="free-futures-stuff.aspx"><span class="chkimg"><img src="Resources/System/Images/Button/_bt_getitnow.gif" border="0" alt="" /></span></a></span>\
						</div></div>';

var delayHideMnu;
var obj;
$(function() {
    //Init data
    $('#itivi .i').each(function(e) {
        n = $(this).attr('rel');
        objTivi[n] = new Object();
        objTivi[n].timg = new Image();
        objTivi[n].himg = new Image();
        //objTivi[n].timg.src = 'images/_txt_'+n+'.png';
        objTivi[n].bimg = new Object();
        if (n == 'weekly-pit-preview') {
            objTivi[n].lnk = n;
            objTivi[n].bimg.src = 'Resources/System/Images/Button/_bt_' + n + '1.png';
            objTivi[n].timg.src = 'Resources/System/Images/Button/_bt_getitnow.gif';
            objTivi[n].hidden = 'visibility: visible';
            objTivi[n].hid = 'background: url(../Images/Background/bg_fash.gif) no-repeat scroll left center);';
            objTivi[n].vis = 'visibility: visible';
        }
        else if (n == 'premium-trade-service') {
            objTivi[n].lnk = 'https://dynamic.infusionsoft.com/cart/?update=true&l=n&cprogram_id=56&cart_skin=3';
            objTivi[n].bimg.src = 'Resources/System/Images/Button/_bt_phone.png';
            objTivi[n].timg.src = 'Resources/System/Images/Button/_bt_getitnow.gif';
            objTivi[n].hidden = 'visibility: hidden';
            objTivi[n].hid = 'background: url(../Images/Background/bg_fash.gif) no-repeat scroll left center);';
            objTivi[n].vis = 'visibility: visible';
        }
        else if (n == 'http://blog.pitguru.com') {
            objTivi[n].lnk = n;
            m = "blog.pitguru.com";
            objTivi[n].bimg.src = 'Resources/System/Images/Button/_bt_blogs_large.png';
            objTivi[n].sty = 'margin-top: 5px; margin-left: 5px; padding: 0px;';
            objTivi[n].timg.src = 'Resources/System/Images/Button/_bt_getitnow.gif';
            objTivi[n].hidden = 'visibility: hidden';
            objTivi[n].hid = 'background: none;';
            objTivi[n].vis = 'visibility: visible';
        }
        else if (n == 'pitguru-tv') {
            objTivi[n].lnk = 'javascript:alert("PitGuru TV - Coming Soon!");';
            //objTivi[n].bimg.src = 'Resources/System/Images/Button/bt-pitguru-tv.png'; //_bt_pitguru-tv_large.png';
            objTivi[n].sty = 'margin-top: 5px; margin-left: 5px; padding: 0px;';
            //objTivi[n].timg.src = 'Resources/System/Images/Button/_bt_commingsoon.gif';
            objTivi[n].hidden = 'visibility: hidden';
            objTivi[n].hid = 'background: none';
            objTivi[n].vis = 'visibility: hidden';
        }
        else if (n == 'pit-radio') {
            objTivi[n].lnk = "Energies-Sector-Audio-Commentary.aspx?Popup=1";
            //objTivi[n].bimg.src = 'Resources/System/Images/Button/_bt_pit-radio_large.png';
            objTivi[n].sty = 'margin-top: 5px; margin-left: 5px; padding: 0px;';
            //objTivi[n].timg.src = 'Resources/System/Images/Button/btn_register.gif';
            objTivi[n].hidden = 'visibility: hidden';
            objTivi[n].hid = 'background: none';
            objTivi[n].vis = 'visibility: hidden';
        }
        else {
            objTivi[n].lnk = n + '.aspx';
            objTivi[n].bimg.src = 'Resources/System/Images/Button/_bt_' + n + '.png';
            objTivi[n].timg.src = 'Resources/System/Images/Button/_bt_getitnow.gif';
            objTivi[n].hidden = 'visibility: hidden';
            objTivi[n].hid = 'background: url(../Images/Background/bg_fash.gif) no-repeat scroll left center);';
            objTivi[n].vis = 'visibility: hidden';
        }

        objTivi[n].ctn = iTiviTxt[n];
        iIndex[e] = n;
    });

    $('.itvnav a').click(function() {
        ind = $(this).attr('rel');
        len = iIndex.length - 1;

        if (ind == 'next') {
            if (indTV >= len) {
                indTV = -1;
            }
            itiviGo(iIndex[indTV + 1]);
            indTV = indTV + 1;
        } else {
            if (indTV <= 0) {
                indTV = len + 1;
            }
            itiviGo(iIndex[indTV - 1]);
            indTV = indTV - 1;
        }

        return false;
    });

    $('#itivi .i').hover(function(e) {
        l = $(this).attr('rel');
        indTV = $('#itivi .i').index(this);
        itiviGo(l);
        if (indTV == 0 || indTV == 3 || indTV == 5) {
            $(this).parent('dd').css({ position: 'relative', zIndex: 999 });
            var pullmnu = $(this).parent('dd').children('dl');
            pullmnu.css({ left: '0px', top: '32px' });
            pullmnu.show();
        }
    },
	function() {
	    if (indTV == 0 || indTV == 3 || indTV == 5) {
	        var pullmnu = $(this).parent('dd').children('dl');
	        $(pullmnu).hover(function() {
	            clearTimeout(delayHideMnu);
	            $(this).show();
	            return true;
	        },
	        function() {
	            pullmnu.hide();
	        });

	        obj = pullmnu;
	        delayHideMnu = setTimeout("hideMnu()", 100);
	        //pullmnu.hide();
	    }
	});

    itiviGo(iIndex[1]);

});

function hideMnu() {
    if (obj)
        obj.hide();
}

function itiviGo(k) {
    $('#blkliveshow .tt').fadeOut('fast');
    $('#blkliveshow .tt').html(iTiviTTL[k]);
    $('#blkliveshow .tt').fadeIn('fast');
    $('#etivi').html(iTiviTxt[k]);
    // Son fix flash ie7
    /*var params = {
        menu: "false",
        wmode: "transparent"
    };
    if (k == 'weekly-pit-preview')
        swfobject.embedSWF("Resources/System/Flash/miniflip.swf", "weekly-pit-previe-flash", "140", "102", "9.0.0", "expressInstall.swf", null, params, null);
    else if (k == 'premium-trade-service')
        swfobject.embedSWF("Resources/System/Flash/sms_phone.swf", "premium-trade-service-flash", "100", "102", "9.0.0", "expressInstall.swf", null, params, null);
    else if (k == 'pit-radio')
        swfobject.embedSWF("Resources/System/Flash/cailoa_small.swf", "pit-radio-flash", "110", "110", "9.0.0", "expressInstall.swf", null, params, null);*/
}
//function itiviGo(k){
//	$('#blkliveshow .tt').fadeOut('fast');
//	$('#blkliveshow .tt').html(iTiviTTL[k]);
//	$('#blkliveshow .tt').fadeIn('fast');
//	
//	$('#blkliveshow .bt').fadeOut('fast');
//	$('#blkliveshow .bt').children('img').attr('src', objTivi[k].bimg.src);
//	$('#blkliveshow .bt').fadeIn('fast');
//	$('#blkliveshow .btstart').fadeOut('fast');
//	$('#blkliveshow .btstart').children('a').attr('href', objTivi[k].lnk);
//	$('#blkliveshow .btstart').fadeIn('fast');
//	$('#blkliveshow .lst').html(iTiviTxt[k]);
//	$('#blkliveshow .chkimg').children('img').attr('src', objTivi[k].timg.src);
//	$('#blkliveshow .femail').attr('style', objTivi[k].hidden);
//	$('.blkss').attr('style', objTivi[k].hid);
//	$('#blkliveshow .bt').attr('style',objTivi[k].vis);
//	$('#blkliveshow .bt').attr('style',objTivi[k].sty);
//}