var ie=0;
try {
if (navigator.appName == 'Microsoft Internet Explorer') { ie=parseFloat(navigator.appVersion); }
} catch(e) {}

// Lang sel
var lang=window.location.pathname.match(/\/\((..)\)(\/.*?\/)(.*)/);
if (lang && lang[1]) {
  var cookie="Lang="+lang[1]+";path="+lang[2];
  document.cookie=cookie;
  window.location=lang[2]+lang[3];
} else {
   l=window.location.search.match(/SetLang=(..)/);
   if (l && l[1]) {
    var cookie="Lang="+l[1];
    document.cookie=cookie;
   }
}

function setLang(link) {
  var l=link.pathname.match(/\/\((..)\)(\/.*?\/)(.*)/);
  if (l && l[1]) {
   var cookie="Lang="+l[1]+";path="+l[2];
   document.cookie=cookie;
   link.href=l[2]+l[3];
//   window.alert("set "+cookie);
  } else {
   l=link.search.match(/SetLang=(..)/);
   c=link.pathname.match(/\/(.*?\/)/);
   if (l && l[1] && c) {
    var cookie="Lang="+l[1]+";path="+c[1];
    document.cookie=cookie;
   }
  }
  return true;
}

// Search
function ghsearch(frm){
	frm.q.value=frm.q.value.replace(/^\s+|\s+$/g, '');
	var strTerm=frm.q.value;
	if(strTerm==""){
		alert("Please enter a search phrase or keyword.");
		frm.q.focus();
		return false;
	}
	return true;
}

var hideHover=new Array();
function vzHH(o) {
 if (ie) { hideHover.push(o); }
}

// ie6 hover
function vzDD(item) {
 try { if (ie && ie<7) {
   if (item.className=='ccc') { item.style.backgroundColor="#ccc"; }
   else if (item.className=='eee') { item.style.backgroundColor="#eee"; }
   else if (item.className.indexOf('666')>=0) { item.style.backgroundColor="#666"; }
   for (var i=0;i<item.childNodes.length;i++) {
    if (item.childNodes[i].nodeName == 'UL' || item.childNodes[i].nodeName=='DIV') {
     item.childNodes[i].style.display='block';item.childNodes[i].style.visibility='visible';
    }
   }
//   var show=item.firstChild;
//   while (show && (show.nodeName != 'UL' && show.nodeName != 'DIV')) {show=show.nextSibling; }
//   show.style.display="block";
//   show.style.visibility="visible";
 }
 if (hideHover) { for (var i=0;i<hideHover.length; i++) {
  hideHover[i].style.visibility="hidden";
 }}
 } catch (e) {}
}

function vzDO(item) {
 try { if (ie && ie<7) {
   if (item.className=='ccc' || item.className=='eee' || item.className.indexOf('666')>=0) { item.style.backgroundColor="transparent"; }
   for (var i=0;i<item.childNodes.length;i++) {
    if (item.childNodes[i].nodeName == 'UL' || item.childNodes[i].nodeName=='DIV') {
     item.childNodes[i].style.visibility='hidden';
    }
   }
//   var show=item.firstChild;
//   while (show && show.nodeName != 'UL' && show.nodeName != 'DIV') {show=show.nextSibling; }
   //show.style.display="none";
//   show.style.visibility="hidden";
 }
 if (hideHover) { for (var i=0;i<hideHover.length; i++) {
  hideHover[i].style.visibility="visible";
 }}
} catch (e) {}
}

function vzbPopup(link,w,h,title) {
 if (!w) { w=562; }
 if (!h) { h=600; }
 if (!title) { title=""+(link.title ? link.title : "popup"); }
 try { if (link.parentNode.className=="pod") { title="Play Podcast"; } } catch(e) {}
 var pop=window.open(link.href,title.replace(/ /,'_'),'width='+w+',height='+h+',scrollbars=1,resizable=1,toolbar=0');
 try { link.blur();
 if (pop && pop.focus) { pop.focus(); }
 } catch(e) {}
 if (pop) {return false; }
}

function openInParent(link) {
 if (window.opener && !window.opener.closed) {
  window.opener.location=link.href;
  if (window.focus) { window.blur(); window.opener.focus(); }
  return false;
 }
 return true;
}

