/* jquery.LinkPrefs.js - LinkPrefs plugin for jquery */
/* handle external links except the url which begins with stringin url array */
/* created by Tomas Strejcek (c) 2008 */
//require jquery.cookie.js & jquery.js (dev on 1.26)
var url = new Array();
url[0] = 'http://127.0.0.1';
var cn = 'local_jsLinkPrefs'; //name of the cookie
$(document).ready(function(){
function mAnchors()
{
  for(i=0;i<url.length;i++)
    $("a:not([@href^=" + url[i] + "])").addClass('external')
                                 .attr('target','_blank');
}
function uAnchors()
{
  for(i=0;i<url.length;i++)
    $("a:not([@href^=" + url[i] + "])").removeClass('external')
                                 .attr('target','_top');
}
$("#LinkPrefs").click(function(){
  if($.cookie(cn)==1){ 
    $.cookie(cn,0);
    uAnchors(); 
  }else{
    $.cookie(cn,1,{ expires: 365 });
    mAnchors(); 
  }
});
if($.cookie(cn)==1){ mAnchors(); $("#LinkPrefs").attr('checked','checked'); }
});
