
var google_ad_client;
var google_ad_width;
var google_ad_height;
var google_ad_format;
var google_ad_type;
var google_ad_channel;
var google_color_border;
var google_color_bg;
var google_color_link;
var google_color_text;
var google_color_url;
var Weite;
var Hoehe;

var pageTracker = _gat._getTracker("UA-7870619-3");

var adresse = "konta"+'kt'+String.fromCharCode(64)+'mai'+'llinks'+String.fromCharCode(46)+'d'+String.fromCharCode(101);
var inputs = new Array('email', 'pw', 'imap', 'user', 'box', 'meaning');
var infos = new Array(
'Your email address<br />of the imap mailbox',
'Your password<br /> of the imap mailbox',
'The address of the imap server<br /><br />You get all important<br />informations about your mailbox<br />from your email provider',
'is often the email address,<br />the part in front of the @-char,<br />or the user number',
'The standard folder for incoming<br />messages is "INBOX", but you can use<br />other folders like "drafts"',
'Please tell us your opinion<br>about MailLinks.de!'
);
var imaps = new Array(
'imap.1und1.de','mxxxxxxx-yyyy<br />(Paketnummer-Postfachkürzel)',
'imap.alice-dsl.net','Alice E-Mail-Adresse',
'imap.de.aol.com','AOL-Name',
'imap.arcor.de','Arcor-Benutzername',
'mail.fh-augsburg.de','FH-Kennung',
'mx.freenet.de','Benutzername@freenet.de',
'imap.googlemail.com','E-Mail-Adresse',
'imap.gmx.net','Kundennummer oder E-Mail-Adresse<br/>(bevorzugen Sie die Kundennummer!)',
'mail.my-mail.ch','Benutzername<br />(Teil vor dem &#064;)',
'imap.snafu.de','Benutzername@snafu.de',
'imap.t-online.de','E-Mail-Adresse',
'imap.web.de','Benutzername<br />(Teil vor dem &#064;)');
var infoinput;
var intv = null;
var local = 'en';

function confirmLink(confirmMsg, todo)
{
    var is_confirmed = confirm(confirmMsg);
    if (is_confirmed) {
        eval(todo);
    }

    return is_confirmed;
}

function setgooglestyle(type){
    google_ad_client = "pub-4169606554002594";
    google_ad_width = 120;
    google_ad_height = 600;
    google_ad_format = "120x600_as";
    google_ad_type = type;
    google_ad_channel = "";
    google_color_border = "355C98";
    google_color_bg = "355C98";
    google_color_link = "F2984C";
    google_color_text = "FFFFFF";
    google_color_url = "FFFF66";
}

function setcontent(e, content){
  if (e.innerHTML) e.innerHTML = content;
  else e.nodeValue = content;
}

function contactover(el){
    el.href='mai'+'lto:'+adresse;
}

function aktiv(len){
    var ccount = 0;
    var tocheck = true;
    var sum = 0;
    for (i=0; i<len; i++){
        e = document.getElementsByName("input[ac]["+i+"]")[0];
        if (e){
            sum++;
            if (e.checked) ccount++;
        }
    }
    if (ccount==sum) tocheck = false;
    for (i=0; i<len; i++){
        e = document.getElementsByName("input[ac]["+i+"]")[0];
        if (e) e.checked = tocheck;
    }
}

function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getX( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function collectionToArray(col) {
	a = new Array();
	for (i = 0; i < col.length; i++)
		a[a.length] = col[i];
	return a;
}

function setonfocus(){
    e = collectionToArray(document.getElementsByTagName("input"));
    e = e.concat(collectionToArray(document.getElementsByTagName("textarea")));

    imap1 = document.getElementsByName("input[imap]")[0];
    imap2 = document.getElementsByName("input[imap2]")[0];
    for (i=0; i<e.length; i++){
        if ((e[i].type=='text') || (e[i].type=='password') || (e[i].tagName.toLowerCase()=='textarea')){
            pos = inputs.findpos(inputname(e[i]));
            if (pos>-1){
                e[i].onfocus = function() {
                    info = document.getElementById("infos");
                    pos = inputs.findpos(inputname(this));
                    pos2 = imaps.findpos(imap1.value);
                    if ((inputs[pos]=='user') && (pos2>-1) && (local=='de')) newinfo = imaps[pos2+1];
                    else newinfo = infos[pos];
                    setcontent(info, newinfo);
                    info.style.display = 'block';
                    if ((inputs[pos]=='imap') && (imap2)) infoinput = document.getElementsByName("input[imap2]")[0];
                    else infoinput = this;
                    info.style.left = (getX(infoinput)+infoinput.offsetWidth+5)+'px';
                    info.style.top =  getY(infoinput)+'px'; //(getY(le)-((info.offsetHeight-le.offsetHeight)/2))+'px';
                };
            }
        }
    }
}

function adheight(){
    html = document.getElementsByTagName("html");
    html = html[0];
    adv = document.getElementById("adsense");
    if (html.scrollHeight>html.offsetHeight) adv.style.height = html.scrollHeight+"px";
    else adv.style.height = "100%";
}

Array.prototype.findpos = function (elem) {
  elem = elem.toLowerCase();
  var i;
  for (i = 0; i < this.length; i++) {
    if (this[i] == elem) {
      return i;
    }
  }

  return -1;
};

function gettarget(e){
  e = e || window.event;
  if (e){
      if (!e.srcElement){
         if (e.target) e = e.target;
         else return e;
      }
      else
         e = e.srcElement;
     return e;
  }
  else return false;
}

function inputname(e){
    iname = '';
    if (e.name){
      pos = e.name.indexOf("[");
      if (pos>0){
        sp = e.name.split("[");
        sp = sp[1].split("]");
        iname = sp[0];
      }
    }
    return iname;
}

function checkclick(e)
{
  info = document.getElementById("infos");
  if (info.style.display != 'none') hide = true;
  else hide = false;
  e = gettarget(e);
  if (e){
    if (inputs.findpos(inputname(e))>-1) hide = false;
    if (hide) info.style.display = 'none';
  }
}

function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function neuAufbau () {
  if (Weite != Fensterweite() || Hoehe != Fensterhoehe()){
     info = document.getElementById("infos");
     if ((infoinput) && (info.style.display!='none')){     
        info.style.left = (getX(infoinput)+infoinput.offsetWidth+5)+'px';
        //info.style.left = (getX(infoinput)+infoinput.offsetWidth+5)+'px';
     }
  }
  adheight();
}

function imapchange(){
    imap1 = document.getElementsByName("input[imap]")[0];
    imap2 = document.getElementsByName("input[imap2]")[0];
    pos = imaps.findpos(imap1.value);
    if (pos<0) imap2.selectedIndex = 0;
    else imap2.selectedIndex = (pos / 2)+1;
}

function imap2change(){
    imap1 = document.getElementsByName("input[imap]")[0];
    imap2 = document.getElementsByName("input[imap2]")[0];
    if (imap2.value!='0') imap1.value = imap2.value;
}

function startscripts(){
    	setonfocus();
    	window.setTimeout("adheight()", 500);
    	window.onresize = neuAufbau;
  		Weite = Fensterweite();
  		Hoehe = Fensterhoehe();
  		pageTracker._trackPageview();
}

function countleft(ta){
    cleft = document.getElementById("cleft");
    setcontent(cleft, (250-ta.value.length));
}

function delac(){
    confirmLink('Do You really want to delete your account?', 'document.settings.deleteaccount.value=1;document.settings.submit()');   
}

setgooglestyle("text_image");

document.onclick = checkclick;

pageTracker._initData();
window.onload = startscripts;
