

function scroll(wert) {
    if (wert != "") {
        window.scrollTo(0, wert);
    }
}


function ullescroll(ankername){
   if (ankername != "") { 
       if(document.getElementsByName) {
//           window.scrollTo(0,document.getElementsByName(ankername)[0].offsetTop);
           window.scrollTo(0,2700);
       }
   }
}

		
function deleteAd_check() {
  var check = window.confirm("\nWollen Sie die Anzeige wirklich l?schen?\n\n\n(Auch gel?schte Anzeigen k?nnen mit der\nAnzeigen-ID-Suche aufgerufen werden,\nalso u. U. Anzeigen-ID merken!)\n");
  return(check);
}


function popup(ort,x,y) {
  win = window.open(ort, 'Fenster','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+x+',height='+y);
  win.focus();
}


function popup2(url, w, h) {
    if(w == 0) w = 500;
    if(h == 0) h = 600;
    var advertPreview = window.open(url, "advertPreview", "width=" + w + ", height=" + h + ",resizable=yes, menubar=no, scrollbars, location=no, top=225, left=180");
    advertPreview.resizeTo(w, h);
    advertPreview.focus();
}


function popup3(url,w,h) {
    if(w == 0) w = 500;
    if(h == 0) h = 600;
    var preisliste = window.open(url, "Preisliste_PrintOnline", "width=" + w + ", height=" + h + ",resizable=no, menubar=no, scrollbars=no, location=no, status=no, left=10, top=20");
    preisliste.resizeTo(w, h);
    preisliste.focus();
}


/* Funktionen fuer Kartenwechsler und Umkreissuche */

function swapMap(selectedValue)
{
/*
alert("ORI: \nselectedValue=" + selectedValue + " \ndocument.newentryForm.regions.options.selectedIndex=" + document.newentryForm.regions.options.selectedIndex + " \ndocument.karte.src=" + document.karte.src);
*/
	bild = new Image();
	bild.src = "/img/jobcenter/yoda/karte.gif";
	if ((selectedValue == document.newentryForm.regions.options.selectedIndex && document.karte.src.indexOf("karte.gif") < 0)) 
	{
	    bild.src = "/img/jobcenter/yoda/karte.gif";
	    document.newentryForm.regions.options.selectedIndex = 0;
	}
	else if (selectedValue >= 1 && selectedValue <= 15)
	{
        bild.src = "/img/jobcenter/yoda/" + selectedValue + ".gif";
		document.newentryForm.regions.options.selectedIndex = selectedValue;
	}
	document.newentryForm.edith_plz.value = "";
	document.newentryForm.edith_radius.value = "";
	document.karte.src = bild.src;
}

function swapMapByRegionsList()
{
	bild = new Image();
	bild.src = "/img/jobcenter/yoda/karte.gif";
	selectedValue = document.newentryForm.regions.options.selectedIndex;
/*
alert("ORI: \nselectedValue=" + selectedValue + " \ndocument.newentryForm.regions.options.selectedIndex=" + document.newentryForm.regions.options.selectedIndex + " \ndocument.karte.src=" + document.karte.src);
*/
	if (selectedValue == 0)
	{
	    bild.src = "/img/jobcenter/yoda/karte.gif";
	}
	else if (selectedValue >= 1 && selectedValue <= 15)
	{
        bild.src = "/img/jobcenter/yoda/" + selectedValue + ".gif";
	}
	document.newentryForm.edith_plz.value = "";
	document.newentryForm.edith_radius.value = "";
	document.karte.src = bild.src;	
}

function resetMapAndRegionsList()
{
	document.karte.src = "/img/jobcenter/yoda/karte.gif";
	document.newentryForm.regions.options.selectedIndex = -1;
	document.newentryForm.regions.options[0].selected = false;
}

function resetRegionsJL()
{
	document.forms[0].regions.options.selectedIndex = -1;
	document.forms[0].regions.options[0].selected = false;
}

function resetPLZRadiusJL()
{
	document.forms[0].letter_plz.value = "";
	document.forms[0].letter_radius.value = "";
}

/* Ende Funktionen fuer Kartenwechsler und Umkreissuche */


/* Funktionen fuer Farbwaehler */

function dx(d)
{
 max = 255;
 if(d > max)
  { return "null"; }
 if(d <= -1)
  { return  "null"; }
 var z = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
 var x = "";
 if(d == 0)
  return "00";
 var i = 1, v = d, r = 0;
 while(v > 15)
  { v = Math.floor(v / 16); i++; }
 v = d;
 for(j=i;j>=1;j=j-1){
   x = x + z[Math.floor(v / Math.pow(16,j-1))];
   v = v - (Math.floor(v / Math.pow(16,j-1)) * Math.pow(16,j-1));
  }
 if(d <= 15)
  x = "0" + x;
 return x;
}

function Farb(R,G,B) {
 var red = eval(R);
 var green = eval(G);
 var blue = eval(B);
 var rx = dx(red);
 var gx = dx(green);
 var bx = dx(blue);
 var HexString = "#" + rx + gx + bx;
 document.forms[0].ad_color.value = HexString;
 document.getElementById("farbe").bgColor = HexString;
 /* document.getElementById("farbe2").bgColor = HexString; */
 /* document.getElementById("farbe3").bgColor = HexString; */
}

function Farbfeld(HexString) {
 var firstchar = HexString.charAt(0);
 if (firstchar != "#") HexString = "#" + HexString;
 if (HexString == "#") HexString = "#FFFFFF";
 document.forms[0].ad_color.value = HexString;
 document.getElementById("farbe").bgColor = HexString;
 /* document.getElementById("farbe2").bgColor = HexString; */
 /* document.getElementById("farbe3").bgColor = HexString; */
}
/* von advertForm
Farbfeld(document.forms[0].ad_color.value);
/ von advertForm */

/* Ende Funktionen fuer Farbwaehler */


/* Funktionen fuer Premium Partner Box (teaserbox.jsp) */

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

* Random Content Order script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

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


function randomizeContent(classname){
	var contents=randomizeContent.collectElementbyClass(classname)
	contents.text.sort(function() {return 0.5 - Math.random();})
	for (var i=0; i<contents.ref.length; i++){
		contents.ref[i].innerHTML=contents.text[i]
		contents.ref[i].style.visibility="visible"
	}
}

randomizeContent.collectElementbyClass=function(classname){ //return two arrays containing elements with specified classname, plus their innerHTML content
	var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
	var contentobj=new Object()
	contentobj.ref=new Array() //array containing references to the participating contents
	contentobj.text=new Array() //array containing participating contents' contents (innerHTML property)
	var alltags=document.all? document.all : document.getElementsByTagName("*")
	for (var i=0; i<alltags.length; i++){
		if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1){
			contentobj.ref[contentobj.ref.length]=alltags[i]
			contentobj.text[contentobj.text.length]=alltags[i].innerHTML
		}
	}
	return contentobj
}