var divout;
function divOutload(req){
 if (req.readyState == 4 && req.status == 200) {
  divout.style.height="100%";
  var div=document.getElementById('divout');
  div.innerHTML=req.responseText;
  var ca=div.getElementsByTagName('DIV');
  var ct;
  for (i=0;i<ca.length;i++) {
   if (ca[i].id.indexOf('content')==0) {
     ct=ca[i]; break;
   }
  }
  div.innerHTML='<a class="close" href="" onClick="this.parentNode.style.display=\'none\';return false;" style="float:right;">Close</a>'+ct.innerHTML;
  if (ie) { div.style.borderRightWidth="2px"; div.style.borderBottomWidth="2px"; }
  div.style.display="block";
  var bh=(window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : 0));
  if (bh) {
   var top=Math.floor((bh-div.clientHeight-40)/2)+(window.scrollY ? window.scrollY : document.body.parentNode.scrollTop);
//   div.innerHTML+="bh="+bh+" do="+divout.clientHeight+" div="+div.clientHeight+" top="+top;
   if (!top || top<8) { top=8; } // else if (top>400) { top=400; }
   //divout.style.top=top+"px"; 
   div.style.top=top+"px";
  div.style.zIndex="9";
  }
 }
}
function vzbDivout(link) {
 if (!divout) {
   divout=document.createElement('div');
 }
 divout.innerHTML='<div id="divout" style="display:none;padding: 6px 6px 12px 6px; background:#f5f5f5 url(\'/gfx/bg/vertical_200.gif\') repeat-x left top; border:solid 1px #666;position: absolute;width:480px;top: 100px;-moz-box-shadow: 2px 2px 2px #666;-webkit-box-shadow: 2px 2px 2px #666;"></div>';
 divout.style.position="absolute";
 divout.style.left="260px";
 divout.style.top="0px";
 document.getElementById('header').parentNode.appendChild(divout);
 var http_request = false;
  if (window.XMLHttpRequest) {
    http_request = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e) {
      try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e) {}
    }
  }
  if (http_request) {
   http_request.onreadystatechange = function() { divOutload(http_request); };
   http_request.open('GET', link.href, true);
   http_request.send(null);
   return false;
  }
  else { return vzbPopup(link); }
}

function keepHash(link) {
 if (link.href.indexOf('#')<0 && window.location.hash) {
  link.href+=window.location.hash;
 }
}

function doRecentPages() {
  var tn=document.getElementById('topnav').getElementsByTagName('a');
  var important=0;
  var m=document.cookie.match(/recent=(.*);?/);
  var pages=(m ? pages=m[1].split("||") : new Array);
  var titles=new Array();
  for (var i=0;i<tn.length;i++) {
   titles[tn[i].pathname]=tn[i].innerHTML;
   if (tn[i].href == window.location.href) {
     important=tn[i].pathname;
   }
  }
  if (important) {
   pages.unshift(important);
   if (pages.length>10) { pages.length=10; }
   var i=pages.length;
   while (i>0) {
    if (pages[i]==important) {
      pages.splice(i,1);
    }
    i--;
   }
   document.cookie="recent="+pages.join("||")+";path=/";
  }
  if (pages.length > 1) {
   var r=document.getElementById('recent'); if (r) {
   rc="<li class='l0 open deepest'><a>"+r.title+"</a><ul>";
   for (var i=0;i<pages.length && i<=8;i++) {
    if (titles[pages[i]] && pages[i] != important) {
      rc+="<li class='l1'><a href='"+pages[i]+"' name='&lpos=recent'>"+titles[pages[i]]+"</a></li>";
    }
   }
   rc+="</ul></li>";
   r.innerHTML=rc;
   }
  }
}

function rcvTopnav(req) {
 if (req.readyState == 4 && req.status == 200) {
  document.getElementById('topnav').innerHTML=req.responseText;
  var lists=document.getElementById('topnav').getElementsByTagName('UL');
  for (var i=0;i<lists.length;i++) {
   if (lists[i].clientHeight > 400 && lists[i].className=='two' ) {
      var morenav=document.createElement('UL');
      morenav.className="two more";
      morenav=lists[i].parentNode.insertBefore(morenav,lists[i].nextSibling);
      var lis=lists[i].getElementsByTagName('LI');
      var half=Math.ceil(lis.length/2);
      for(var n=half;n>0;n--) { if (lis[half]) {
        morenav.appendChild(lis[half]);
      } }

//    lists[i].style.width="380px"; lists[i].className+=" wide";
   }
  }
  //doRecentPages();
 }
}
function loadTopnav(root,lang) {
  var http_request = false;
  if (window.XMLHttpRequest) {
    http_request = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e) {
      try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e) {}
    }
  }
  if (http_request) {
   http_request.onreadystatechange = function() { rcvTopnav(http_request); };
   http_request.open('GET', root+"topnav.xml"+"?SetLang="+lang, true);
   http_request.send(null);
  }
}

