/********************************************************************
content shedding variabies
********************************************************************/
var shedAllGeos = false; //change to true if need to block all video links from all geos
/********************************************************************
variables for home page modules set to open or closed
********************************************************************/
var videoOpen;
var newsOpen;
/********************************************************************
variable for message refresh
********************************************************************/
var messageRefresh = 300000;
/********************************************************************
variabies for sublevel index page promos
********************************************************************/
var web_promos = false;
var client_promos = false;
var guide_promos = true;
var news_promos = false;
var internet_promos = false;
var history_promos = false;
var homeOpenCount = 0; //variable to count how many elements on the homepage are 'open'
var showBgImage; //variable to determing whether or not background image is being shown
var geoblock = "false";
var navigation_state = "nav_cookie";
function geoBlock(geo,geovalue){
if (geovalue)
geovalue = "true";
else{
geovalue = "false";
}
$.cookie("geo_cookie",geovalue);
if(geovalue == "true"){ $('#subPromo1').hide(); }
if(shedAllGeos){ $('#subPromo1').hide(); } //do this when shedding content
geoblock = geovalue;
}
function setNavCookie(state){
$.cookie(navigation_state,state);
}
$(function(){
/* get or set geoblock cookie */
if($.cookie("geo_cookie")){
geoblock = $.cookie("geo_cookie");
if(geoblock == "true"){ $('#subPromo1').hide(); }
if(shedAllGeos){ $('#subPromo1').hide(); } //do this when shedding content
} else {
var g = document.createElement("script");
g.src = "";
g.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(g);
}
});
$(document).ready(function(){
if (document.all){$("#nav li").hoverClass("over"); }
$("#navSubPlus").hide();
$("#PriceboardLargeHome").hide();
$("#infoLarge").hide();
if(videoOpen){
$("#videoSmall").hide();
$("#videoLarge").show();
setTimeout("initHomeVideo()",2000);
homeOpenCount++;
homeFadeOut();
} else {
$("#videoLarge").hide();
}
if(newsOpen){
$("#newsSmall").hide();
$("#newsLarge").show();
setTimeout("loadHeadlines()",2000);
homeOpenCount++;
homeFadeOut();
} else {
$("#newsLarge").hide();
}
if(qsParse.get("view")){
var page_set = qsParse.get("view");
if(page_set == "Priceboard"){
PriceboardExpand('external');
}
}
$("#background img").bind("contextmenu",function(e){
return false;
});
initBackground();
StartTimer();
if(document.all){$("#navWebClients").hoverClass("over");}
if(document.all){$("#navClients").hoverClass("over");}
if(document.all){$("#navInternet").hoverClass("over"); }
if(document.all){$("#navVideo").hoverClass("over");}
if(document.all){$("#navNews").hoverClass("over");}
if(document.all){$("#navProducts").hoverClass("over");}
if(document.all){$("#navHistory").hoverClass("over");}
var path = location.pathname.substring(0);
var url = location.href;
if( (path.indexOf("/web_US/index.") != -1) || path == "/web_US/"){
/* set or get nav_cookie when index page loads */
if($.cookie(navigation_state)){
var nav_state = $.cookie(navigation_state);
if(nav_state == "cont"){
/* minimize nav when index page loads */
$("#navMinus").hide();
$("#nav").width("360px");
$("#navNews").hide();
$("#navProducts").hide();
$("#navHistory").hide();
} else {
$("#navPlus").hide();
}
} else {
setNavCookie("cont");
/* minimize nav when index page loads */
$("#navMinus").hide();
$("#nav").width("360px");
$("#navNews").hide();
$("#navProducts").hide();
$("#navHistory").hide();
}
}
if (path.indexOf('/clients/') != -1){path = "/web_US/clients/index.html";}
if (path.indexOf('/history/') != -1){path = "/web_US/history/index.html";}
if (path.indexOf('/stats/') != -1){path = "/web_US/results/index.html";}
if (path.indexOf('/interviews/') != -1){path = "/web_US/news/index.html";}
if (path.indexOf('/articles/') != -1){path = "/web_US/news/index.html";}
$('#nav ul li ul').hide();
$('#navSub ul li ul').hide();
$('#nav a[@href$="' + path + '"]').addClass('active');
$('#nav a[@href$="' + path + '"]').parents("li").addClass('active');
$('#navSub a[@href$="' + path + '"]').addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("li").addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("ul").prev("ul li").addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
$('#navWebClients').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navWebClients').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navInternet').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navInternet').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navHistory').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navHistory').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navNews').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navNews').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
}); /* end document.ready */
//jquery code for top navigation
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover(
function() { $(this).addClass(c); },
function() { $(this).removeClass(c); }
);
});
};
/**********************************************************************
This function fades the background image out
**********************************************************************/
function homeFadeOut(){ /* $("#background img").fadeTo("normal", 0.20);*/ }
/**********************************************************************
This function brings the background image in
**********************************************************************/
function homeFadeIn(){ /*$("#background img").fadeTo("normal", 1);*/ }
/**********************************************************************
This function contracts the main nav on the home page
**********************************************************************/
$(function(){
$("#navMinus img").click(function(){
$("#nav").animate({width:"360px", height:"21px"}, 250);
$("#navNews").hide();
$("#navProducts").hide();
$("#navHistory").hide();
$("#navMinus").toggle();
$("#navPlus").toggle();
setNavCookie("cont");
measureApp('Home','Navigation','Hide');
});
});
/**********************************************************************
This function expands the main nav on the home page
**********************************************************************/
$(function(){
$("#navPlus img").click(function(){
$("#nav").animate({
width:"613px",
height:"21px"
}, 200, function(){
$("#navNews").show();
$("#navProducts").show();
$("#navHistory").show();
});
$("#navPlus").toggle();
$("#navMinus").toggle();
setNavCookie("exp");
measureApp('Home','Navigation','Show');
});
});
/**********************************************************************
This function contracts the main nav on sublevel pages
**********************************************************************/
$(function(){
$("#navSubMinus img").click(function(){
$("#navSub").animate({width:"360px", height:"21px"}, 250);
$("#navNews").hide();
$("#navProducts").hide();
$("#navHistory").hide();
$("#navSubMinus").toggle();
$("#navSubPlus").toggle();
setNavCookie("cont");
measureApp('Sublevel','Navigation','Hide');
});
});
/**********************************************************************
This function expands the main nav on sublevel pages
**********************************************************************/
$(function(){
$("#navSubPlus img").click(function(){
$("#navSub").animate({
width:"613px",
height:"21px"
}, 200, function(){
$("#navNews").show();
$("#navProducts").show();
$("#navHistory").show();
});
$("#navSubPlus").toggle();
$("#navSubMinus").toggle();
setNavCookie("exp");
measureApp('Home','Navigation','Show');
});
});
/**********************************************************************
This function expands the Priceboard div
**********************************************************************/
function PriceboardExpand(which){
$("#hmPriceboard").animate({
width:"525px",
height:"563px"
}, 650, function(){
checkVersions();//writeFlash();//put your code here, ed
});
homeOpenCount++;
homeFadeOut();
$("#PriceboardSmallHome").toggle();
$("#PriceboardLargeHome").toggle();
if(!which){ measureApp('Home','Chart Container','Large'); }
}
/**********************************************************************
This function contracts the Priceboard div
**********************************************************************/
var sb_launch = "false";
function PriceboardContract(launch){
if(launch){sb_launch = launch;}
$("#hmPriceboard").animate({width:"292px", height:"160px"}, 200);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#PriceboardLargeHome").toggle();
$("#PriceboardSmallHome").toggle();
$("#ChartContainer").html('');
if(sb_launch == "false"){
measureApp('Home','Chart Container','Small');
}
}
/**********************************************************************
This function expands the video div
**********************************************************************/
function hmVideoExpand(){
$("#hmVideo").animate({
height:"290px"
}, 650, function(){
if(window.initHomeVideo){
initHomeVideo();
}
});
homeOpenCount++;
homeFadeOut();
$("#videoSmall").toggle();
$("#videoLarge").toggle();
measureApp('Home','Watch','Show');
}
/**********************************************************************
This function contracts the video div
**********************************************************************/
function hmVideoContract(){
if(window.stopHomeVideo){
stopHomeVideo();
}
$("#hmVideo").animate({height:"33px"}, 650);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#videoLarge").toggle();
$("#videoSmall").toggle();
measureApp('Home','Watch','Hide');
}
/**********************************************************************
This function expands the news div
**********************************************************************/
function hmNewsExpand(){
$("#hmNews").animate({
width:456,
height:286
}, 650, function() {
loadHeadlines();
});
homeOpenCount++;
homeFadeOut();
$("#newsSmall").toggle();
$("#newsLarge").toggle();
measureApp('Home','Latest News','Show');
}
/**********************************************************************
This function contracts the news div
**********************************************************************/
function hmNewsContract(){
$("#hmNews").animate({width:456, height:33}, 650);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#newsLarge").toggle();
$("#newsSmall").toggle();
measureApp('Home','Latest News','Hide');
}
/**********************************************************************
This function expands the info div
**********************************************************************/
$(function(){
$("#infoSmall").click(function(){
$(".hmInfo").animate({width:562, height:66}, 650);
$(".splashInfo").animate({width:562, height:66}, 650);
$("#infoSmall").hide();
$("#infoLarge").show();
$("#captionDiv").html(caption_text);
$("#captionDiv").append(" <a id='showBgLink' href='javascript:hideShowContent();'>Reveal background photo</a>");
if(link_changed){ getLinkText(); }
measureApp('Site Functions','Background Info Box');
});
});
/**********************************************************************
This function contracts the info div
**********************************************************************/
function closeInfo(){
$(".hmInfo").animate({width:37, height:37}, 650);
$(".splashInfo").animate({width:37, height:37}, 650);
$("#infoLarge").hide();
$("#infoSmall").show();
}
/**********************************************************************
This function hides or shows all the page content to show or hide the
background image
**********************************************************************/
var showBg = false;
var link_changed = false;
function getLinkText(){
$("#showBgLink").html("Reveal page content");
link_changed = true;
}
function hideShowContent(){
if(!showBg){
$("#content").fadeOut("slow");
$("#footerContentBar").fadeOut("slow");
$("#hmInfoButton").removeClass("hmInfo").addClass("splashInfo");
$("#hmInfoButton").parent("div").addClass("splashFooterContainer");
getLinkText();
showBg = true;
measureApp('Site Functions','Reveal Background Photo');
} else if (showBg){
$("#content").fadeIn("slow");
$("#footerContentBar").fadeIn("slow");
closeInfo();
/*$("#infoLarge").hide(function(){
$("#infoSmall").fadeIn("slow");
});*/
$("#hmInfoButton").parent("div").removeClass("splashFooterContainer");
$("#hmInfoButton").removeClass("splashInfo").addClass("hmInfo");
showBg = false;
link_changed = false;
measureApp('Site Functions','Reveal Page Content');
}
}
/**********************************************************************
This function expands the viewing instructions div on the 3D page
**********************************************************************/
function viewingExpand(){
$("#threeDViewing").animate({height:"214px"}, 650);
$("#threeDViewingSmall").toggle();
$("#threeDViewingLarge").toggle();
measureApp('3D','Viewing Instructions','Show');
}
/**********************************************************************
This function contracts the viewing requirements div on the 3D page
**********************************************************************/
function viewingContract(){
$("#threeDViewing").animate({height:"32px"}, 650);
$("#threeDViewingLarge").toggle();
$("#threeDViewingSmall").toggle();
measureApp('3D','Viewing Instructions','Hide');
}
/**********************************************************************
This function expands the requirements instructions div on the 3D page
**********************************************************************/
function systemExpand(){
$("#threeDSystem").animate({height:"378px"}, 650);
$("#threeDSystemSmall").toggle();
$("#threeDSystemLarge").toggle();
measureApp('3D','System Requirements','Show');
}
/**********************************************************************
This function contracts the requirements requirements div on the 3D page
**********************************************************************/
function systemContract(){
$("#threeDSystem").animate({height:"32px"}, 650);
$("#threeDSystemLarge").toggle();
$("#threeDSystemSmall").toggle();
measureApp('3D','System Requirements','Hide');
}
/**********************************************************************
These functions manipulate the background image when resizing the
browser window
**********************************************************************/
function initBackground() {
$(window).resize(backgroundResizeHandler);
$(window).trigger('resize');
};
var backgroundResizeHandler = function() {
// If the inital image isn't cached, it'll report 0 dimensions.
if ($('#background img').height() == 0 || $('#background img').width() == 0) {
setTimeout(function() { $(window).trigger('resize'); }, 100);
return;
}
if ($('#background').hasClass('horizontal')) {
if ($('#background img').height() < $('#background').height()) {
$('#background').addClass('vertical').removeClass('horizontal');
$('#background img').css('marginLeft', -1 * parseInt($('#background img').width() / 2));
}
} else {
if ($('#background img').width() < $('#background').width()) {
$('#background').addClass('horizontal').removeClass('vertical');
$('#background img').css('marginLeft', 0);
}
}
};
/**********************************************************************
functions for sponsor logo rotation
**********************************************************************/
var x = 15;
var y = 1;
function StartTimer() {
$('#sponMenu2').hide();
$('#sponMenu3').hide();
random_num = (Math.round((Math.random()*1)+1));
if (random_num == 1) {
$('#sponMenu2').toggle();
setTimeout("switchAdvertisers()" , 15000);
}
else {
$('#sponMenu3').toggle();
setTimeout("switchAdvertisers()" , 15000);
}
}
function switchAdvertisers(){
$('#sponMenu2').toggle();
$('#sponMenu3').toggle();
setTimeout("switchAdvertisers()", 15000);
}
/**********************************************************************
functions for sponsor logo rotation
**********************************************************************/
var lbWindow = "";
function launchLB(syn,debug,alt){
var lbLaunchPage = "/web_US/realtime/lb.html?";
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
lbLaunchPage += "ts=" + t;
lbLaunchPage += (syn)?"&syn="+syn:"&syn=";
lbLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
lbLaunchPage += "&ref=" + document.location.host + document.location.pathname;
lbLaunchPage += (alt)?"&alt="+alt:"&alt=";
if (lbWindow.closed || lbWindow==""){
lbWindow = window.open(lbLaunchPage,"vcWindow","width=525,height=623,top=0,left=0")
if (lbWindow.opener == null) lbWindow.opener=self;
}
lbWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "/web_US/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