/* Ende Funktionen fuer Premium Partner Box (teaserbox.jsp) */


// ||||||||||||||||||||||||||||||||||||||||||||||||||

Menu = {timer : null, current : null};
Menu.getStyle = function(name){
	if(document.getElementById) return document.getElementById(name).style;
	else if(document.all) return document.all[name].style;
	else if(document.layers) return document.layers[name];
}
Menu.show = function(name){
	if(this.timer) clearTimeout(this.timer);
	this.getStyle(name).visibility = "visible";
	this.current = name;
}
Menu.hide = function(){
	this.timer = setTimeout("Menu.doHide()",300);
}
Menu.doHide = function(){
	if(this.current){
		this.getStyle(this.current).visibility = "hidden";
		this.current = null;
	}
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||


/**
 * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki
 */

/**
 * Some browser detection
 */
var clientPC  = navigator.userAgent.toLowerCase(); // Get client info
var is_gecko  = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1));
var is_safari = ((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1));
var is_khtml  = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ));
if (clientPC.indexOf('opera')!=-1) {
    var is_opera = true;
    var is_opera_preseven = (window.opera && !document.childNodes);
    var is_opera_seven = (window.opera && document.childNodes);
}


/**
 * apply tagOpen/tagClose to selection in textarea, use sampleText instead
 * of selection if there is none copied and adapted from phpBB
 *
 * @author phpBB development team
 * @author MediaWiki development team
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Jim Raynor <jim_raynor@web.de>
 * @author Jazid Radoin <jr@bsmo.de>
 */
