/* Einstellung für PopFenster */
var iDeltaX = -50;
var iDeltaY = -150;


function PicPrev(url, src) {
	url = url + "?src=" + src;
	NewWindow(url, 100, 100, "showimg", "yes");
}

function NewWindow(url, w, h, name, scroll) {
	NewWin = window.open(url,name,"width="+w+",height="+h+",scrollbars="+scroll+",status=no,toolbar=no,menubar=no,resizable=yes");
	NewWin.focus();
}

function preview() {
	url = p + ";bPrint:1";
	printWin = window.open(url, "printpage", "width=620,height=600,scrollbars=yes,status=no,toolbar=no,menubar=yes,resizable=no");
	printWin.focus();
}

function search() {
	document.frmSearch.submit();
}

function newwin(w,h) {
  myparm = 'width='+ w +',height='+ h +',scrollbars=no,status=no,toolbar=no,menubar=no';

  mywindow=window.open('','newwin',myparm);
  mywindow.focus();
}


window.addEvent('domready', function() {
	//initAccordion();
	//initLayPop();
});

function initLayPop() {
	$$('.lnkLayer').each(function(obj) {
		obj.addEvent('click', function(e) {
			e = new Event(e).stop();
		});
		obj.addEvent('mouseover', function(e) {
			obj = this;
			/*(function() {*/
				removePopup(e, obj, 'mo');
				createPopup(e, obj, 'mo');
			/*}).delay(1000);*/
		});
		obj.addEvent('mouseout', function(e) {
			obj = this;
			/*(function() {*/
				removePopup(e, obj, 'mo');
			/*}).delay(1000);*/
		});
	});
	$$('.lnkPopup').each(function(obj) {
		obj.addEvent('click', function(e) {
			removePopup(e, this, 'mc');
			createPopup(e, this, 'mc');
		});
	});
	$$('.lnkPopupOhneIcon').each(function(obj) {
		obj.addEvent('click', function(e) {
			removePopup(e, this, 'mc');
			createPopup(e, this, 'mc');
		});
	});
	$$('.lnkPopupFilm').each(function(obj) {
		obj.addEvent('click', function(e) {
			removePopup(e, this, 'mc');
			createPopup(e, this, 'mc');
		});
	});
	$$('.lnkFilm').each(function(obj) {
		obj.addEvent('click', function(e) {
		});
	});
	$$('.lnkMusik').each(function(obj) {
		obj.addEvent('click', function(e) {
		});
	});
}

function createPopup(e, obj, sE) {

	if (sE=='mc') {
		e = new Event(e).stop();
	}

	var url = obj.getProperty('href');

	if (url) {
		var iT = obj.getTop()+iDeltaY;
		var iL = obj.getLeft()+iDeltaX;

		var objPopupBox = new Element('div', {
		    'styles': {
		        'position': 'absolute'
		    },
		    'id': 'objPopupBox'
	    });
		var objPopup = new Element('div', {
		    'styles': {
		        'position': 'absolute',
		        'top': iT + 'px',
		        'left': iL + 'px',
		        'background': '#FFF',
		        'border': '1px #01284E solid',
		        'z-index': '90'
		    },
		    'events': {
		        'click': function(){
		            //aaa
		        },
		        'mousedown': function(){
		            //aaa
		        }
		    },
		    'id': 'objPopup',
		    'class': 'myClassSuperClass'
		});

		new Ajax(url, {
			method: 'get',
			update: objPopup,
			onComplete: fillPopup
		}).request();

		objPopup.injectInside(objPopupBox);
		objPopupBox.injectBefore('titleArea');
	}
}

function fillPopup(response) {
	/*alert(response);*/
}

function removePopup(e, obj, sE) {

	if (sE=='mc') {
		e = new Event(e).stop();
	}

	if ($('objPopupBox')) {
		$('objPopupBox').remove();
	}
}

