<!-- hide script
//	all contents on this site							--
//	are copyright (c) 1998-2010 by				--
//	http://www.art-emission.com					 	--
//	of Switzerland, all rights reserved		--

	var maxScreenX = 640; 
	if (screen.width){ maxScreenX=screen.width;};
	if (maxScreenX<=640){ maxScreenX=640;};
	var maxScreenY = 480;
	if (screen.height){ maxScreenY=screen.height;};
	if (maxScreenY<=480){ maxScreenY=480;};
	
	// Werte innerScreenX/Y werden nur fuer NS4 verwendet
	var innerScreenX = 1024;
	if (window.innerWidth){ innerScreenX=window.innerWidth;};
	if (innerScreenX<=100){ innerScreenX=100;};
	var innerScreenY = 768;
	if (window.innerHeight){ innerScreenY=window.innerHeight;};
	if (innerScreenY<=100){ innerScreenY=100;};
	
	var actualwin1=null;
	var win1open=false;
	
	var actualwin2=null;
	var win2open=false;

	var oldindex=0;

	
// for release
// -----------
//window.onerror=handleError;
//function handleError() { return true; } 

// --------------------------------------
// JQuery
// --------------------------------------
	
$(document).ready(function() 
{
	// Tabs sind vorhanden
	if ( ((typeof gTabDefJQuery!="undefined") && (gTabDefJQuery > 0)) &&
	     ((typeof gTabDefJQueryMSie6!="undefined") && (gTabDefJQueryMSie6 > 0)) )
	{
		if ($.browser.msie && parseFloat($.browser.version) < 7) {
			$('#tabs1').tabs({ cache: true, selected: (gTabDefJQueryMSie6-1) });
		} else {
			$('#tabs1').tabs({ cache: true, selected: (gTabDefJQuery-1) });
		}
	}
  //$('#tabs1').bind('tabsshow', function(event, ui) {
	//  if (ui.panel.id == "tabs1-2") {
  //	}
  //});	
	
});

	
	


