// avoid conflicts with other libraries jQuery.noConflict(); /** * Copyright (c) 2005 - 2009, James Auldridge * All rights reserved. * * Licensed under the BSD, MIT, and GPL (your choice!) Licenses: * http://code.google.com/p/cookies/wiki/License * */ var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{};jaaulde.utils.cookies=(function(){var cookies=[];var defaultOptions={hoursToLive:null,path:'/',domain:null,secure:false};var resolveOptions=function(options){var returnValue;if(typeof options!=='object'||options===null){returnValue=defaultOptions;}else{returnValue={hoursToLive:(typeof options.hoursToLive==='number'&&options.hoursToLive!==0?options.hoursToLive:defaultOptions.hoursToLive),path:(typeof options.path==='string'&&options.path!==''?options.path:defaultOptions.path),domain:(typeof options.domain==='string'&&options.domain!==''?options.domain:defaultOptions.domain),secure:(typeof options.secure==='boolean'&&options.secure?options.secure:defaultOptions.secure)};}return returnValue;};var expiresGMTString=function(hoursToLive){var dateObject=new Date();dateObject.setTime(dateObject.getTime()+(hoursToLive*60*60*1000));return dateObject.toGMTString();};var assembleOptionsString=function(options){options=resolveOptions(options);return((typeof options.hoursToLive==='number'?'; expires='+expiresGMTString(options.hoursToLive):'')+'; path='+options.path+(typeof options.domain==='string'?'; domain='+options.domain:'')+(options.secure===true?'; secure':''));};var splitCookies=function(){cookies={};var pair,name,value,separated=document.cookie.split(';');for(var i=0;iLoading...') .hide() .appendTo('body') .css('color','green') .ajaxStart(function(){ $(this).show(); }).ajaxStop(function(){ $(this).hide(); }); /* ------------------------------------------ */ // show/hide session outline $('a.toggle-outline').click(function(){ $link = $(this); $link.parent().next().animate({ opacity: 'toggle', height: 'toggle' }, 'fast'); if ($link.filter(':contains(Show)').length) { $link.text('[-] Hide Outline'); } else { $link.text('[+] Show Outline'); } return false; }) /* ------------------------------------------ */ // expand/collapse sessions var toggleSessionList = function(event){ var $link = $(this); $link.closest('div.gapbox').animate({ opacity: 'toggle', height: 'toggle' }, 'slow').queue(function(){ var $sessions = $(this).find('div.sessions') var $th = $link.parent(); if ($th.hasClass('texthide')){ $th .removeClass('texthide') .html('You have not selected a session for this timeslot. Please select a session for this slot or leave as a session to fill later. Or go to the Session Finder to search sessions by track, industry or other criteria.') .find('a.toggle-sessions').bind('click', toggleSessionList); $sessions.hide(); }else{ $th .addClass('texthide') .html('You have not selected a session for this timeslot. Please select a session below or leave as a session to fill later. Click here to hide sessions for this timeslot.') .find('a.toggle-sessions').bind('click', toggleSessionList); $sessions.show(); } $(this).dequeue(); }).animate({ opacity: 'toggle', height: 'toggle' }, 'slow'); return false; }; $('a.toggle-sessions').bind('click', toggleSessionList); /* ------------------------------------------ */ // add session to calendar var addSession = function(){ // check if not signed in var accountCookie = $.cookies.get('OTAccountID'); if (accountCookie == '' || accountCookie == null) { return; } var $link = $(this); var $gapbox = $link.closest('div.gapbox'); var $meta = $link.parent().siblings('div.meta'); var room = $meta.find('div.session-room').text(); var itemid = $meta.find('div.itemid').text(); var itemcode = $meta.find('div.itemcode').text(); if ($link.parent().prev().filter(':contains(Space)').length) { var linkType = 'calendar'; var url = '/contentworld/2009/webservice/ws_addtocalendar.html'; var data = {'itemid': itemid, 'itemtype': 'Session', 'itemcode': itemcode}; } else { var linkType = 'waitlist'; var url = '/contentworld/2009/webservice/ws_addtowaitlist.html'; var data = {'itemid': itemid, 'itemtype': 'Session', 'itemcode': itemcode}; } $gapbox.animate({ opacity: 'toggle', height: 'toggle' }, 'slow').queue(function(){ // position loading message $('#loading').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')); // ajax call $.post(url, data, function(xml){ //if ($(xml).filter('error').length > 0) if ($(xml).parent().find('error').length > 0) { // error $('

'+$(xml).filter('error').parent().text()+'

').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')).css('color', 'red'); //$('

'+$(xml).filter('error').parent().text()+'

').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')); //$('

'+$(xml).parent().find('error').text()+'

').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')); } //else if ($(xml).filter('Success').length > 0) else if ($(xml).parent().find('Success').length > 0) { // hide intro $link.closest('div.sessions').prev().hide(); // add room $('

Room: ' + room + '

').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')); // inject appropriate links if (linkType == 'calendar') { $link.html('Remove from Your Calendar').unbind().bind('click', removeSession); $link.parent().prev().html('Scheduled'); $link.parent().next().show(); } else { $link.html('Remove from Waiting List').unbind().bind('click', removeSession); $link.parent().prev().html('Waitlisted'); $link.parent().next().show(); } // restyle header row and hide sibling rows //$link.closest('table').find('thead tr').addClass('tint'); $link.closest('tr').addClass('tint-override').siblings().hide(); $gapbox.dequeue(); } }); }).animate({ opacity: 'toggle', height: 'toggle' }, 'slow'); return false; }; $('a.add-session').bind('click', addSession); /* ------------------------------------------ */ // remove session from calendar var removeSession = function(){ // check if not signed in var accountCookie = $.cookies.get('OTAccountID'); if (accountCookie == '' || accountCookie == null) { return; } var $link = $(this); var $gapbox = $link.closest('div.gapbox'); var $meta = $link.parent().siblings('div.meta'); var itemid = $meta.find('div.itemid').text(); if ($link.parent().prev().filter(':contains(Scheduled)').length) { var linkType = 'calendar'; var url = '/contentworld/2009/webservice/ws_deletecalendarentry.html'; var data = {'itemid': itemid, 'itemtype': 'Session'}; } else { var linkType = 'waitlist'; var url = '/contentworld/2009/webservice/ws_deletecalendarentry.html'; var data = {'itemid': itemid, 'itemtype': 'Session'}; } $link.closest('div.gapbox').animate({ opacity: 'toggle', height: 'toggle' }, 'slow').queue(function(){ // position loading message $('#loading').insertAfter($link.closest('div.stretchyboxinsidebottom').find('h2')); // remove room $link.closest('div.stretchyboxinsidebottom').find('h3').remove(); // ajax call $.post(url, data, function(xml){ // show intro $link.closest('div.sessions').prev().show(); // inject appropriate links if (linkType == 'calendar') { $link.html('Add to Your Calendar').unbind().bind('click', addSession); $link.parent().prev().html('Space Available'); $link.parent().next().hide(); } else { $link.html('Add to Waiting List').unbind().bind('click', addSession); $link.parent().prev().html('Waiting List'); $link.parent().next().hide(); } // restyle header row and hide sibling rows //$link.closest('table').find('thead tr').removeClass('tint'); $link.closest('tr').removeClass('tint-override').siblings().show(); $gapbox.dequeue(); }); }).animate({ opacity: 'toggle', height: 'toggle' }, 'slow'); return false; }; $('a.remove-session').bind('click', removeSession); });