function seeTopLinks() {
 var width=(window.innerWidth ? window.innerWidth : document.documentElement.clientWidth);
 var topLinks=document.getElementById('toplinks');
 if (topLinks){
  var right=topLinks.offsetLeft+topLinks.offsetWidth;
  var lost=width-right;
  if (lost<0 && lost>-480) {
   lost=20-lost;
   topLinks.style.paddingRight=lost+"px";
   document.getElementById('search').style.paddingRight=lost+"px";
   try { document.getElementById('langselect').style.paddingRight=lost+"px"; } catch(e) {}
  }
 }
}

// Tabs
var lastTab=document.getElementById("tab-overview");
var currentTab;
var tabCheck;
function selectTab(e) {
 if (!lastTab) { lastTab=document.getElementById("tab-overview"); }
 var tabs=document.getElementById('tabs');
 if (!tabs) { return false; }
 var lis=tabs.getElementsByTagName('li');
 if (!lis) { return false; }
 for (var i=0;i<lis.length;i++) { if (lis[i].className!="br") { lis[i].className=""; } }
 var tabname;
 if (this && this.href) { tabname=this.hash.substring(1); this.blur(); }
 else if (e && e.srcElement && e.srcElement.href) { tabname=e.srcElement.hash.substring(1); }
 else if (window.location.hash && window.location.hash!="#top") { tabname=window.location.hash.substring(1); }
 else { lis[0].className="selected"; }
 if (tabname) {
  if (tabname.indexOf('-')>0) { tabname=tabname.substring(0,tabname.indexOf('-')); }
  var tabpos=0;
  for (var i=0; i<lis.length;i++) {
   if (lis[i].firstChild && lis[i].firstChild.hash == "#"+tabname) { lis[i].className="selected"; tabpos=i; break; }
  }
  var tab=document.getElementById("tab-"+tabname);
  if (tab && tab!=lastTab) {
    if(lastTab) { lastTab.style.display="none"; }
    tab.style.display="block";
    lastTab=tab;
    if (window.scrollY > tabs.offsetTop) {
     window.scrollTo(0,tabs.offsetTop-12);
    }
    //if (e){e.preventDefault();}
    sizeLeft();
    try { _hbLink("Tab: "+tabname,tabpos); } catch (e) {}
  }
  currentTab=tabname;
  clearInterval(tabCheck);
  tabCheck=setInterval("checkTab()",1200);
 }
}
function checkTab() {
  if (window.location.hash.substring(1,currentTab.length+1) != currentTab && window.location.hash!="#top") {
//   window.alert(window.location.hash.substring(1,currentTab.length+1)+" != "+currentTab);
    selectTab();
  }
}
function tabLinks() {
 var a=document.getElementsByTagName('a');
 var here=window.location.pathname;
 var here2=here.substring(1);
 for (var i=0;i<a.length;i++) { 
  if (a[i].href && a[i].href.indexOf('#')>=0 && a[i].href.indexOf('#top')<0) {
  if (a[i].pathname == here || a[i].pathname == here2 || a[1].pathname+"index.xml" == here2) {
    if (a[i].addEventListener) { a[i].addEventListener('click',selectTab,false); }
    else if (a[i].attachEvent) { a[i].attachEvent('onclick',selectTab); }
  } }
 }
}


function popupLinks() {
 var a=document.getElementsByTagName('a');
 var here=window.location.pathname.substring(1);
 for (var i=0;i<a.length;i++) { 
  if (a[i].href && a[i].href.indexOf('#')<0) {
   if (a[i].pathname.indexOf(here)<0) {
    if (!a[i].target) { a[i].target="_blank"; }
   }
  }
 }
}