// Aufruf innerhalb einer Datei 
function initJQuery()  
{ 
	
	// Gallery Photo ist vorhanden
	if ((typeof gGalleryPhotoJQuery!="undefined") && (gGalleryPhotoJQuery == true))
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 1, /* fast/slow/normal */
			opacity: 0.90, /* Value between 0 and 1 */
			showTitle: false, /* true/false */
			allowresize: true, /* true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: false, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			callback: function(){}, /* Called when prettyPhoto is closed */
			markup: '<div class="pp_pic_holder"> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_loaderIcon"></div> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details clearfix"> \
											<a class="pp_close" href="#">X</a> \
											<p class="pp_description"></p> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div> \
					<div class="ppt"></div>',
			image_markup: '<img id="fullResImage" src="" />',
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline clearfix">{content}</div>'
		});
	}

	// Tabs werden aktiviert
	if ( ((typeof gTabDefJQuery!="undefined") && (gTabDefJQuery > 0)) &&
	     ((typeof gTabDefJQueryMSie6!="undefined") && (gTabDefJQueryMSie6 > 0)) ) 
	{
		$('#tabs1').show();
	}
	
	// Accordion ist vorhanden
	if ((typeof gAcJQuery!="undefined") && (gAcJQuery == true))
	{
		//$("#accordion").hide();
		$("#accordion").css("display","block");
		$("#accordion").accordion({ 
			header: "h6", 
			collapsible: true, 
			autoHeight: gAcJQueryHeight,
			active: gAcJQueryActive
		});
		//$('#accordion').accordion('option', 'autoHeight', false);
	}	
	
	// More Infos
	if ((typeof gMoreJQuery!="undefined") && (gMoreJQuery == true))
	{
		//hide the all of the elements with class moreinfo
	  $(".moreinfo").hide();
	}	

	// Form fuer Kontakt ist vorhanden
	if ((typeof gFormJQueryContact!="undefined") && (gFormJQueryContact == true))
	{
		var optionsC =
		{ 
			//target:      '#formResponse',   // target element(s) to be updated with server response 
			//beforeSubmit:validate,  			  // pre-submit callback 
			success:       showFormResponse,  // post-submit callback 
			
			// other available options: 
			url:       'http://www.zentrum-der-begegnung.ch/scripts/sendmailContact.php' // override for form's 'action' attribute 
			//type:      type        // 'get' or 'post', override for form's 'method' attribute 
			//dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
			//clearForm: true        // clear all form fields after successful submit 
			//resetForm: true        // reset the form after successful submit 
			
			// $.ajax options can be used here too, for example: 
			//timeout:   3000 
		}; 

    // bind form using 'ajaxForm' 
    $('#formContact').ajaxForm(optionsC);
		
		// validate the comment form when it is submitted
		$("#formContact").validate(
		{
			rules: {
				anfrageC: {
					required: true,
					minlength: 5
				},
				anredeherrfrauC:	"required",
				nameC: {
					required: true,
					minlength: 2
				},
				emailC: {
					required: true,
					email: true
				}
			},
			messages: {
				anfrageC: "Geben Sie bitte ihre Anfrage ein",
				anredeherrfrauC: "Geben Sie bitte ihre Anrede ein", 
				nameC: "Geben Sie bitte ihren Namen ein",
				emailC: "Geben Sie bitte ihre E-Mailadresse ein"
			},
			// the errorPlacement has to take the table layout into account 
      errorPlacement: function(error, element) 
			{ 
	  		error.insertAfter('#'+element[0].id+'Error');
      }, 
			// specifying a submitHandler prevents the default submit, good for the demo 
      submitHandler: function(form) 
			{
			  //form.submit();
  	  }, 
			// set this class to error-labels to indicate valid fields 
			success: function(label) 
			{ } 
		});
		
		var anredeInitC = $("#anredefrauC");
		anredeInitC.click(function() 
		{
			$("#anredeherrfrauC").css('border','none');
		});


			
		jQuery.extend(jQuery.validator.messages, 
		{
			required: "Dieses Feld ist ein Pflichtfeld.",
			maxlength: jQuery.validator.format("Geben Sie bitte maximal {0} Zeichen ein."),
			minlength: jQuery.validator.format("Geben Sie bitte mindestens {0} Zeichen ein."),
			rangelength: jQuery.validator.format("Geben Sie bitte mindestens {0} und maximal {1} Zeichen ein."),
			email: "Geben Sie bitte eine g&uuml;tige E-Mail Adresse ein.",
			url: "Geben Sie bitte eine g&uuml;ltige URL ein.",
			dateDE: "Bitte geben Sie ein g&uuml;ltiges Datum ein.",
			numberDE: "Geben Sie bitte eine Nummer ein.",
			digits: "Geben Sie bitte nur Ziffern ein.",
			equalTo: "Bitte denselben Wert wiederholen.",
			range: jQuery.validator.format("Geben Sie bitten einen Wert zwischen {0} und {1}."),
			max: jQuery.validator.format("Geben Sie bitte einen Wert kleiner oder gleich {0} ein."),
			min: jQuery.validator.format("Geben Sie bitte einen Wert gr&ouml;sser oder gleich {0} ein."),
			creditcard: "Geben Sie bitte ein g&uuml;ltige Kreditkarten-Nummer ein."
		});	
		
		jQuery.prompt.setDefaults({ top: '5%', persistent: false}); 

		//document.formQuestion.anfrageC.focus();
		//var formtx = document.forms[0].anfrageC;
		//formtx.focus();
		//formtx.value += '';		
	}
	
	
	
	// Gallery ist vorhanden
	if ((typeof gGalleryJQuery!="undefined") && (gGalleryJQuery == true))
	{
		$('.galleryA').addClass('galleryImgA'); // adds new class name to maintain degradability
		
		$('ul.galleryImgA').galleriaA(
		{
			history   : false, 				// activates the history object for bookmarking, back-button etc.
			clickNext : false, 				// helper for making the image clickable
			insert    : '#mainImageA', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1);
				}
				caption.css('display','none').fadeIn(1);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.4);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				// !! new ausschalten
				// image.attr('title','Next image >>');
				
				// !! new
				var a1 = image.parents('a');
				var strSrc  = image.attr('src');
				var strName = thumb.attr('name');
				
				//alert(strSrc);
				//alert(strName);
				
				//var str2 = strSrc.replace('s.','l.');
				var str2 = strSrc.replace('_s&rex','_l&rex');
				
				// Bei Galerie/Portrait "boxGalerie_g"
				var str2 = strSrc.replace('_g&rex','_l&rex');
				
				a1.attr('href', str2);

				a1.attr('title', thumb.attr('title'));
				a1.attr('alt', thumb.attr('alt'));
				a1.attr('onClick','$(\'#'+strName+'\').click(); return false;');
							
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.4';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.4); } // don't fade out if the parent is active
				)
			}
		});

		$('.galleryB').addClass('galleryImgB'); // adds new class name to maintain degradability
		
		$('ul.galleryImgB').galleriaB(
		{
			history   : false, 				// activates the history object for bookmarking, back-button etc.
			clickNext : false, 				// helper for making the image clickable
			insert    : '#mainImageB', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1);
				}
				caption.css('display','none').fadeIn(1);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.4);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				// !! new ausschalten
				// image.attr('title','Next image >>');
				
				// !! new
				var a1 = image.parents('a');
				var strSrc  = image.attr('src');
				var strName = thumb.attr('name');
				
				//alert(strSrc);
				//alert(strName);
				
				//var str2 = strSrc.replace('s.','l.');
				var str2 = strSrc.replace('_s&rex','_l&rex');
				
				// Bei Galerie/Portrait "boxGalerie_g"
				var str2 = strSrc.replace('_g&rex','_l&rex');
				
				a1.attr('href', str2);

				a1.attr('title', thumb.attr('title'));
				a1.attr('alt', thumb.attr('alt'));
				a1.attr('onClick','$(\'#'+strName+'\').click(); return false;');
							
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.4';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.4); } // don't fade out if the parent is active
				)
			}
		});		
	}
		

	// More Infos
	if ((typeof gMoreJQuery!="undefined") && (gMoreJQuery == true))
	{
	  //show the more link for users with javascript enabled
	  $("p.moreinfo_link").show();
  
	  //toggle the content to be displayed
	  $("p.moreinfo_link").click(function()
	  {   
			if ($(this).next(".moreinfo").is(":hidden"))
	    {
		    $(this).html("weniger Anzeigen");
	  	  $(this).next(".moreinfo").slideToggle(600);
	    	$(this).addClass("linkless");
		    $(this).removeClass("linkmore");
	
		    $("p.lessinfo_link").html("weniger Anzeigen");
				$("p.lessinfo_link").addClass("linkless");
		    $("p.lessinfo_link").removeClass("linkmore");
				
				$("p.lessinfo_link").show();
				
	    } 
			else 
			{
		    $(this).html("mehr Anzeigen");
	  	  $(this).next(".moreinfo").slideToggle(600);
	    	$(this).addClass("linkmore");
		    $(this).removeClass("linkless");
	
		    $("p.lessinfo_link").html("mehr Anzeigen");
	    	$("p.lessinfo_link").addClass("linkmore");
		    $("p.lessinfo_link").removeClass("linkless");
				
			  $("p.lessinfo_link").hide();
	
			}
		});

	  $("p.lessinfo_link").click(function()
	  {   
			if ($(this).prev(".moreinfo").is(":hidden"))
	    {
		    $(this).html("mehr Anzeigen");
	  	  $(this).prev(".moreinfo").slideToggle(600);
	    	$(this).addClass("linkmore");
		    $(this).removeClass("linkless");
	
		    $("p.moreinfo_link").html("weniger Anzeigen");
				$("p.moreinfo_link").addClass("linkless");
		    $("p.moreinfo_link").removeClass("linkmore");
	
			  $("p.lessinfo_link").hide();
	    } 
			else 
			{
		    $(this).html("weniger Anzeigen");
	  	  $(this).prev(".moreinfo").slideToggle(600);
	    	$(this).addClass("linkless");
		    $(this).removeClass("linkmore");
				
		    $("p.moreinfo_link").html("mehr Anzeigen");
	    	$("p.moreinfo_link").addClass("linkmore");
		    $("p.moreinfo_link").removeClass("linkless");
	
			  $("p.lessinfo_link").hide();
			}
		});
	}

	// Sliding
	if ((typeof gSlidingJQuery!="undefined") && (gSlidingJQuery == true))
	{
		//Full Caption Sliding (Hidden to Visible)
		$('.boxgrid.captionfull').hover(function(){
			$(".cover", this).stop().animate({top:'270px'},{queue:false,duration:160});
		}, function() {
			$(".cover", this).stop().animate({top:'430px'},{queue:false,duration:160});
		});

		$('.boxgrid_light.captionfull_light').hover(function(){
			$(".cover", this).stop().animate({top:'320px'},{queue:false,duration:160});
		}, function() {
			$(".cover", this).stop().animate({top:'430px'},{queue:false,duration:160});
		});
	}	
	
	
	// Scrollable ist vorhanden
	if ((typeof gScrollJQuery!="undefined") && (gScrollJQuery == true))
	{	

		$("#tab4Kontakt a").tooltip({showURL: false});
		$("#tab4Kontakt div").tooltip({showURL: false});
		$("#tab4Kontakt area").tooltip({showURL: false});

		// initialize scrollable 
		var api = $("#wheeled").scrollable(
		{
			size: 1,
			vertical: true,
			clickable:	true	
		}).navigator().mousewheel({api: true});

	}	

	jQueryIsReady = true;
	
	
	
}

