/********************************************************************
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 scores_promos = false;
var WebProducts_promos = false;
var guide_promos = true;
var news_promos = false;
var course_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 = "geocheck.js";
g.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(g);
}
});
$(document).ready(function(){
if (document.all){$("#nav li").hoverClass("over"); }
$("#navSubPlus").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){$("#navProducts").hoverClass("over");}
if(document.all){$("#navHosting").hoverClass("over");}
if(document.all){$("#navGraphics").hoverClass("over"); }
if(document.all){$("#navNews").hoverClass("over");}
if(document.all){$("#navClientsSamples").hoverClass("over");}
if(document.all){$("#navHistory").hoverClass("over");}
var path = location.pathname.substring(0);
var url = location.href;
if( (path.indexOf("/en_US/index.") != -1) || path == "/en_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();
$("#navClientsSamples").hide();
$("#navHistory").hide();
} else {
$("#navPlus").hide();
}
} else {
setNavCookie("cont");
/* minimize nav when index page loads */
$("#navMinus").hide();
$("#nav").width("360px");
$("#navNews").hide();
$("#navClientsSamples").hide();
$("#navHistory").hide();
}
}

$('#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');
$('#navProducts').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navProducts').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navHosting').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navHosting').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });

$('#navGraphics').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navGraphics').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'); });

$('#navClientsSamples').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navClientsSamples').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'); });

}); /* 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();
$("#navClientsSamples").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();
$("#navClientsSamples").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();
$("#navClientsSamples").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();
$("#navClientsSamples").show();
$("#navHistory").show();
});
$("#navSubPlus").toggle();
$("#navSubMinus").toggle();
setNavCookie("exp");
measureApp('Home','Navigation','Show');
});
});

/**********************************************************************
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 image</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 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 Image');
} 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 Content');
}
}

/**********************************************************************
This function expands the left div on the main page
**********************************************************************/
function serviceExpand(){
$("#infoService").animate({height:"213px"}, 650);
$("#infoServiceSmall").toggle();
$("#infoServiceLarge").toggle();
measureApp('Web Site Tips','Servicing Our Clients','Show');
}
/**********************************************************************
This function contracts the left div on the main page
**********************************************************************/
function serviceContract(){
$("#infoService").animate({height:"32px"}, 650);
$("#infoServiceLarge").toggle();
$("#infoServiceSmall").toggle();
measureApp('Web Site Tips','Servicing Our Clients','Hide');
}

/**********************************************************************
This function expands the the right div on the main page
**********************************************************************/
function graphicsExpand(){
$("#infoGraphics").animate({height:"213px"}, 650);
$("#infoGraphicsSmall").toggle();
$("#infoGraphicsLarge").toggle();
measureApp('E-Commerce','New Web Solutions','Show');
}
/**********************************************************************
This function contracts the the right div on the main page
**********************************************************************/
function graphicsContract(){
$("#infoGraphics").animate({height:"32px"}, 650);
$("#infoGraphicsLarge").toggle();
$("#infoGraphicsSmall").toggle();
measureApp('E-Commerce','New Web Solutions','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 advertiser 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("switchSponsers()" , 15000);
}
else {
$('#sponMenu3').toggle();
setTimeout("switchSponsers()" , 15000);
}
}
function switchSponsers(){
$('#sponMenu2').toggle();
$('#sponMenu3').toggle();
setTimeout("switchSponsers()", 15000);
}
/**********************************************************************
functions for advertiser logo rotation
**********************************************************************/
var lbWindow = "";
function launchLB(syn,debug,alt){
var lbLaunchPage = "/en_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 = "/flash_upgrade.htm?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
