function fimg(u) {
 if (u.match(/^http/i)) return;
 var s=u.replace(/\-0([0-9])/g, "-$1").replace(/_(.*)$/, "/$1/$1_preview.jpg").replace(/\-/g, "/");
 if (s.match(/jpg$/)) { document.write('<img style="margin-left:6px;float:right" height="70px" src="/images/'+s+'" border="0"/>'); }
}
function pimg() {
 if (this.width > 1) { 
   this.target.height="35"; 
   this.target.src=this.src; 
 } else { this.target.style.height="0px"; }
}
function gimg(u,t) { 
 if (u.match(/\/na\//) || u.match(/id=reu/)) return;
 var s=u.replace(/\/news/, "/images").replace(/\/0([0-9])/g, "/$1").replace(/([^\/]*)\.html$/, "/$1/$1_preview.jpg");
 if (s.match(/images/)) {
  var img=new Image();
  img.src=s;
  img.target=t;
  img.onload=pimg;
 }
}
function ak() {
  var ny = new Date(); ny.setFullYear(ny.getFullYear()+2); var k=Math.random().toString().substr(2); document.cookie= "ri="+k+"; path=/; expires=" + ny.toGMTString();
  return k;
}
/*var ri='';
try { var k=document.cookie; var p=k.indexOf("ri="); if (p != -1) { p+=3; var e=k.indexOf(";", p); if (e==-1) { e=k.length; } ri=k.substring(p, e); }
} catch(e) { }
if (ri=='') ri=ak(); 
if(document.images){(new Image()).src="http://216.133.241.227/v?ref="+escape(document.referrer)+"&ri="+ri;}*/


function videoPlayer(vidFile,headline,format,hd,category,relID) {
 // Opera Detection
 var agt = navigator.userAgent.toLowerCase();
 var browser =  (agt.indexOf("opera") != -1) ? "OP" : "nonOP";
 // Platform Detection
 var platform = (navigator.appVersion.indexOf("Windows") != -1) ? "win" : "mac"; 
 
 var category = escape(unescape(category).replace(/'/g, "&#39;"));
 if (!hd || hd == "") hd = "acc";
 var h = (screen.width > 1000 && browser != "OP") ? 655 : 510;
 var winState = (screen.width > 1000 && browser != "OP") ? "exp" : "col";
 var vidUrl = "http://www.foxnews.com/video2/resize05.html?"+vidFile+"&"+format+"&"+headline+"&"+hd+"&"+category+"&"+relID+"&"+winState +"&www.breitbart.com";
 var winl = ((screen.width - 700) / 2) - 5;
 winprops = 'height='+h+',width=700,top=5,left='+winl;
 fncVidWin = window.open(vidUrl, 'fncVidPlayer', winprops);
 fncVidWin.focus();
}

function insert_digg_btn(cat) {
 var title=document.title.replace(/BREITBART.COM - /, '');
 var c='world_news';
 if (cat=='tech') { c='tech_news'; }
 else if (cat=='biz') { c='business_finance'; }
 else if (cat=='pol') { c='politics'; }
 else if (cat=='odd') { c='offbeat_news'; }
 else if (cat=='hlth') { c='health'; }
 var url='http://digg.com/submit?phase=2&url='+escape(document.location)+'&title='+escape(title)+'&topic='+c;
 document.write(' <a href="'+url+'"><img src="/images/digg-link.gif" border="0"/></a>');
}