function showTool(id) {
  var e=document.getElementById(id);
  if (e && e.style) { e.style.display="block"; return false; }
  return true;
}
function hideTool(id) {
  var e=document.getElementById(id);
  if (e && e.style) { e.style.display="none"; return false; }
  return true;
}

function hpnews() { try {
 document.getElementById('colProducts').offsetHeight;
 document.getElementBtId('colNews').offsetHeight;
 // make news smaller than products
 } catch(e) {}
}

// left nav
var leftHeight;
function sizeLeft() { try {
 if (!leftHeight) {
  leftHeight=document.getElementById('left').offsetHeight;
  if (leftHeight<400) {leftHeight=400;}
 }
 else { document.getElementById('left').style.height=leftHeight+"px"; }
 var height=document.getElementById('wrapper').offsetHeight;
 if (height > leftHeight) { document.getElementById('left').style.height=height+"px"; }
 var rcol=document.getElementById('right');
 if (rcol && rcol.offsetHeight < height) {
  rcol.style.minHeight=height+"px";
 }
 } catch (e) {}
}

var lastShowLI=new Array();
var hideLI;
var showLI;
var hoverLI;
function showNext() {
  while (showLI && showLI.tagName!="LI") { showLI=showLI.nextSibling; }
  while (hideLI && hideLI.tagName!="LI") { hideLI=hideLI.nextSibling; }
  if (hideLI) {
   hideLI.style.display="none";
   hideLI=hideLI.nextSibling;
  }
  else if (showLI) {
   showLI.style.display="block";
   showLI=showLI.nextSibling;
  }
  if (showLI || hideLI) {
    setTimeout("showNext()",50);
  }
}

function showMore(link) {
 var li=link.parentNode;
 if (li) {
//  li.style.display="none";
  li.style.backgroundColor="#eee";
  showLI=li.nextSibling;
  showNext();
  lastShowLI.push(li);
//  setTimeout("hideMore()",9000);
 }
 link.blur();
 noMore();
  return false;
}

function hideMore(link) {
 if (link) {
   var li=link.parentNode;
    li.style.backgroundColor="#fff";
    hideLI=li.nextSibling;
    showNext();
 }
 else if (lastShowLI[0]) {
 //   lastShowLI[0].style.display="block";
    lastShowLI[0].style.backgroundColor="#fff";
    hideLI=lastShowLI[0].nextSibling;
    lastShowLI.shift();
    showNext();
 }
}
function toggleMore(link) {
 var li=link.parentNode;
 if (li) {
  if (link.className=='plus') { link.className="minus"; showMore(link); }
  else { link.className="plus"; hideMore(link); }
 }
 link.blur();
 return false;
}
var hovermoreT;
function hoverMore(link) {
 hoverLI=link;
 hovermoreT=setTimeout("showMore(hoverLI)",500);
}
function noMore() {
 clearTimeout(hovermoreT);
 hoverLI=false;
}

// form handler
var captchaVerified=0;
function rcvCaptcha(req,field) {
 if (req.readyState==4 && req.status == 200) {
   if (req.responseText == 1) {
     field.style.backgroundColor="#cfc";
     captchaVerified=1;
     return true;
   } else {
    field.style.backgroundColor="#fcc";
    window.alert("The code you entered was incorrect, please try again.");
    captchaVerified--;
    return false;
   }
 }
}
function checkCaptcha(userfield,capfield) {
  captchaVerified=-1;
  var user=userfield.value;
  var encval=userfield.form.elements[capfield].value;
  var http_request = false;
  if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); }
  else if (window.ActiveXObject) {
    try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e) {
      try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
    }
  }
  if (http_request) {
   http_request.onreadystatechange = function() { rcvCaptcha(http_request,userfield); };
   http_request.open('GET', "/templates/captest.xml"+"?verify="+user+"&captchacode="+encval, true);
   http_request.send(null);
  }
}

