EVENT = new function(){	
this.init = function(){
if (EVENT.Voting.active) EVENT.Voting.init();
}
}

EVENT.User = {};

EVENT.NomineeVoting = new function(){
this.more = function(){
if(Flux.Context.isUserAuthenticated()){
window.open('http://www.vh1.com/ontv/movieawards/2010/nominee_voting/index.jhtml?categoryId=' + EVENT.Voting.categoryId, 'nominee_voting', 'height=532, width=749');
}
else{
MTVN.UI.ModalWindow.open(EVENT.Voting.loginWindowUrl,null,"jquery");
return false;
}	
}
}

EVENT.Utils = new function(){
this.arrayContains = function(ar, val){
var contains = false;
for(var i=0; i < ar.length; i++){ if(ar[i] == val) contains = true; }
return contains;	
},
this.reloadUserContext = function() {
jQuery.ajax({
async: false,
cache: false,
dataType: 'script',
url: EVENT.Utils.userContextUrl()
});
},
this.userContextUrl = function() {
var host = window.location.host;
var userContextUrl = 'http://widgets3.flux.com/context/short/06F4FFFF009B10200002FFFFF406';
if( host.match(/.logoonline-d.mtvi.com/) ){
userContextUrl = 'http://widgets3.flux-staging.com/context/short/06F4FFFF009B10200002FFFFF406';
}
return userContextUrl;
}
}

EVENT.Voting = new function(){
this.active = false;
this.cogix = "polling-onair";
this.validator= "timestamp|votes";
this.authClass = "com.mtvnet.auth.dis.HashDigestInputStrategy1";
this.categoryId = "";
this.projectcode = "MTV62";
this.style = "list";
this.thanksWindowUrl = "/events/newnownext_awards/2011/scripts/ajax/thanks.jhtml";
this.loginWindowUrl = "/events/newnownext_awards/2011/scripts/ajax/not_logged_in.jhtml";
this.answer = "";

this.init = function(){

$j(".vote-btn").each(function() {

});
}

this.preSubmit = function(){
return true; // we are ignoring whether they are logged in or not

if( typeof Flux.context == 'undefined' || Flux.context.user == null || typeof Flux.context.user == 'undefined' ) {
$j().jOverlay({url: EVENT.Voting.loginWindowUrl});
return false;
} else {
if( !Flux.context.user.communityMember ) {
$j().jOverlay({url: EVENT.Voting.loginWindowUrl});
return false;
} else {
var vauth = (MTVN.Utils.Cookies.read("vauth")!=null) ? MTVN.Utils.Cookies.read("vauth") : "";
var voted = EVENT.Utils.arrayContains(vauth.split(","),EVENT.Voting.categoryId);
if(!voted) {
vauth += EVENT.Voting.categoryId + ",";
MTVN.Utils.Cookies.create("vauth", vauth);
}
//EVENT.Voting.postSubmit();
return true;
}
}

}

this.postSubmit = function(){
var categories = [
'best-new-indulgence','brink-of-fame-actor','brink-of-fame-music-artist','cause-youre-hot','tv-you-better-watch','zomg-internet-award','most-addictive-reality-star','next-must-see-movie'
];
var category = EVENT.Voting.categoryId;
var index = categories.indexOf(category);
if (index == categories.length - 1) {
index = 0;
} else {
index += 1;
}
var next_category = categories[index];
$j().jOverlay({url: EVENT.Voting.thanksWindowUrl + '?next=' + next_category });
}
}

