var pageTracker;
function getWindows(){
var elms= $$('.window');
if (elms.length>0){
return $(elms[elms.length-1]).id;
} else {
return 0;
}
}
function addWin(){
var id=getWindows();
var win = new Element('div', {'id': id,'class': 'window border padding','html': 'lulu'});
$('containerContent').appendChild(win);
ajaxRequest('/de/keller1.php',win);
}
window.addEvent('load', function() {
if(pageTracker) {
$$('a[href^=http]').each(function(el) {
el.addEvent('click',function() {
var dd = '/outgoing/' + el.get('href').replace('http://','');
pageTracker._trackPageview(dd);
}.bind(this));
});
}
});
window.addEvent('domready', function() {
// init ajax cart
ajaxRequest('/cart.php','cart');
// cart end
if (!$('submenu')){
$('bookingDetails').addEvent('mousemove',function(e) {
if (e.page.y>620){
$('cartWrapper').setStyle('top', (e.page.y-35)+"px");
}
});
// add event for booking button
if ($('booking')){
$('booking').addEvent('click', function(){
ajaxRequest('/de/ajax/booking.php?id='+$('booking').get('rel'),'bookingDetails');
});
}
}
// booking end
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
new Asset.javascript(gaJsHost + "google-analytics.com/ga.js", {
onload: function() {
pageTracker = _gat._getTracker("UA-939964-40");
pageTracker._initData();
pageTracker._trackPageview();
}
});
var ticker = window.setInterval("checkBookings()", 720);
if ($('gebietsAuswahl_uncheckAll')){
$('gebietsAuswahl_uncheckAll').addEvent('click', function(e){
var inp = $$('#gebietsauswahl input');
inp.each(function(elm, i){
if (elm.type=="checkbox") elm.checked=false;
});
});
}
if ($('gebietsAuswahl_checkAll')){
$('gebietsAuswahl_checkAll').addEvent('click', function(e){
var inp = $$('#gebietsauswahl input');
inp.each(function(elm, i){
if (elm.type=="checkbox") elm.checked=true;
});
});
}
if ($('gebietsAuswahl_save')){
$('gebietsAuswahl_save').addEvent('click', function(e){
var inp = $$('#gebietsauswahl input');
inp.each(function(elm, i){
if (elm.type=="checkbox") {
Cookie.write(elm.id, elm.checked, {duration: 7});
}
});
location.reload();
});
}
var elms= $$('.expandHandle');
/*elms.each(function(elm, i){
elm.addEvent('click', function(e){
var expElms=(elm.id).split("_");
var expElm=expElms[0];
if ($(expElm).hasClass('opened')){
$(expElm).removeClass('opened');
$(expElm).addClass('closed');
Cookie.write(expElms[0], '1', {duration: 7});
} else {
$(expElm).removeClass('closed');
$(expElm).addClass('opened');
Cookie.dispose(expElms[0]);
}
});
});
*/
initForms();
initFormsChange();
initInputs();
initInputsChange();
});
function handleBannerClick(obj){
var containerBanner=$(obj).getParent();
var link=$(containerBanner).getProperty("rel");
var banner_id=$(containerBanner).getProperty('id');
if ($(containerBanner).getProperty("target")=="_blank") {
new Request({url: '/de/ajax/handleBannerClick.php', method: 'get', async: true,onSuccess:function(){window.open(link);}}).send('banner_id='+banner_id);
} else {
new Request({url: '/de/ajax/handleBannerClick.php', method: 'get', async: false,onSuccess:function(){document.location.href=link;}}).send('banner_id='+banner_id);
}
}
function initInputs(){
removeSubmit();
var inputs=$$('.validate');
if (inputs.length>0)
$('formErrors').set('value',inputs.length);
inputs.each(function(inp, i){
if (($(inp).get('type'))!="checkbox") {
$(inp).addEvent('change', function(e) {
var valid=$(inp).getProperty("rel");
var inputValue=$(inp).get('value');
formRequest(valid+"?value="+inputValue, $(inp).id+'_error');
checkSubmitNormal();
});
} else {
$(inp).addEvent('change', function(e) {
var valid=$(inp).getProperty("rel");
var inputValue=$(inp).get('checked');
formRequest(valid+"?value="+inputValue, $(inp).id+'_error');
checkSubmitNormal();
});
}
});
}
function initInputsChange(){
var inputs=$$('.validate_change');
if (inputs.length>0)
$('formErrors').set('value',0);
inputs.each(function(inp, i){
if (($(inp).get('type'))!="checkbox") {
$(inp).addEvent('change', function(e) {
var valid=$(inp).getProperty("rel");
var inputValue=$(inp).get('value');
formRequestChange(valid+"?value="+inputValue, $(inp).id+'_error');
});
} else {
$(inp).addEvent('change', function(e) {
var valid=$(inp).getProperty("rel");
var inputValue=$(inp).get('checked');
formRequestChange(valid+"?value="+inputValue, $(inp).id+'_error');
});
}
});
}
function ajaxRequest(url, id){
if (pageTracker){
pageTracker._trackPageview('/ajax/'+url);
}
//document.getElementById(id).innerHTML='
';
$(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
//document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
$(id).set('html',this.response.text);
// Keller 2009
//Milkbox.initialize();
initForms();
initFormsChange();
initInputs();
initInputsChange();
applyKino();
}
}).send();
}
function ajaxRequestReload(url, id){
if (pageTracker){
pageTracker._trackPageview('/ajax/'+url);
}
//document.getElementById(id).innerHTML='
';
$(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
//document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
document.location.reload();
}
}).send();
}
function str_replace(search, replace, subject) {
return subject.split(search).join(replace);
}
function ajaxRequestImage(url, id){
$(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
//document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
$(id).set('html',this.response.text);
Milkbox.initialize();
}
}).send();
}
function ajaxRequestPost(url, id){
//document.getElementById(id).innerHTML='
';
$(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'post',
evalScripts: true,
evalResponse: false,
onFailure: function(){
document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
$(id).set('html',this.response.text);
//Milkbox.initialize();
initDraggables();
initForms();
initFormsChange();
initInputs();
initInputsChange();
}
}).send();
}
function resetFolders(id_old,id_new){
$('imageLoader').set('html',' ');
//$(id_old).set('id', id_new);
}
function walkToPrevious(){
$('walkTo').value=(parseInt($('walkTo').value)-1);
var to=$('walkTo').value;
if (to==-1) {
var currentPage=parseInt($('page').value);
var maxPage=parseInt($('total').value);
var idr=parseInt($('idr').value);
var fileDir=$('dir').value;
var gpass=$('gpass').value;
if (currentPage>0){
ajaxRequest('/de/imageLoader.php?dir='+fileDir+'&page='+(currentPage-1)+'&gpass='+gpass+'&idr='+idr,'imageLoader');
} else {
to=0;
$('walkTo').value=0;
}
}
$('scrollerReport').setStyle("top", (0-260*to));
}
function walkToNext(){
$('walkTo').value=(parseInt($('walkTo').value)+1);
var to=$('walkTo').value;
if (to==12) {
var currentPage=parseInt($('page').value);
var idr=parseInt($('idr').value);
var maxPage=parseInt($('total').value);
var slideon=parseInt($('slideon').value);
var fileDir=$('dir').value;
var gpass=$('gpass').value;
if (currentPage';
}
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
if ($(id).get('type')=="text"){
$(id).set('value',this.response.text);
} else {
$(id).set('html',this.response.text);
}
}
}).send();
}
function removeSubmit(){
if ($('formSubmit')){
if ($('formSubmit').get('type')=="submit"){
if ($('formErrors').get('type')=="text"){
$('formSubmit').removeClass('visible');
$('formSubmit').addClass('invisible');
}
}
}
}
function formRequest(url, id){
document.getElementById(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
if (this.response.text=="") {
$(id).set('html','
');
var idElms=(id).split("_");
//if (($(idElms[0]).type!="password")) $(idElms[0]).set('disabled', true);
$(idElms[0]).addClass('greenBorder');
var err=$('formErrors').get('value');
err--;
$('formErrors').set('value', err);
if ($('formErrors').get('value')<1) {
$('formSubmit').removeClass('invisible');
$('formSubmit').addClass('visible');
} else {
//$('formSubmit').removeClass('visible');
//$('formSubmit').addClass('invisible');
}
} else {
$(id).set('html','
'+this.response.text);
}
initForms();
}
}).send();
}
function formRequestChange(url, id){
document.getElementById(id).innerHTML='
';
var myAjax = new Request(
{ url: url,
method: 'get',
evalScripts: true,
evalResponse: false,
onFailure: function(){
document.getElementById(id).innerHTML="Ajax Request Error";
},
onComplete: function(){
if (this.response.text=="") {
$(id).set('html','
');
var idElms=(id).split("_");
var err=$('formErrors').get('value');
if (err>0)
err--;
$('formErrors').set('value', err);
checkSubmit();
//if (($(idElms[0]).type!="password")) $(idElms[0]).set('disabled', true);
$(idElms[0]).addClass('greenBorder');
} else {
$(id).set('html','
'+this.response.text);
var err=$('formErrors').get('value');
err++;
$('formErrors').set('value', err);
checkSubmit();
}
initFormsChange();
}
}).send();
}
function checkSubmit(){
if ($('formSubmit')){
if ($('formErrors').get('type')=="text"){
if ($('formErrors').get('value')<1) {
$('formSubmit').removeClass('invisible');
$('formSubmit').addClass('visible');
} else {
$('formSubmit').removeClass('visible');
$('formSubmit').addClass('invisible');
}
}
}
}
function checkSubmitNormal(){
if ($('formErrors').get('type')=="text"){
if ($('formErrors').get('value')>0) {
$('formSubmit').removeClass('visible');
$('formSubmit').addClass('invisible');
} else {
$('formSubmit').removeClass('invisible');
$('formSubmit').addClass('visible');
}
}
}
function initForms(){
var frms=$$('.ajaxForm');
frms.each(function(frm, i){
$(frm).addEvent('submit', function(e) {
new Event(e).stop();
var log = $('log_res').empty();
this.set('send', {
url: this.action,
evalScripts: true,
method: 'get',
onSuccess: function(responseText, responseXML) {
log.set('html',responseText);
}
})
this.send();
});
});
}
function initFormsChange(){
checkSubmit();
var frms=$$('.ajaxForm');
frms.each(function(frm, i){
$(frm).addEvent('submit', function(e) {
new Event(e).stop();
removeSubmit();
var log = $('log_res').empty();
this.set('send', {
url: this.action,
evalScripts: true,
method: 'get',
onSuccess: function(responseText, responseXML) {
log.set('html',responseText);
}
})
this.send();
});
});
}
function schwammerl(){
alert('bodhur');
}
function slideLeft(div) {
$(div).setStyle('opacity', 1).set('tween', { duration: 600, transition: Fx.Transitions.Quart.easeOut }).tween('margin-left', [600, 0]);
}
function slideRight(div) {
$(div).setStyle('opacity', 1).set('tween', { duration: 600, transition: Fx.Transitions.Quart.easeOut }).tween('margin-left', [-600, 0]);
}
function slideLoad(adr, div) {
new Request({ method: 'post',
url: adr,
onComplete: function(data) { $(div).set('html', 'xxx'+data); }
}).send();
}
function initDraggables(){
document.ondragstart = function () { return false; }; //IE drag hack
//for every dragable image...
$$('.dragable').each(function(drag) {
//this is where we'll save the initial spot of the image
var position = drag.getPosition();
//make it dragable, and set the destination divs
new Drag.Move(drag, {
droppables: '.droppable',
onDrop: function(el,droppable) {
if(droppable.get('rel') != 'orsched')
{
var x=$(el).getParent();
var oridir="";
if ($(x).get('rel')!=null) oridir=$(x).get('rel');
if (droppable.get('id')=="trashcan"){
miniRequest('/de/ajax/deleteImage.php?image='+$(el).id+'&subdir='+$(droppable).id,'mover');
} else {
miniRequest('/de/ajax/moveImage.php?oridir='+oridir+'&image='+$(el).id+'&subdir='+$('input_'+droppable.id).value,'mover');
}
//el.inject(droppable).addClass('locked');
el.setStyles({'left':0,'top':0,'display':'none','margin':0}); //hack -- wtf?
droppable.set('rel','filled');
this.detach();
//this.destroy();
}
},
onEnter: function(el,droppable) {
//colors!
droppable.addClass('mo');
},
onLeave: function(el,droppable) {
droppable.removeClass('mo');
}
});
drag.setStyles({ 'top':0, 'left':0, 'margin-right':'20px' });
});
}
function walkToImage(idr,ind, fil){
if ($defined($('walkTo'))){
$('walkTo').set('value',ind);
$('scrollerReport').setStyle("top", (0-260*ind));
} else {
ajaxRequestImage('/de/ajax/viewImage.php?idr='+idr+'&index='+ind+'&files='+fil,'bigImage');
}
}
function newload(){
alert("dududu");
}
function checkStop(){
if ($('slideon').value==1){
$('slideStop').removeClass('invisible');
$('slideStop').addClass('visible');
} else {
$('slideStop').removeClass('invisible');
$('slideStop').addClass('visible');
}
}
function setSlideShow(){
$('slideon').value="1";
}
function slideShow(){
if ($('slideon').value==1){
setTimeout("slideShow()",3000);
walkToNext();
}
}
function checkPasswordRepeat(){
var pwd=$('passwordenter').get('value');
var repeat=$('passwordrepeat').get('value');
if (pwd==repeat){
$('passwordrepeat_error').set('html','
');
var err=$('formErrors').get('value');
err--;
$('formErrors').set('value', err);
if ($('formErrors').get('value')<1) {
$('formSubmit').removeClass('invisible');
$('formSubmit').addClass('visible');
} else {
$('formSubmit').removeClass('visible');
$('formSubmit').addClass('invisible');
}
} else {
$('passwordrepeat_error').set('html','
Password und Wiederholung müssen übereinstimmen.');
}
}
function save_comment(){
var title=document.getElementById('titel').value;
var id_user=document.getElementById('id_user').value;
var comment_type=document.getElementById('comment_type').value;
var comment_text=document.getElementById('comment_text').value;
var id_link=document.getElementById('id_link').value;
document.getElementById('ajax_updater').innerHTML='
';
ajaxRequest('/de/ajax/commentUpdater.php?title='+title+'&id_user='+id_user+'&comment_type='+comment_type+'&comment_text='+escape(comment_text)+'&id_link='+id_link, 'ajax_updater');
document.getElementById('ajax_form').style.display='none';
//button_activate('submit');
var box_comments=document.getElementById('box_comments');
}
function save_comment_text(){
var title=document.getElementById('titel').value;
var id_user=document.getElementById('id_user').value;
var comment_type=document.getElementById('comment_type').value;
var comment_text=document.getElementById('comment_text').value;
var id_link=document.getElementById('id_link').value;
document.getElementById('ajax_updater').innerHTML='
';
ajaxRequest('/de/ajax/setUserText.php?title='+title+'&id_user='+id_user+'&comment_type='+comment_type+'&comment_text='+escape(comment_text)+'&id_link='+id_link, 'ajax_updater');
document.getElementById('ajax_form').style.display='none';
//button_activate('submit');
var box_comments=document.getElementById('box_comments');
}
function show(id){$(id).setStyle('display','block');}
function hide(id){$(id).setStyle('display','none');}
function trackPage(url){
pageTracker._trackPageview(url);
}
function checkBookings(){
}
function applyKino(){
$$('.chair').removeEvents();
$$('.chair').each(function(el) {
if (el.hasClass('available')){
el.addEvent('click',function() {
var productid=el.get('rel');
var id_option=el.get('id');
ajaxRequest('/cart.php?action=add_product&id_product='+productid+'&quantity=1&id_option='+id_option,'cart');
el.removeClass('available');
el.addClass('occupied');
}.bind(this));
}
});
}