var idMap1     = "";
var longitude1 = 1;
var latitude1  = 1;
var zoom1      = 14;
var newtext1   = "";

function setMap(idMap, longitude, latitude, zoom, newtext)
{
	idMap1     = idMap;
	longitude1 = longitude;
	latitude1  = latitude;
	zoom1      = zoom;
	newtext1   = newtext;
} 


function initMap()
{
	try {
	if (GBrowserIsCompatible()) { 
	    
		var map = new GMap2(document.getElementById(idMap1));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(longitude1, latitude1), zoom1);
		
		var point = new GLatLng(longitude1, latitude1);
		var marker = new GMarker(point);
		GEvent.addListener(marker, 'click',
		function() {
			marker.openInfoWindowHtml(newtext1);
		}
   );
   GEvent.addListener(map, 'click',
	 function() {
		marker.openInfoWindowHtml(newtext1);
	 }
   );
    marker.openInfoWindowHtml(newtext1);
    map.addOverlay(marker);

  }

  } catch (error) { }

} // function initMap()


// post-submit callback 
function showFormResponse(responseText, statusText)  
{ 
	if (responseText.length<=2) 
	{
		if (responseText.length<=1) 
		{
			$.prompt('<b class="rot">Das Formular wurde nicht gesendet !</b>', { callback: showPromptCallbackNoOK });
		}	
	}
	else
	{ 
		$.prompt('<b class="rot">Das Formular wurde erfolgreich gesendet:</b>'+responseText, { callback: showPromptCallbackOK });
	}
} 		
		
		
	
