<!--
var keepstatic=1;
var menucolor="#75C5F0";
var submenuwidth=150;
var global_cbox_online_status_unavailable= false;

/* dumDiDum */
function dummy_Validator() {
  return true;
}

function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, numofCols)
{
  var theCells = null;
  if ((thePointerColor == '') || typeof(theRow.style) == 'undefined') return false;
  if (typeof(document.getElementsByTagName) != 'undefined') theCells = theRow.getElementsByTagName('td');
  else if (typeof(theRow.cells) != 'undefined') theCells = theRow.cells;
  else return false;
  
  var rowCellsCnt = theCells.length;
  if(numofCols!=0) rowCellsCnt=numofCols; 
  var domDetect    = null; var currentColor = null; var newColor     = null;
  
  if (typeof(window.opera) == 'undefined'
      && typeof(theCells[0].getAttribute) != 'undefined') {
    currentColor = theCells[0].getAttribute('bgcolor');
    domDetect    = true;
  }
  else { currentColor = theCells[0].style.backgroundColor; domDetect = false; }
  
  if (theAction == 'over' && thePointerColor != '') newColor = thePointerColor;
  if (theAction == 'out') newColor = theDefaultColor;
  
  if (newColor) {
    var c = null;
    if (domDetect) { for (c = 0; c < rowCellsCnt; c++) { theCells[c].setAttribute('bgcolor', newColor, 0); } }
    else { for (c = 0; c < rowCellsCnt; c++) { theCells[c].style.backgroundColor = newColor; } }
  }
  return true;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_openBrWindow(theURL,winName,features) { 
    window.open(theURL,winName,features);
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function ConfDelete(theText,theUrl) {
    check = confirm(theText);
    if(check == false) return;
    location.href=theUrl;
}
function Browser() {
  var ua, s, nos, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  nos= "Opera";
  if ((i = ua.indexOf(s)) >= 0 && ua.indexOf(nos) < 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
function set_none(el) { el.style.display='none'; }
function set_block(el) { el.style.display='block'; }
function toggle_block(el) { el.style.display=((el.style.display=='block')?'none':'block'); }
function in_array (val,arr) {
  var i;
  for (i=0;i<arr.length;++i)
    if (arr[i]==val)
      return true;
  
  return false;
}
function sizeof(arr) {
 return arr.length;
}
function cookie_set (cname, cval) {
  if (!cname.match(/^[a-zA-z0-9\_]+$/)) return false;
  document.cookie= cname+"="+escape(cval);
}
function cookie_get (cname) {
  var cookies= document.cookie.split(";");
  var i, cvals;
  for (i=0;i<sizeof(cookies);++i) {
    if (cookies[i].indexOf("=") == -1) continue;
    cvals= cookies[i].split("=");
    cvals[0]= cvals[0].replace(/\ /g, "");

    // cookies case-sensitive!
    if (cvals[0] == cname) return unescape(cvals[1]);
  }
  return false;
}
function show_infobox () {
  var box= document.createElement("div");
  
  box.id= "infobox";

  box.style.border= "1px solid black";
  box.style.background= "#f7f7f7";

  box.style.color= "black";
  
  document.body.appendChild(box);
}
function hide_infobox () {
  document.body.removeChild( document.getElementById('infobox') );
}
function start_confirm_links (msg, exclude) {
  var theas= document.getElementsByTagName("a");
  var i;
  var excl;

  if (!exclude) excl= "this_title_is_never_gonna_be_set______12345";
  else excl= exclude;

  for (i=0;i<sizeof(theas);++i) {
    if (theas[i].title == excl) continue;

    theas[i].ondoubleclick= theas[i].onclick;

    theas[i].onclick= function() {
      if (!confirm(msg)) {
        return false;
      }
  
      this.ondoubleclick();
    }
  }
}

function end_confirm_links () {
	var theas= document.getElementsByTagName("a");
	var i, test;

	for (i=0;i<sizeof(theas);++i) {
		test= new String(theas[i].onclick);
		if (test.length > 0 &&
				test.indexOf("function") != -1) {

			test= new String(theas[i].ondoubleclick);
			if (test.length > 0 &&
					test.indexOf("function") != -1) {

				theas[i].onclick= theas[i].ondoubleclick;
				theas[i].ondoubleclick= null;
			}
		}
	}
}

/******************* NEU ****************************/

function set_styles (el, styles) {
  var i;
  var vals, matches;
  for (i=0;i<sizeof(styles);++i) {
    vals= styles[i].split(":");
    if (vals[0]=="class") {
      el.className= vals[1]; continue;
    }
    if (vals[0].indexOf("-") != -1 && (matches= vals[0].match(/\-([a-z])/))) {
      vals[0]=vals[0].replace(matches[0],matches[1].toUpperCase());
    }
    eval("el.style."+ vals[0] +"= '"+ vals[1] +"';");
  }
  return true;
}

/*****************************************************************************

   CONTACTBOX 

*******************************************************************/

// Timeouts
var in_timeout= false;
var out_timeout= false;

// Koordinaten
var cbox_x;
var cbox_y;

// Globales Event (TODO -> clientX/Y fuer den firefox)
var e= false;

// Daten des anzuzeigenden Users
var data= false;

// SIP-ID des Users
var sid= false;

// lang
var cbox_lang= false;

var cbox_cust= "";

// Stoppt das Timeout zum Anzeigen der Box
function stop_in () {
  if (in_timeout) {
    clearTimeout(in_timeout);
    in_timeout= false;
    e= false;
  }
}

// Startet das Timeout zum Ausblenden der Box
function start_out () {
  out_timeout= setTimeout("exec_out()", 400);
}

// Stoppt das Timeout zum Ausblenden der Box
function stop_out () {
  if (out_timeout) {
    clearTimeout(out_timeout);
    out_timeout= false;
  }
}

// Blendet die Box aus
function exec_out () {
  if (document.getElementById('cbox')) {
    document.body.removeChild( document.getElementById('cbox') );
  }
  if (out_timeout) {
    clearTimeout(out_timeout);
    out_timeout= false;
  }
  
  cbox_x= 0;
  cbox_y= 0;
}

// Startet das Timeout zum Anzeigen der Box
function start_in (event, name, a_data, c_id, imp, s_id, cblang, cb_online, cb_fax) {
  if (!event) {
    event= window.event;
  }
  cbox_x= event.clientX + document.body.scrollLeft;
  cbox_y= event.clientY + document.body.scrollTop;;

  if ((new Browser()).isIE) {
    cbox_x+= document.documentElement.scrollLeft; 
    cbox_y+= document.documentElement.scrollTop;
  }

  if (cbox_x <= 20) cbox_x= 20;
  if (cbox_y <= -10) cbox_y= -10;
  
  data= a_data;
  sid= s_id;
  cbox_lang= cblang;  

  if (a_data) {

    in_timeout= setTimeout("exec_in('"+ name +"', '"+ c_id +"', "+ ( (imp) ? "true" : "false" ) + ", '"+ cb_online +"', "+ ( (cb_fax) ? "\""+ cb_fax +"\"" : "false" ) +")", 200);

  } else {
    
    in_timeout= setTimeout("exec_in('"+ name +"', false)", 200);

  }

}

// Zeigt die Box an	
function exec_in (name, id, imp, online, fax) {

  var div= document.createElement("div");

  var output= "";
  var i;
  
  var bgcolor= "";

  div.id= "cbox";

  div.style.border= '1px solid #999999';
  div.style.position= "absolute";
  div.style.zIndex= "1000";
  div.style.margin= "0";
  div.style.padding= "0";
  div.style.width= "370px";
  div.style.left= cbox_x + 20;
  div.style.top=  cbox_y + 10;

  var line_type, line_section, line_val, line_shortid;
  var lines_output= "";
  var cell= false;
  var mail= false;
  
  if (id) {
    
    /////////// bekannter Kontakt
    
    for (i=0;i<data.length;++i) {
      
      line_type= data[i][0];
      line_section= data[i][1];
      line_value= data[i][2];
      line_shortid= data[i][3];
      
      if (!cell) {
        if (line_type.toLowerCase() == "mobile" ||
            line_type.toLowerCase() == "cell" ||
            line_type.toLowerCase() == "mobile") {
          cell= line_value;
        }
      }
      
      if (!mail) {
        if (line_type.toLowerCase() == "e-mail" ||
            line_type.toLowerCase() == "email") {
          mail= line_value;
        }
      }
      
      lines_output+= '<tr><td style="padding-top:3px; padding-right:10px; width:110px;" align="right">'+ line_type +', '+ line_section +': </td>';
      lines_output+= '<td style="padding-top:3px;">'+ actions2(line_type, line_value, 1, 1, 1) +'</td></tr>';
    }

    output+= '<div class="oben" style="background:#f7f7e7; padding:5px;">';
    output+= '<a href="javascript:;" onclick="open_ctd_win2(\'222\', sid); exec_out();"><img src="/img/cbox_call_'+ cbox_lang +'.gif" border="0" onclick="this.blur();"></a> ';
    
    if (cell) {
      output+= '<a href="javascript:;" onclick="location.href = \'/sms.php?num='+ cell +'\'; exec_out();">';
      output+= '<img src="/img/cbox_sms.gif" border="0" onclick="this.blur();"></a> ';
    }
    
    if (mail) {
      output+= '<a href="mailto:'+ mail +'"><img src="/img/cbox_mail.gif" border="0" onclick="this.blur(); exec_out();"></a> ';
    }
    
    if (online == "offnet") {
      output+= '<a href="/freunde_einladen.php"><img src="/img/cbox_invite_'+ cbox_lang +'.gif" border="0"></a> ';
    }

    if (fax) {
      output+= '<a href="/fax/?send=1&num='+ fax +'"><img src="/img/cbox_fax.gif" border="0"></a> ';
    }
    
    output+= '</div><div class="unten" style="background:white; padding:5px;"><table class="fbrb" border="0" cellspacing="0" cellpadding="0" width="360"><tr><td>';
    output+= '<img src="/img/kontakte2_';
    
    if (!imp) { output+= 'un'; }
    
    output+= 'wichtig.gif" border="0"';
    
    if (id > 0) {
    }

    output+= '>&nbsp;&nbsp;';
    
    output+= '<b>'+ name +'</b></td>';
    output+= '<td align="right">';

    if (global_cbox_online_status_unavailable &&
        (online == "online" || online == "offline")) {
      output+= cbox_cust;
      output+= '&nbsp;<img src="/img/pbunavailable.gif" align="absmiddle" border="0">';
    } else {

      if (online == "online") {
        
        output+= cbox_cust;
        output+= '&nbsp;<img src="/img/pbonline.gif" align="absmiddle" border="0">';
        
      } else if (online == "offline") {
        
        output+= cbox_cust;
        output+= '&nbsp;<img src="/img/pboffline.gif" align="absmiddle" border="0">';
        
      }
    }

    output+= '</td></tr></table>';
    output+= '<table class="fbrb" border="0" cellspacing="0" cellpadding="0" width="360" style="margin-top:10px;">';
    
    output+= lines_output;
    
    output+= '<tr><td style="height:10px;"></td></tr><tr>';
    output+= '<td style="padding-top:3px;"><a class="fbrb" href="contacts.php?s=details&c='+ id +'">'+ cbox_showc +'</a></td>';
    output+= '<td align="right" style="padding-top:3px;"><a class="fbrb" href="contacts.php?s=edit&c='+ id +'">'+ cbox_editc +'</a></td>';
    output+= '</tr>';
    output+= '<tr><td style="height:4px;"></td></tr><tr>';
    output+= '</table></div>';
    
  } else {

    /////////// unbekannter Kontakt

    output+= '<div class="oben" style="background:#f7f7e7; padding:5px;">';
    output+= '<a href="javascript:;" onclick="open_ctd_win2(\'sip%3A'+ name +'%40s1111ipgate.de\', '+ sid +'); exec_out();"><img src="/img/cbox_call_'+ cbox_lang +'.gif" border="0" onclick="this.blur();"></a> ';
    output+= '</div><div class="unten fbrb" style="background:white; padding:5px; padding-top:10px; padding-bottom:10px;">';

    output+= '<a class="fbrb" href="/contacts.php?s=new&newphone='+ name +'" onclick="exec_out();">'+ cbox_savec +'</a>';

    output+= '</div>';

  }

  div.innerHTML= output;

  div.onmouseover= stop_out;
  div.onmouseout= start_out;

  document.body.appendChild(div);
}

// debug...	
function debug () {
  
  var output= "<pre style=\"color:white;\">";

  output+= "sip-id:         "+ sid + "\n";
  output+= "in_timeout:     "+ ( (in_timeout) ? "set" : "unset" ) + "\n" ;
  output+= "out_timeout:    "+ ( (out_timeout) ? "set" : "unset" ) + "\n\n" ;

  output+= "event:          "+ ( (cbox_x && cbox_y) ? ("x: "+ cbox_x + ", y: "+ cbox_y) : "unset" ) + "" ;
    
  output+= "</pre>";
  document.getElementById('debug').innerHTML= output;

  setTimeout('debug()', 100);
}

function actions2 (type, val, id) { var retval= ""; ; type= type.toLowerCase(); if (type=="fax") type="telephone"; switch (type) { case "telephone": case "phone": case "voip": { retval+= "<a class=\"fbrb\" href=\"#\" onclick=\"open_ctd_win2('222', '"+val+"');\">"+ val +"</a>"; break; } case "mobile": case "mobile": case "cell": { retval= "<a class=\"fbrb\" href=\"#\" onclick=\"open_ctd_win2('sip%3A"+ val +"%40333333333', 'sip%3A%40');\">"+ val +"</a>"; break; } case "e-mail": { retval= "<a class=\"fbrb\" href=\"mailto:"+ val +"\">"+ val +"</a>"; break; } case "fax": { retval= "<a class=\"fbrb\" href=\"#\">"+ val +"</a>"; break; } default: { retval= val; break; } } return retval+"&nbsp;&nbsp;"; }

function set_title(to) {
	document.title= to;
}

function submit_data_to (opts) {

  var ___div=     document.createElement("div");
  var ___form=    document.createElement("form");
  var ___inputs=  new Array();
 
  ___div.style.position= "absolute";
  ___div.style.display= "none";
  ___div.style.height= 0;
  ___div.style.width= 0;
    
  ___form.name= opts['name'];
  ___form.method= opts['method'];
  ___form.action= opts['action'];

  for (inputname in opts['inputs']) {
    
    ___inputs.push(document.createElement("input"));

    ___inputs[___inputs.length-1].type= "hidden";
    ___inputs[___inputs.length-1].name= inputname;
    ___inputs[___inputs.length-1].value= opts['inputs'][inputname];

    ___form.appendChild(___inputs[___inputs.length-1]);
  }

  ___div.appendChild(___form);
  document.body.appendChild(___div);
  
  ___form.submit();
  
}

function draw_modal (txt) {

  var _modal= document.createElement("div");
  var _bg= document.createElement("div");
  
  _modal.style.width= "200px";
  _modal.style.border= "1px solid black";
  _modal.style.borderRight= "2px solid black";
  _modal.style.borderBottom= "2px solid black";
  _modal.style.background= "#f7f7f7";
  _modal.style.fontSize= "10pt";
  _modal.style.padding= "10px";

  _modal.style.position= "absolute";
  _modal.style.top= "50%";
  _modal.style.left= "50%";
  _modal.marginTop= "-50%";
  _modal.marginLeft= "-50px";

  _modal.innerHTML= txt;

/*
  _bg.style.position= "absolute";
  _bg.style.top= "0px";
  _bg.style.left= "0px";
  _bg.style.width= "100%";
  _bg.style.height= document.body.scrollHeight +'px';	
  _bg.style.background= "#f7f7f7";
  _bg.style.filter= "alpha(opacity=50)";
  _bg.style.opacity= "0.5";
  _bg.style.mozOpacity= "0.5";

  document.body.appendChild(_bg);
*/
  
  document.body.appendChild(_modal);

  return new Array(_modal/*, _bg*/);
}

function remove_modal (_objects) {
  var i;
  for (i=0;i<_objects.length;++i) {
    document.body.removeChild(_objects[i]);
  } 
}

                                
//-->

