isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isMSIE=document.all && document.all.item //Microsoft Internet Explorer 4+
isNetscape4=document.layers //Netscape 4.*
isOpera=window.opera //Opera
isOpera5=isOpera && isDOM //Opera 5+
isMSIE5=isDOM && isMSIE && !isOpera //MSIE 5+
isMozilla=isNetscape6=isDOM && !isMSIE && !isOpera

var obj;

function getLayer(layerName, parentLayerName){
 if(isDOM){ return document.getElementById(layerName); }
 if(isMSIE){ return document.all[layerName]; }
 if(isNetscape4){ return eval('document.layers[layerName]'); }
 return false;
}

function ts(e,what){
 
 mousex = e.clientX;
 mousey = e.clientY;

 if (!e) var e = window.event;

 if (e.pageX || e.pageY) {
   mousex = e.pageX;
   mousey = e.pageY;
 } else if (e.clientX || e.clientY) {
   mousex = e.clientX;
   mousey = e.clientY;
   if (isMSIE || isMSIE5) {
     mousex += document.body.scrollLeft;
     mousey += document.body.scrollTop;
   }
 }


 if (obj) tc();

 if(getLayer(what)){

     obj = getLayer(what);
  
  if(obj){
      leftoff = mousex;
     obj.style.left = mousex;
 
      topoff = mousey;
     if(isOpera && topoff <= 30)
       obj.style.top = mousey + 20;
      else 
     if( mousey <= 30) 
          obj.style.top = mousey + 20;
     else 
        if (isOpera) 
         obj.style.top = mousey + 20;
      else
       obj.style.top = mousey + 20;
        
     
      if(isNetscape4)
       obj.style.visibility = 'show';
      else
       obj.style.visibility = 'visible';
    }
  }
 return true;

}


function tc(){
 if(obj){
   if(isNetscape4)
     obj.style.visibility = 'hide';
   else
     obj.style.visibility='hidden';
 }
 return true
}

function p(x, y, z) {
  for (a = 0; a < arguments.length; a++) {
     arguments[a] = arguments[a].split('');
     arguments[a] = arguments[a].reverse();
     arguments[a] = arguments[a].join('');
  }
  document.location.href = "mailto:" + x + "@" + y + "." + z;
}
function p_u(x, y, z) {
  c = arguments;
  for (b = 0; b < c.length; b++) {
       if (b == 3) continue;
     c[b] = c[b].split(',');
     c[b] = c[b].reverse();
     for (a = 0; a < c[b].length; a++)
        c[b][a] = String.fromCharCode(c[b][a] - 10);
     c[b] = c[b].join('');
  }
  document.location.href = "mailto:" + c[0] + "@" + c[1] + "." + c[2] + "?subject=" + c[3] + "";
  
}

var win = null;
function nwin(mypage,myname,w,h,scroll){LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;TopPosition = (screen.height) ? (screen.height-h)/2 : 0;settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}


//AJAX

function httpRequest( url, method, params, func ) {
       
     
     var msxmlhttp = new Array(
               'Msxml2.XMLHTTP.5.0',
               'Msxml2.XMLHTTP.4.0',
               'Msxml2.XMLHTTP.3.0',
               'Msxml2.XMLHTTP',
               'Microsoft.XMLHTTP');

       if ( window.XMLHttpRequest ) {
               request = new XMLHttpRequest;
               if ( request.overrideMimeType ) {
                       request.overrideMimeType( 'text/xml' );
               }
       } else if ( window.ActiveXObject ) {
               for ( var i = 0; i < msxmlhttp.length; i ++ ) {
                       try {
                               request = new ActiveXObject( msxmlhttp[i] );
                       } catch ( e ) {
                               request = false;
                       }
               }
       }

       if ( ! request ) {
               alert( 'Can\'t creare XMLHTTP instance :(' );
               return false;
       }

       request.onreadystatechange = function() {
               if ( request.readyState == 4 ) {
                       if ( request.status == 200 ) {
                       httpResponse( request , func );
                       } else {
                               alert( 'There was a problem with the request :(' );
                       }
               }
       }
       request.open( method, url, true );
       request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
       request.send( params );

}

function httpResponse( request , func  ){
  
  response = unescape(request.responseText);
  response = response.split('|.|');

  func( response );
}
