// JavaScript Document
// normale gestione dei link attraverso clickserver
// V3.1-071005
var ckSrvUrl="";
var ckTarget="";
var ckTo=null;
function clickServer(url,a,b,c) {
 if(url.indexOf("://")<0) return goCkSrv('http://'+url,a,b,c,null);
 return goCkSrv(url,a,b,c,null);
}
function ckSrv(lnk,a,b,c,target) {
 if(lnk.href !== undefined) {
  urlHref=lnk.href;
  if(target == null && lnk.target !== undefined && lnk.target !== "") {
   target=lnk.target;
  }
 } else urlHref=lnk;
 return goCkSrv(urlHref,a,b,c,target);
}
function goCkSrv(url,a,b,c,target) {
 ckSrvUrl=url;
 ckTarget=self;
 if(url.indexOf("://")<0) {
  b=document.getElementsByTagName("BASE");
  if(b[0]) url=b[0].href+url;
  else {
   pathname = window.location.pathname;
   pathname = pathname.substring(0, pathname.lastIndexOf('/')+1 );
   if(pathname.charAt(0)=='/') url=window.location.protocol+'//'+window.location.host+'/'+url;
   else url=window.location.protocol+"//"+window.location.host+pathname+url;
  }
 }
 if (url.substring(0,7) == "http://") { url = url.substring(7); }
 else if (url.substring(0,8) == "https://") { url = url.substring(8); }
 dt=new Date();
 nloc="http://clickserver.libero.it/ck/"+dt.getTime()+"/"+escape(a)+"/"+escape(b)+"/"+escape(c)+"/_f_/"+escape(location.host+location.pathname)+"/_t_/"+url;
 if(target===undefined) return nloc;
 if(target!==null && target.toLowerCase()!='_top' && target.toLowerCase()!='_parent') {
  x=new Image();
  x.src=nloc;
  w=window.open(ckSrvUrl, target);
 } else {
  w=self;
  cnt=0;
  if(target!==null) {
   if(target.toLowerCase()=='_parent') {
    w=w.parent;
   } else {
    while(w.parent !== w && ++cnt<10) w=w.parent;
   }
  }
  ckTarget=w;
  x=new Image();
  x.onload=ckGo;
  x.onerror=ckGo;
  x.src=nloc;
  ckTo=window.setTimeout("ckTarget.document.location='"+ckSrvUrl+"';",2000);
 }
 return false;
}
function ckGo() { ckTarget.document.location=ckSrvUrl; window.clearTimeout(ckTo); }