var ajax_root_url='http://www.ichbinneu.de/classes/ajax_wrapper_frontend.php';
function Fehlerbehandlung (Nachricht, Datei, Zeile)
{
Fehler = 'Error: ' + Nachricht + ' in: ' + Datei + ' at Line:' + Zeile;
new Ajax.Request(ajax_root_url + '?wrapper=jserror&error='+Fehler,
{
method:'post'
});
alert(Fehler);
return true;
}
window.onerror = Fehlerbehandlung;
function CenterElement( $element )
{
$element.style.display = 'block';
$element.position = 'absolute';
$element.position.top = '0px';
$element.position.left = '0px';
var w = (window.innerWidth > document.body.clientWidth)?
window.innerWidth : document.body.clientWidth;
w -= $element.offsetWidth;
w *= 0.5;
if( w )
w += document.body.scrollLeft;
$element.style.left = w + 'px';
var h = (window.innerHeight > document.body.clientHeight)?
window.innerHeight : document.body.clientHeight;
h -= $element.offsetHeight;
h *= 0.4;
h += document.body.scrollTop;
$element.style.top = h + 'px';
}
function MessageBox( $msg, $caption )
{
try
{
var $overlay = null;
var $iframe = null;
var $msgbox = null;
var $Html = '';
var $id = new Date();
$msg || ($msg = ' ');
$caption || ($caption = ' ');
$id = $id.valueOf();
$overlay = document.createElement( 'div' );
$overlay.id = '' + $id + '.1';
$overlay.className = 'msgbox_overlay';
with( $overlay.style )
{
backgroundColor = '#bbbbbb';
position = 'absolute';
width = '100%';
height = '100%';
top = '0';
left = '0';
filter = 'alpha(opacity=0)';
opacity = '0';
}
$iframe = document.createElement( 'iframe' );
$overlay.appendChild( $iframe );
with( $iframe.style )
{
border = 'none';
width = '100%';
height = '100%';
filter = 'chroma(color=#ffffff)';
}
var $msgbox = document.createElement( 'div' );
$msgbox.id = '' + $id + '.2';
with( $msgbox.style )
{
border = 'none';
display = 'inline';
position = 'absolute';
}
$Html = '
';
$Html += '';
$Html += '';
$Html += '| ';
$Html += ' ';
$Html += ' ';
$Html += ' ';
$Html += $caption;
$Html += ' | ';
$Html += '
';
$Html += '';
$Html += '| ';
$Html += $msg;
$Html += ' | ';
$Html += '
';
$Html += '';
$Html += '
';
$msgbox.innerHTML = $Html;
document.body.appendChild( $overlay );
document.body.appendChild( $msgbox );
var w = (window.innerWidth > document.body.clientWidth)?
window.innerWidth : document.body.clientWidth;
w -= $msgbox.offsetWidth;
w *= 0.5;
if( w )
w += document.body.scrollLeft;
$msgbox.style.left = w + 'px';
var h = (window.innerHeight > document.body.clientHeight)?
window.innerHeight : document.body.clientHeight;
h -= $msgbox.offsetHeight;
h *= 0.4;
h += document.body.scrollTop;
$msgbox.style.top = h + 'px';
}
catch( $e )
{
//alert( $msg );
}
}
function show_msgbox( box )
{
var bg = box.parentNode? box.parentNode : (box.parentElement? box.parentElement : null);
bg.style.top = '0px';
bg.style.left = '0px';
bg.style.width = document.body.scrollWidth + 'px';
bg.style.height = document.body.scrollHeight + 'px';
var iframe = document.createElement( 'iframe' );
bg.appendChild( iframe );
iframe.style.width = '100%';
iframe.style.height = '100%';
/*@cc_on
iframe.style.filter = 'chroma (color=#ffffff)';
@*/
bg.style.display = 'block';
box.style.display = 'inline';
var w = (window.innerWidth > document.body.clientWidth)?
window.innerWidth : document.body.clientWidth;
w -= box.offsetWidth;
w *= 0.5;
if( w )
w += document.body.scrollLeft;
box.style.left = w + 'px';
var h = (window.innerHeight > document.body.clientHeight)?
window.innerHeight : document.body.clientHeight;
h -= box.offsetHeight;
h *= 0.4;
h += document.body.scrollTop;
box.style.top = h + 'px';
}
function close_msgbox( box )
{
var bg = box.parentNode? box.parentNode : (box.parentElement? box.parentElement : null);
for( var i = 0; i < bg.childNodes.length; ++i )
{
if( bg.childNodes[i].tagName && (bg.childNodes[i].tagName.toLowerCase() == 'iframe') )
{
bg.removeChild( bg.childNodes[i] );
break;
}
}
bg.style.display = 'none';
}
function GreyBox( id )
{
try
{
var $overlay = null;
var $iframe = null;
var $Html = '';
$id = new Date();
$id = $id.valueOf();
$overlay = $(id);
if( $overlay )
close_greybox( $id );
$overlay = document.createElement( 'div' );
$overlay.id = id;
$overlay.className = 'greybox_overlay';
var h = (window.innerHeight > document.body.scrollHeight)?
window.innerHeight : document.body.scrollHeight;
var w = (window.innerWidth > document.body.scrollWidth)?
window.innerWidth : document.body.scrollWidth;
with( $overlay.style )
{
backgroundColor = '#bbbbbb';
position = 'absolute';
width = w+'px';//'100%';
height = h+'px';//'100%';
top = '0';
left = '0';
filter = 'alpha(opacity=0)';
opacity = '0.0';
}
$iframe = document.createElement( 'iframe' );
$overlay.appendChild( $iframe );
with( $iframe.style )
{
border = 'none';
width = '100%';
height = '100%';
filter = 'chroma(color=#ffffff)';
}
document.body.appendChild( $overlay );
}
catch( $e )
{
//alert( $e );
}
}
function show_greybox( box )
{
var bg = box.parentNode? box.parentNode : (box.parentElement? box.parentElement : null);
bg.style.top = '0px';
bg.style.left = '0px';
bg.style.width = document.body.scrollWidth + 'px';
bg.style.height = document.body.scrollHeight + 'px';
var iframe = document.createElement( 'iframe' );
bg.appendChild( iframe );
iframe.style.width = '100%';
iframe.style.height = '100%';
/*@cc_on
iframe.style.filter = 'chroma (color=#ffffff)';
@*/
bg.style.display = 'block';
box.style.display = 'inline';
var w = (window.innerWidth > document.body.clientWidth)?
window.innerWidth : document.body.clientWidth;
w -= box.offsetWidth;
w *= 0.5;
if( w )
w += document.body.scrollLeft;
box.style.left = w + 'px';
var h = (window.innerHeight > document.body.clientHeight)?
window.innerHeight : document.body.clientHeight;
h -= box.offsetHeight;
h *= 0.4;
h += document.body.scrollTop;
box.style.top = h + 'px';
}
function close_greybox( id )
{
var $box = $(id);
if( $box )
{
var $parent = $box.parentNode? $box.parentNode:($box.parentElement? $box.parentElement:null);
if( $parent )
$parent.removeChild( $box );
}
// $(id).style.display = 'none';
/*
var bg = box.parentNode? box.parentNode : (box.parentElement? box.parentElement : null);
for( var i = 0; i < bg.childNodes.length; ++i )
{
if( bg.childNodes[i].tagName && (bg.childNodes[i].tagName.toLowerCase() == 'iframe') )
{
bg.removeChild( bg.childNodes[i] );
break;
}
}
*/
}
function log_external_klick(url, position, klickid)
{
var parameter = klickid+'&pos='+position+'&url='+url;
draw_ajax('ajax_log_external_klick', '', parameter, '','login', '');
}
function change_middle_pic_final()
{
//$('$hdnCurrentPreviewOffs').value='$check';
//$('$hdnRealBigUrl').value='$pic_gen_file2_html';
//$('$hdnCurrentPreviewOffs').value=check;
//$('$hdnRealBigUrl').value=pic_middle;
var id=pic_obj.id.replace(/[0-9]$/,'');
var i=0;
var thumb=$(''+id+i);
alert(thumb);
while(thumb)
{
thumb.src='/images/blind_transp.gif';
thumb.activated=false;
thumb=$(''+id+(++i));
};
this.src='/images/produkt_pic_small_border.gif';
this.activated=true;
}
function change_middle_pic(prod_id, pic, pic_big, pic_title)
{
var parameter = prod_id+'&pic='+pic+'&pic_big='+pic_big+'&pic_title='+pic_title;
draw_ajax('ajax_change_middle_pic', 'PD_GROSSES_BILD', parameter, '','login','response');
}
function promo1()
{
//GreyBox('weiterleitengrey');
$('produkt_promo1').style.display='block';
}
function send_promo1_final(resp)
{
$('inhalt_promo1').innerHTML = resp;
}
function send_promo1()
{
var parameter = '';
draw_ajax('ajax_send_promo1', '', parameter, 'send_promo1_final','form_promo1', 'response');
}
function close_promo1(rel)
{
try
{
$('produkt_promo1').style.display='none';
$('produkt_promo_wk').style.display='none';
if (rel!=0)
{
//location.reload();
}
}
catch (e)
{
}
}
function submit_kontakt_final(resp)
{
var resp_dump = resp.split('|');
if (resp_dump[0]=='1')
{
//erfolgreich
MessageBox( resp_dump[1], '' );
}
else
{
//fehler
MessageBox( resp_dump[1], '' );
}
}
function submit_kontakt()
{
var parameter = '';
draw_ajax('ajax_submit_kontakt', '', parameter, 'submit_kontakt_final','kontaktformular', 'response');
}
function order_password_final(resp)
{
if (resp==1)
{
MessageBox('Ihr neues Passwort wurde Ihnen erfolgreich an Ihre Emailadresse geschickt.');
}
else
{
MessageBox('Fehler '+ resp);
}
}
function order_password(email)
{
var parameter = email;
draw_ajax('ajax_order_password', '', parameter, 'order_password_final','passwortvergessen_form', 'response');
}
function delete_product_from_wl_final(resp)
{
//alert(resp);
if (resp=='0')
{
}
else
{
$('shop_wlprod_del_confirm').style.display='none';
$('grey').style.display='none';
draw_wunschzettel_produkte(resp);
}
}
function wlprod_delete_confirm_final(type, prod_id, wz_id)
{
if (type==2)
{
$('shop_wlprod_del_confirm').style.display='none';
$('grey').style.display='none';
}
else if (type==1)
{
//alert(wz_id + ' ' + prod_id);
var parameter = wz_id + '&prod_id='+prod_id;
draw_ajax('ajax_delete_product_from_wl', '', parameter, 'delete_product_from_wl_final','wunschzettel_detail_produkteform', 'response', wz_id);
}
}
function delete_product_from_wl(wz_id, prod_id)
{
alert('delete');
$('delprodid').value= prod_id;
$('delwzid').value= wz_id;
$('shop_wlprod_del_confirm').style.display='block';
CenterElement( $('shop_wlprod_del_confirm') );
return;
var $element = $('shop_wlprod_del_confirm');
var w = (window.innerWidth > document.body.clientWidth)?
window.innerWidth : document.body.clientWidth;
w -= $element.offsetWidth;
w *= 0.5;
if( w )
w += document.body.scrollLeft;
$element.style.left = w + 'px';
var h = (window.innerHeight > document.body.clientHeight)?
window.innerHeight : document.body.clientHeight;
h -= $element.offsetHeight;
h *= 0.4;
h += document.body.scrollTop;
$element.style.top = h + 'px';
//$('grey').style.display='block';
}
function check_content_length()
{
}
function send_wunschzettel_final(resp)
{
//alert(resp);
if (resp==0)
{
MessageBox('Fehler Beim Wunschzettel versenden');
}
else if (resp==1)
{
MessageBox('Nicht alle Emails konnten gesendet werden aber zumindest 1 ging raus');
}
else if (resp==2)
{
MessageBox('Ihr Wunschzettel wurde erfolgreich gesendet');
}
else if (resp==3)
{
MessageBox('Bitte fügen Sie erst 1 oder mehrere Empfänger zu Ihrem Wunschzettel hinzu!');
}
else if (resp==4)
{
MessageBox('Bitte fügen Sie erst 1 oder mehrere Neuheiten zu Ihrem Wunschzettel hinzu!');
}
else if (resp==5)
{
MessageBox('Falsches Email Format');
}
else if (resp==6)
{
MessageBox('Falsches Email Format');
}
else if (resp==7)
{
try
{
$('neue_emailname').value='';
$('neue_emailemail').value='';
}
catch (e)
{
}
draw_wunschzettel_detail_final();
MessageBox('Erfolgreich gespeichert');
}
else
{
try
{
$('neue_emailname').value='';
$('neue_emailemail').value='';
}
catch (e)
{
}
draw_wunschzettel_detail_final();
//alert(resp);
}
}
function send_wunschzettel(type)
{
var parameter = type;
draw_ajax('ajax_sende_wunschzettel', '', parameter, 'send_wunschzettel_final','form_wunschzettel_detail', 'response');
}
function draw_wunschzettel_detail_final(type, id)
{
if (type=='')
{
var parameter = $('wz_id').value + '&type='+type + '&detailid='+id;
draw_ajax('ajax_draw_wunschzettel_detail_emailcontainer', 'wunschzettel_detail_emailcontainer', parameter, '','form_wunschzettel_detail', '');
}
else
{
//alert($('form_wunschzettel_emaildetail'));
var parameter = $('wz_id').value + '&type='+type + '&detailid='+id;
draw_ajax('ajax_draw_wunschzettel_detail_emailcontainer', 'wunschzettel_detail_emailcontainer', parameter, '','form_wunschzettel_detail', '');
}
}
function update_wunschzettel_detail(wz_id, type)
{
if (type=='nachricht')
{
var parameter = wz_id;
draw_ajax('ajax_update_wunschzettel_detail', '', parameter, '','form_wunschzettel_detail', '');
}
}
function draw_wunschzettel_produkte(wz_id)
{
var parameter = wz_id;
draw_ajax('ajax_draw_wunschzettel_produkte', 'wunschzettel_detail_produkte', parameter, '','wunschzettel_detail_produkteform', '');
}
function submit_userdaten_final(resp)
{
//alert(resp);
var resp_dump = resp.split('|');
if (resp_dump[0]=='1')
{
//erfolgreich
if($('registermaintrue'))
{
//neue registrierung
$('reg_anrede').innerHTML=resp_dump[2];
$('reg_vorname').innerHTML=resp_dump[4];
$('reg_name').innerHTML=resp_dump[3];
$('registermaintrue').style.display='block';
$('registermain').style.display='none';
}
else
{
//alter registrierung
MessageBox( 'Ihre Userdaten wurden erfolgreich aktualisiert', '' );
}
//alert('erfolgreich eingetragen');
//$('MAIN').innerHTML='erfolgreich eingetragen';
}
else
{
//fehler
MessageBox( resp_dump[1], '' );
}
}
function submit_userdaten(type)
{
var parameter = type;
draw_ajax('ajax_submit_userdaten', '', parameter, 'submit_userdaten_final','form_userdaten', 'response');
}
function open_mitteilung(id, type)
{
var parameter = id + '&type='+type;
draw_ajax('ajax_draw_meine_mitteilungen', 'meine_mitteilungen_content', parameter, '','mitteilungen_form');
}
function einblenden_user(elementname1,elementname2,contentid, type,id)
{
if (type=='meine_stammdaten')
{
draw_ajax('ajax_draw_meine_stammdaten', $(contentid), '', '','login', '');
}
else if (type=='meine_infoscout')
{
draw_ajax('ajax_draw_meine_infoscout', $(contentid), '', '','login', '');
}
else if (type=='meine_bestellungen')
{
draw_ajax('ajax_draw_meine_bestellungen', $(contentid), '', '','login', '');
}
else if (type=='meine_mitteilungen')
{
draw_ajax('ajax_draw_meine_mitteilungen', $(contentid), '', '','login', '');
}
else if (type=='meine_weiterleitungen')
{
draw_ajax('ajax_draw_meine_weiterleitungen', $(contentid), '', '','login', '');
}
else if (type=='meine_wunschzettel')
{
draw_ajax('ajax_draw_meine_wunschzettel', $(contentid), '', '','login', '');
}
else if (type=='meine_nichtvergessen')
{
draw_ajax('ajax_draw_meine_nichtvergessen', $(contentid), '', '','login', '');
}
else if (type=='meine_neuheiten')
{
draw_ajax('ajax_draw_meine_neuheiten', $(contentid), '', '','login', '');
}
else if (type=='wunschzettel_detail')
{
draw_ajax('ajax_draw_wunschzettel_detail', $(contentid), id, 'draw_wunschzettel_detail_final','login', '');
}
$(elementname1).style.display='block';
$(elementname2).style.display='none';
}
function ausblenden_user(elementname1,elementname2,contentid,type)
{
$(contentid).innerHTML = '';
$(elementname1).style.display='none';
$(elementname2).style.display='block';
}
function order_submit_final(resp)
{
var resp_dump = resp.split('|');
if (resp_dump[0]=='1')
{
//order_div_2
$('order_div_2').style.display='block';
$('order_div_1').style.display='none';
}
else
{
MessageBox( resp_dump[1], '' );
}
}
function order_submit()
{
draw_ajax('ajax_order_submit', '', '', 'order_submit_final','order', 'response');
}
function merken_final(resp)
{
if (resp=='1')
{
MessageBox( 'erfolgreich gemerkt', '' );
}
}
function merken(id)
{
draw_ajax('ajax_produkt_merken', '', id, 'merken_final','merken', 'response');
}
function send_mitteilung_an_anbieter()
{
draw_ajax('ajax_send_mitteilung_an_anbieter', '', '', 'close_mitteilung_an_anbieter','form_mitteilung', '');
}
function close_mitteilung_an_anbieter()
{
close_greybox('mitteilunggrey');
$('div_mitteilung').style.display='none';
// $('grey').style.display='none';
}
function mitteilung_an_anbieter()
{
GreyBox('mitteilunggrey');
$('div_mitteilung').style.display='block';
CenterElement( $('div_mitteilung') );
// $('grey').style.display='block';
}
function send_weiterleiten2(resp)
{
if (resp=='error')
{
$('weiterleiten_email').style.backgroundColor='#FF0000';
}
else
{
close_greybox('weiterleitengrey');
$('div_weiterleiten').style.display='none';
}
}
function send_weiterleiten()
{
draw_ajax('ajax_send_weiterleiten', '', '', 'send_weiterleiten2','form_weiterleiten', 'response');
}
function close_weiterleiten()
{
// alert($('weiterleitengrey'));
$('div_weiterleiten').style.display='none';
close_greybox('weiterleitengrey');
}
function weiterleiten()
{
close_promo1(0);
GreyBox('weiterleitengrey');
$('div_weiterleiten').style.display='block';
CenterElement( $('div_weiterleiten') );
//$('grey').style.display='block';
}
function ChangeBigPreview( sender, imgurl )
{
var img = document.getElementById('b_big_1');
img.src=imgurl;
img.alt=sender.alt;
img.title=sender.title;
document.getElementById('pd_fullsize_description').innerHTML = sender.title;
var container = document.getElementById('big_preview_container');
with( container.style )
{
width = document.body.scrollWidth + 'px';
height = '';
if( display != 'block' )
{
display = 'block';
}
}
if( container.offsetHeight < document.body.offsetHeight )
{
container.style.height = document.body.offsetHeight + 'px';
}
}
function close_wunschzettel()
{
$('div_wunschzettel').style.display='none';
$('grey').style.display='none';
}
function draw_wunschzettel(prodid)
{
var parameter = prodid
draw_ajax('ajax_draw_wunschzettel', 'div_wunschzettel', parameter, '','suche', '');
}
function add_to_infoscout_final(resp)
{
MessageBox( resp, '' );
}
function add_to_infoscout(email)
{
//infoscout_katid
draw_ajax('ajax_insert_infoscout', '', email, 'add_to_infoscout_final','infoscout_add', 'response');
}
function delete_product_from_wunschzettel_final(resp)
{
draw_ajax('ajax_draw_meine_wunschzettel', 'meine_wunschzettel_content', '', '','form_wunschzettel', '');
}
function delete_product_from_wunschzettel(id)
{
draw_ajax('ajax_delete_wunschliste', '', id, 'delete_product_from_wunschzettel_final','form_wunschzettel', 'response');
}
function delete_product_from_merkliste_final(resp)
{
draw_ajax('ajax_draw_meine_neuheiten', 'meine_neuheiten_content', '', '','form_neuheiten', '');
}
function delete_product_from_merkliste(merkid)
{
draw_ajax('ajax_delete_merkliste', '', merkid, 'delete_product_from_merkliste_final','form_neuheiten', 'response');
}
function delete_product_from_weiterleitung_final(resp)
{
draw_ajax('ajax_draw_meine_weiterleitungen', 'meine_weiterleitungen_content', '', '','form_weiterleitung', '');
}
function delete_product_from_weiterleitung(wlid)
{
draw_ajax('ajax_delete_weiterleitung', '', wlid, 'delete_product_from_weiterleitung_final','form_weiterleitung', 'response');
}
function delete_infoscout_final(resp)
{
draw_ajax('ajax_draw_meine_infoscout', 'meine_infoscout_content', '', '','form_infoscout', '');
}
function delete_infoscout(katid)
{
draw_ajax('ajax_delete_infoscout', '', katid, 'delete_infoscout_final','form_infoscout', 'response');
}
function check_login_final(resp)
{
//alert(resp);
if (resp=="0")
{
MessageBox( 'Login fehlgeschlagen!', '' );
}
else
{
var dump = resp.split('|');
//location.href=resp;
var loginuser = dump[1];
var loginpass = dump[2];
var challenge = dump[0];
if (challenge=='')
{
//alert('user login erfolgreich');
}
else
{
$('loginuser').value=loginuser;
$('loginuser').name='loginuser'+challenge;
$('loginpass').value=loginpass;
$('loginpass').name='loginpass'+challenge;
$('challenge').value= challenge;
$('login2').action = dump[3];
document.forms.login2.submit();
}
}
}
function check_login_final2(resp)
{
//alert(resp);
}
function check_login2()
{
var user = $('username2').value;
var pass = $('realpass2').value;
draw_ajax('ajax_check_login', '', '', 'check_login_final','login3', 'response');
}
function check_login()
{
var user = $('username').value;
var pass = $('realpass').value;
draw_ajax('ajax_check_login', '', '', 'check_login_final','login', 'response');
}
function draw_ajax(function_name, returner_id, parameter, rfunction_name, post, rfunction_name_parameter)
{
if (!parameter)
{
parameter='';
}
if ((!post) || (post==''))
{
var post_id = 'kontaktformular';
}
else
{
var post_id = post;
}
var dumper = $(post_id);
new Ajax.Request(ajax_root_url + '?wrapper=infoscout&mid=26&func='+function_name+'&p='+parameter,
{
parameters: $(post_id).serialize(true),
method:'post',
onSuccess: function(transport)
{
var response = transport.responseText;
if ((response=='FALSE') || (response==''))
{
}
else
{
//alert(response);
if (returner_id!='')
{
if (($(returner_id).style.display) && ($(returner_id).style.display=='none'))
{
$('grey').style.height = document.body.scrollHeight;
$('grey').style.display='block';
$(returner_id).style.top=50 + document.body.scrollTop;
$(returner_id).style.display = 'block';
}
$(returner_id).innerHTML = response;
}
if (rfunction_name!='')
{
if (rfunction_name_parameter=='response')
{
rfunction_name_parameter = response;
}
eval(rfunction_name + '(rfunction_name_parameter);');
}
}
},
onFailure: function()
{
alert('Something went wrong...');
}
});
}
function change_picture(id)
{
var middle_pic = $('big'+id).value;
$('middle_img').src = middle_pic;
$('middle_img').alt = $('alt'+id).alt;
$('middle_img').title = $('alt'+id).title;
$('PD_GROSSES_BILD_DESC').innerHTML = $('alt'+id).alt;
}
function einblenden(elementname1,elementname2)
{
document.getElementById(elementname1).style.display='block';
document.getElementById(elementname2).style.display='none';
}
function ausblenden(elementname1,elementname2)
{
document.getElementById(elementname1).style.display='none';
document.getElementById(elementname2).style.display='block';
}
var NAV = {};
NAV.ToKategory = function( $KatId )
{
//navigation holen
var $Method = 'GET';
var $Url = '/classes/ajax_wrapper.php?wrapper=nav&func=HandleRequest';
var $bAsync = false;
var $xhr = new XMLHttpRequest();
if( $KatId )
$Url += '&kat='+$KatId;
$xhr.open( $Method, $Url, $bAsync );
$xhr.send( '' );
var $Container = document.getElementById( 'navigation' );
$Container.innerHTML = $xhr.responseText;
//main updaten
//herausfinden ob ein komplettes update notwendig ist oder nur nicht
//promorechts udaten
//alert ('promo');
}