EVENT.Voting.Share = new function() {

this.categories = 
{"best-new-indulgence": {"title": "Best New Indulgence", 'url': '/events/newnownext_awards/2011/categories/best-new-indulgence', 'facebookUrl': "http://logo.to/NNNAIndulge", 'twitterUrl': "http://logo.to/NNNAindulge", 'nominees': {'1': {'name': "Angry Birds", 'twitterText': "I voted for Angry Birds (@roviomobile) for Best New Indulgence in the #NNNAwards! To vote RT #IndulgeBirds or http://logo.to/NNNAindulge", 'facebookText': "I voted for Angry Birds for the Best New Indulgence Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAIndulge"}, '2': {'name': "Netflix Watch Instantly", 'twitterText': "I voted for Netflix Watch Instantly for Best New Indulgence in the #NNNAwards! To vote RT #IndulgeNetflix or http://logo.to/NNNAindulge", 'facebookText': "I voted for Netflix Watch Instantly for the Best New Indulgence Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAIndulge"}, '3': {'name': "New Kids On The Block / Backstreet Boys Summer Tour 2011", 'twitterText': "I voted @NKOTB &amp; @BackstreetBoys Summer Tour for Best New Indulgence in #NNNAwards! To vote RT #IndulgeTour or http://logo.to/NNNAindulge", 'facebookText': "I voted for New Kids On The Block / Backstreet Boys Summer Tour for the Best New Indulgence Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAIndulge"}, '4': {'name': "OWN", 'twitterText': "I voted for @OWN for the Best New Indulgence in the #NNNAwards! To vote RT #IndulgeOWN or click http://logo.to/NNNAindulge", 'facebookText': "I voted for the Oprah Winfrey Network (OWN) for the Best New Indulgence Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAIndulge"}, '5': {'name': "TJ Kelly", 'twitterText': "I voted for @TJKelly10 from #AListNY for Best New Indulgence in the #NNNAwards! FTo vote RT #IndulgeTJ or click http://logo.to/NNNAindulge", 'facebookText': "I voted for The A-List: New York's TJ Kelly for the Best New Indulgence Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAIndulge"}}},"brink-of-fame-actor": {"title": "Brink of Fame: Actor", 'url': '/events/newnownext_awards/2011/categories/brink-of-fame-actor', 'facebookUrl': "http://logo.to/NNNAActor", 'twitterUrl': "http://logo.to/NNNAactor", 'nominees': {'1': {'name': "Andrew Garfield", 'twitterText': "I voted for @AndrewGarfield_ as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorAndrew or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Andrew Garfield as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}, '2': {'name': "Darren Criss", 'twitterText': "I voted for @DarrenCriss as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorDarren or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Darren Criss as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}, '3': {'name': "Donald Glover", 'twitterText': "I voted for @MrDonaldGlover as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorDonald or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Donald Glover as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}, '4': {'name': "Emma Stone", 'twitterText': "I voted for @theEmmaStone as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorEmma or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Emma Stone as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}, '5': {'name': "Nicholas Hoult", 'twitterText': "I voted for @real_NickHoult as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorNicholas or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Nicholas Hoult as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}, '6': {'name': "Rooney Mara", 'twitterText': "I voted for Rooney Mara as Brink of Fame: Actor in the #NNNAwards! To vote RT #ActorRooney or click: http://logo.to/NNNAactor", 'facebookText': "I voted for Rooney Mara as Brink of Fame: Actor in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAActor"}}},"brink-of-fame-music-artist": {"title": "Brink of Fame: Music Artist", 'url': '/events/newnownext_awards/2011/categories/brink-of-fame-music-artist', 'facebookUrl': "http://logo.to/NNNAMusic", 'twitterUrl': "http://logo.to/NNNAmusic", 'nominees': {'1': {'name': "Oh Land", 'twitterText': "I voted for @OHLANDMusic for Brink of Fame: Music Artist in the #NNNAwards! To vote RT #MusicOHLAND or click: http://logo.to/NNNAmusic", 'facebookText': "I voted for Oh Land for the Brink of Fame: Music Artist Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMusic"}, '2': {'name': "Sleigh Bells", 'twitterText': "I voted for @SleighBells for Brink of Fame: Music Artist in the #NNNAwards! To vote RT #MusicSleighBells or http://logo.to/NNNAmusic", 'facebookText': "I voted for Sleigh Bells for the Brink of Fame: Music Artist Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMusic"}, '3': {'name': "Two Door Cinema Club", 'twitterText': "I voted for @TDCinemaClub for Brink of Fame: Music Artist in the #NNNAwards! To vote RT #MusicTDCinema or click: http://logo.to/NNNAmusic", 'facebookText': "I voted for Two Door Cinema Club for the Brink of Fame: Music Artist Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMusic"}, '4': {'name': "Willow", 'twitterText': "I voted for @OfficialWillow for Brink of Fame: Music Artist in the #NNNAwards! To vote RT #MusicWillow or http://logo.to/NNNAmusic", 'facebookText': "I voted for Willow for the Brink of Fame: Music Artist Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMusic"}, '5': {'name': "Wynter Gordon", 'twitterText': "I voted Wynter Gordon (@wyntermusic) for Brink of Fame: Music Artist in #NNNAwards! To vote RT #MusicWynter or http://logo.to/NNNAmusic", 'facebookText': "I voted for Wynter Gordon for the Brink of Fame: Music Artist Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMusic"}}},"cause-youre-hot": {"title": "Cause You're Hot", 'url': '/events/newnownext_awards/2011/categories/cause-youre-hot', 'facebookUrl': "http://logo.to/NNNAHot", 'twitterUrl': "http://logo.to/NNNAhot", 'nominees': {'1': {'name': "Amber Heard", 'twitterText': "I voted for @AmberHeard for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotAmber or click: http://logo.to/NNNAhot", 'facebookText': "I voted for Amber Heard for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}, '2': {'name': "Archie Panjabi", 'twitterText': "I voted for Archie Panjabi for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotArchieor click: http://logo.to/NNNAhot", 'facebookText': "I voted for Archie Panjabi for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}, '3': {'name': "Ben Cohen", 'twitterText': "I voted for @rugbyBenCohen for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotBen or click: http://logo.to/NNNAhot", 'facebookText': "I voted for Ben Cohen for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}, '4': {'name': "Jesse Williams", 'twitterText': "I voted for @JesseWilliams_ for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotJesse or click: http://logo.to/NNNAhot", 'facebookText': "I voted for Jesse Williams for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}, '5': {'name': "Joe Manganiello", 'twitterText': "I voted for @JoeManganiello for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotJoe or click: http://logo.to/NNNAhot", 'facebookText': "I voted for Joe Manganiello for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}, '6': {'name': "Sofia Vergara", 'twitterText': "I voted for @SofiaVergara for the Cause You're Hot Award in the #NNNAwards! To vote RT #HotSofia or click: http://logo.to/NNNAhot", 'facebookText': "I voted for Sofia Vergara for the Cause You're Hot Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAHot"}}},"tv-you-better-watch": {"title": "TV You Betta Watch", 'url': '/events/newnownext_awards/2011/categories/tv-you-better-watch', 'facebookUrl': "http://logo.to/NNNATV", 'twitterUrl': "http://logo.to/NNNAtv", 'nominees': {'1': {'name': "1 Girl 5 Gays", 'twitterText': "I voted for @1Girl5Gays for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TV1girl5gays or click: http://logo.to/NNNAtv", 'facebookText': "I voted for 1 Girl 5 Gays for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}, '2': {'name': "Pretty Little Liars", 'twitterText': "I voted Pretty Little Liars (@ABCPLL) for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TVPretty or http://logo.to/NNNAtv", 'facebookText': "I voted for Pretty Little Liars for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}, '3': {'name': "Skins", 'twitterText': "I voted for @SkinsTV for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TVSkins or click: http://logo.to/NNNAtv", 'facebookText': "I voted for Skins for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}, '4': {'name': "The Game", 'twitterText': "I voted for @betTheGame for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TVGame or click: http://logo.to/NNNAtv", 'facebookText': "I voted for The Game for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}, '5': {'name': "Tosh.O", 'twitterText': "I voted for @DanielTosh for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TVTosh or click: http://logo.to/NNNAtv", 'facebookText': "I voted for Tosh.0 for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}, '6': {'name': "The Vampire Diaries", 'twitterText': "I voted for @cw_VampDiaries for the TV You Betta Watch Award in the #NNNAwards! To vote RT #TVVampire or click: http://logo.to/NNNAtv", 'facebookText': "I voted for The Vampire Diaries for the TV You Betta Watch Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNATV"}}},"zomg-internet-award": {"title": "#ZOMG Internet Award", 'url': '/events/newnownext_awards/2011/categories/zomg-internet-award', 'facebookUrl': "http://logo.to/NNNAZOMG", 'twitterUrl': "http://logo.to/NNNAzOMG", 'nominees': {'1': {'name': "@CarrieFFisher on Twitter", 'twitterText': "I voted for @CarrieFFisher for the #zOMG Internet Award in the #NNNAwards! To vote RT #zOMGCarrie or click: http://logo.to/NNNAzOMG", 'facebookText': "I voted for @CarrieFFisher on Twitter for the #zOMG Internet Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAZOMG"}, '2': {'name': "DamnYouAutoCorrect.com", 'twitterText': "I voted DamnYouAutoCorrect (@damnyouac) for the #zOMG Internet Award in the #NNNAwards! RT #zOMGAuto or click: http://logo.to/NNNAzOMG", 'facebookText': "I voted for DamnYouAutoCorrect.com for the #zOMG Internet Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAZOMG"}, '3': {'name': "JamesVanDerMemes.com", 'twitterText': "I voted for JamesVanDerMemes.com for the #zOMG Internet Award in the #NNNAwards! To vote RT #zOMGJames or click: http://logo.to/NNNAzOMG", 'facebookText': "I voted for JamesVanDerMemes.com for the #zOMG Internet Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAZOMG"}, '4': {'name': "Mike Tompkins", 'twitterText': "I voted for @Mike_Tompkins for the #zOMG Internet Award in the #NNNAwards! To vote RT #zOMGMike or click: http://logo.to/NNNAzOMG", 'facebookText': "I voted for Mike Tompkins for the #zOMG Internet Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAZOMG"}, '5': {'name': "Sassy Gay Friend", 'twitterText': "I voted for @SassyGayFriend for the #zOMG Internet Award in the #NNNAwards! To vote RT #zOMGSassyGay or click: http://logo.to/NNNAzOMG", 'facebookText': "I voted for Sassy Gay Friend for the #zOMG Internet Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAZOMG"}}},"most-addictive-reality-star": {"title": "Most Addictive Reality Star", 'url': '/events/newnownext_awards/2011/categories/most-addictive-reality-star', 'facebookUrl': "http://logo.to/NNNAReality", 'twitterUrl': "http://logo.to/NNNAreality", 'nominees': {'1': {'name': "Tabatha Coffey", 'twitterText': "I voted for @TabathaCoffey for Most Addictive Reality Star in #NNNAwards! To vote RT #RealityTabatha or click http://logo.to/NNNAreality", 'facebookText': "I voted for Tabatha Coffey, of Tabatha's Salon Takeover, for the Most Addictive Reality Star in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAReality"}, '2': {'name': "Tyler and Catelynn", 'twitterText': "I voted Teen Mom's Tyler &amp; Catelynn as Most Addictive Reality Star in #NNNAwards! To vote RT #RealityTeens or http://logo.to/NNNAreality", 'facebookText': "I voted for Teen Mom's Tyler &amp; Catelynn for the Most Addictive Reality Star in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAReality"}, '3': {'name': "Carmen Carrera", 'twitterText': "I voted for @Carmen_Carrera for Most Addictive Reality Star in the #NNNAwards! To vote RT #RealityCarmen or http://logo.to/NNNAreality", 'facebookText': "I voted for RuPaul's Drag Race's Carmen Carrera for the Most Addictive Reality Star in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAReality"}, '4': {'name': "Josh Kilmer-Purcell and Brent Ridge", 'twitterText': "I voted The Beekman Boys @Joshkp &amp; @drbrent_ for Most Addictive Reality Star in #NNNAwards! RT #RealityBoys or http://logo.to/NNNAreality", 'facebookText': "I voted for Josh Kilmer-Purcell &amp; Brent Ridge (The Fabulous Beekman Boys) for the Most Addictive Reality Star in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAReality"}}},"next-must-see-movie": {"title": "Next Must-See Movie", 'url': '/events/newnownext_awards/2011/categories/next-must-see-movie', 'facebookUrl': "http://logo.to/NNNAMovie ", 'twitterUrl': "http://logo.to/NNNAmovie", 'nominees': {'1': {'name': "Bridesmaids", 'twitterText': "I voted for Bridesmaids for Next Must-See Movie in the #NNNAwards! To vote RT #MovieBridesmaids or click: http://logo.to/NNNAmovie", 'facebookText': "I voted for Bridesmaids for the Next Must-See Movie Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMovie"}, '2': {'name': "Harry Potter and the Deathly Hallows: Part 2", 'twitterText': "I voted for @HarryPotterFilm for Next Must-See Movie in the #NNNAwards! To vote RT #MoviePotter or click: http://logo.to/NNNAmovie", 'facebookText': "I voted for Harry Potter and the Deathly Hallows: Part 2 for the Next Must-See Movie Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMovie"}, '3': {'name': "The Smurfs", 'twitterText': "I voted for @TheSmurfsMovie for Next Must-See Movie in the #NNNAwards! To vote RT #MovieSmurfs or click: http://logo.to/NNNAmovie", 'facebookText': "I voted for The Smurfs for the Next Must-See Movie Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMovie"}, '4': {'name': "Water For Elephants", 'twitterText': "I voted for @H2OForElephants for Next Must-See Movie in the #NNNAwards! To vote RT #MovieWater or click: http://logo.to/NNNAmovie", 'facebookText': "I voted for Water For Elephants for the Next Must-See Movie Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMovie"}, '5': {'name': "X-Men: First Class", 'twitterText': "I voted for X-Men: First Class for Next Must-See Movie in the #NNNAwards! To vote RT #MovieXMen or click: http://logo.to/NNNAmovie", 'facebookText': "I voted for X-Men: First Class for the Next Must-See Movie Award in Logo's NewNowNext Awards and you should too! Vote: http://logo.to/NNNAMovie"}}}};

this.shareTitle = function() {
return 'I voted for a 2011 NewNowNext Awards ' + EVENT.Voting.Share.categories[EVENT.Voting.categoryId].title + ' nominee';
}
this.shareText = function() {
return 'I voted for '+EVENT.Voting.Share.categories[EVENT.Voting.categoryId].nominees[EVENT.Voting.answer].name;
}
this.shareTweetText = function() {
return 'I voted for '+EVENT.Voting.Share.categories[EVENT.Voting.categoryId].nominees[EVENT.Voting.answer].twitterName;
}
this.shareUrl = function(type) {
if( type == 'facebook' ) {
return EVENT.Voting.Share.categories[EVENT.Voting.categoryId].facebookUrl;
} else if ( type == 'twitter' ) {
return EVENT.Voting.Share.categories[EVENT.Voting.categoryId].twitterUrl;
} else {
return '/events/newnownext_awards/2011/';
}
}

this.facebook = new function(share) {

// if we're on live use logotv.com facebook app
// otherwise use Logo Staging app
if( window.location.host.match(/-d/) || window.location.host.match(/-jd/) || window.location.host.match(/-q/) || window.location.host.match(/-jq/) ) {
this.api_key = '6ce79a626e5a38ecd640899e1bc666a5';
} else {
this.api_key = window.location.host.match(/vh1\.com$/) ? '41d2377c1cc1f578e51d2aba114b84c4' : '41d2377c1cc1f578e51d2aba114b84c4';
}
this.api_key = '6ce79a626e5a38ecd640899e1bc666a5';

this.channel_path = 'http://www./events/newnownext_awards/2011/scripts/xd_receiver.htm'; 
this.is_logged_in = false;
this.debug = true;
var self = this;

this.init = function(){
try {
FB.init(self.api_key, self.channel_path); 
} catch ( err ) {
//console.log(err);
}
}

this.share = function() {
var shareText = encodeURIComponent(EVENT.Voting.Share.categories[EVENT.Voting.categoryId].nominees[EVENT.Voting.answer].facebookText.replace("&amp;", "&"));
window.open('http://www.facebook.com/connect/prompt_feed.php?message='+shareText,'','width=800,height=600');
/**
try {
mtvn.btg.Controller.sendLinkEvent( { linkName:'NNN11:Share:' + EVENT.Voting.Share.categories[EVENT.Voting.categoryId].title + ':facebook', linkType:'o' } );
FB.Connect.streamPublish('', {
'name': share.shareTitle(),
'href': share.shareUrl('facebook'),
'description': shareText,
'media': [{'type': 'image',
'src': 'http://www.vh1.com/sitewide/css/charlie/themes/events/critics_choice/_2011/130x130-dsa-logo.jpg',
'href': share.shareUrl('facebook')}]
}, [{ 'text': 'Vote at logotv.com/events/newnownext_awards/2011/', 'href': share.shareUrl('facebook')}]);
} catch (err) {
console.log( err );
}
**/
}

}(this)

this.twitter = function() {
var twitterText = encodeURIComponent(EVENT.Voting.Share.categories[EVENT.Voting.categoryId].nominees[EVENT.Voting.answer].twitterText.replace("&amp;","&"));
window.open('http://twitter.com/home?status='+twitterText,'','width=800,height=600');
}

this.tweetmeme = function(container, tweetmeme_style) {

//var _url = window.location.href;
/**
var _url = EVENT.Voting.Share.shareUrl('twitter');
var _url = _url.replace(/((?:\?|&)?fbc_receiver=.+)?(?:#.*)?$/, "");
var url = escape((typeof tweetmeme_url == "string") ? tweetmeme_url : ((typeof TWEETMEME_URL == "string") ? TWEETMEME_URL : _url)).replace(/\+/g, "%2b");
var source = (typeof tweetmeme_source == "string") ? escape(tweetmeme_source) : ((typeof TWEETMEME_SOURCE == "string") ? escape(TWEETMEME_SOURCE) : false);
var style = (typeof tweetmeme_style == "string") ? escape(tweetmeme_style) : ((typeof TWEETMEME_STYLE == "string") ? escape(TWEETMEME_STYLE) : "normal");
var service = (typeof tweetmeme_service == "string") ? escape(tweetmeme_service) : ((typeof TWEETMEME_SERVICE == "string") ? escape(TWEETMEME_SERVICE) : false);
var service_api = (typeof tweetmeme_service_api == "string") ? escape(tweetmeme_service_api) : ((typeof TWEETMEME_SERVICE_API == "string") ? escape(TWEETMEME_SERVICE_API) : false);
var alias = (typeof tweetmeme_alias == "string") ? escape(tweetmeme_alias) : ((typeof TWEETMEME_ALIAS == "string") ? escape(TWEETMEME_ALIAS) : false);
var hashtags = (typeof tweetmeme_hashtags == "string") ? escape(tweetmeme_hashtags) : ((typeof TWEETMEME_HASHTAGS == "string") ? escape(TWEETMEME_HASHTAGS) : false);
var space = (typeof tweetmeme_space == "number") ? escape(tweetmeme_space) : ((typeof TWEETMEME_SPACE == "number") ? escape(TWEETMEME_SPACE) : false);
var src = "http://api.tweetmeme.com/button.js";
switch (style) {
case "compact":
var h = 20;
var w = 85;
break;
default:
var h = 61;
var w = 50;
break
}
src += "?url=" + url;
src += "&style=" + style;
if (source != false) {
src += "&source=" + source
}
if (service) {
src += "&service=" + service
}
if (service_api) {
src += "&service_api=" + service_api
}
if (alias) {
src += "&alias=" + alias
}
if (hashtags) {
src += "&hashtags=" + hashtags
}
if (space) {
src += "&space=" + space
}
$j(container).append('<iframe src="' + src + '" height="' + h + '" width="' + w + '" frameborder="0" scrolling="no"></iframe>');
**/
}

this.myspace = new function(share) {
this.url = 'http://www.myspace.com/index.cfm?fuseaction=postto&t=';
this.share = function() {
mtvn.btg.Controller.sendLinkEvent( { linkName:'DSA10:Share:' + EVENT.Voting.Share.categories[EVENT.Voting.categoryId].title + ':myspace', linkType:'o' } );
var targetUrl = this.url + encodeURIComponent(share.shareTitle()) 
+ '&c=' + encodeURIComponent(share.shareText()) 
+ '&u=' + encodeURIComponent(window.location.href);
window.open(targetUrl, 'ptm', 'height=450,width=440').focus();
}
}(this);

}

$j(function() {

/*
(function($){
$.fn.shuffle = function() {
return this.each(function(){
var items = $(this).children();
return (items.length)
? $(this).html($.shuffle(items))
: this;
});
}

$.shuffle = function(arr) {
for(
var j, x, i = arr.length; i;
j = parseInt(Math.random() * i),
x = arr[--i], arr[i] = arr[j], arr[j] = x
);
return arr;
}
})(jQuery);

*/

// Only shuffle if there is no winner state
if( !$j("ol.lst-nominees-list li span.winner").length ) {
//$j("ol.lst-nominees-list").shuffle();
}

EVENT.init();
EVENT.Utils.reloadUserContext();
//MTVN.UI.Overlay.init();
EVENT.Voting.Share.facebook.init();

// Override Flux Sign In button so it reloads user context upon sign in.
$j('.signIn').live('click', function() {
Flux.createWidget('Authentication', {}, function(authentication) {
Flux.loadContext(function(context) {
context.onSignIn = EVENT.Utils.reloadUserContext;
});
authentication.showSignInForm();
}); 
});

});

var firstClick = true;
var votingPreSubmit = EVENT.Voting.preSubmit;
var revealThanks = EVENT.Voting.postSubmit;

//var revealThanks = function() {};

$j(function() {

$j("ol.lst-nominees-list li p.relnk a[linkpretext]").each( function() {
$j(this).parent().prepend('<span>' + $j(this).attr('linkpretext') + '</span>');
});

$j("ol.lst-nominees-list li").attr("class", "");
$j("ol.lst-nominees-list li:first").addClass("first");
$j("ol.lst-nominees-list li:odd").addClass("alt");
$j("ol.lst-nominees-list li:last").addClass("last");

$j('.votingGrid a[title="Watch Clip"]').attr('target', '_blank');

/* Override share links on home page video list */
$j('.listShare').attr('target', '_blank');
});

if(!Array.indexOf){
Array.prototype.indexOf = function(obj){
for(var i=0; i<this.length; i++){
if(this[i]==obj){
return i;
}
}
return -1;
}
}

$j(function() {
// THIS ALLOWS FOR US TO SEND THE RIGHT TWITTER AND FACEBOOK SHARE MESSAGES
$j(".voteButtonInline, .voteButtonInline embed").hover(function() {
EVENT.Voting.answer = $j(this).attr("rel");
});
$j(".voteButtonInline, .voteButtonInline embed").click(function() {
EVENT.Voting.answer = $j(this).attr("rel");
});

jQuery(".group-c .videoLink img").after('<span class="icon icon-play">Video: </span>');
jQuery(".group-c .photo-module .title2 a img.thumb").after('<span class="icon icon-view">Photo: </span>');

});

