

/*
function show_sending(){
	send_div = $('sending');
	if (send_div) send_div.show();
	send_butt = $('send_mail_butt');
	if (send_butt) send_butt.hide();	
}
function hide_sending(){
	send_div = $('sending');
	if (send_div) send_div.hide();
	send_butt = $('send_mail_butt');
	if (send_butt) send_butt.show();	
}

function ax_email_form(form_id){
show_sending();

url=lv()+'mail_form_handler_ax.php'
//alert(url);
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: conf_mail,
		onFailure: fail_mail
	});
}

*/
function ax_email_form_post(form_id){
show_sending();

url= 'mail_form_handler_ax.php'
//alert(url); 
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'post', 
		parameters: pars, 
		onComplete: conf_mail,
		onFailure: fail_mail
	});
}



function conf_mail(originalRequest){
	var part = originalRequest.responseText.split("_#__#_");	
	returned_msg=part[0];
	
	hide_sending();
	if (part[1]=='ERROR'){
		$('message_div').removeClassName('message_div');
		$('message_div').addClassName('message_div_alert');
		$('message_div').update(returned_msg).show();
	}else{
		$('message_div').removeClassName('message_div_alert');
		$('message_div').addClassName('message_div');
		$('message_div').update(returned_msg).show();	
		//weg2('send_mail_butt','shrink');
		setTimeout("weg2('message_div','fade')",15000);   
	}
}
function fail_mail(originalRequest){
var returned_msg = originalRequest.responseText;
}




function google_site_search(term) {
//alert(term);
if (term=='') return false;

url='http://www.google.com/search?q=site:www.cncdynamix.ch ' + escape(term);
tit= 'cncdynamix Site-Suche';
w1=getviewportWidth();
h1=getviewportHeight();

//myLightWindow.activateWindow({href: url, 	title: tit, width: w1 ,height: h1});
//myLightWindow.activateWindow({href: url, 	title: tit});

//PopupLarge_sized(url,w1,h1);

//window.location.href = url;

window.open(url);

}

// onmouseover="Effect.Pulsate(this);" 
function nifty_all(){
if ($('pH_div')) {Nifty("ul#pH_div","big all");}

Nifty("ul.split_blue h3","top");
Nifty("ul.split_red h3","top");
Nifty("ul.split_green h3","top");
Nifty("ul.split_gold h3","top");
Nifty("ul.split_silver h3","top");
Nifty("ul.split_black h3","top");
}


function show_cont(trig_show,trig_hide,which_div){
show2(which_div,'blind');
$(trig_show).hide();
$(trig_hide).show();
}

function hide_cont(trig_show,trig_hide,which_div){
weg2(which_div,'blind');
$(trig_hide).hide();
$(trig_show).show();
}


function alert_n(text){
grayOut(true, {'zindex':'90', 'bgcolor':'#334455', 'opacity':'70'});
alert(text);
grayOut(false);
}
function alert_r(text){
grayOut(true, {'zindex':'90', 'bgcolor':'#aa0000', 'opacity':'70'});
alert(text);
grayOut(false);
}


function check_if_email_existst(email_address){
if(email_address!=''){
	do_qu('ax_upd_cat.php','id=4_'+email_address,'check_if_email_existst_CONF');
	Modalbox.resizeToInclude('errmsg_firstname',
	{afterResize: 
	function(){
	new Effect.Appear('check_if_email_existst_CONF');
	}});
}}


function validate_regform(form_id){
return_val = true;
if( $('firstname').value==''  ){
	$('errmsg').update('Vornamen eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('lastname').value==''  ){
	$('errmsg').update('Nachnamen eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('email_address').value=='' || !checkEmail( $('email_address').value ) ){
	$('errmsg').update('Email-Adresse ung&uuml;ltig oder leer!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}


if( $('telephone').value==''  ){
	$('errmsg').update('Telefonnummer eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('street_address').value==''  ){
	$('errmsg').update('Strasse eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('postcode').value==''  ){
	$('errmsg').update('Postleitzahl eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('city').value==''  ){
	$('errmsg').update('Ort eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;
}

if( $('password').value==''  ){
	$('errmsg').update('Passwort eingeben!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;	
}

if( $('confirmation').value=='' || $('confirmation').value!=$('password').value  ){
	$('errmsg').update('Passwort-Best&auml;tigung passt nicht oder ist leer!');
	Modalbox.resizeToInclude('errmsg',
	{afterResize: 
	function(){
	new Effect.Appear('errmsg');
	}});
	return_val = false;
	return;	
}

if (return_val===true) {ax_regform(form_id);}

}



function ax_regform(form_id){
show_sending();
url=lv()+'create_account_ax_hndl.php'
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: conf_regform,
		onFailure: fail_regform
	});
}
function conf_regform(originalRequest){
	var part = originalRequest.responseText.split("_#__#_");	
	returned_msg=part[0];
	
	hide_sending();
	if (part[1]=='ERROR'){
		$('message_div').removeClassName('message_div');
		$('message_div').addClassName('message_div_alert');
		$('message_div').update(returned_msg).show();
	}else{
		$('message_div').removeClassName('message_div_alert');
		$('message_div').addClassName('message_div');
		$('message_div').update(returned_msg).show();	
		setTimeout("weg2('message_div','fade')",15000);  
	}
}
function fail_regform(originalRequest){
var returned_msg = originalRequest.responseText;
}

function check_password(){
if ( $('password').value=='' ){
grayOut(true, {'zindex':'90', 'bgcolor':'#334455', 'opacity':'70'});
alert('Bitte Ihr Passwort eingeben!');
grayOut(false);
return false;
}else{
return true;
}
}

function selectAll(theField) {
tempval=$(theField);
tempval.focus();
tempval.select();
}

function show_mind_best_werte(){
var win224 = new Window(
{
className: "mac_os_x",  
width:530, height:240, zIndex: 100, 
resizable: true,  
title: "Mindesbestellwerte nach PLZ:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink,
destroyOnClose:true,
draggable:true, 
wiredDrag: true});

$url=lv()+'show_mind_best_werte.php';
win224.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});

}

function open_vorteile_reg(){

var win346 = new Window(
{
className: "mac_os_x",  
width:720, height:550, zIndex: 100, 
resizable: true, 
title: "Registrieren Sie sich...", 
showEffect:Effect.Appear, hideEffect: Effect.Fade, 
destroyOnClose:true,
draggable:false, 
wiredDrag: false});
$url=lv()+'form_vorteile_reg.php';
win346.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}

function open_coupon_info(){
var win346 = new Window(
{
className: "mac_os_x",  
width:720, height:550, zIndex: 100, 
resizable: true, 
title: "Tragen Sie Ihren Coupon-Code ein...", 
showEffect:Effect.Appear, hideEffect: Effect.Fade, 
destroyOnClose:true,
draggable:false, 
wiredDrag: false});
$url=lv()+'form_coupons.php';
win346.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}

function show_sending(){
	send_div = $('sending');
	if (send_div) send_div.show();
	send_butt = $('send_mail_butt');
	if (send_butt) send_butt.hide();	
}
function hide_sending(){
	send_div = $('sending');
	if (send_div) send_div.hide();
	send_butt = $('send_mail_butt');
	if (send_butt) send_butt.show();	
}
function ax_email_form(form_id){
show_sending();
url=lv()+'mail_form_handler_ax.php'
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: conf_mail,
		onFailure: fail_mail
	});
}
function conf_mail(originalRequest){
	var part = originalRequest.responseText.split("_#__#_");	
	returned_msg=part[0];
	
	hide_sending();
	if (part[1]=='ERROR'){
		$('message_div').removeClassName('message_div');
		$('message_div').addClassName('message_div_alert');
		$('message_div').update(returned_msg).show();
	}else{
		$('message_div').removeClassName('message_div_alert');
		$('message_div').addClassName('message_div');
		$('message_div').update(returned_msg).show();	
		setTimeout("weg2('message_div','fade')",15000);  
	}
}
function fail_mail(originalRequest){
var returned_msg = originalRequest.responseText;
}
function ax_guestbook_form(form_id){
show_sending();
url=lv()+'guestbook_form_handler_ax.php'
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: conf_gbook,
		onFailure: fail_gbook
	});
}
function conf_gbook(originalRequest){
	var part = originalRequest.responseText.split("_#__#_");	
	returned_msg=part[0];
	
	hide_sending();
	if (part[1]=='ERROR'){
		$('message_div').removeClassName('message_div');
		$('message_div').addClassName('message_div_alert');
		$('message_div').update(returned_msg).show();
	}else{
		$('message_div').removeClassName('message_div_alert');
		$('message_div').addClassName('message_div');
		$('message_div').update(returned_msg).show();	
		setTimeout("weg2('message_div','fade')",5000);  
	}
}
function fail_gbook(originalRequest){
var returned_msg = originalRequest.responseText;
}

function ax_review_form(form_id){
show_sending();
url=lv()+'form_product_review_handler.php'
var pars=$(form_id).serialize();
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: conf_review,
		onFailure: fail_review
	});
}
function conf_review(originalRequest){
	var part = originalRequest.responseText.split("_#__#_");	
	returned_msg=part[0];
	
	hide_sending();
	if (part[1]=='ERROR'){
		$('message_div').removeClassName('message_div');
		$('message_div').addClassName('message_div_alert');
		$('message_div').update(returned_msg).show();
	}else{
		$('message_div').removeClassName('message_div_alert');
		$('message_div').addClassName('message_div');
		$('message_div').update(returned_msg).show();	
		setTimeout("weg2('message_div','fade')",5000);  
	}
}
function fail_review(originalRequest){
var returned_msg = originalRequest.responseText;
}

