var currentcase = -1; var casepoints = new Array(); var casewidth = new Number(); var audiolength = new String(); var casepointon = -1; var casewidths = [ 0, 1050, 1130, 1130, 1130, 1130, 1130, 1130 ]; var caselengths = [ 0, 392, 201, 236, 222, 249, 160, 0 ]; var slidemode = false; var firstrun = true; var inpause = false; var receptive = true; var recInterval = new Number(); var autocloseInterval = new Number(); var narrationup = false; $(window).resize(function () { var ch = $("#caseholder").position(); arrowupdate(ch.left); }); function caserollin (targetnum) { $("#itemhead").css({ 'background-color': '#ff0000' }); $("#casetitle").html($("#cs" + targetnum + 's').find(".casehead:first").text()); $("#casetag").html($("#cs" + targetnum + 's').find(".casetag:first").text()); } function caserollout (targetnum) { $("#itemhead").css({ 'background-color': '#444444' }); $("#casetitle").html($("#cs" + currentcase + 's').find(".casehead:first").text()); $("#casetag").html($("#cs" + currentcase + 's').find(".casetag:first").text()); } function casefocus (target,collapsemap){ if(currentcase != parseInt(target.substring(1,2))){ casepoints.length = 0; casepointon = -1; $("#itemhead").css({ 'background-color': '#444444' }); $(".caselist li").each(function (){ $(this).removeClass('csel'); $(this).addClass('cl'); $(this).unbind("mouseover"); $(this).unbind("mouseout"); $(this).mouseover(function () { caserollin($(this).attr('cn')); }); $(this).mouseout(function () { caserollout($(this).attr('cn')); }); }); receptive = true; $(".casebottom").find(".ppstory").hide(); clearInterval(recInterval); currentcase = parseInt(target.substring(1,2)); $("#s" + currentcase).addClass('csel'); $("#s" + currentcase).removeClass('cl'); $("#s" + currentcase).unbind("mouseover"); $("#s" + currentcase).unbind("mouseout"); $("#cs" + currentcase + 's').show(); $("#casetitle").html($("#cs" + currentcase + 's').find(".casehead:first").text()); $("#casetag").html($("#cs" + currentcase + 's').find(".casetag:first").text()); var str = '
';
inf += '
';
if(thiscase.haslink){
outp += '<\/a>';
}
}
var thistext = thiscase.bodytext;
if(thiscase.haslink){
outp += '' + lint + ' »<\/a>';
}
if(thiscase.isvideo && narrclick){
thistext += ' Click to watch the video';
}
if(thiscase.bodytext != undefined && thiscase.bodytext != ''){
newwidth = 500;
outp += thistext;
} else {
if(!thiscase.isvideo && !thiscase.haslink){
newwidth = thiscase.imgwidth;
newmargin = (thiscase.x - 30);
}
}
if(thiscase.isvideo && newwidth < 386){
newwidth = 386;
}
if(thiscase.photocredit != ''){
outp += ' ' + thiscase.photocredit + '<\/span>';
}
if((parseInt(newwidth) + parseInt(thiscase.x)) > casewidth){
newmargin = parseInt(casewidth) - (parseInt(newwidth) + 50);
}
$("#" + targetid).removeClass('boxen');
$("#" + targetid).addClass('boxenon');
$("#" + targetid).css({ 'z-index':40 });
$("#" + targetid).animate({ 'width': newwidth + 'px', 'height':'260px','margin-top':'5px','margin-left':newmargin + 'px' }, 400, function () {
$("#" + targetid).html(outp);
if(thiscase.isvideo){
if(narrclick){
videoembed(thiscase.videoid,false);
} else {
videoembed(thiscase.videoid,true);
}
}
});
$("#" + targetid).html('');
}
if(narrationup){
comms_started();
}
$("#" + targetid).unbind('click');
$("#" + targetid).click( function () { });
refocus(thiscase.x);
casepointon = parseInt(itemidx);
}
}
function receptiveagain () {
receptive = true;
}
function point_manualclose (targetid) {
clearInterval(receptiveagain);
recInterval = setTimeout(receptiveagain,5000);
point_retract(targetid,true);
}
function point_retract (targetid,viaclose) {
if(viaclose){
casepointon = -1;
}
var itemidx = targetid.substring(2,targetid.length);
$("#" + targetid).css({ 'z-index':(20 + parseInt(itemidx)) });
if(slidemode){
} else {
$("#" + targetid).animate({ 'width':'90px', 'height':'90px','margin-top':casepoints[itemidx].y + 'px', 'margin-left':casepoints[itemidx].x + 'px'}, 800, function () {
$("#" + targetid).removeClass('boxenon').addClass('boxen');
$("#" + targetid).click( function () {
point_click(targetid);
});
});
$("#" + targetid).unbind('click');
var inf = '';
if(casepoints[itemidx].isvideo){
inf += '';
$("#vidid").remove();
}
if(casepoints[itemidx].isupdate){
inf += '
';
$("#" + targetid).html(inf);
}
}
function videoembed (videoid,playnow){
var refv = new Array();
refv.pap_url = window.location.href;
if(playnow){
refv.pap_play = true;
}
refv.pap_url = window.location.href;
refv.pap_usecache = true;
refv.pap_hash = videoid;
refv.pap_arrowonly = true;
refv.pap_buttoncolor = 'ff0000';
refv.pap_buttonroll = 'b848c2';
refv.pap_standalone = true;
refv.pap_segmentlisten = 'comms_pause';
refv.pap_replaymode = true;
swfobject.embedSWF(_papevideourl,'vid',386,248,"9",null,refv,{wmode:"opaque",allowFullScreen:"true",allowScriptAccess:"always"},{ id:'vidid',name:'vidna' });
}
function refocus (x) {
var ch = $("#caseholder").position();
var vis = (0 - parseInt(ch.left)) + $("#caseinner").width();
var targetx = x - 130;
if(targetx > (casewidth - $("#caseinner").width())){
targetx = (casewidth - $("#caseinner").width());
}
if(targetx < 0){
targetx = 0;
}
$("#caseholder").animate({ "left" : (0 - targetx) + "px" }, 1000);
arrowupdate(0-targetx);
}
function arrowupdate (targetx) {
if(targetx < - 50){
$("#leftar").show();
} else {
$("#leftar").hide();
}
var ch = $("#caseholder").position();
var vis = (0 - targetx) + $("#caseinner").width();
if(vis < (casewidth - 100)){
$("#rightar").show();
} else {
$("#rightar").hide();
}
}
function mover (newx) {
var ch = $("#caseholder").position();
var targetx = ch.left + newx;
arrowupdate(targetx);
if(targetx > 0){
targetx = 0;
}
$("#caseholder").animate({ "left" : targetx + "px" }, 700);
}
function openpromo() {
$(".promowin").slideDown('slow');
$(".promo").hide();
$(".promo1").show();
}
function closepromo() {
$(".promowin").slideUp('slow');
$(".promo1").hide();
$(".promo").show();
}
function showtalk (onoff,text){
if(document.getElementById('subtitle')){
if(onoff){
$("#subtitle").stop();
$("#subtitle").css({opacity:"1"});
$("#subtitle").fadeIn(300);
document.getElementById('subtitle').innerHTML = text;
} else {
$("#subtitle").stop();
document.getElementById('subtitle').style.display = 'none';
}
}
}