var strRuta = "http://www.dicaf.es/"; 
function loguid(uid,upwd,target,cmd)
{
  var dia=new Date();
  var ahora=dia.getFullYear()+'/'+(dia.getMonth()+1)+'/'+dia.getDate()+'/'+dia.getHours();
  var luid=encripta(uid);
  var lupwd=encripta(upwd);
  var lahora=encripta(ahora);
  var stot=lahora+'@'+luid+'@'+lupwd;
  if ( cmd>0 )
	stot+=('@'+cmd);

  if ( target=='_self') {
	location.href=strRuta+'loguin_colegis.asp?id='+stot;
	return;
  }
  if ( target=='_blank') {
    window.open(strRuta+'loguin_colegis.asp?id='+stot,'DICAF','');
    return;
  }

  window.parent.location.href=strRuta+'loguin_colegis.asp?id='+stot;


  return ;
}
function encripta(cadena)  
{
 
 var v,vpos,strval,icount,strchr,strret; 

 v=new Array(3,1,-2,3,-2,5,-6,7,-1,8,2,5,6,1,8,5,-3,-4,5,1,5,6,5,9,10,-5,0,0,4,5,1,9,1,2,6)
// v=Array(3,1,0,3,2,5,0,7,6,1,8,2,5,6,1,8,5,1,4,5,1,5,6,5,9,10,5,0,7,4,5,1,9,1,2,6)

 vpos=0;
 strval=0;
 strret="";

 for (iCount=0; iCount<cadena.length; iCount++) {
   strval=cadena.charCodeAt(iCount)+v[vpos];
   if ( strval==64)
	strval=255;
   if ( strval == 43 )
	strval=254;
   strchar=String.fromCharCode(strval);
   strret+=strchar;
   vpos++;
   if ( vpos>34 ) vpos=0;
 }
 return strret;
}