function showPromptCallbackOK(v, m, f)
{	
  $('#formContact').clearForm(); 
}

function showPromptCallbackNoOK(v, m, f)
{
	alert('showPromptCallbackNoOK');
}
	
function goTop()
{	
	if (document.location.hash=="#top")
	{	window.location.href=document.location;	}
	else
	{	window.location.href=document.location+"#top";	}	
}	



function emaillinkname(name, domain, subject)
{	
	var web1="mailto:"+name;
	var web2="@"
	var web3=domain;
	var web4=subject;
	var web=web1+web2+web3+'?subject='+web4;
	location.href=web;
}


// new windows		
function clswinlocal()
{
	var oldwin=window.opener;
	if (oldwin!=null)
	{	window.close();}
}
	
// Position von Fenster
function getXcenter(sizeX)
{	
	var newPosX = 0;
	if (sizeX<=maxScreenX)
	{	newPosX = (maxScreenX-sizeX)/2;}
	return newPosX;
}

// Position von Fenster
function getYcenter(sizeY)
{	
	var newPosY = 0;
	if ((sizeY+70)<=maxScreenY)
	{	newPosY = (maxScreenY-(sizeY+70))/2;}
	return newPosY;
}

// Position von Fenster
function getMaxYsize(sizeY,maxYsize)
{	
	var newMaxY = sizeY;
	if ((sizeY+80)>=maxScreenY)
	{	newMaxY = (maxScreenY-80);}
	else
	{	newMaxY = sizeY;}
	if (newMaxY>=maxYsize)
	{	newMaxY = maxYsize;}
	return newMaxY;
}
		



function loadObjectInWindow(url)
{	
	var merkmalewin1='toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=990,height='+getMaxYsize(530,1200)+',left='+getXcenter(990)+',top='+getYcenter(getMaxYsize(530,1200));
	var dateiname=url;
	actualwin1=window.open('','docwin1net',merkmalewin1);
	win1open=true;
	if (actualwin1!=null)
	{	actualwin1.focus();
		actualwin1.location.href=dateiname;
		return false;}
	else
	{	return true;}
}

function loadLinkInWindow(url)
{	
	var merkmalewin2='toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1012,height='+getMaxYsize(560,1200)+',left='+getXcenter(1012)+',top='+getYcenter(getMaxYsize(560,1200));
	var dateiname=url;
	actualwin2=window.open('','docwin2net',merkmalewin2);
	win2open=true;
	if (actualwin2!=null)
	{	actualwin2.focus();
		actualwin2.location.href=dateiname;}
		
}


function clswinall(index)
{	if (index==1)
	{	if (win1open && (actualwin1!=null) && !(actualwin1.closed))
		{	actualwin1.close();
			actualwin1=null;}
		win1open=false;}
	else
	{	if (win2open && (actualwin2!=null) && !(actualwin2.closed))
		{	actualwin2.close();
			actualwin2=null;}
		win2open=false;}	
}

					
function unloadPictures()
{
	clswinall(2);
	clswinall(1);
}


function buttonColorOn(button, color)
{
	if (button.style)
	{
		button.style.backgroundColor = color;
	}	
}

function buttonColorOff(button, color)
{
	if (button.style)
	{
		button.style.backgroundColor = color;
	}	
}		


	
// stop hiding -->	
		
	
		

