var path = "/3"; function bodyOnLoad() { updateShells(); } var selected_video_section_thumb; $(document).ready(function() { $('#page').css({'padding-top' : $('#topnav').height() + 'px'}); glowShells(); $.address.change(function(event) { var url = event.value; if (url == '/') { return false; } var section_name = url.substr(1, url.length); var section = $('#' + section_name); if (selected) { selected.attr('selected', 0); selected.mouseout(); } selected = $("img[linkedto="+section_name+"]"); selected.attr('selected', 1); selected.mouseover(); $('html,body').animate({scrollTop: section.offset().top - $('#topnav').height()}, 400); }); $('.imgSwap').live('mouseover', function() { var cssProp = { 'cursor': 'pointer' }; $(this).css(cssProp); $(this).attr("src",$(this).attr('hover')); return false; }); $('.imgSwap').live('mouseout', function() { if ($(this).attr('selected') == 1) { return false; } $(this).attr("src",$(this).attr('default')); return false; }); $('.video_section_thumb').live('click', function() { var section = $(this).attr('section'); var url = 'beaterator/demoSection/' + section; $('#firstdemo').children('img').attr('src',$('#firstdemo').children('img').attr('default')); if (selected_video_section_thumb) { selected_video_section_thumb.attr('selected', 0); selected_video_section_thumb.mouseout(); } selected_video_section_thumb = $(this).children('img'); selected_video_section_thumb.attr('selected', 1); selected_video_section_thumb.mouseover(); selected_video_section_thumb.mouseout(); $.get(url,function(data) { $('#video_subnav').html((data)); }); return false; }) $('#firstTrailer').click(); $('#firstdemo').click(); $('#first_iphone_section').click(); }); var selected; $('.topnavlink').live('click', function() { var section = $(this).attr('linkedto'); $.address.value(section); return false; }) var selected_trailer_thumb; $('.trailer_thumb').live('click', function() { var vid = $(this).attr('vid'); var trailer_player = $('#trailer_player'); var flashvars = {}; flashvars.featured = true; var params = {bgcolor:"000000"}; params.allowFullScreen = true; params.allowScriptAccess = "always"; params.wmode = "opaque"; var attributes = {id: "trailer_player"}; swfobject.embedSWF("http://media.rockstargames.com/products/rockstar/media player/RockstarMediaPlayer.swf?skin=beaterator/ES/official&autoPlay=true&vidID="+vid+"&cache=01", "trailer_player", "100%", "100%", "9", "", flashvars, params, attributes); //trailer_player.empty(); //trailer_player.html(' '); if (selected_trailer_thumb) { selected_trailer_thumb.attr('selected', 0); } $('.trailer_thumb').mouseout(); selected_trailer_thumb = $(this); selected_trailer_thumb.attr('selected', 1); //alert(selected_trailer_thumb); $('.trailer_thumb').mouseover(); $('.trailer_thumb').mouseout(); return false; }) var selected_demo_thumb; $('.demo_thumb').live('click', function() { var vid = $(this).attr('vid'); var share = $(this).attr('share'); var demo_player = $('#demo_player'); var flashvars = {}; flashvars.featured = true; var params = {bgcolor:"000000"}; params.allowFullScreen = true; params.allowScriptAccess = "always"; params.wmode = "opaque"; var attributes = {id: "demo_player"}; (share == "no") ? swfobject.embedSWF("http://media.rockstargames.com/products/rockstar/media player/RockstarMediaPlayer.swf?skin=beaterator/ES/official2&autoPlay=true&vidID="+vid+"&cache=01", "demo_player", "100%", "100%", "9", "", flashvars, params, attributes) : swfobject.embedSWF("http://media.rockstargames.com/products/rockstar/media player/RockstarMediaPlayer.swf?skin=beaterator/ES/official&autoPlay=true&vidID="+vid+"&cache=01", "demo_player", "100%", "100%", "9", "", flashvars, params, attributes); var cliptext = $(this).attr('clipcontent'); var clipinfodiv = $('#clip_info'); clipinfodiv.empty(); clipinfodiv.html(cliptext); if (selected_demo_thumb) { selected_demo_thumb.attr('selected', 0); } $('.demo_thumb').mouseout(); selected_demo_thumb = $(this); selected_demo_thumb.attr('selected', 1); $('.demo_thumb').mouseover(); $('.demo_thumb').mouseout(); return false; }) var display_page = 0; $('#prev_vids').live('click', function() { cycle_page(-1); }) $('#more_vids').live('click', function() { cycle_page(1); }) function cycle_page(new_page) { $('#prev_vids').attr('class', 'show'); $('#more_vids').attr('class', 'show'); $('#tutorials_0').attr('class', 'invisible'); $('#tutorials_1').attr('class', 'invisible'); $('#tutorials_2').attr('class', 'invisible'); (new_page == 0) ? display_page = 0 : display_page += new_page; if(display_page == 0) { $('#prev_vids').attr('class', 'hide'); } if(display_page == 2) { $('#more_vids').attr('class', 'hide'); } $('#tutorials_'+display_page).attr('class', 'seen'); } $('.features_thumb').live('click', function() { var loadpic = $(this).attr('picnum'); var picholder = $('#features_large'); var $image = '_features/big'+loadpic+'.jpg'; picholder.empty(); $.get(path+'/beaterator/getFeaturedMode/'+loadpic,function(data) { picholder.html(data); }); }) $('.iphone_thumb').live('click', function() { var loadpic = $(this).attr('picnum'); var picholder = $('#iphone_large'); var $image = '_iphone/big'+loadpic+'.jpg'; picholder.empty(); $.get(path+'/beaterator/getIphoneMode/'+loadpic,function(data) { picholder.html(data); }); }) var selected_iphone_section; $('.iphone_section').live('click', function() { var section = $(this).attr('section'); var url = 'beaterator/iphoneSection/' + section; $.get(url,function(data) { $('#iphone_target').html((data)); }); if (selected_iphone_section) { selected_iphone_section.attr('selected', 0); } $('.iphone_section').children('img').mouseout(); selected_iphone_section = $(this).children('img'); selected_iphone_section.attr('selected', 1); $('.iphone_section').children('img').mouseover(); $('.iphone_section').children('img').mouseout(); return false; }) function updateShells() { $('.section_content').each(function(){ var height = $(this).children('.section_content_shell').children('.content_clone').height(); $(this).children('.section_content_shell').children('.glow_side').css({'height': height -7 + 'px'}); }); } function glowShells() { $('.section_content').each(function(){ var section_content_shell = $(document.createElement("div")).attr('class', 'section_content_shell'); var glow_top = $(document.createElement("div")).attr('class', 'glow_top'); var glow_side = $(document.createElement("div")).attr('class', 'glow_side'); var glow_bottom = $(document.createElement("div")).attr('class', 'glow_bottom'); var content_clone = $(this).clone().attr('class', 'content_clone'); content_clone.attr('id', $(this).attr('clone_id')); section_content_shell.prepend(glow_bottom); section_content_shell.prepend(content_clone); section_content_shell.prepend(glow_side); section_content_shell.prepend(glow_top); $(this).empty(); $(this).append(section_content_shell); glow_side.css({'height': Number(content_clone.height()) + 'px'}); }); }