function insertTags(tagOpen, tagClose, sampleText) {

txtarea = document.newentryForm.textbox;

  // IE
  if(document.selection  && !is_gecko) {
    var theSelection = document.selection.createRange().text;
    var replaced = true;
    if(!theSelection){
      replaced = false;
      theSelection=sampleText;
    }

    txtarea.focus();
    // This has change
    text = theSelection;
    if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
      theSelection = theSelection.substring(0, theSelection.length - 1);
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose + " ";
    } else {
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose;
    }
    if(!replaced){
      r.moveStart('character',-text.length-tagClose.length);
      r.moveEnd('character',-tagClose.length);
    }
    r.select();
  // Mozilla
  } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
    var replaced = false;
    var startPos = txtarea.selectionStart;
    var endPos   = txtarea.selectionEnd;
    if(endPos - startPos) replaced = true;
    var scrollTop=txtarea.scrollTop;
    var myText = (txtarea.value).substring(startPos, endPos);
    if(!myText) { myText=sampleText;}
    if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
      subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
    } else {
      subst = tagOpen + myText + tagClose;
    }
    txtarea.value = txtarea.value.substring(0, startPos) + subst +
                    txtarea.value.substring(endPos, txtarea.value.length);
    txtarea.focus();

    //set new selection
    if(replaced){
      var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
      txtarea.selectionStart=cPos;
      txtarea.selectionEnd=cPos;
    }else{
      txtarea.selectionStart=startPos+tagOpen.length;
      txtarea.selectionEnd=startPos+tagOpen.length+myText.length;
      txtarea.scrollTop=scrollTop;
    }
  // All others
  } else {
    var copy_alertText=alertText;
    var re1=new RegExp("\\$1","g");
    var re2=new RegExp("\\$2","g");
    copy_alertText=copy_alertText.replace(re1,sampleText);
    copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose);
    var text;
    if (sampleText) {
      text=prompt(copy_alertText);
    } else {
      text="";
    }
    if(!text) { text=sampleText;}
    text=tagOpen+text+tagClose;
    //append to the end
    txtarea.value += "\n"+text;

    // in Safari this causes scrolling
    if(!is_safari) {
      txtarea.focus();
    }

  }
  // reposition cursor if possible
  if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}

/**
 * apply tagOpen/tagClose to selection in textarea, use sampleText instead
 * of selection if there is none copied and adapted from phpBB
 *
 * @author phpBB development team
 * @author MediaWiki development team
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Jim Raynor <jim_raynor@web.de>
 * @author Jazid Radoin <jr@bsmo.de>
 */
