// UPM Image
function upm_pop_img(src,w,h,name,title)
{var ww=parseInt(w);var wh=parseInt(h);if(ww<100)
{ww=125;}
if(wh<100)
{wh=125;ww+=75;}
var scroll=false;if(screen.width&&(screen.width<ww))
{scroll='yes';ww=screen.width;}
if(screen.height&&(screen.height<wh))
{scroll='yes';wh=screen.height;}
if(!title)
{title=name;}
var t=(screen.height)?(screen.height-wh)/2:0;var l=(screen.width)?(screen.width-ww)/2:0;var upm_pop_win=window.open('','upm_pop_win','top = '+t+', left = '+l+', width = '+ww+', height = '+wh+', toolbar = no, location = no, directories = no, status = no, menubar = no, scrollbars = '+scroll+', copyhistory = no, resizable = yes');upm_pop_win.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">');upm_pop_win.document.writeln('<html>');upm_pop_win.document.writeln('<head>');upm_pop_win.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');upm_pop_win.document.writeln('<meta http-equiv="imagetoolbar" content="no">');upm_pop_win.document.writeln('<title>'+title+'</title>');upm_pop_win.document.writeln('<style type="text/css">');upm_pop_win.document.writeln('<!--');upm_pop_win.document.writeln('body {');upm_pop_win.document.writeln('margin: 0;');upm_pop_win.document.writeln('padding: 0;');upm_pop_win.document.writeln('color: #000;');upm_pop_win.document.writeln('background-color: #fff;');upm_pop_win.document.writeln('text-align: center;');if(scroll==false)
{upm_pop_win.document.writeln('overflow: hidden;');}
upm_pop_win.document.writeln('}');upm_pop_win.document.writeln('');upm_pop_win.document.writeln('img {');upm_pop_win.document.writeln('margin: 0 auto;');upm_pop_win.document.writeln('padding: 0;');upm_pop_win.document.writeln('border: none;');if(wh==125)
{upm_pop_win.document.writeln('margin-top: '+Math.floor(50-(h/2))+'px;');}
upm_pop_win.document.writeln('}');upm_pop_win.document.writeln('-->');upm_pop_win.document.writeln('</style>');upm_pop_win.document.writeln('</head>');upm_pop_win.document.writeln('<body>');upm_pop_win.document.writeln('<div id="upm-image-view">');upm_pop_win.document.writeln('<img src="'+src+'" width="'+w+'" height="'+h+'" alt="">');upm_pop_win.document.writeln('</div>');upm_pop_win.document.writeln('</body>');upm_pop_win.document.write('</html>');upm_pop_win.document.close();upm_pop_win.focus();return false;}

//CBS Live Search
var cbs_live_search=(function(d){var f="",q,a,m,n,p,b,o,c,r,h,j;function g(){o.value="";k();o.focus()}function e(){clearTimeout(n);i(r);if(a){a=0;d(h).hide(600)}}function i(t,s){if(t){return t.css("visibility",s?"":"hidden")}}function k(){var s=o.value;if(s!=f){f=s;i(c,s);s=d.trim(s);if(s!=q.q){if(b){b.abort()}if((q.q=s).length<3){e()}else{i(r,1);b=d.ajax(d.extend(p,{data:q}))}}}}function l(){var s={width:j.clientWidth,height:j.clientHeight};if(!a){a=1;d(h).queue(function(){d(h).css(s).dequeue()}).show(600)}else{d(h).animate(s,600)}}return function(v,s,u,w,t){w=w&&/Apple Computer/.test(navigator.vendor)&&(parseInt(navigator.productSub)>=20020000);u="<p>"+u+"</p>";q=t;v=d("#"+v).append(d([j=i(d("<div />")).css("position","absolute")[0],h=d("<div />").css("display","none")[0]]).addClass("ls_results"))[0];o=d("input",v).focus(function(){if(d(o).hasClass("ls_inactive")){d(o).removeClass("ls_inactive");o.value=""}m=setInterval(k,1000)}).blur(function(){clearInterval(m);k();if(!w&&(o.value=="")){d(o).addClass("ls_inactive");o.value=s}}).keydown(function(x){if(x.keyCode==27){g()}})[0];r=i(d('<span class="ls_wait_image" />')).insertAfter(o);c=!w&&i(d('<span class="ls_reset_image" />')).click(g).insertAfter(o);if(d.browser.mozilla&&!document.getElementsByClassName){r.add(c).css("display","-moz-inline-stack")}if(w){d(v).addClass("ls_safari");o.type="search";d(o).attr({autosave:v.action,results:"5",placeholder:s})}else{d(o).attr({autocomplete:"off",value:s}).addClass("ls_inactive")}p={url:v.action,type:"POST",dataType:"html",success:function(x){clearTimeout(n);i(r);d([j,h]).html((x=="<none />")?u:x);n=setTimeout(l,50)},error:e}}})(jQuery);
	
// Google Analytics
(function($){$.gaTracker=function(code,opts){opts=jQuery.extend({external:'/external/',mailto:'/mailtos/',download:'/downloads/',extensions:['pdf','doc','xls','csv','jpg','gif','mp3','swf','txt','ppt','zip','gz','dmg','xml']},opts);function decorateLink(u){var trackingURL='';if(u.indexOf('://')==-1&&u.indexOf('mailto:')!=0){var ext=u.split('.')[u.split('.').length-1];var exts=opts.extensions;for(i=0;i<exts.length;i++){if(ext==exts[i]){trackingURL=opts.download+u;break;}}}else{if(u.indexOf('mailto:')==0){trackingURL=opts.mailto+u.substring(7);}else{var regex=/([^:\/]+)*(?::\/\/)*([^:\/]+)(:[0-9]+)*\/?/i;var linkparts=regex.exec(u);var urlparts=regex.exec(location.href);if(linkparts[2]!=urlparts[2])trackingURL=opts.external+u;}}
return trackingURL;}
function addTracking(){_uacct=code;urchinTracker();$('a').each(function(){var u=$(this).attr('href');if(typeof(u)!='undefined'){var newLink=decorateLink(u);if(newLink.length){$(this).click(function(){urchinTracker(newLink);});}}});}
function initGA(){try{var gaURL=(location.href.indexOf('https')==0?'https://ssl':'http://www');gaURL+='.google-analytics.com/urchin.js';$.getScript(gaURL,function(){addTracking();});}catch(err){console.log('Failed to load Google Analytics:'+err);}}
initGA();}})(jQuery);