function checkEmail(email) {
  var proto  = "(mailto:)?";
  var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
  var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";

  var rgx    = new RegExp(regex);
  return rgx.exec(email) ? true : false;
}


function cat_folder_name(){
this_url = location.href;
var Suche = this_url.indexOf("catalog_dev");

	if (Suche){
		return 'catalog_dev';
	}else{
		return 'catalog';
	}
}




function doRound(x, pl) {
/*
zahl = zahl.toFixed(places);
Number.toPrecision(x)
*/
var zahl = Math.round(x*Math.pow(10,pl))/Math.pow(10,pl);
return zahl.toFixed(2);

}


function ltrim (value) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
function rtrim (value) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}
function trim (value) {
	return ltrim(rtrim(value));
}



function my_toggle_style(id,from,to){
var obj = $(id);
	 obj.removeClassName(from);
	 obj.addClassName(to);

}
function wordcount(string) {
  var a = string.split(/\s+/g); // split the sentence into an array of words
  return a.length;
}
function countInstances(string, word) {
  var substrings = string.split(word);
  return substrings.length - 1;
}

function curPageName(){
var sPath = window.location.pathname;
return sPath.substring(sPath.lastIndexOf('/') + 1);
}

function lv(){
// siehe auch my_url()
return cat_path_ws();
}

function my_url(){
return location.protocol+'//'+location.host+'/'+cat_folder_name()+'/';
}

function open_contact_owner(ttl){
w1=730;
h1=530;
page=location.href;
url=lv()+'form_ajax_contact_owner.php?p='+page;
tit='Kontakt, Feedback, Support';

open_m(url,tit,w1,h1);

}

function open_guestbook_form(customers_id){
w1=680;
h1=500;
page=location.href;
url=lv()+'form_guestbook.php?p='+page+'&cid='+customers_id;
tit='Tragen Sie sich in unser G&auml;stebuch ein..';

open_m(url,tit,w1,h1);

}

function get_win_inner(what) {
/*
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
*/
	if (what=='h') {
		//return myHeight;
		return getviewportHeight();
	}else{
		//return myWidth;
		return getviewportWidth();
	}
}
function width_fit_win(val){
innerw=get_win_inner('w');
	if (innerw>0)  {
	w = Math.min(val,innerw-20);
	}else{
	w=val;
	}
return w;
}
function height_fit_win(val){
innerh=get_win_inner('h');
	if (innerh>0)  {
	h = Math.min(val,innerh-20);
	}else{
	h=val;
	}
return h;
}


