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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      v=args[i+2];
      if (obj.style) {
        obj=obj.style;
        v=(v=='show')?'visible':(v=='hide')?'hidden':v;
      }
    }
    obj.visibility=v;
  }
}
function ShowLayer(LayerName) {
  MM_showHideLayers('layer_default','','hide');
  MM_showHideLayers(LayerName,'','show');
}
function HideLayer(LayerName) {
  MM_showHideLayers('layer_default','','show');
  MM_showHideLayers(LayerName,'','hide');
}

function vcsave(id) {
	open('vormerken.php?eid='+id,'Vormerken','width=350,height=175');
}
function vcdel(id,tmpl) {
	
  Check = confirm('Gewerbeeintrag aus Vormerkliste entfernen.\n\nSind Sie sicher?');
  if(Check==1) {
	location.href="?content=vliste&eid="+id+"&del=1&tmpl="+tmpl;
  }
}

function countDigits(){ 
  var maxDigits = 50;   //maximale Zeichenanzahl 
  var areaString = document.forms[0].text.value;     
  var currLength = areaString.length + 1; 
  var restLength = maxDigits - currLength +1; 
  if ( restLength <  0 ) { 
    restLength = 0; 
  } 
                    
  document.forms[0].counter.value = restLength;    
  if (areaString.length  > maxDigits-1) { 
    //die folgende Zeile entfernt alle Zeichen die  > maxDigits sind 
    document.forms[0].text.value = document.forms[0].text.value.substring(0,maxDigits); 
  } 
} 
function soon() {
	alert('In Bearbeitung ...\n\nDie Funktionalität kann nicht gewährleistet werden');
}

// Email-Fenster öffnen
function open_vcemail(id) 
{

	window.open('../main/vcemail.php?id='+id,'','width=600, height=600, scrollbars=1');

}

function open_adetails(a_id) {

	open('../main/a_details.php?a_id='+a_id,'','width=600,height=400,scrollbars=yes');

}

function open_branchen() {
	open('../branchen.php','branchen','width=750,height=400,scrollbars=yes');
}

function open_profile(id,seite) {
	open('../profile/frameset.php?id='+id+'&s='+seite,'','width=670,height=435,status=0');
}

function hole_cookie()
  {
   var Wert = "";
   if(document.cookie) 
   {
    Wertstart = document.cookie.indexOf("=") + 1;
    Wertende = document.cookie.indexOf(";");
    if(Wertende == -1) Wertende = document.cookie.length;
    Wert = document.cookie.substring(Wertstart,Wertende);
   }
   return Wert;
  }

function setze_cookie(Bezeichner, Wert, Verfall)
  {
   var jetzt = new Date();
   var Auszeit = new Date(jetzt.getTime() + Verfall);
   document.cookie = Bezeichner+"="+Wert+"; expires="+Auszeit.toGMTString()+";";
  }



function merke_profil(id) {
	
	winheight = 150;
	winwidth = 400;
	winleft = screen.width/2 - winwidth/2;
	wintop = screen.height/2 - winheight;
	open('merke.php?typ=g&id='+id,'Merker','width='+winwidth+', height='+winheight+',left='+winleft+',top='+wintop);

//	setze_cookie('profil'+id',1,1440);

//	profil = document.frm_merker.zaehler_profil.value;
//	cookiep = document.cookie.indexOf('profil_')+1;
//	cookie_p = hole_cookie();
//	alert(cookie_p);
//	if(cookie_p) {
//		document.frm_merker.zaehler_profil.value = parseInt(profil) + 1;
//	} else {
//		document.frm_merker.zaehler_profil.value = parseInt(profil) - 1;
//}
}

