//jQuery 1.2.6.min

var storyTimer = 0;
var memberTimer = 0;

function visitenkarte_modul(modulshortcut)
{
  
  $.ajax( {
    url: 'ajax_menu_visitenkarte.php',
    type: 'POST',
    data: 'sub='+modulshortcut,
    cache: false,
    dataType: 'html',
    processData: false,
    success: function(data){
      //$('#ajax_content').empty();
      $('#submodul').html(data);
      // alert('SUPER!');
    }
  });  
 
  return( false ); // FALSE verhindert Neuladen der Seite bei Success
  
} // eof visitenkarte_modul


function readonemail(idmail)
{

  $.ajax( {
    url: 'ajax_readamail.php',
    type: 'POST',
    data: 'read='+idmail,
    cache: true,
    dataType: 'html',
    success: function(html){
      $('#nachricht').empty();
      $('#nachricht').append(html);
    }
  });
  
  return( false );

}

function rotateStories()
{
 
  $('#sidebar_story').fadeOut("slow", function() {
    $(this).load( 'ajax_getstory.php' ).fadeIn("slow");
  });  
  
  storyTimer = setTimeout('rotateStories()', 12000 );
  
  return( false );
}

function rotateMembers()
{

  $('#members').load( 'ajax_getmembers.php' );
  memberTimer = setTimeout('rotateMembers()', 12000 );
  
  return( false );
}

function addbookmark()
{
  bookmarkurl=self.location.href;
  bookmarktitle=document.title;

  if (document.all)
  {
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
  }
  else
  {
    alert("Bitte drücken Sie STRG + D");
  }
}

function waitforstop()
{
  clearTimeout( oldTimer );
  
  if( ( tmId != tmLast ) && (oldX == mouseX) && (oldY == mouseY) )
  {
    
    tmCounter++;
    
    if( tmCounter > 8 )
    {
    
      tmCounter = 0;
      tmLast = tmId;
      
      /* Invoke Ajax */
      $.ajax( {
        url: 'ajax_gettmdata.php',
        type: 'POST',
        data: 'id=' + tmId,
        cache: true,
        dataType: 'html',
        success: function(html){
          $('#ajaxdata').empty();
          $('#ajaxdata').append(html);
        }
      });      
      
      /*
      
      new ajax ( 'ajax_gettmdata.php',
      {
        postBody: 'id=' + tmId,
        update: $('ajaxdata'),
        onComplete: null
      });
    
     */
    }
    else
    {
      oldTimer = setTimeout('waitforstop()', 50); 
    }
  
  }
  else
  {
    tmCounter = 0;
    tmStop++;
    oldX = mouseX;
    oldY = mouseY;
    
    if( tmStop < 6 )
    {
      oldTimer = setTimeout('waitforstop()', 50);     
    }
    else
    {
      tmStop=0;
    }
  }
}


function readtmdata(idtm)
{
  
  if( idtm > 0 )
  {
    tmId = idtm;
  }
  
  tmCounter = 0;
  oldX = mouseX;
  oldY = mouseY;
  tmStop = 0;

  if( oldTimer != 0 )
  {
    clearTimeout( oldTimer );
  }
  
  oldTimer = setTimeout('waitforstop()', 50);     
  
}

function getmdataold(idtm)
{
	new ajax ( 'ajax_gettmdata.php',
	{
		postBody: 'id='+idtm,
		update: $('ajaxdata'),
		onComplete: null
  });

  clearTimeout( oldTimer );
  
  return( false );

}

var mouseX, mouseY ;
var oldX, oldY, tmCounter, tmId, tmLast, tmStop, oldTimer;

tmCounter = 0;
tmLast = 0;
tmStop = 0;
oldTimer = 0;
tmId = 0;

function mouseXY(e){

var ev=(!e)?window.event:e;//IE:Moz
if (ev.pageX){//Moz
mouseX=ev.pageX+window.pageXOffset;
mouseY=ev.pageY+window.pageYOffset;
}
else if(ev.clientX){//IE
if(document.documentElement){//IE 6+ strict mode
mouseX=ev.clientX+document.documentElement.scrollLeft;
mouseY=ev.clientY+document.documentElement.scrollTop;
}
else if(document.body){//Other IE
mouseX=ev.clientX+document.body.scrollLeft;
mouseY=ev.clientY+document.body.scrollTop;
}
}
else{return false}//old browsers

}

//document.onmousemove=mouseXY;
