//Hero spot for Brillant Futures
var rsPic = new Array(4);
rsPic[0] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-jennifer.jpg';
rsPic[1] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-alexandre.jpg';
rsPic[2] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-jessica.jpg';
rsPic[3] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-jasmine.jpg';
rsPic[4] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-sheetal.jpg';
rsPic[5] = '/en_CA/ca/campus-recruiting/assets/2011-07-27-rock-star-sean.jpg';
var rsName = new Array(4);
rsName[0] = 'Jennifer';
rsName[1] = 'Alex';
rsName[2] = 'Jessica';
rsName[3] = 'Jasmine';
rsName[4] = 'Sheetal';
rsName[5] = 'Sean';
var rsExtra = new Array(4);
rsExtra[0] = "Developing her career while<br />helping others become leaders";
rsExtra[1] = "Making lasting connections<br />while shaping his career";
rsExtra[2] = "Working with different teams,<br />shaping her own path";
rsExtra[3] = "Using her job to explore<br />a whole world of opportunities";
rsExtra[4] = "Supporting the community,<br />while supported by PwC";
rsExtra[5] = "A basketball player,<br />using coaching skills in his job";
var lang = location.pathname;
(lang.indexOf('_CA') == -1) ? lang = lang.slice(4, 6) : lang = lang.slice(1, 3);
var rsUrl = new Array(4);


var randomRs = Math.floor(Math.random() * 5);
var manual = false;
$(function () {
    /*$('#box, #rockstar img, #boxName img').wrap('<a />');
    $('#heroHolder > a, #rockstar > a').css({
        display: 'block',
        height: "336px",
        width: "1103px",
        textDecoration: "none",
        cursor: "pointer"
    });*/

    function rsShow() {
       /* $('#heroHolder a, #rockstar a').attr('href', rsUrl[randomRs]);
	   $('#media-launch').attr({
		  "media-title": '',
		  "media-width": '556',
		  "media-hd": 'false',
		  "media-height": '313',
		  "media-mobile": 'true',
		  "media-src": function() { 
			return rsUrl[randomRs]; 
		   }
		});*/
	   
	   
        if (randomRs == 1 | randomRs == 4 | randomRs == 5) { //image on left
            $('#boxHeading').css('left', '562px');
            $('#boxName').css({
                top: '-100px',
                left: '500px'
            });
            $('#boxMessage').css('left', '530px');
            $('#rockstar img').css({
                marginLeft: "-80px"
            });
            $('#boxMessageText').css('left', '553px');
        } else { //image on right
            $('#boxHeading').css('left', '0');
            $('#boxName').css({
                top: '-100px',
                left: '270px'
            });
            $('#boxMessage').css('left', '110px');
            $('#rockstar img').css({
                marginLeft: "-20px"
            });
            $('#boxMessageText').css('left', '133px');
        }
        $('#rockstar img').attr('src', rsPic[randomRs]);
        $('#boxName span.tangoBoldItalic').text('Meet ' + rsName[randomRs] + ',');
        $('.boxNameMsg').html(rsExtra[randomRs]);
        $('#box').hide().show(2000, 'easeInOutExpo');
        if (!manual) {
            $('#rockstar img').delay(500).animate({
                marginLeft: "-50px",
                height: "336px",
                width: "1103px"
            }, 4000, 'swing');
        } else {
            $('#rockstar img').css({
                marginLeft: "-50px",
                height: "336px",
                width: "1103px"
            });
        }
    }
    

    function nextRs(check) {
        if (check) {
              randomRs++;
            if (randomRs == 6) {
                randomRs = 0;
            }
        } else {
	    randomRs--;
            if (randomRs == -1) {
                randomRs = 5;
            }
        }
    }

    function rsWipe(direction) {
        $('#box').hide(500, function () {
            $('#rockstar img').height(416).width(1365);
			
            nextRs(direction);
            rsShow()
        });
       
    }
    var rsTimer = setInterval(rsWipe, 12000);
    $('#sliderLinkRight').click(function () {
        clearInterval(rsTimer);
        manual = true;
        rsWipe(true);
    });
    $('#sliderLinkLeft').click(function () {
        clearInterval(rsTimer);
		manual = true;
        rsWipe(false);
    });
    //for twitter widget
    $('.twtr-ft, .twtr-hd').remove();
    $('<h3 id="twitH3">@PwC_ca_campus</h3>').prependTo('#twitter');
    $('.centerColumns .expander H3').unbind('click').click(function () {
        window.location.href = "/ca/en/campus-recruiting/site-map.jhtml";
    });
    $('#twitter .expander h3').wrap('<a />');
    $('#twitter .expander a:first').css({
        display: 'block',
        height: "18px",
        width: "250px",
        textDecoration: "none",
        cursor: "pointer"
    }).attr({
        'href': 'http://twitter.com/#!/PwC_ca_campus',
        'target': '_blank'
    });
	//once only
	rsShow();
	
	rsUrl[0] = $('#il-Jen');
	rsUrl[1] = $('#il-Alex');
	rsUrl[2] = $('#il-Jess');
	rsUrl[3] = $('#il-Jas');
	rsUrl[4] = $('#il-She');
	rsUrl[5] = $('#il-Sean');
	$('#box').css('cursor', 'pointer' ).click(function(){
		rsUrl[randomRs].trigger('click');
		clearInterval(rsTimer);
		manual = true;
	});
});