function vzbvalid(form) {
 var input=form.getElementsByTagName("input");
 var select=form.getElementsByTagName("select");

 for (var i=0;i<input.length;i++) {
  if (input[i].attributes["required"]) {
    if (input[i].type=='text' && input[i].value.length < 1) {
      input[i].style.backgroundColor='#fcc';
      window.alert("Please complete required field "+(input[i].title ? input[i].title : input[i].name));
      return false;
    }
  }
  if (input[i].attributes["captcha"]) {
   if (captchaVerified < 1) {
    if (captchaVerified == 0) { checkCaptcha(input[i],input[i].attributes["captcha"].value); }
    return false;
   }
  }
 }
 for (var i=0;i<select.length;i++) {
  if (select[i].attributes["required"]) {
    if (select[i].selectedIndex < 1) {
      select[i].style.backgroundColor='#fcc';
      window.alert("Please make required selection "+(select[i].title ? select[i].title : select[i].name));
      return false;
    }
  }
 }
 return true;
}

// bannerflipper
var currentBanner = 0;
var totalBanners = 0;
var bannertable;
var bannerPos=new Array();

function bannerPrev(b) {
  bannertable=document.getElementById('bannertable');
  if (!totalBanners) { totalBanners=bannertable.getElementsByTagName('td').length; 
  currentBanner=Math.floor(-bannertable.offsetLeft/1000); }
  bannerPos.push(-(currentBanner-0.2)*1000);
  bannerPos.push(-(currentBanner-0.4)*1000);
  if (currentBanner < 1) { currentBanner=totalBanners; }
  currentBanner--;
  bannerPos.push(-(currentBanner+0.4)*1000);
  bannerPos.push(-(currentBanner+0.2)*1000);
  bannerPos.push(-currentBanner*1000);
  bannerScroll();
  b.blur();
  return false;
}
function bannerNext(b) {
  bannertable=document.getElementById('bannertable');
  if (!totalBanners) { totalBanners=bannertable.getElementsByTagName('td').length;
  currentBanner=Math.round(-bannertable.offsetLeft/1000); }
  bannerPos.push(-(currentBanner+0.2)*1000);
  bannerPos.push(-(currentBanner+0.4)*1000);
  currentBanner++;
  if (currentBanner >= totalBanners) { currentBanner=0; }
  bannerPos.push(-(currentBanner-0.4)*1000);
  bannerPos.push(-(currentBanner-0.2)*1000);
  bannerPos.push(-currentBanner*1000);
  bannerScroll();
  b.blur();
  return false;
}
function bannerScroll() {
  if (bannerPos) {
   var pos=bannerPos.shift();
   bannertable.style.left=pos+"px";
   if (bannerPos.length) {
    window.setTimeout("bannerScroll()",60);
   }
  }
}


function toolUsage(tool,ctry,query,id) {
  var r=Math.random();
  var user='';
  var c=document.cookie.match(/tooluser=([A-Z]+);?/);
  if (c && c[1]) {
   user=c[1];
  } else {
   for (var i=0;i<15;i++) {
   user+=String.fromCharCode(65+Math.floor(Math.random()*26));
   }
   var exp = new Date();
   exp.setTime(exp.getTime()+(52*7*24*60*60*1000));
   document.cookie="tooluser="+user+"; path=/; expires="+exp.toGMTString(); 
  }
  if (!id) { id=0; }
  var log=new Image();
  log.src="/templates/tooluse.xml?tool="+tool+"&user="+user+"&c="+ctry+"&id="+id+"&q="+query;
}



var shownUL;
function showUL(link) {
  var ul=link.nextSibling;
  while (ul && ul.nodeName!="UL") { ul=ul.nextSibling; }
  if (shownUL) { shownUL.style.display="none"; }
  if (ul) {
  ul.style.display="block";
  shownUL=ul;
  }
}

function balPortfolio(id) {
 var pf=document.getElementById("portfolio"+id);
 var p2=document.getElementById("portfright"+id);
 var pl=pf.childNodes;
 if (pl.length<=1) { return true; }
 var half=Math.ceil(pl.length/2);
 var pp;
 var ps=0;
 for (var i=0;i<pl.length;i++) {
   var a=pl[i].firstChild;
   while (a && a.nodeName!='A') {a=a.nextChild; }
   if (a) {
    var u=a.href;
    if (pp && u.indexOf(pp)==0) {
     pl[i].className="sublink";
     } else {
     if (!ps && i>=half) { ps=i; }
    pp=u; }
   }
 }
 if (ps) {
  for(var i=pl.length-1;i>=ps;i--) {
   p2.appendChild(pl[ps]);
  }
 }
}