function open_x(file,header,w1,h1){
h = height_fit_win(h1);
w = width_fit_win(w1);
var win = new Window({
className: "mac_os_x",  
width:w, height:h, zIndex: 100, 
resizable: false, 
title: header, 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+file;
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}


function open_m(url,tit,w1,h1){
if (h1===undefined) { h1 = 700; }
h = height_fit_win(h1);
w = width_fit_win(w1);

Modalbox.show(url, {title: tit, width: w}); 
}

function open_oeffnungszeiten(){
var win = new Window(
{
className: "mac_os_x",  
width:760, height:360, zIndex: 100, 
resizable: false, 
title: "Unsere &Ouml;ffnungszeiten:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_open_time.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}
function open_liefergebiete(){
var win = new Window(
{
className: "mac_os_x",  
width:790, height:450, zIndex: 100, 
resizable: true, 
title: "Unsere Liefergebiete:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_liefergebiet.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}
function open_liefer_zlg(){
var win = new Window({
className: "mac_os_x",  
width:790, height:360, zIndex: 100, 
resizable: true, 
title: "Lieferung und Zahlung:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_liefer_zlg.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}

function open_datenschutz(){
var win = new Window({
className: "mac_os_x",  
width:760, height:360, zIndex: 100, 
resizable: false, 
title: "Datenschutz:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_datenschutz.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}
function open_agbs(){
var win = new Window({
className: "mac_os_x",  
width:790, height:360, zIndex: 100, 
resizable: false, 
title: "Unsere AGBs:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_agbs.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}
function open_impressum(){
var win = new Window({
className: "mac_os_x",  
width:760, height:360, zIndex: 100, 
resizable: false, 
title: "Impressum:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_impressum.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}
function open_coupons_cond(){
var win = new Window(
{
className: "mac_os_x",  
width:760, height:360, zIndex: 100, 
resizable: false, 
title: "Sparen Sie mit unseren Coupons:", 
showEffect:Effect.Appear, hideEffect: Effect.Shrink, destroyOnClose:true,
draggable:true, 
wiredDrag: true});
$url=lv()+'popup_coupons_cond.php';
win.setAjaxContent($url,{method:'get'},{showCentered:true},{showModal:true});
}



function open_video(nr,ttl,w,h){
if (ttl==undefined) ttl='';
if (w==undefined) w=484;
if (h==undefined) h=464;

url = 'popup_video.php?nr='+nr;

myLightWindow.activateWindow({href: url, 
title: ttl, width: w ,height: h
});

}




function open_lexikon(ttl){
if (ttl==undefined) ttl='Lexikon - Informatives bei CNC Dynamix:';
/*
my_width=getWidth();
my_height=getHeight(); 

my_width=Math.round(my_width-400); 
my_height=Math.round(my_height-150);
*/
w=800;
h=550;

url = 'lexikon_overview.php';

myLightWindow.activateWindow({href: url, 
title: ttl, width: w ,height: h
});
//Sound.play('sound/click1.mp3'); 
}



function open_google_map(ttl){
if (ttl==undefined) ttl='Unser Standort:';
my_width=getWidth();
my_height=getHeight(); 

my_width=Math.round(my_width-400); 
my_height=Math.round(my_height-150);

w=my_width;
h=my_height;

url = 'popup_google_map_wrapper.php?lv='+lv();

myLightWindow.activateWindow({href: url, 
title: ttl, width: w ,height: h
});
//Sound.play('sound/click1.mp3'); 
}



function silentErrorHandler() {return true;}
var show_ax_img = false;
var myGlobalHandlers = {
	onCreate: function(){
		if (show_ax_img){
			Element.show('systemWorking1')
		};
	},
	onComplete: function() {
		if(Ajax.activeRequestCount == 0){
			if (show_ax_img){
			Element.hide('systemWorking1');
			show_ax_img = false;
			};
		}
	}
};
Ajax.Responders.register(myGlobalHandlers);
function hide_open(){
weg2('opent_l','fade');
show2('opent_s','blind');
	if (cookiesAllowed()){
		setCookie('show_opentime',false,1)
	}	
}
function show_open(){

weg2('opent_s','fade');
show2('opent_l','blind');
	if (cookiesAllowed()){
		setCookie('show_opentime',false,-1)
	}
}
function del_plz_cook(){
	setCookie('plz','',-3);
	window.location.reload();
}

function do_qu_blind(url,pars,ziel){
$(ziel).visualEffect('BlindUp', {duration: 0.5, queue: { position: 'end', scope: ziel }}); 

var ur = url;
var pa = pars;
var ta = ziel;
var myAjax = new Ajax.Updater(ta, ur, 
{method: 'get', 
parameters: pa, 
scope: ziel,
onSuccess : do_qu_show(ziel)
}
);

}
function do_qu_show(ziel){
//setTimeout($(ziel).visualEffect('BlindDown', {duration: 1.2, queue: { position: 'end', scope: ziel }}),100)
//$(ziel).visualEffect('BlindDown', {duration: 1.2, queue: { position: 'end', scope: ziel }}); 
$(ziel).visualEffect('BlindDown', {duration: 1.2, queue: { position: 'end', scope: ziel }}); 
}



function do_qu_blind_slow(url,pars,ziel){
$(ziel).visualEffect('Fade', {duration: 1.4, queue: { position: 'end', scope: ziel }});

var ur = url;
var pa = pars;
var ta = ziel;
var myAjax = new Ajax.Updater(ta, ur, {
method: 'get', 
parameters: pa, 
scope: ziel,
evalScripts: true,
onSuccess : do_qu_slow_show(ziel)
}
);
//$(ziel).visualEffect('BlindDown', {duration: 3.6, queue: { position: 'end', scope: ziel }}); 
} 

function do_qu_slow_show(ziel){
//$(ziel).visualEffect('BlindUp', {duration: 1.4, queue: { position: 'end', scope: ziel }});
$(ziel).visualEffect('BlindDown', {duration: 1.6, queue: { position: 'end', scope: ziel }}); 
//setTimeout($(ziel).visualEffect('Appear', {duration: 1.6, queue: { position: 'end', scope: ziel }}),3000)
//var lightbox = new lightbox.initialize();

//updateImageList()
//new Lightbox.updateImageList();
//new Lightbox.initialize;

//updateImageList();
//initLightbox();
//Lightbox.prototype.updateImageList();
//Lightbox.prototype.initialize();
//Lightbox.prototype.updateImageList();

}










function do_qu(url,pars,ziel){
show_ax_img=true;
var ur = url;
var pa = pars;
var ta = ziel;
var myAjax = new Ajax.Updater(ta, ur, {method: 'get', parameters: pa});
}

function do_qu_confirm(url,pars,ziel){
grayOut(true, {'zindex':'90', 'bgcolor':'#aa0000', 'opacity':'70'});
Check = confirm("Wirklich l"+unescape("%F6")+"schen?");
	if (Check == true){
	var ur = url;
	var pa = pars;
	var ta = ziel;
	var myAjax = new Ajax.Updater(ta, ur, {method: 'get', parameters: pa});
	}
grayOut(false);	
}


function do_qu_confirm_frage(url,pars,ziel,frage){
grayOut(true, {'zindex':'90', 'bgcolor':'#385570', 'opacity':'70'});
Check = confirm(frage);
	if (Check == true){
	var ur = url;
	var pa = pars;
	var ta = ziel;
	var myAjax = new Ajax.Updater(ta, ur, {method: 'get', parameters: pa});
	}
grayOut(false);
}




function ax_subm_form(form_id,url){
var pars=$(form_id).serialize() 
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'post', 
		parameters: pars, 
		onComplete: conf_data_saved,
		onFailure: fail_data_saved
	});
}
function conf_data_saved(originalRequest){
$('message_div').removeClassName('message_div_alert');
$('message_div').addClassName('message_div');

$('message_div').update('Die Daten wurden gespeichert.').show();
setTimeout("weg2('message_div','fade')",3000)
}
function fail_data_saved(originalRequest){
$('message_div').update('Problem!<br>Die Daten wurden NICHT gespeichert.').show();
}

function request_ajax_source(para){
var url = lv()+'ajax_source.php';
var pars = 'id='+para;
var myAjax = new Ajax.Request(
	url, 
	{
		method: 'get', 
		parameters: pars, 
		onComplete: showResponse_coo
	});
} 

String.prototype.htmlEntities = function () {   
//usage:
//var tmp = '<html><head></head>';
//var safe= tmp.htmlEntities(); // Returns ““&lt;html&gt;&lt;head&gt;&lt;/head&gt;””
return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
};
function set_coo(bool,what,expire){
//true = hide
if(bool) {bool=0}else{bool=1}
setCookie(what,bool,expire);
}
function cookiesAllowed() {
   setCookie('checkCookie', 'test', 1);
   if (getCookie('checkCookie')) {
      deleteCookie('checkCookie');
      return true;
   }
   return false;
}
function setCookie(name,value,expires, options) {
   if (options===undefined) { options = {}; }
   if ( expires ) {
      var expires_date = new Date();
      expires_date.setDate(expires_date.getDate() + expires)
   }
   document.cookie = name+'='+escape( value ) +
      ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + 
      ( ( options.path ) ? ';path=' + options.path : '' ) +
      ( ( options.domain ) ? ';domain=' + options.domain : '' ) +
      ( ( options.secure ) ? ';secure' : '' );
}
function getCookie( name ) {
   var start = document.cookie.indexOf( name + "=" );
   var len = start + name.length + 1;
   if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
      return null;
   }
   if ( start == -1 ) return null;
   var end = document.cookie.indexOf( ';', len );
   if ( end == -1 ) end = document.cookie.length;
   return unescape( document.cookie.substring( len, end ) );
}
function deleteCookie( name, path, domain ) {
   if ( getCookie( name ) ) document.cookie = name + '=' +
      ( ( path ) ? ';path=' + path : '') +
      ( ( domain ) ? ';domain=' + domain : '' ) +
      ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
// trim
String.prototype.trim = function() {
   return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
   return this.replace(/^\s+/g,"");
}
String.prototype.rtrim = function() {
   return this.replace(/\s+$/g,"");
}
function Right(str, n){
    if (n <= 0){
       return "";
    }else{ 
	if (n > String(str).length)
       {return str;
    }else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
	   }
    }
}
// sort array
Array.prototype.sortNum = function() {
   return this.sort( function (a,b) { return a-b; } );
}
// format numers
function formatNumber(num,prefix){
   prefix = prefix || '';
   num += '';
   var splitStr = num.split('.');
   var splitLeft = splitStr[0];
   var splitRight = splitStr.length > 1 ? '.' + splitStr[1] : '';
   var regx = /(\d+)(\d{3})/;
   while (regx.test(splitLeft)) {
      splitLeft = splitLeft.replace(regx, '$1' + ',' + '$2');
   }
   return prefix + splitLeft + splitRight;
}
function unformatNumber(num) {
   return num.replace(/([^0-9\.\-])/g,'')*1;
}
// end 
function confirm_goto(url){
//var this_url = my_url();
txt='<img src="'+lv()+'images/icons/ic_n_50/Icon-note.png" width="64" height="64" style="float:left;margin-right:9px"/>';
txt += 'Wirklich l'+unescape("%F6")+'schen? ';				
		var OK='Ja, l&ouml;schen';	
		Dialog.confirm("<div style='padding:20px 10px 10px 10px ;font-size:1.3em;text-align:left'>"+txt+"</div>", 
		   {className: "dialog", width:410, okLabel: OK, 
		   buttonClass: "button1",
		   id: "myDialogId", destroyOnClose:true,
		   cancel:function(win) {return false;},
		   ok:function(win) {goto(url);  return true;}
		  });
}
 
function confirm_goto_txt(url,msg,ok_txt){
//var this_url = my_url();
txt='<img src="'+lv()+'images/icons/ic_n_50/Icon-note.png" width="64" height="64" style="float:left;margin-right:9px"/>';
txt += msg;				
		var OK=ok_txt;	
		Dialog.confirm("<div style='padding:20px 10px 10px 10px ;font-size:1.3em;text-align:left'>"+txt+"</div>", 
		   {className: "dialog", width:410, okLabel: OK, 
		   buttonClass: "button1",
		   id: "myDialogId", destroyOnClose:true,
		   cancel:function(win) {return false;},
		   ok:function(win) {goto(url);  return true;}
		  });
}

function goto(url){window.location.href = url;}
function go_to(url){window.location.href = url;}

function confirm_win(txt,OK,ex){
Dialog.confirm("<div style='padding:20px 10px 10px 10px ;font-size:1.3em;text-align:left'>"+txt+"</div>", 
               {className: "dialog", width:400, okLabel: OK, 
               buttonClass: "button1",
               id: "myDialogId",
               cancel:function(win) {debug("cancel");},
               ok:function(win) {exec(ex); return true;}
              });
// function exec(ex) gelöscht
}
// nicht mehr aktuell, ersetzt mit neuem alert_win
function short_message(msg){
openInfoDialog(msg,140,2.0)
}
// message
function alert_win2(txt,mldg,h,w){
img='<img src="'+my_url()+'images/icons/ic_n_50/Icon-note.png" width="64" height="64" style="float:left;margin: 0px 14px 10px 0px"/>';
txt=img+txt;
alert_win(txt,mldg,h,w)
}
//AL
function alert_win_AL(txt,mldg,h,w){
img='<img src="'+my_url()+'images/icons/ic_n_50/120px-Icon-warning.png" width="60" height="60" style="float:left;margin: 0px 14px 10px 0px"/>';
txt=img+txt;
alert_win(txt,mldg,h,w)
}
//OK
function alert_win_OK(txt,mldg,h,w){
img='<img src="'+my_url()+'images/icons/icons_neu/Yes.png" width="48" height="48" style="float:left;margin: 0px 14px 10px 0px"/>';
txt=img+txt;
alert_win(txt,mldg,h,w)
}
function alert_win(txt,mldg,h,w){
if (h==undefined) h=130;
if (w==undefined) w=400;
if (mldg==undefined) mldg='OK';
Dialog.alert("<div style='padding:20px 10px 10px 10px;font-size:1.3em;text-align:left'>"+txt+"</div>", 
{className: "dialog", buttonClass: "button2", width:w, height:h, okLabel: mldg, ok:function(win) {return true;}});
}

var timeout;
function openInfoDialog(txt,ht,tout) {
  Dialog.info("<div style='padding:20px 10px 10px 10px ;font-size:1.5em;text-align:center;color:#009;'>"+txt+"<br><br><div align=\"center\"><img src=\"images/icons/anim/loading.gif\" width=\"32\" height=\"32\"></div></div>",
               {className: "dialog", width:400, height:ht, showProgress: true});
  timeout=tout;
  setTimeout(infoTimeout, 1000)
}
function infoTimeout() {
  timeout--;
  if (timeout >0) {
   // Dialog.setInfoMessage("Test of info panel, it will close <br />in " + timeout + "s ...")
    setTimeout(infoTimeout, 1000)
 }
 else
  Dialog.closeInfo()
}

// in upload docs und in member_change
function conf_upload_doc_nozip(file)
{
if (file==='') {
	alert_win2('Bitte eine Datei ausw&auml;hlen mit Durchsuchen...','OK',120,400);
	return false;
}else{
	$dot_pos =file.lastIndexOf('.');
	$file_type=file.substr($dot_pos,4);
	$file_type=$file_type.toLowerCase();
		if ($file_type=='.pdf' || $file_type=='.doc' ){
			return true;
		}else{
			alert_win2('Der Upload von '+$file_type+' ist hier nicht erlaubt! <br /><br />Bitte beachten Sie die Hinweise.','OK',120,400);
			return false;
		}
}
}

function get_current_page_name(){
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
return sPage;
}
function getHeight() {
/*
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
*/  
  return getviewportHeight();
}
function getWidth() {
/*
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
*/
  return getviewportWidth();
}

function getviewportWidth() {
if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
return viewportwidth;
}

function getviewportHeight() {
if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
return viewportheight;
}
// Call: strReplaceAll2 = strText.replaceAll( "th", "[X]" ) 
String.prototype.replaceAll = function( 
strTarget, // The substring you want to replace
strSubString // The string you want to replace in. 
){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
while (intIndexOfMatch != -1){
strText = strText.replace( strTarget, strSubString )
intIndexOfMatch = strText.indexOf( strTarget );
} 
return( strText );
}
function weg2(id,met) {
 if (met=='switch') {
	//Sound.play('sound/puff.mp3');
	new Effect.SwitchOff(id);
	
 } else if (met=='drop') {
   new Effect.DropOut(id);
   
 } else if (met=='blind') {
   new Effect.BlindUp(id);
 } else if (met=='squish') {
	new Effect.squish(id); 
	
 } else if (met=='fold') {
	new Effect.Fold(id);
  
 } else if (met=='shrink') {
	new Effect.Shrink(id); 
	
 } else if (met=='slide') {
	new Effect.SlideUp(id);  
	
 } else if (met=='puff') {
	new Effect.Puff(id,{duration:4.5});
 
 } else if (met=='fade') {
	new Effect.Fade(id,{duration:1.2, from:0.9});
 }
}

function show2(id,met) {
 if (met=='blind') {
	new Effect.BlindDown(id);
 } else if (met=='grow') {
	new Effect.Grow(id); 
 } else if (met=='slide') {
	new Effect.SlideDown(id);  
 } else if (met=='appear') {
	new Effect.Appear(id,{duration:1.2, from:0.9});
 }
}
 
function show_hide(id,met) {
met='blind';

	if(!$(id).visible()){

		 if (met=='blind') {
			new Effect.BlindDown(id);
		 } else if (met=='grow') {
			new Effect.Grow(id); 
		 } else if (met=='slide') {
			new Effect.SlideDown(id);  
		 } else if (met=='appear') {
			new Effect.Appear(id,{duration:1.2, from:0.9});
		 }
		 
	}else{

		 if (met=='switch') {
			//Sound.play('sound/puff.mp3');
			new Effect.SwitchOff(id);			
		 } else if (met=='drop') {
		   new Effect.DropOut(id);
		   
		 } else if (met=='blind') {
		   new Effect.BlindUp(id);
		 } else if (met=='squish') {
			new Effect.squish(id); 
			
		 } else if (met=='fold') {
			new Effect.Fold(id);
		  
		 } else if (met=='shrink') {
			new Effect.Shrink(id); 
			
		 } else if (met=='slide') {
			new Effect.SlideUp(id);  
			
		 } else if (met=='puff') {
			new Effect.Puff(id,{duration:4.5});
		 
		 } else if (met=='fade') {
			new Effect.Fade(id,{duration:1.2, from:0.9});
		 }	
	}		
}

function fullw(){
window.moveTo(0,0);  
window.resizeTo(screen.availWidth,screen.availHeight); 
if (cookiesAllowed()){

/*
innerw=window.innerWidth;
innerh=window.innerHeight;
*/
innerw=getviewportWidth();
innerh=getviewportHeight();

setCookie('screenwidth',innerw,2);
setCookie('screenheight',innerh,2);
}} 
function gettranslation(lang) {
var v_link = window.location;
var width= window.screen.width-200;
var height= window.screen.height-100;
var top=190;
var left=90;
if (lang=='e') {
var trans_link = "http://translate.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&langpair=de%7Cen&u=";
trans_link = trans_link + v_link;
trans_link = trans_link + '&prev=/language_tools';
}
if (lang=='f') {
var trans_link = "http://translate.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&langpair=de%7Cfr&u=";
trans_link = trans_link + v_link;
trans_link = trans_link + '&prev=/language_tools';
}
if (lang=='i') {
var trans_link = "http://translate.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&langpair=de%7Cit&u=";
trans_link = trans_link + v_link;
trans_link = trans_link + '&prev=/language_tools';
}
popUpWin = open(trans_link, 'popUpWin', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function gettranslation2(lang) {

//open_x('popup_translation_hint.php','Bitte beachten! - Important!',500,400);

if (lang=='') {return false;}

var v_link = window.location;
var width= window.screen.width-200;
var height= window.screen.height-100;
var top=190;
var left=90;

var trans_link = "http://translate.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&sl=de&tl=";
    trans_link = trans_link + lang;
	trans_link = trans_link + '&u=' + v_link;

popUpWin = open(trans_link, 'popUpWin', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}


function grayOut(vis, options) {
  var options = options || {}; 
  var zindex = options.zindex || 2050;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           
        tnode.style.position='absolute';                 
        tnode.style.top='0px';                           
        tnode.style.left='0px';                          
        tnode.style.overflow='hidden';                   
        tnode.style.display='none';                      
        tnode.id='darkenScreenObject';                   
    tbody.appendChild(tnode);                            
    dark=document.getElementById('darkenScreenObject');  
  }
  if (vis) {

    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   

    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';				 
  } else {
     dark.style.display='none';
  }
}

function scroll_to(id){
Effect.ScrollTo(id, { duration: 1.5 })
}


document.ondblclick=goPageTop;
function goPageTop()
{Effect.ScrollTo('oben1', { duration: 1.5 })}


if (document.layers) document.captureEvents(Event.ONDBLCLICK);
document.ondblclick=goPageTop;


function do_transl(source,target,lang_code){
source_text = $(source).value;
	google.language.translate(source_text, "de", lang_code, function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.value = result.translation; 
		$('help_descr_'+lang_code).value=result.translation;		
	}});
}

function do_transl_ed(source,target,lang_code){
source_text = $(source).value;
	google.language.translate(source_text, "en", lang_code, function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.value = result.translation; 
		$('help_descr_'+lang_code).value=result.translation;		
	}});
}


function do_transl_innerHTML(source,target,lang_code){
source_text = $(source).innerHTML;
	google.language.translate(source_text, "de", lang_code, function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.value = result.translation; 
		$('help_descr_'+lang_code).value=result.translation;		
	}});
}
function do_transl_inner2HTML(source,target,lang_code,para){
if (lang_code=='') return;
source_text = $(source).innerHTML;
	google.language.translate(source_text, "de", lang_code, function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.innerHTML = result.translation; 
		show2(container,'blind');
		show2('cimg_'+para,'appear');		
	}});
}

function do_transl_innerHTML_2(source,target,lang_code){
//english - > deutsch
source_text = $(source).value;
	google.language.translate(source_text, "en", "de", function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.innerHTML = result.translation; 
	}});
}

function do_transl_innerHTML_to_innerHTML_de(source,target,lang_code){
//deutsch -> alle
source_text = $(source).innerHTML;
	google.language.translate(source_text, "de", lang_code, function(result) { 
		if (!result.error) { 
		var container = $(target); 
		container.innerHTML = result.translation; 
	}});
}

// lightwindow.js v2.0 http://www.scriptingmagic.com/Topics/Compression/JavaScript%20Compactor/

if(typeof Effect=="undefined"){throw ("lightwindow.js requires including script.aculo.us' effects.js library!")}try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}var lightwindow=Class.create();lightwindow.prototype={element:null,contentToFetch:null,windowActive:false,dataEffects:[],dimensions:{cruft:null,container:null,viewport:{height:null,width:null,offsetTop:null,offsetLeft:null}},pagePosition:{x:0,y:0},pageDimensions:{width:null,height:null},preloadImage:[],preloadedImage:[],galleries:[],resizeTo:{height:null,heightPercent:null,width:null,widthPercent:null,fixedTop:null,fixedLeft:null},scrollbarOffset:18,navigationObservers:{previous:null,next:null},containerChange:{height:0,width:0},activeGallery:false,galleryLocation:{current:0,total:0},initialize:function(a){this.options=Object.extend({resizeSpeed:8,contentOffset:{height:20,width:20},dimensions:{image:{height:250,width:250},page:{height:250,width:250},inline:{height:250,width:250},media:{height:250,width:250},external:{height:250,width:250},titleHeight:25},classNames:{standard:"lightwindow",action:"lightwindow_action"},fileTypes:{page:["asp","aspx","cgi","cfm","htm","html","pl","php4","php3","php","php5","phtml","rhtml","shtml","txt","vbs","rb"],media:["aif","aiff","asf","avi","divx","m1v","m2a","m2v","m3u","mid","midi","mov","moov","movie","mp2","mp3","mpa","mpa","mpe","mpeg","mpg","mpg","mpga","pps","qt","rm","ram","swf","viv","vivo","wav"],image:["bmp","gif","jpg","png","tiff"]},mimeTypes:{avi:"video/avi",aif:"audio/aiff",aiff:"audio/aiff",gif:"image/gif",bmp:"image/bmp",jpeg:"image/jpeg",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3u:"audio/x-mpequrl",mid:"audio/x-midi",midi:"audio/x-midi",mjpg:"video/x-motion-jpeg",moov:"video/quicktime",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp3:"audio/mpeg3",mpa:"audio/mpeg",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"audio/mpeg",mpg:"video/mpeg",mpga:"audio/mpeg",pdf:"application/pdf",png:"image/png",pps:"application/mspowerpoint",qt:"video/quicktime",ram:"audio/x-pn-realaudio-plugin",rm:"application/vnd.rn-realmedia",swf:"application/x-shockwave-flash",tiff:"image/tiff",viv:"video/vivo",vivo:"video/vivo",wav:"audio/wav",wmv:"application/x-mplayer2"},classids:{mov:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",swf:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",wmv:"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"},codebases:{mov:"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0",swf:"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0",wmv:"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"},viewportPadding:10,EOLASFix:"swf,wmv,fla,flv",overlay:{opacity:0.7,image:"images/lightwindow/black.png",presetImage:"images/lightwindow/black-70.png"},skin:{main:'<div id="lightwindow_container" ><div id="lightwindow_title_bar" ><div id="lightwindow_title_bar_inner" ><span id="lightwindow_title_bar_title"></span><a id="lightwindow_title_bar_close_link">&nbsp;schliessen <img src="http://www.cncdynamix.ch/new_site/images/icon4/famfam/cancel.png" width="16" height="16" /></a></div></div><div id="lightwindow_stage" ><div id="lightwindow_contents" ></div><div id="lightwindow_navigation" ><a href="#" id="lightwindow_previous" ><span id="lightwindow_previous_title"></span></a><a href="#" id="lightwindow_next" ><span id="lightwindow_next_title"></span></a><iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div><div id="lightwindow_galleries"><div id="lightwindow_galleries_tab_container" ><a href="#" id="lightwindow_galleries_tab" ><span id="lightwindow_galleries_tab_span" class="up" >Galerie</span></a></div><div id="lightwindow_galleries_list" ></div></div></div><div id="lightwindow_data_slide" ><div id="lightwindow_data_slide_inner" ><div id="lightwindow_data_details" ><div id="lightwindow_data_gallery_container" ><span id="lightwindow_data_gallery_current"></span> of <span id="lightwindow_data_gallery_total"></span></div><div id="lightwindow_data_author_container" >by <span id="lightwindow_data_author"></span></div></div><div id="lightwindow_data_caption" ></div></div></div></div>',loading:'<div id="lightwindow_loading" ><img src="images/ajax-loading.gif" alt="laden" /><span>Laden oder <a href="javascript: myLightWindow.deactivate();">Abbruch</a></span><iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div>',iframe:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><body>{body_replace}</body></html>',gallery:{top:'<div class="lightwindow_galleries_list"><h1>{gallery_title_replace}</h1><ul>',middle:"<li>{gallery_link_replace}</li>",bottom:"</ul></div>"}},formMethod:"get",hideFlash:false,hideGalleryTab:false,showTitleBar:true,animationHandler:false,navigationHandler:false,transitionHandler:false,finalAnimationHandler:false,formHandler:false,galleryAnimationHandler:false,showGalleryCount:true},a||{});this.duration=((11-this.options.resizeSpeed)*0.15);this._setupLinks();this._getScroll();this._getPageDimensions();this._browserDimensions();this._addLightWindowMarkup(false);this._setupDimensions();this.buildGalleryList()},activate:function(e,a){this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(a);this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements("hidden",false);this._displayLightWindow("block","hidden");this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow()},deactivate:function(){this.windowActive=false;this.activeGallery=false;if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false)}this.animating=false;this.element=null;this._displayLightWindow("none","visible");this._clearWindowContents(false);var a=Effect.Queues.get("lightwindowAnimation").each(function(e){e.cancel()});this._prepareIE(false);this._setupDimensions();this._toggleTroubleElements("visible",false);this._monitorKeyboard(false)},createWindow:function(a,b){this._processLink($(a))},activateWindow:function(a){this.element=Object.extend({href:null,title:null,author:null,caption:null,rel:null,top:null,left:null,type:null,showImages:null,height:null,width:null,loadingAnimation:null,iframeEmbed:null,form:null},a||{});this.contentToFetch=this.element.href;this.windowType=this.element.type?this.element.type:this._fileType(this.element.href);this._clearWindowContents(true);this._addLoadingWindowMarkup();this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements("hidden",false);this._displayLightWindow("block","hidden");this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow()},submitForm:function(e){if(this.options.formHandler){this.options.formHandler(e)}else{this._defaultFormHandler(e)}},openWindow:function(a){var a=$(a);this.windowActive=true;this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(a);this._setStatus(true);this._handleTransition()},navigateWindow:function(a){this._handleNavigation(false);if(a=="previous"){this.openWindow(this.navigationObservers.previous)}else{if(a=="next"){this.openWindow(this.navigationObservers.next)}}},buildGalleryList:function(){var a="";var b;for(i in this.galleries){if(typeof this.galleries[i]=="object"){a+=(this.options.skin.gallery.top).replace("{gallery_title_replace}",unescape(i));for(j in this.galleries[i]){if(typeof this.galleries[i][j]=="object"){b='<a href="#" id="lightwindow_gallery_'+i+"_"+j+'" >'+unescape(j)+"</a>";a+=(this.options.skin.gallery.middle).replace("{gallery_link_replace}",b)}}a+=this.options.skin.gallery.bottom}}new Insertion.Top("lightwindow_galleries_list",a);for(i in this.galleries){if(typeof this.galleries[i]=="object"){for(j in this.galleries[i]){if(typeof this.galleries[i][j]=="object"){Event.observe($("lightwindow_gallery_"+i+"_"+j),"click",this.openWindow.bind(this,this.galleries[i][j][0]),false);$("lightwindow_gallery_"+i+"_"+j).onclick=function(){return false}}}}}},_setupLinks:function(){var a=$$("."+this.options.classNames.standard);a.each(function(b){this._processLink(b)}.bind(this))},_processLink:function(a){if((this._fileType(a.getAttribute("href"))=="image"||this._fileType(a.getAttribute("href"))=="media")){if(gallery=this._getGalleryInfo(a.rel)){if(!this.galleries[gallery[0]]){this.galleries[gallery[0]]=new Array()}if(!this.galleries[gallery[0]][gallery[1]]){this.galleries[gallery[0]][gallery[1]]=new Array()}this.galleries[gallery[0]][gallery[1]].push(a)}}var b=a.getAttribute("href");if(b.indexOf("?")>-1){b=b.substring(0,b.indexOf("?"))}var c=b.substring(b.indexOf("#")+1);if($(c)){$(c).setStyle({display:"none"})}Event.observe(a,"click",this.activate.bindAsEventListener(this,a),false);a.onclick=function(){return false}},_setupActions:function(){var a=$$("#lightwindow_container ."+this.options.classNames.action);a.each(function(b){Event.observe(b,"click",this[b.getAttribute("rel")].bindAsEventListener(this,b),false);b.onclick=function(){return false}}.bind(this))},_addLightWindowMarkup:function(a){var b=Element.extend(document.createElement("div"));b.setAttribute("id","lightwindow_overlay");if(Prototype.Browser.Gecko){b.setStyle({backgroundImage:"url("+this.options.overlay.presetImage+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"})}else{b.setStyle({opacity:this.options.overlay.opacity,backgroundImage:"url("+this.options.overlay.image+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"})}var c=document.createElement("div");c.setAttribute("id","lightwindow");c.innerHTML=this.options.skin.main;var d=document.getElementsByTagName("body")[0];d.appendChild(b);d.appendChild(c);if($("lightwindow_title_bar_close_link")){Event.observe("lightwindow_title_bar_close_link","click",this.deactivate.bindAsEventListener(this));$("lightwindow_title_bar_close_link").onclick=function(){return false}}Event.observe($("lightwindow_previous"),"click",this.navigateWindow.bind(this,"previous"),false);$("lightwindow_previous").onclick=function(){return false};Event.observe($("lightwindow_next"),"click",this.navigateWindow.bind(this,"next"),false);$("lightwindow_next").onclick=function(){return false};if(!this.options.hideGalleryTab){Event.observe($("lightwindow_galleries_tab"),"click",this._handleGalleryAnimation.bind(this,true),false);$("lightwindow_galleries_tab").onclick=function(){return false}}if(Prototype.Browser.IE){Event.observe(document,"mousewheel",this._stopScrolling.bindAsEventListener(this),false)}else{Event.observe(window,"DOMMouseScroll",this._stopScrolling.bindAsEventListener(this),false)}Event.observe(b,"click",this.deactivate.bindAsEventListener(this),false);b.onclick=function(){return false}},_addLoadingWindowMarkup:function(){$("lightwindow_contents").innerHTML+=this.options.skin.loading},_setupWindowElements:function(a){this.element=a;this.element.title=null?"":a.getAttribute("title");this.element.author=null?"":a.getAttribute("author");this.element.caption=null?"":a.getAttribute("caption");this.element.rel=null?"":a.getAttribute("rel");this.element.params=null?"":a.getAttribute("params");this.contentToFetch=this.element.href;this.windowType=this._getParameter("lightwindow_type")?this._getParameter("lightwindow_type"):this._fileType(this.contentToFetch)},_clearWindowContents:function(a){if($("lightwindow_iframe")){Element.remove($("lightwindow_iframe"))}if($("lightwindow_media_primary")){try{$("lightwindow_media_primary").Stop()}catch(e){}Element.remove($("lightwindow_media_primary"))}if($("lightwindow_media_secondary")){try{$("lightwindow_media_secondary").Stop()}catch(e){}Element.remove($("lightwindow_media_secondary"))}this.activeGallery=false;this._handleNavigation(this.activeGallery);if(a){$("lightwindow_contents").innerHTML="";$("lightwindow_contents").setStyle({overflow:"hidden"});if(!this.windowActive){$("lightwindow_data_slide_inner").setStyle({display:"none"});$("lightwindow_title_bar_title").innerHTML=""}$("lightwindow_data_slide").setStyle({height:"auto"})}this.resizeTo.height=null;this.resizeTo.width=null},_setStatus:function(a){this.animating=a;if(a){Element.show("lightwindow_loading")}if(!(/MSIE 6./i.test(navigator.userAgent))){this._fixedWindow(a)}},_fixedWindow:function(a){if(a){if(this.windowActive){this._getScroll();$("lightwindow").setStyle({position:"absolute",top:parseFloat($("lightwindow").getStyle("top"))+this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))+this.pagePosition.x+"px"})}else{$("lightwindow").setStyle({position:"absolute"})}}else{if(this.windowActive){this._getScroll();$("lightwindow").setStyle({position:"fixed",top:parseFloat($("lightwindow").getStyle("top"))-this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))-this.pagePosition.x+"px"})}else{if($("lightwindow_iframe")){this._browserDimensions()}$("lightwindow").setStyle({position:"fixed",top:(parseFloat(this._getParameter("lightwindow_top"))?parseFloat(this._getParameter("lightwindow_top"))+"px":this.dimensions.viewport.height/2+"px"),left:(parseFloat(this._getParameter("lightwindow_left"))?parseFloat(this._getParameter("lightwindow_left"))+"px":this.dimensions.viewport.width/2+"px")})}}},_prepareIE:function(a){if(Prototype.Browser.IE){var b,c,d;if(a){var b="100%"}else{var b="auto"}var e=document.getElementsByTagName("body")[0];var f=document.getElementsByTagName("html")[0];f.style.height=e.style.height=b}},_stopScrolling:function(e){if(this.animating){if(e.preventDefault){e.preventDefault()}e.returnValue=false}},_getScroll:function(){if(typeof (window.pageYOffset)=="number"){this.pagePosition.x=window.pageXOffset;this.pagePosition.y=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){this.pagePosition.x=document.body.scrollLeft;this.pagePosition.y=document.body.scrollTop}else{if(document.documentElement){this.pagePosition.x=document.documentElement.scrollLeft;this.pagePosition.y=document.documentElement.scrollTop}}}},_setScroll:function(x,y){document.documentElement.scrollLeft=x;document.documentElement.scrollTop=y},_toggleTroubleElements:function(a,b){if(b){var c=$("lightwindow_contents").getElementsByTagName("select")}else{var c=document.getElementsByTagName("select")}for(var i=0;i<c.length;i++){c[i].style.visibility=a}if(!b){if(this.options.hideFlash){var d=document.getElementsByTagName("object");for(i=0;i!=d.length;i++){d[i].style.visibility=a}var e=document.getElementsByTagName("embed");for(i=0;i!=e.length;i++){e[i].style.visibility=a}}var f=document.getElementsByTagName("iframe");for(i=0;i!=f.length;i++){f[i].style.visibility=a}}},_getPageDimensions:function(){var a,b;if(window.innerHeight&&window.scrollMaxY){a=document.body.scrollWidth;b=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){a=document.body.scrollWidth;b=document.body.scrollHeight}else{a=document.body.offsetWidth;b=document.body.offsetHeight}}var c,d;if(self.innerHeight){c=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;d=document.body.clientHeight}}}if(b<d){this.pageDimensions.height=d}else{this.pageDimensions.height=b}if(a<c){this.pageDimensions.width=c}else{this.pageDimensions.width=a}},_displayLightWindow:function(a,b){$("lightwindow_overlay").style.display=$("lightwindow").style.display=$("lightwindow_container").style.display=a;$("lightwindow_overlay").style.visibility=$("lightwindow").style.visibility=$("lightwindow_container").style.visibility=b},_setupDimensions:function(){var a,b;switch(this.windowType){case "page":a=this.options.dimensions.page.height;b=this.options.dimensions.page.width;break;case "image":a=this.options.dimensions.image.height;b=this.options.dimensions.image.width;break;case "media":a=this.options.dimensions.media.height;b=this.options.dimensions.media.width;break;case "external":a=this.options.dimensions.external.height;b=this.options.dimensions.external.width;break;case "inline":a=this.options.dimensions.inline.height;b=this.options.dimensions.inline.width;break;default:a=this.options.dimensions.page.height;b=this.options.dimensions.page.width;break}var c=this._getParameter("lightwindow_top")?parseFloat(this._getParameter("lightwindow_top"))+this.pagePosition.y:this.dimensions.viewport.height/2+this.pagePosition.y;var d=this._getParameter("lightwindow_left")?parseFloat(this._getParameter("lightwindow_left"))+this.pagePosition.x:this.dimensions.viewport.width/2+this.pagePosition.x;$("lightwindow").setStyle({top:c+"px",left:d+"px"});$("lightwindow_container").setStyle({height:a+"px",width:b+"px",left:-(b/2)+"px",top:-(a/2)+"px"});$("lightwindow_contents").setStyle({height:a+"px",width:b+"px"})},_fileType:function(a){var b=new RegExp("[^.].("+this.options.fileTypes.image.join("|")+")s*$","i");if(b.test(a)){return "image"}if(a.indexOf("#")>-1&&(document.domain==this._getDomain(a))){return "inline"}if(a.indexOf("?")>-1){a=a.substring(0,a.indexOf("?"))}var c="unknown";var d=new RegExp("[^.].("+this.options.fileTypes.page.join("|")+")s*$","i");var e=new RegExp("[^.].("+this.options.fileTypes.media.join("|")+")s*$","i");if(document.domain!=this._getDomain(a)){c="external"}if(e.test(a)){c="media"}if(c=="external"||c=="media"){return c}if(d.test(a)||a.substr((a.length-1),a.length)=="/"){c="page"}return c},_fileExtension:function(a){if(a.indexOf("?")>-1){a=a.substring(0,a.indexOf("?"))}var b="";for(var x=(a.length-1);x>-1;x--){if(a.charAt(x)=="."){return b}b=a.charAt(x)+b}},_monitorKeyboard:function(a){if(a){document.onkeydown=this._eventKeypress.bind(this)}else{document.onkeydown=""}},_eventKeypress:function(e){if(e==null){var a=event.keyCode}else{var a=e.which}switch(a){case 27:this.deactivate();break;case 13:return;default:break}if(this.animating){return false}switch(String.fromCharCode(a).toLowerCase()){case "p":if(this.navigationObservers.previous){this.navigateWindow("previous")}break;case "n":if(this.navigationObservers.next){this.navigateWindow("next")}break;default:break}},_getGalleryInfo:function(a){if(!a){return false}if(a.indexOf("[")>-1){return new Array(escape(a.substring(0,a.indexOf("["))),escape(a.substring(a.indexOf("[")+1,a.indexOf("]"))))}else{return false}},_getDomain:function(a){var b=a.indexOf("//");var c=b+2;var d=a.substring(c,a.length);var e=d.indexOf("/");var f=d.substring(0,e);if(f.indexOf(":")>-1){var g=f.indexOf(":");f=f.substring(0,g)}return f},_getParameter:function(a,b){if(!this.element){return false}if(a=="lightwindow_top"&&this.element.top){return unescape(this.element.top)}else{if(a=="lightwindow_left"&&this.element.left){return unescape(this.element.left)}else{if(a=="lightwindow_type"&&this.element.type){return unescape(this.element.type)}else{if(a=="lightwindow_show_images"&&this.element.showImages){return unescape(this.element.showImages)}else{if(a=="lightwindow_height"&&this.element.height){return unescape(this.element.height)}else{if(a=="lightwindow_width"&&this.element.width){return unescape(this.element.width)}else{if(a=="lightwindow_loading_animation"&&this.element.loadingAnimation){return unescape(this.element.loadingAnimation)}else{if(a=="lightwindow_iframe_embed"&&this.element.iframeEmbed){return unescape(this.element.iframeEmbed)}else{if(a=="lightwindow_form"&&this.element.form){return unescape(this.element.form)}else{if(!b){if(this.element.params){b=this.element.params}else{return}}var c;var d=b.split(",");var e=a+"=";var f=e.length;for(var i=0;i<d.length;i++){if(d[i].substr(0,f)==e){var g=d[i].split("=");c=g[1];break}}if(!c){return false}else{return unescape(c)}}}}}}}}}}},_browserDimensions:function(){if(Prototype.Browser.IE){this.dimensions.viewport.height=document.documentElement.clientHeight;this.dimensions.viewport.width=document.documentElement.clientWidth}else{this.dimensions.viewport.height=window.innerHeight;this.dimensions.viewport.width=document.width||document.body.offsetWidth}},_getScrollerWidth:function(){var a=Element.extend(document.createElement("div"));a.setAttribute("id","lightwindow_scroll_div");a.setStyle({position:"absolute",top:"-10000px",left:"-10000px",width:"100px",height:"100px",overflow:"hidden"});var b=Element.extend(document.createElement("div"));b.setAttribute("id","lightwindow_content_scroll_div");b.setStyle({width:"100%",height:"200px"});a.appendChild(b);var c=document.getElementsByTagName("body")[0];c.appendChild(a);var d=$("lightwindow_content_scroll_div").offsetWidth;a.style.overflow="auto";var e=$("lightwindow_content_scroll_div").offsetWidth;Element.remove($("lightwindow_scroll_div"));this.scrollbarOffset=d-e},_addParamToObject:function(a,b,c,d){var e=document.createElement("param");e.setAttribute("value",b);e.setAttribute("name",a);if(d){e.setAttribute("id",d)}c.appendChild(e);return c},_outerHTML:function(a){if(Prototype.Browser.IE){return a.outerHTML}else{var b=a.cloneNode(true);var c=document.createElement("div");c.appendChild(b);return c.innerHTML}},_convertToMarkup:function(a,b){var c=this._outerHTML(a).replace("</"+b+">","");if(Prototype.Browser.IE){for(var i=0;i<a.childNodes.length;i++){c+=this._outerHTML(a.childNodes[i])}c+="</"+b+">"}return c},_appendObject:function(a,b,c){if(Prototype.Browser.IE){c.innerHTML+=this._convertToMarkup(a,b);if(this.options.EOLASFix.indexOf(this._fileType(this.element.href))>-1){var d=document.getElementsByTagName("object");for(var i=0;i<d.length;i++){if(d[i].getAttribute("data")){d[i].removeAttribute("data")}d[i].outerHTML=d[i].outerHTML;d[i].style.visibility="visible"}}}else{c.appendChild(a)}},_appendIframe:function(a){var b=document.createElement("iframe");b.setAttribute("id","lightwindow_iframe");b.setAttribute("name","lightwindow_iframe");b.setAttribute("src","about:blank");b.setAttribute("height","100%");b.setAttribute("width","100%");b.setAttribute("frameborder","0");b.setAttribute("marginwidth","0");b.setAttribute("marginheight","0");b.setAttribute("scrolling",a);this._appendObject(b,"iframe",$("lightwindow_contents"))},_writeToIframe:function(a){var b=this.options.skin.iframe;b=b.replace("{body_replace}",a);if($("lightwindow_iframe").contentWindow){$("lightwindow_iframe").contentWindow.document.open();$("lightwindow_iframe").contentWindow.document.write(b);$("lightwindow_iframe").contentWindow.document.close()}else{$("lightwindow_iframe").contentDocument.open();$("lightwindow_iframe").contentDocument.write(b);$("lightwindow_iframe").contentDocument.close()}},_loadWindow:function(){switch(this.windowType){case "image":var a=0;var b=[];this.checkImage=[];this.resizeTo.height=this.resizeTo.width=0;this.imageCount=this._getParameter("lightwindow_show_images")?parseInt(this._getParameter("lightwindow_show_images")):1;if(gallery=this._getGalleryInfo(this.element.rel)){for(a=0;a<this.galleries[gallery[0]][gallery[1]].length;a++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][a].href)>-1){break}}if(this.galleries[gallery[0]][gallery[1]][a-this.imageCount]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][a-this.imageCount]}else{this.navigationObservers.previous=false}if(this.galleries[gallery[0]][gallery[1]][a+this.imageCount]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][a+this.imageCount]}else{this.navigationObservers.next=false}this.activeGallery=true}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false}for(var i=a;i<(a+this.imageCount);i++){if(gallery&&this.galleries[gallery[0]][gallery[1]][i]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][i].href;this.galleryLocation={current:(i+1)/this.imageCount,total:(this.galleries[gallery[0]][gallery[1]].length)/this.imageCount};if(!this.galleries[gallery[0]][gallery[1]][i+this.imageCount]){$("lightwindow_next").setStyle({display:"none"})}else{$("lightwindow_next").setStyle({display:"block"});$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][i+this.imageCount].title}if(!this.galleries[gallery[0]][gallery[1]][i-this.imageCount]){$("lightwindow_previous").setStyle({display:"none"})}else{$("lightwindow_previous").setStyle({display:"block"});$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][i-this.imageCount].title}}b[i]=document.createElement("img");b[i].setAttribute("id","lightwindow_image_"+i);b[i].setAttribute("border","0");b[i].setAttribute("src",this.contentToFetch);$("lightwindow_contents").appendChild(b[i]);this.checkImage[i]=new PeriodicalExecuter(function(c){if(!(typeof $("lightwindow_image_"+c).naturalWidth!="undefined"&&$("lightwindow_image_"+c).naturalWidth==0)){this.checkImage[c].stop();var d=$("lightwindow_image_"+c).getHeight();if(d>this.resizeTo.height){this.resizeTo.height=d}this.resizeTo.width+=$("lightwindow_image_"+c).getWidth();this.imageCount--;$("lightwindow_image_"+c).setStyle({height:"100%"});if(this.imageCount==0){this._processWindow()}}}.bind(this,i),1)}break;case "media":var a=0;this.resizeTo.height=this.resizeTo.width=0;if(gallery=this._getGalleryInfo(this.element.rel)){for(a=0;a<this.galleries[gallery[0]][gallery[1]].length;a++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][a].href)>-1){break}}if(this.galleries[gallery[0]][gallery[1]][a-1]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][a-1]}else{this.navigationObservers.previous=false}if(this.galleries[gallery[0]][gallery[1]][a+1]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][a+1]}else{this.navigationObservers.next=false}this.activeGallery=true}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false}if(gallery&&this.galleries[gallery[0]][gallery[1]][a]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][a].href;this.galleryLocation={current:a+1,total:this.galleries[gallery[0]][gallery[1]].length};if(!this.galleries[gallery[0]][gallery[1]][a+1]){$("lightwindow_next").setStyle({display:"none"})}else{$("lightwindow_next").setStyle({display:"block"});$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][a+1].title}if(!this.galleries[gallery[0]][gallery[1]][a-1]){$("lightwindow_previous").setStyle({display:"none"})}else{$("lightwindow_previous").setStyle({display:"block"});$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][a-1].title}}if(this._getParameter("lightwindow_iframe_embed")){this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width}else{this.resizeTo.height=this._getParameter("lightwindow_height");this.resizeTo.width=this._getParameter("lightwindow_width")}this._processWindow();break;case "external":this._appendIframe("auto");this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width;this._processWindow();break;case "page":var c=new Ajax.Request(this.contentToFetch,{method:"get",parameters:"",onComplete:function(d){$("lightwindow_contents").innerHTML+=d.responseText;this.resizeTo.height=$("lightwindow_contents").scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$("lightwindow_contents").scrollWidth+(this.options.contentOffset.width);this._processWindow()}.bind(this)});break;case "inline":var d=this.contentToFetch;if(d.indexOf("?")>-1){d=d.substring(0,d.indexOf("?"))}d=d.substring(d.indexOf("#")+1);new Insertion.Top($("lightwindow_contents"),$(d).innerHTML);this.resizeTo.height=$("lightwindow_contents").scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$("lightwindow_contents").scrollWidth+(this.options.contentOffset.width);this._toggleTroubleElements("hidden",true);this._processWindow();break;default:throw ("Page Type could not be determined, please amend this lightwindow URL "+this.contentToFetch);break}},_resizeWindowToFit:function(){if(this.resizeTo.height+this.dimensions.cruft.height>this.dimensions.viewport.height){var a=this.resizeTo.height/this.resizeTo.width;this.resizeTo.height=this.dimensions.viewport.height-this.dimensions.cruft.height-(2*this.options.viewportPadding);if(this.windowType=="image"||(this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed"))){this.resizeTo.width=this.resizeTo.height/a;$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px"})}}if(this.resizeTo.width+this.dimensions.cruft.width>this.dimensions.viewport.width){var b=this.resizeTo.width/this.resizeTo.height;this.resizeTo.width=this.dimensions.viewport.width-2*this.dimensions.cruft.width-(2*this.options.viewportPadding);if(this.windowType=="image"||(this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed"))){this.resizeTo.height=this.resizeTo.width/b;$("lightwindow_data_slide_inner").setStyle({height:this.resizeTo.height+"px"})}}},_presetWindowSize:function(){if(this._getParameter("lightwindow_height")){this.resizeTo.height=parseFloat(this._getParameter("lightwindow_height"))}if(this._getParameter("lightwindow_width")){this.resizeTo.width=parseFloat(this._getParameter("lightwindow_width"))}},_processWindow:function(){this.dimensions.dataEffects=[];if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){if(this.element.caption){$("lightwindow_data_caption").innerHTML=this.element.caption;$("lightwindow_data_caption").setStyle({display:"block"})}else{$("lightwindow_data_caption").setStyle({display:"none"})}if(this.element.author){$("lightwindow_data_author").innerHTML=this.element.author;$("lightwindow_data_author_container").setStyle({display:"block"})}else{$("lightwindow_data_author_container").setStyle({display:"none"})}if(this.activeGallery&&this.options.showGalleryCount){$("lightwindow_data_gallery_current").innerHTML=this.galleryLocation.current;$("lightwindow_data_gallery_total").innerHTML=this.galleryLocation.total;$("lightwindow_data_gallery_container").setStyle({display:"block"})}else{$("lightwindow_data_gallery_container").setStyle({display:"none"})}$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px",height:"auto",visibility:"visible",display:"block"});$("lightwindow_data_slide").setStyle({height:$("lightwindow_data_slide").getHeight()+"px",width:"1px",overflow:"hidden",display:"block"})}else{$("lightwindow_data_slide").setStyle({display:"none",width:"auto"});$("lightwindow_data_slide_inner").setStyle({display:"none",visibility:"hidden",width:this.resizeTo.width+"px",height:"0px"})}if(this.element.title!="null"){$("lightwindow_title_bar_title").innerHTML=this.element.title}else{$("lightwindow_title_bar_title").innerHTML=""}var a={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};$("lightwindow_container").setStyle({height:"auto",width:$("lightwindow_container").getWidth()+this.options.contentOffset.width-(this.windowActive?this.options.contentOffset.width:0)+"px"});var b={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};this.containerChange={height:a.height-b.height,width:a.width-b.width};this.dimensions.container={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};this.dimensions.cruft={height:this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.options.contentOffset.height,width:this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.options.contentOffset.width};this._presetWindowSize();this._resizeWindowToFit();if(!this.windowActive){$("lightwindow_container").setStyle({left:-(this.dimensions.container.width/2)+"px",top:-(this.dimensions.container.height/2)+"px"})}$("lightwindow_container").setStyle({height:this.dimensions.container.height+"px",width:this.dimensions.container.width+"px"});this._displayLightWindow("block","visible");this._animateLightWindow()},_animateLightWindow:function(){if(this.options.animationHandler){this.options.animationHandler().bind(this)}else{this._defaultAnimationHandler()}},_handleNavigation:function(a){if(this.options.navigationHandler){this.options.navigationHandler().bind(this,a)}else{this._defaultDisplayNavigation(a)}},_handleTransition:function(){if(this.options.transitionHandler){this.options.transitionHandler().bind(this)}else{this._defaultTransitionHandler()}},_handleFinalWindowAnimation:function(a){if(this.options.finalAnimationHandler){this.options.finalAnimationHandler().bind(this,a)}else{this._defaultfinalWindowAnimationHandler(a)}},_handleGalleryAnimation:function(a){if(this.options.galleryAnimationHandler){this.options.galleryAnimationHandler().bind(this,a)}else{this._defaultGalleryAnimationHandler(a)}},_defaultDisplayNavigation:function(a){if(a){$("lightwindow_navigation").setStyle({display:"block",height:$("lightwindow_contents").getHeight()+"px",width:"100%",marginTop:this.options.dimensions.titleHeight+"px"})}else{$("lightwindow_navigation").setStyle({display:"none",height:"auto",width:"auto"})}},_defaultAnimationHandler:function(){if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){$("lightwindow_data_slide").setStyle({display:"none",width:"auto"});this.dimensions.dataEffects.push(new Effect.SlideDown("lightwindow_data_slide",{sync:true}),new Effect.Appear("lightwindow_data_slide",{sync:true,from:0,to:1}))}$("lightwindow_title_bar_inner").setStyle({height:"0px",marginTop:this.options.dimensions.titleHeight+"px"});this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:true,style:{height:this.options.dimensions.titleHeight+"px",marginTop:"0px"}}),new Effect.Appear("lightwindow_title_bar_inner",{sync:true,from:0,to:1}));if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false);if($("lightwindow_galleries_tab_container").getHeight()==0){this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",{sync:true,style:{height:"20px",marginTop:"0px"}}));$("lightwindow_galleries").setStyle({width:"0px"})}}var a=false;var b=this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.resizeTo.width+this.options.contentOffset.width;if(b!=$("lightwindow_container").getWidth()){new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.width/$("lightwindow_contents").getWidth()),{scaleFrom:100*($("lightwindow_contents").getWidth()/($("lightwindow_contents").getWidth()+(this.options.contentOffset.width))),sync:true,scaleY:false,scaleContent:false}),new Effect.Scale("lightwindow_container",100*(b/(this.dimensions.container.width)),{sync:true,scaleY:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,delay:0.25,queue:{position:"end",scope:"lightwindowAnimation"}})}b=this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.resizeTo.height+this.options.contentOffset.height;if(b!=$("lightwindow_container").getHeight()){new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.height/$("lightwindow_contents").getHeight()),{scaleFrom:100*($("lightwindow_contents").getHeight()/($("lightwindow_contents").getHeight()+(this.options.contentOffset.height))),sync:true,scaleX:false,scaleContent:false}),new Effect.Scale("lightwindow_container",100*(b/(this.dimensions.container.height)),{sync:true,scaleX:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,afterFinish:function(){if(this.dimensions.dataEffects.length>0){if(!this.options.hideGalleryTab){$("lightwindow_galleries").setStyle({width:this.resizeTo.width+"px"})}new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}});a=true}if(!a&&this.dimensions.dataEffects.length>0){new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,beforeStart:function(){if(!this.options.hideGalleryTab){$("lightwindow_galleries").setStyle({width:this.resizeTo.width+"px"})}if(this.containerChange.height!=0||this.containerChange.width!=0){new Effect.MoveBy("lightwindow_container",this.containerChange.height,this.containerChange.width,{transition:Effect.Transitions.sinoidal})}}.bind(this),afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultfinalWindowAnimationHandler:function(a){if(this.windowType=="media"||this._getParameter("lightwindow_loading_animation")){Element.hide("lightwindow_loading");this._handleNavigation(this.activeGallery);this._setStatus(false)}else{Effect.Fade("lightwindow_loading",{duration:0.8,delay:1,afterFinish:function(){if(this.windowType!="image"&&this.windowType!="media"&&this.windowType!="external"){$("lightwindow_contents").setStyle({overflow:"auto"})}this._handleNavigation(this.activeGallery);this._defaultGalleryAnimationHandler();this._setStatus(false)}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultGalleryAnimationHandler:function(a){if(this.activeGallery){$("lightwindow_galleries").setStyle({display:"block",marginBottom:$("lightwindow_data_slide").getHeight()+this.options.contentOffset.height/2+"px"});$("lightwindow_navigation").setStyle({height:$("lightwindow_contents").getHeight()-20+"px"})}else{$("lightwindow_galleries").setStyle({display:"none"});$("lightwindow_galleries_tab_container").setStyle({height:"0px",marginTop:"20px"});$("lightwindow_galleries_list").setStyle({height:"0px"});return false}if(a){if($("lightwindow_galleries_list").getHeight()==0){var b=$("lightwindow_contents").getHeight()*0.8;$("lightwindow_galleries_tab_span").className="down"}else{var b=0;$("lightwindow_galleries_tab_span").className="up"}new Effect.Morph("lightwindow_galleries_list",{duration:this.duration,transition:Effect.Transitions.sinoidal,style:{height:b+"px"},beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})},queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultTransitionHandler:function(){this.dimensions.dataEffects=[];if($("lightwindow_data_slide").getStyle("display")!="none"){this.dimensions.dataEffects.push(new Effect.SlideUp("lightwindow_data_slide",{sync:true}),new Effect.Fade("lightwindow_data_slide",{sync:true,from:1,to:0}))}if(!this.options.hideGalleryTab){if($("lightwindow_galleries").getHeight()!=0&&!this.options.hideGalleryTab){this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",{sync:true,style:{height:"0px",marginTop:"20px"}}))}if($("lightwindow_galleries_list").getHeight()!=0){$("lightwindow_galleries_tab_span").className="up";this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_list",{sync:true,style:{height:"0px"},transition:Effect.Transitions.sinoidal,beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})}}))}}this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:true,style:{height:"0px",marginTop:this.options.dimensions.titleHeight+"px"}}),new Effect.Fade("lightwindow_title_bar_inner",{sync:true,from:1,to:0}));new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._loadWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultFormHandler:function(e){var a=Event.element(e).parentNode;var b=Form.serialize(this._getParameter("lightwindow_form",a.getAttribute("params")));if(this.options.formMethod=="post"){var c=new Ajax.Request(a.href,{method:"post",postBody:b,onComplete:this.openWindow.bind(this,a)})}else{if(this.options.formMethod=="get"){var c=new Ajax.Request(a.href,{method:"get",parameters:b,onComplete:this.openWindow.bind(this,a)})}}},_finishWindow:function(){if(this.windowType=="external"){$("lightwindow_iframe").setAttribute("src",this.element.href);this._handleFinalWindowAnimation(1)}else{if(this.windowType=="media"){var a=document.createElement("object");a.setAttribute("classid",this.options.classids[this._fileExtension(this.contentToFetch)]);a.setAttribute("codebase",this.options.codebases[this._fileExtension(this.contentToFetch)]);a.setAttribute("id","lightwindow_media_primary");a.setAttribute("name","lightwindow_media_primary");a.setAttribute("width",this.resizeTo.width);a.setAttribute("height",this.resizeTo.height);a=this._addParamToObject("movie",this.contentToFetch,a);a=this._addParamToObject("src",this.contentToFetch,a);a=this._addParamToObject("controller","true",a);a=this._addParamToObject("wmode","transparent",a);a=this._addParamToObject("cache","false",a);a=this._addParamToObject("quality","high",a);if(!Prototype.Browser.IE){var b=document.createElement("object");b.setAttribute("type",this.options.mimeTypes[this._fileExtension(this.contentToFetch)]);b.setAttribute("data",this.contentToFetch);b.setAttribute("id","lightwindow_media_secondary");b.setAttribute("name","lightwindow_media_secondary");b.setAttribute("width",this.resizeTo.width);b.setAttribute("height",this.resizeTo.height);b=this._addParamToObject("controller","true",b);b=this._addParamToObject("wmode","transparent",b);b=this._addParamToObject("cache","false",b);b=this._addParamToObject("quality","high",b);a.appendChild(b)}if(this._getParameter("lightwindow_iframe_embed")){this._appendIframe("no");this._writeToIframe(this._convertToMarkup(a,"object"))}else{this._appendObject(a,"object",$("lightwindow_contents"))}this._handleFinalWindowAnimation(0)}else{this._handleFinalWindowAnimation(0)}}this._setupActions()}};Event.observe(window,"load",lightwindowInit,false);var myLightWindow=null;function lightwindowInit(){myLightWindow=new lightwindow()}
