// Mausposition
var posx = 0;
var posy = 0;



//Creates an AJAX Object; Tries different Systems and returns correct Object for your Browser
function createAjaxObject() {

         try {           //Try all out of IE
          AjaxObject = new XMLHttpRequest();
        } catch(versuchmicrosoft) {
          try {          //Try IE6/7
             AjaxObject  = new ActiveXObject("Msxml2.XMLHTTP");
            } catch(anderemicrosoft) {
               try {     //Try older IE
                 AjaxObject  = ("Microsoft.XMLHTTP");
               } catch (fehlschlag) {  //Nothing works
                 AjaxObject = null;
              }
             } 
        }

        if (AjaxObject == null) {
            alert("Fehler beim anlegen des AJAX - Objekts!");
         } else {
            return AjaxObject;
        }
}

function isNull (element) {

}

function onInitWebsite() {
	secondsUntil();
	setInterval("secondsUntil();",1000)
}

function GetRandom( min, max ) {
        if( min > max ) {
                return( -1 );
        }
        if( min == max ) {
                return( min );
        }
 
        return( min + parseInt( Math.random() * ( max-min+1 ) ) );
}


function secondsUntil() {
	var jetzt = new Date();
	
   var heute = jetzt.getTime();
	theSecondsUntil = 1234567890 - (Math.floor(heute / 1000));
  
  	$('secondUntil').innerHTML = theSecondsUntil;
   
   /*)
   var dann = heute + (200 * 24 * 60 * 60 * 1000);
   jetzt.setTime(dann);
   var Jahr = jetzt.getFullYear();
   var Monat = jetzt.getMonth() + 1;
   var Tag = jetzt.getDate();
   alert("in 200 Tagen ist der " + Tag + "." + Monat + "." + Jahr);
   */
}

function addRemindMail() {
	if($('usrRemindEmail').value == "") {
		$('usrRemindEmail').style.border = "red solid 1px";
		$('result').innerHTML = "Bitte geben Sie eine E-Mail Adresse ein!";
		return;	
	}
			$('usrRemindEmail').style.border = "none";

	
	AO = createAjaxObject();
	
	AO.open('POST', 'loader.php?go=requestRemindEmail', true);     //TODO relative Path
   AO.setRequestHeader('If-Modified-Since', 'Tue, 22 Jan 2008 00:00:00 GMT');
   AO.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
   AO.onreadystatechange = function () {
   	if (AO.readyState == 4) {
  			$('result').innerHTML = AO.responseText;  
      }
   };
   AO.send("email="+$('usrRemindEmail').value);	
}

function killMore(element) {
	$(element).innerHTML = '';
}

function setMore(element) {

	$(element).innerHTML = '...mehr';
	
}

function drag(ereignis) {
  //Wird aufgerufen, wenn die Maus bewegt wird und bewegt bei Bedarf das Objekt.
	//alert(posx);
  posx = document.all ? window.event.clientX : ereignis.pageX;
  posy = document.all ? window.event.clientY : ereignis.pageY;
}