function insertTags1(tagOpen, tagClose, sampleText) {

txtarea = document.newentryForm.textbox1;

  // IE
  if(document.selection  && !is_gecko) {
    var theSelection = document.selection.createRange().text;
    var replaced = true;
    if(!theSelection){
      replaced = false;
      theSelection=sampleText;
    }

    txtarea.focus();
    // This has change
    text = theSelection;
    if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
      theSelection = theSelection.substring(0, theSelection.length - 1);
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose + " ";
    } else {
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose;
    }
    if(!replaced){
      r.moveStart('character',-text.length-tagClose.length);
      r.moveEnd('character',-tagClose.length);
    }
    r.select();
  // Mozilla
  } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
    var replaced = false;
    var startPos = txtarea.selectionStart;
    var endPos   = txtarea.selectionEnd;
    if(endPos - startPos) replaced = true;
    var scrollTop=txtarea.scrollTop;
    var myText = (txtarea.value).substring(startPos, endPos);
    if(!myText) { myText=sampleText;}
    if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
      subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
    } else {
      subst = tagOpen + myText + tagClose;
    }
    txtarea.value = txtarea.value.substring(0, startPos) + subst +
                    txtarea.value.substring(endPos, txtarea.value.length);
    txtarea.focus();

    //set new selection
    if(replaced){
      var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
      txtarea.selectionStart=cPos;
      txtarea.selectionEnd=cPos;
    }else{
      txtarea.selectionStart=startPos+tagOpen.length;
      txtarea.selectionEnd=startPos+tagOpen.length+myText.length;
      txtarea.scrollTop=scrollTop;
    }
  // All others
  } else {
    var copy_alertText=alertText;
    var re1=new RegExp("\\$1","g");
    var re2=new RegExp("\\$2","g");
    copy_alertText=copy_alertText.replace(re1,sampleText);
    copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose);
    var text;
    if (sampleText) {
      text=prompt(copy_alertText);
    } else {
      text="";
    }
    if(!text) { text=sampleText;}
    text=tagOpen+text+tagClose;
    //append to the end
    txtarea.value += "\n"+text;

    // in Safari this causes scrolling
    if(!is_safari) {
      txtarea.focus();
    }

  }
  // reposition cursor if possible
  if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}

/**
 * apply tagOpen/tagClose to selection in textarea, use sampleText instead
 * of selection if there is none copied and adapted from phpBB
 *
 * @author phpBB development team
 * @author MediaWiki development team
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Jim Raynor <jim_raynor@web.de>
 * @author Jazid Radoin <jr@bsmo.de>
 */
function insertTags2(tagOpen, tagClose, sampleText) {

txtarea = document.newentryForm.textbox2;

  // IE
  if(document.selection  && !is_gecko) {
    var theSelection = document.selection.createRange().text;
    var replaced = true;
    if(!theSelection){
      replaced = false;
      theSelection=sampleText;
    }

    txtarea.focus();
    // This has change
    text = theSelection;
    if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
      theSelection = theSelection.substring(0, theSelection.length - 1);
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose + " ";
    } else {
      r = document.selection.createRange();
      r.text = tagOpen + theSelection + tagClose;
    }
    if(!replaced){
      r.moveStart('character',-text.length-tagClose.length);
      r.moveEnd('character',-tagClose.length);
    }
    r.select();
  // Mozilla
  } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
    var replaced = false;
    var startPos = txtarea.selectionStart;
    var endPos   = txtarea.selectionEnd;
    if(endPos - startPos) replaced = true;
    var scrollTop=txtarea.scrollTop;
    var myText = (txtarea.value).substring(startPos, endPos);
    if(!myText) { myText=sampleText;}
    if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
      subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
    } else {
      subst = tagOpen + myText + tagClose;
    }
    txtarea.value = txtarea.value.substring(0, startPos) + subst +
                    txtarea.value.substring(endPos, txtarea.value.length);
    txtarea.focus();

    //set new selection
    if(replaced){
      var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
      txtarea.selectionStart=cPos;
      txtarea.selectionEnd=cPos;
    }else{
      txtarea.selectionStart=startPos+tagOpen.length;
      txtarea.selectionEnd=startPos+tagOpen.length+myText.length;
      txtarea.scrollTop=scrollTop;
    }
  // All others
  } else {
    var copy_alertText=alertText;
    var re1=new RegExp("\\$1","g");
    var re2=new RegExp("\\$2","g");
    copy_alertText=copy_alertText.replace(re1,sampleText);
    copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose);
    var text;
    if (sampleText) {
      text=prompt(copy_alertText);
    } else {
      text="";
    }
    if(!text) { text=sampleText;}
    text=tagOpen+text+tagClose;
    //append to the end
    txtarea.value += "\n"+text;

    // in Safari this causes scrolling
    if(!is_safari) {
      txtarea.focus();
    }

  }
  // reposition cursor if possible
  if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}