var oneScrollT;
var oneScrollP=0;
var oneScrollN=1;
var oneScrollUL;
function oneScroll(d,link) {
 clearTimeout(oneScrollT);
 if (d) {
  if (link) {
   try { oneScrollUL=link.parentNode.parentNode.getElementsByTagName('UL')[0]; } catch (e) {}
  }
  if (oneScrollUL) {
  oneScrollN+=d;
  if (oneScrollN >= oneScrollUL.childNodes.length) { oneScrollN--; }
  else if (oneScrollN < 1) { oneScrollN=1; }
  else {
   var max=oneScrollUL.offsetHeight;
   var h=24;
   try { h=oneScrollUL.childNodes[oneScrollN].offsetHeight; } catch (e) {}
   oneScrollP=h*(oneScrollN-1);
   oneScrollUL.style.marginTop=(d*18-oneScrollP)+'px';
   setTimeout("oneScrollUL.style.marginTop="+(d*12-oneScrollP)+"+'px'",60);
   setTimeout("oneScrollUL.style.marginTop="+(d*6-oneScrollP)+"+'px'",120);
   setTimeout("oneScrollUL.style.marginTop="+-oneScrollP+"+'px'",180);
   oneScrollT=setTimeout("oneScroll("+d+")",360);
  }
  }
 }
}

function nonflash(id) {
 document.getElementById('flashflash'+id).style.display="none";
 document.getElementById('flashcontent'+id).style.display="block";
 return false;
}

var ctpTimerOut;
var ctpActivated=false;
var ctpTimerIn;
function ctpStop() {
 try { document.getElementById('ctpFlash').SetVariable("player:jsStop", ""); return false;}
 catch (e) {}
}
function ctpPlay() {
 if (ctpTimerOut) { clearTimeout(ctpTimerOut); }
 try { 
  ctpActivated=true;
// document.getElementById('ctpTitle').parentNode.style.display="none";
  document.getElementById('ctpFlash').SetVariable("player:jsPlay", "");
  document.getElementById('ctpFlash').SetVariable("player:jsPause", "");
  $("#ctpTitle").parent().fadeOut('slow',function() {
   document.getElementById('ctpFlash').SetVariable("player:jsPlay", "");
  });
 return false;}
 catch (e) {}
}
var ctpCurrent;
var ctpTmp;
function ctpLoad(size) {
 var fslink=document.getElementById('ctpFull');
// try {
 var links=document.getElementById('ctpLinks');
 var vids;
 if (links) { vids=links.getElementsByTagName('A'); }
 if (!vids || !vids.length) { vids=document.getElementById('ctpPlayer').getElementsByTagName('A'); }
 var vid=vids[Math.floor(Math.random()*vids.length)];
 ctpCurrent=vid;
 var img=vid.getElementsByTagName('IMG')[0];
 var link=document.getElementById('ctpTitle');
 if (link) {
  link.href=vid.title;
  var info=vid.getElementsByTagName('I')[0];
  var label=vid.getElementsByTagName('B')[0];
  link.innerHTML="<b>"+(label ? label.innerHTML : img.title)+"</b>"+(info ? "<br/>"+info.innerHTML : "");
 }
 if (fslink) {
  fslink.href=vid.href;
 }
 var po=new SWFObject('/resources/media/player_flv_maxi.swf','ctpFlash',(size == 'med' ? 320 : 210),(size == 'med' ? 204 : 122),6);
 po.addVariable("flv",img.name+"-ref="+window.location.pathname+"-title="+escape(img.title));
 po.addVariable("startimage",(size == 'med' ? img.src.replace(/-tn\.jpg/,"-180.jpg") : img.src));
 po.addVariable('width',(size == 'med' ? 320 : 208));
 po.addVariable('height',(size == 'med' ? 204 : 120));
 po.addVariable("margin",(size == 'med' ? 0 : 2));
 po.addVariable("autoplay",0);
 po.addVariable("autoload",0);
 po.addVariable("showtime",0);
 po.addVariable("showvolume",1);
 po.addVariable("showiconplay",0);
 po.addVariable("showplayer",(size == 'med' ? 'always' : 'autohide'));
 po.addVariable("showloading",'always');
 po.addVariable("playeralpha",100);
 po.addVariable("iconplaybgalpha",25);
 po.addVariable("playercolor",'eeeeee');
 po.addVariable("bgcolor1",'cccccc');
 po.addVariable("bgcolor2",'eeeeee');
 po.addVariable("videobgcolor",'eeeeee');
 po.addVariable("loadingcolor",'333333');
 po.addVariable("buttoncolor",'000000');
 po.addVariable("buttonovercolor",'ff0000');
 po.addVariable("sliderovercolor",'ff0000');
 po.addVariable("loadonstop",0);
 po.addParam("wmode", "transparent");
 po.addParam("allowScriptAccess","always");
 po.addParam("menu","false");
 po.write('ctpPlayer');
 if (size=='med') { $("#ctpPlayer").mousedown(function() { ctpActivated=true; $('#ctpTitle').parent().fadeOut('fast');}).mouseover(function() { $('#ctpTitle').parent().fadeIn('fast');}).mouseout(function() { $('#ctpTitle').parent().fadeOut('slow');}); }
// } catch (e) { if (fslink) { fslink.style.display="none"; } }
}

