/* OnlineOpinion (S3tS v3.1) */

/* This product and other products of OpinionLab, Inc. are protected by U.S. Patent No. 6606581, 6421724, 6785717 B1 and other patents pending. */

var custom_var,_sp='%3A\\/\\/',_rp='%3A//',_poE=0.0, _poX=0.0,_sH=screen.height,_d=document,_w=window,_ht=escape(_w.location.href),_hr=_d.referrer,_tm=(new Date()).getTime(),_kp=0,_sW=screen.width;function _fC(_u){_aT=_sp+',\\/,\\.,-,_,'+_rp+',%2F,%2E,%2D,%5F';_aA=_aT.split(',');for(i=0;i<5;i++){eval('_u=_u.replace(/'+_aA[i]+'/g,_aA[i+5])')}return _u};function O_LC(){_w.open('https://secure.opinionlab.com/ccc01/comment_card.asp?time1='+_tm+'&time2='+(new Date()).getTime()+'&prev='+_fC(escape(_hr))+'&referer='+_fC(_ht)+'&height='+_sH+'&width='+_sW+'&custom_var='+custom_var,'comments','width=535,height=192,screenX='+((_sW-535)/2)+',screenY='+((_sH-192)/2)+',top='+((_sH-192)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no')};function _fPe(){if(Math.random()>=1.0-_poE){O_LC();_poX=0.0}};function _fPx(){if(Math.random()>=1.0-_poX)O_LC()};window.onunload=_fPx;function O_GoT(_p){_d.write('<a href=\'javascript:O_LC()\' class=\'headertext\'>'+_p+'</a>');_fPe()}

/* define a new shortcut for jQuery to prevent conflict with Prototype */
$jq = jQuery.noConflict(); 

/* define the TANDBERG object to avoid conflicts with any third party code */
var TANDBERG = {};

/* define all configurable variables used for the TANDBERG site */
TANDBERG.vars = {
    /* camelCase naming convention */
    mainNavDelayOver: 0,
    mainNavDelayOut: 0.75,
    mainNavTimerOver: '', /* a setTimeout var to start the mouseOver event of the main nav. */
    mainNavTimerOut: ''   /* a setTimeout var to start the mouseOut  event of the main nav. */
};

/* define all reusable functions for the TANDBERG site */
TANDBERG.functions = {
/* camelCase naming convention */
/* main navigation mouseover */
    mainNavMouseOver: function(i) {
        $jq('a.activeSub').removeClass('activeSub');
        $jq('#navMain div').hide();
        $jq('#navMain div').eq(i).show();
        $jq('#navMain li').eq(i).find('a').addClass('activeSub');
    },
    
/* main navigation mouseout */
    mainNavMouseOut: function() {
        $jq('#navMain div').hide();
        $jq('a.activeSub').removeClass('activeSub');
    },
    
    navFeaturedHide: function() {
        $jq('#navFeatured div').fadeOut(); 
        return false;
    }
};



/* jQuery DOMdocument.ready */
$jq(document).ready(function(){
/* HTML; add HTML to the page that is not content. this HTML either purely decorative, or purely functional (requiring JS to work). */
	if($jq.browser.safari == true) {
	   $jq('body').addClass('browserSafari');
	}
	if($jq.browser.opera == true) {
	   $jq('body').addClass('browserOpera');
	}
	if($jq.browser.msie == true && parseInt($jq.browser.version) == 8) {
	   $jq('body').addClass('browserIE8');
	}
	
	
	
	/* Interactions; define the intereactive components of the page. *//*
    $jq('#navGlobal a:last').click(function(){
        O_LC();
        return false;
    });*/
    $jq('#contentSlidesNav a').hover(function(){
        var index = $jq('#contentSlidesNav a').index(this);
        $jq('#contentSlidesNav a.active').removeClass('active');
        $jq(this).addClass('active');
        $jq('#contentSlidesWrapper div:visible').fadeOut();
        $jq('#contentSlidesWrapper div').eq(index).fadeIn();
    });

/* module form to redirect traffic */
    $jq('div.module form.url')
        .find('div.fieldSubmit')
        .hide()
        .end()
        .find('select')
        .change(function(){
            var url = $jq(this).val();
            if(url != '') {
                location.href = $jq(this).val();
            }
        });


    Shadowbox.init({
        players: ['iframe']
    });



/* Visual Clean-Up; help non standards-based browsers render the page properly. */
	$jq('div.module').equalHeights();
	$jq('div.module h2').equalHeights();
	$jq('div.modules>div:last-child').addClass('jsModuleLast');
	$jq('li:last-child').addClass('jsLastChild');
	
	
	
    $jq('#navMain li').each(function(i){
        $jq(this)
            .mouseover(function(){
                clearTimeout(TANDBERG.vars.mainNavTimerOut);
                TANDBERG.vars.mainNavTimerOver = setTimeout(
                    function() {
                        TANDBERG.functions.mainNavMouseOver(i);
                    },
                    TANDBERG.vars.mainNavDelayOver * 1000
                );
            })
            .mouseout(function(){
                clearTimeout(TANDBERG.vars.mainNavTimerOver);
                TANDBERG.vars.mainNavTimerOut = setTimeout(
                    function() {
                        TANDBERG.functions.mainNavMouseOut();
                    },
                    TANDBERG.vars.mainNavDelayOut * 1000
                );
            });
    });
    $jq('#navMain div').each(function(i){
        $jq(this).find('a:last').addClass('last');
        $jq(this).find('h4:first').addClass('first');
        $jq(this)
            .mouseover(function(){
                clearTimeout(TANDBERG.vars.mainNavTimerOut);
                TANDBERG.vars.mainNavTimerOver = setTimeout(
                    function() {
                        TANDBERG.functions.mainNavMouseOver(i);
                    },
                    TANDBERG.vars.mainNavDelayOver * 1000
                );
            })
            .mouseout(function(){
                clearTimeout(TANDBERG.vars.mainNavTimerOver);
                TANDBERG.vars.mainNavTimerOut = setTimeout(
                    function() {
                        TANDBERG.functions.mainNavMouseOut();
                    },
                    TANDBERG.vars.mainNavDelayOut * 1000
                );
            });
    });
    
    $jq('#navFeatured li#nf4 a').click(function(){
        $jq('#navFeatured div').fadeIn();
        return false;
    });
    
/* apply style changes where possible to things without a proper CSS hook */
// make all links in right rail orange.
//$jq('td[width=145] a').css('color','#ff5200');
// change padding of left rail
//$jq('td[width=137]').css('padding','0 10px 0 0');
//$jq('td[width=137] td').css('padding','0 10px 0 0');
// adjust dividing lines between left nav
    $jq('td[width=137] div.leftnavlev2:last').addClass('leftnavlev2last');
    
// telepresence page slideshow
    $jq('#tpSlideshowModule p.desc').equalHeights();
    $jq('#tpSlideshowModule div.slideshow').cycle({
  		fx:'fade',
  		timeout:0,
  		pager:'#tpSlideshowCtrl',
      pagerAnchorBuilder:function(idx,slide){
        var theLink = '<a href="#"><span>'+$jq(slide).find('div.ctrlTxt').text()+'<\/span><\/a>';
        return theLink;
      }
  	});
  	$jq('#tpSlideshowCtrl a').bind(
  	   'focus',
  	   function(){
  	     this.blur();
  	     return false;
  	   }
  	);
// telepresence page accordion
  	$jq('#tpAccordionModule div.accordion').accordion({ autoHeight:false });
}); 

