
/****************************************************************************************
 *  Javascript Cache                                                                    *
 ***************************************************************************************/

var deskman_cache = new Array ();
function poke ( variable, inhalt ) { deskman_cache [variable] = inhalt; }
function peek ( variable ) { 
if ( variable != null ) return ( deskman_cache [variable] );
else return false;  }



/****************************************************************************************
 *  Javascript Init                                                                    *
 ***************************************************************************************/

function init () {
         if (navigator.userAgent.indexOf('iPad') == -1) 
         if (navigator.userAgent.indexOf('iPhone') == -1) 
         window.setTimeout("flashlight()", 1000);
         document.onmousemove = doDrag; document.onmouseup = stopDrag;
         if ( document.getElementById('suche').value == '' ) 
         document.getElementById('suche').style.backgroundImage = 
         'url(/media/styles/kleinanzeigen/pictures/suche2.png)';
         if ( document.getElementById('ort').value == '' ) 
         document.getElementById('ort').style.backgroundImage = 
         'url(/media/styles/kleinanzeigen/pictures/ort2.png)';
         }





/****************************************************************************************
 *  Moving Windows                                                                      *
 ***************************************************************************************/

var objDrag = null;   // Element, über dem Maus bewegt wurde
var mouseX   = 0;     // X-Koordinate der Maus
var mouseY   = 0;     // Y-Koordinate der Maus
var offX = 0;         // X-Offset der Maus zur linken oberen Ecke des Elements
var offY = 0;         // Y-Offset der Maus zur linken oberen Ecke des Elements
IE = document.all&&!window.opera;
DOM = document.getElementById&&!IE;
var pointer_start = 0;

         poke ( 'dragStop', 0 );

function startDrag(objElem) {
         if ( !objElem.style )
         objElem = document.getElementById( objElem );
         objDrag = objElem;
         offX = mouseX - objDrag.offsetLeft;
         offY = mouseY - objDrag.offsetTop;
         wtX  = mouseX - objDrag.offsetWidth;
         wtY  = mouseY - objDrag.offsetHeight; }

function doDrag(ereignis) {

         mouseX = (IE) ? window.event.clientX : ereignis.pageX;
         mouseY = (IE) ? window.event.clientY : ereignis.pageY;
         if (objDrag != null) {
         objDrag.style.backgroundPosition = objDrag.style.left + ' ' +  objDrag.style.top;

         if ( peek ( 'dragStop' ) == 0 ) {
         objDrag.style.left = (mouseX - offX) + "px";
         objDrag.style.top = (mouseY - offY) + "px"; } } } 

function stopDrag (ereignis) { objDrag = null; }
function yesDrag () { poke ( 'dragStop', 0 ); }
function noDrag  () { poke ( 'dragStop', 1 ); }





/****************************************************************************************
 *  Iframe Position eintellen                                                           *
 ***************************************************************************************/

 function iframe_pos () {
 document.getElementById('iframe').style.top = '';
 var scrollPos = parent.document.body.scrollTop;
 if ( scrollPos < 1 )
 scrollPos = parent.window.pageYOffset;
 var posy = scrollPos + 100;
 if ( scrollPos > 200 ) 
 document.getElementById('iframe').style.top = posy + 'px'; }




/****************************************************************************************
 *  Formular Anbieter Kontakt einblenden                                                *
 ***************************************************************************************/

function kontakt (id, title, action) {
iframe_pos ();
document.getElementById('iframe_title').innerHTML = title;
document.getElementById('iframe_window').innerHTML = '<iframe scrolling="no" style="border:0px; width:100%; height:100%" src="/index.php?seite=anbieter-kontakt&LNr='+id+'"></iframe>'; 
document.getElementById('iframe').style.visibility='visible'; }




/****************************************************************************************
 *  Formular Anbieter Impressum einblenden                                                  *
 ***************************************************************************************/

function impressum (id, title, action) {
iframe_pos ();
document.getElementById('iframe_title').innerHTML = title;
document.getElementById('iframe_window').innerHTML = '<iframe scrolling="yes" style="border:0px; width:100%; height:100%" src="/index.php?seite=anbieter-impressum&LNr='+id+'"></iframe>'; 
document.getElementById('iframe').style.visibility='visible'; }




/****************************************************************************************
 *  Formular Anzeige melden einblenden                                                  *
 ***************************************************************************************/

function nospam (id, title) {
iframe_pos ();
document.getElementById('iframe_title').innerHTML = title;
document.getElementById('iframe_window').innerHTML = '<iframe scrolling="no" style="border:0px; width:100%; height:100%" src="/index.php?seite=anzeige-melden&LNr='+id+'"></iframe>'; 
document.getElementById('iframe').style.visibility='visible'; }



/****************************************************************************************
 *  Ajax Funktion Anzeige merken                                                        *
 ***************************************************************************************/

function merke (id) { document.getElementById('ajax').innerHTML = '<iframe src="/tools/merge.php?merge='+id+'"></iframe>'; }



/****************************************************************************************
 *  Ajax Funktion Anzeigen Update                                                       *
 ***************************************************************************************/

function update (id) { document.getElementById('ajax').innerHTML = '<iframe src="/tools/update.php?update='+id+'"></iframe>'; }



/****************************************************************************************
 *  Ajax Funktion Anzeige Action                                                        *
 ***************************************************************************************/

function set_status (lnr, action ) {

url = '/index.php?programm=modul_set_status&LNr='+lnr+'&action='+action;
 
document.getElementById('ajax').innerHTML = '<iframe src="'+url+'"></iframe>'; }





/****************************************************************************************
 *  Email mit Button öffnen / schliessen                                                *
 ***************************************************************************************/

function email_switch (id) {
if ( document.getElementById(id).style.height != '100%' ) {
document.getElementById(id).style.height='100%';
document.getElementById(id).style.overflowY='hidden'; } 

else {
document.getElementById(id).style.height='100px';
document.getElementById(id).style.overflowY='hidden'; } }




/****************************************************************************************
 *  Container mit Button öffnen / schliessen                                            *
 ***************************************************************************************/

function container_switch (id) {
if ( document.getElementById(id).style.height != '100%' ) {
document.getElementById(id).style.height='100%';
document.getElementById(id).style.overflowY='hidden'; } 

else {
document.getElementById(id).style.height='170px';
document.getElementById(id).style.overflowY='hidden'; } }


/****************************************************************************************
 *  Container mit Mouseover öffnen / schliessen                                         *
 ***************************************************************************************/

function container_hover (id) {
document.getElementById(id).style.height='100%';
document.getElementById(id).style.overflowY='hidden'; }

function container_blur (id) {
document.getElementById(id).style.height='170px';
document.getElementById(id).style.overflowY='hidden'; }




/****************************************************************************************
 *  Logo Flashlight                                                                     *
 ***************************************************************************************/


function flashlight () {
         }


function flashlight_org () {
         var ads = 'Kostenlose Kleinanzeigen';
         var txt = '';
         for (var i = 0; i <= 23; i++ ) {
         var char = ads.substr(i, 1);
         highlight = '<font color="#eeeeee">' + char + '</font>';
         if ( i == pointer_start ) txt += highlight;
         else txt += char;
         document.getElementById('logo').innerHTML = txt; }
         pointer_start ++;
         if ( pointer_start < 25 ) window.setTimeout("flashlight()", 20); }