function ctpChange(link,click) {
  if (ctpCurrent) { ctpCurrent.style.borderColor='#666'; }
  var player=document.getElementById('ctpFlash');
  var img=link.getElementsByTagName('IMG')[0];
  var flv=img.name+"-ref="+window.location.pathname+"-title="+escape(img.title);
  var title=document.getElementById('ctpTitle');
  if (click || !ctpActivated) {
   ctpCurrent=link;
   if (ctpActivated && img.style.backgroundImage) {
    var m=img.style.backgroundImage.match(/url\('?(.*)'?\)/);
    if (m) {img.src=m[1];}
   }
   if (player) {
    player.SetVariable("player:jsStop", "");
    player.SetVariable("player:jsStartImage",img.src.replace(/-tn\.jpg/,"-180.jpg"));
    player.SetVariable("player:jsUrl", flv);
    if (click) {
     player.SetVariable("player:jsPlay", ""); player.SetVariable("player:jsPause", ""); }
   }
   if (title) {
    $("#ctpTitle").parent().hide();
    title.href=link.title;
    var info=link.getElementsByTagName('I')[0];
    var label=link.getElementsByTagName('B')[0];
    title.innerHTML="<b>"+(label ? label.innerHTML : img.title)+"</b>"+(info ? "<br/>"+info.innerHTML : "");
    $("#ctpTitle").parent().fadeIn('def');
   }
   link.style.borderColor="#f00";
   if (click && player) {
    $("#ctpTitle").parent().fadeOut('slow',function() {
     document.getElementById('ctpFlash').SetVariable("player:jsPlay", "");
    });
   }
  }
  else if (!click) {
   if (!img.style.backgroundImage) {
    img.style.backgroundImage="url('"+img.src+"')"; }
   img.src="/gfx/buttons/play_92x70."+(ie && ie<7 ? "gif" : "png");
   var info=link.getElementsByTagName('I')[0];
   var label=link.getElementsByTagName('B')[0];
   $('#ctpTip').hide();
   $('#ctpTip').css('left',$('#ctpLinks img[name="'+img.name+'"]').offset().left);
   $('#ctpTip').html("<b>"+label.innerHTML+"</b><br/>"+info.innerHTML).fadeIn('def');
  }
}

function ctpHover(link,click) {
 if (ctpTimerOut) { clearTimeout(ctpTimerOut); }
 if (ctpTimerIn) { clearTimeout(ctpTimerIn); }
 if (link != ctpCurrent) {
   if (click) {
    ctpChange(link,click);
   }
   else {
    ctpTmp=link;
    ctpTimerIn=setTimeout("ctpChange(ctpTmp,0);",250);
   }
 } else {
  if (click) {
   ctpActivated=true;
    $("#ctpTitle").parent().fadeOut('slow',function() {
     document.getElementById('ctpFlash').SetVariable("player:jsPlay", "");
    });
  } else { $("#ctpTitle").parent().fadeIn('fast'); }
 }
 return false;
}

function ctpHoverOut(link) {
 if (ctpTimerIn) { clearTimeout(ctpTimerIn); }
 if (ctpTimerOut) { clearTimeout(ctpTimerOut); }
 if (link) {
 ctpTimerOut=setTimeout("ctpHoverOut()",2000);
  if (ctpActivated) {
   var img=link.getElementsByTagName('IMG')[0];
   if (img.style.backgroundImage) {
    var m=img.style.backgroundImage.match(/url\('?(.*)'?\)/);
    if (m) {img.src=m[1];}
   }
   $('#ctpTip').fadeOut('fast');
  }
 } else {
  $("#ctpTitle").parent().fadeOut('slow');
 }
// document.getElementById('ctpTitle').parentNode.display="none"; 
}

