// JavaScript Document //* Cufon.replace('.gtio_font', { fontFamily: 'Fette Engschrift', hover: true }); Cufon.replace('.gtio_font2', { fontFamily: 'Ashley Script MT Std' }); Cufon.replace('.gtio_font3', { fontFamily: 'HelveticaRounded LT BoldCn', hover:true}); //*/ var submittingForm = ''; var uploadPage = false; var errorPageHide = false; $(document).ready(function(){ if ($(window).height() < 550){ $('.overlay_box').css ('top', '20px'); } if ($(window).height() < 350){ $('#overlay').css ('position', 'absolute'); } if ( $("#sxsw") ) { $('#sxsw').bind('click', function () {window.location='http://sxsw.com/interactive/accelerator/';} );} if ( $("#loginBtn") ) { $('#loginBtn').bind('click', doLogin );} //if ( $("#loginBtn") ) { $('#loginBtn').bind('click', pageTracker._trackEvent('Buttons', "Login Button") );} $('#processUpdateUser').bind('click', function (){ processUpdateUser('updateUserForm');} ); $('#processUpdateProfile').bind('click', function (){processUpdateUser('updateUserProfileForm');} ); $('#logoutBtn').bind('click', doLogout); $('#homeBtn').bind('click', function(){pageTracker._trackEvent('Buttons', "home button"); window.location='/';}); $('#search_btn').bind('click', function(){pageTracker._trackEvent('Buttons', "search button");}); initRadio(); $('#persistentLoginBox').bind('click', function (){ if ( $.cookie('persistentLogin')=="true" ) { $('#persistentLogin').attr('checked', false); $.cookie("persistentLogin", null); } else { $('#persistentLogin').attr('checked', true); $.cookie("persistentLogin", true); } }); $('#overlaygradient').fadeTo('fast', 0.50); $("#overlay_iframe").attr( 'src', rpxURL + "openid/embed?token_url=" + escape(location.href) ); $('.overlayCloseBtn').bind('click', closeOverlay); $('#footer').show(); if (forceLogin){ if (isProfileLogin){ $('.overlayCloseBtn').hide(); $('#footer').hide(); } doLogin(); } else { if (uploadPage && userData.enabled=='false'){ doDisabledUser(); } else if (finishReg){ doLoginMore(); } else if (uploadIntro){ doUploadIntro(); } } $('#header').show(); $('#outfit').show(); $('#subhead').show(); $('#browse').show(); $('#upload').show(); $('#info').show(); if (errorPageHide ){ $('.nav_item').hide(); $('.login').hide(); $('#sxsw').hide(); $('.links').css('visibility', 'hidden'); $('.icons').css('visibility', 'hidden'); } if (userData.firstLogin){ pageTracker._trackEvent('Registration', "New User"); } if (userData.justLoggedIn){ pageTracker._trackEvent('Registration', "Return Login"); } if ($.browser.firefox() && $.browser.mac() ){ $('#header .homepage_spacer').css('height', '70px'); //$('.vote_btn .top').css('padding-top', '8px'); //$('.vote_btn.vote_multiple .top').css('height', '36px'); $('.isgoing cufon').css('top', '2px'); $('.vote_btn .bottom').css('padding-top', '5px'); $('.next_outfit_btn .left cufon').css('top', '1px'); $('.vote_btn.vote_multiple .top cufon').css('top', '8px'); $('.vote_btn.vote_none .top cufon').css('top', '4px'); $('.looks_verdict_top cufon').css('top','4px'); $('.looks_verdict_bottom cufon').css('top','4px'); $('.looks_meter_box span').css('top','-3px'); //$('.next_outfit_btn .left').css('padding-top', '8px'); //$('.next_outfit_btn .left').css('height', '19px'); $('.cufon-active * #header .nav .nav_item').css('padding-top', '3px'); $('.cufon-active * #header .nav .nav_item').css('height', '26px'); } }); function doDisabledUser() { doError('Your account has been suspended for violating our terms of use. Email us at support@gotryiton.com if you think there\'s been a mistake... or if you\'re sorry.'); } function doRadio(){ var id = $(this).attr('id'); radioParts = id.split('-'); $(this).siblings().removeClass('selected'); $(this).addClass('selected'); var radioid = $(this).attr('id'); $(this).parent().children('#' + radioParts[0]).val(radioParts[1]); } function initRadio(){ $('.radio').bind('click', doRadio); $('.radioInput').each ( function () { $('#' + $(this).attr('id') + '-' + $(this).val() ).addClass('selected'); }); } function doLogin(){ if (userData['firstName']!=null && userData['firstName']!=''){ $('#loginHi').html('Welcome back, ' + userData['firstName']); } if (userData['providerName']!=null && userData['providerName']!=''){ $('#loginExisting').html('Sign in again with your ' + userData['providerName'] + ' account!' ); } openPopover('login'); return true; } function doLogout(){ $.getJSON("/rest/logout.php", {} , finishLogout ); pageTracker._trackEvent('Buttons', "Logout Button"); } function finishLogout(data){ userData = data; window.location = window.location; } function doLoginMore(){ openPopover('login_more'); $('#overlay').ready( function() { initRadio(); } ); pageTracker._trackEvent('Registration', "Get Extra Info"); return true; } function doError(msg){ $('#errorMsg').html(msg); openPopover('errorBox'); pageTracker._trackEvent('Alert Windows', "Displayed error box"); } function doUploadIntro(){ openPopover('upload_overlay'); pageTracker._trackEvent('Alert Windows', "Displayed upload intro"); return true; } function updateUser(data){ if (data.response =='ok'){ if (submittingForm=="updateUserForm"){ if (uploadIntro){ clearOverlays() doUploadIntro(); } else { closeOverlay(); } } else { $('#' + submittingForm + '-error').html("SAVED!"); Cufon.refresh('.gtio_font3'); $('#' + submittingForm + '-error').show(); window.location = '/profile/'; } } else { $('#' + submittingForm + '-error').html(data.msg); Cufon.refresh('.gtio_font3'); $('#' + submittingForm + '-error').show(); } } function openPopover(name){ clearOverlays() $('#' + name).show(); Cufon.refresh(); $("#overlay").fadeIn(); } function clearOverlays(){ $('.overlay_box').each( function (index) { $(this).hide(); } ); } function closeOverlay(){ clearOverlays() $("#overlay").fadeOut(); if (userData.enabled=='false' && uploadPage){ window.location = '/'; } } function processUpdateUser(formname){ submittingForm = formname; var submitValues = Object(); var doSubmit = true; $('#' + formname + ' > * > .formerror').hide(); $('#' + formname + ' > * > .formInput').each(function(index) { $(this).parent().removeClass('error'); }); $('#' + formname + ' > * > .formInput').each( function(index) { if ($(this).hasClass('required') && $(this).val() ==''){ doSubmit=false; $(this).parent().addClass('error'); } submitValues[$(this).attr('name')] = $(this).val(); }); if (doSubmit){ $.post("/rest/updateUser.php", submitValues , function (data) { updateUser(data);} , "json" ); } else { //alert('#' + formname + ' > * > .formerror'); // alert( $('#' + formname + ' > * > .formerror').html() ); $('#' + formname + '-error').show(); } }