function videoPlayer(id,flv,title,img,ratio) {
 try {
 var player=document.getElementById('player'+id);
 var size=240;
 var width=320;
 if (flv.match(/-360\.flv$/)) { size=380; width=640; }
 else if (flv.match(/-430\.flv$/)) { size=450; width=640; }
 else if (flv.match(/-480\.flv$/)) { size=500; width=640; }
 else if (flv.match(/-240\.flv$/)) { size=260; width=420; }
 else if (flv.match(/-120\.flv$/)) { size=140; width=208; }
 player.style.height=size+"px";
 if (!img) {
  if (flv.match(/-\d\d\d\....$/)) { img=flv.replace(/\....$/,".jpg"); }
  else { img=flv.replace(/\....$/,"-"+size+".jpg"); }
 }
 if (!title) {
  try { title=document.getElementById('feature'+id).getElementsByTagName('H4')[0].innerHTML; } catch(e) {}
 }
 var po=new SWFObject('/resources/media/player_flv_maxi.swf','playerSWF'+id,width,size,6);
 po.addVariable("flv",'/podcasts'+flv.replace(/\.mp4/,".flv")+"?id="+id+"-ref="+window.location.pathname+"-title="+escape(title));
 po.addVariable("startimage",img);
 po.addVariable('width',width);
 po.addVariable('height',size);
 po.addVariable("margin",0);
 po.addVariable("autoplay",0);
 po.addVariable("autoload",0);
 po.addVariable("showtime",0);
 po.addVariable("showvolume",1);
 po.addVariable("showiconplay",0);
 po.addVariable("showplayer",'always');
 po.addVariable("showloading",'always');
 po.addVariable("playeralpha",100);
 po.addVariable("iconplaybgalpha",25);
 po.addVariable("playercolor",'dddddd');
 po.addVariable("bgcolor1",'cccccc');
 po.addVariable("bgcolor2",'eeeeee');
 po.addVariable("videobgcolor",'eeeeee');
 po.addVariable("loadingcolor",'333333');
 po.addVariable("buttoncolor",'000000');
 po.addVariable("buttonovercolor",'ff0000');
 po.addVariable("sliderovercolor",'ff0000');
 po.addVariable("loadonstop",0);
 po.addParam("wmode", "transparent");
 po.addParam("allowScriptAccess","always");
 po.addParam("menu","false");
 po.write('player'+id);
 } catch (e) { }
}

function audioPlayer(id,mp3,title) {
 try {
 var player=document.getElementById('player'+id);
 if (!title) {
  try { title=escape(document.getElementById('feature'+id).getElementsByTagName('H4')[0].innerHTML); } catch(e) {}
 }
 var po=new SWFObject('/resources/media/player_mp3_maxi.swf','playerSWF'+id,320,20,6);
 po.addVariable("mp3",'/podcasts'+mp3+"?id="+id+"-ref="+window.location.pathname+"-title="+title);
 po.addVariable('width',320);
 po.addVariable('height',20);
 po.addVariable("showtime",0);
 po.addVariable("showvolume",1);
 po.addVariable("bgcolor1",'eeeeee');
 po.addVariable("bgcolor2",'cccccc');
 po.addVariable("loadingcolor",'ffffff');
 po.addVariable("buttoncolor",'000000');
 po.addVariable("buttonovercolor",'ff0000');
 po.addVariable("sliderovercolor",'ff0000');
 po.addParam("wmode", "transparent");
 po.addParam("allowScriptAccess","always");
 po.addParam("menu","false");
 po.write('player'+id);
 } catch (e) { }
}

function setEmp(l) {
 if (l.title) {
  var exp=new Date();
  exp.setTime(exp.getTime()+(180*86400*1000));
  document.cookie="Employee="+l.title+"; expires="+exp.toGMTString()+"; path=/";
  vzbPopup(l,120,120);
 }
 if (divout) { divout.style.display="none"; }
 return false;
}

