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


$(document).ready(function() 
{
	// Tabs sind vorhanden
	if (gTabJQuery && (gTabJQuery > 0))
	{
		for (i=0; i<gTabJQuery; i++)
		{
			$('#tabs'+(i+1)).tabs({ cache: true, selected: (gTabDefJQuery-1) });
		}
		
		
	}
	
	// Accordion ist vorhanden
	if (gAcJQuery && (gAcJQuery == true))
	{
		//$("#accordion").hide();
		$("#accordion").css("display","block");
		$("#accordion").accordion({ 
			header: "h6", 
			collapsible: true, 
			autoHeight: gAcJQueryHeight,
			active: gAcJQueryActive
		});
		//$('#accordion').accordion('option', 'autoHeight', false);
	}
	
	// Mediafiles sind vorhanden
	if (gMediaJQuery && (gMediaJQuery == true))
	{	
		$("a.media").media( { width: 300, height: 20} );
	}	
	
	
	
	
	// Gallery ist vorhanden
	if (gGalleryJQuery && (gGalleryJQuery == true))
	{
		$('.gallery').addClass('mmhide_galleryImg'); // adds new class name to maintain degradability
		
		$('ul.mmhide_galleryImg').galleria(
		{
			history   : false, 				// activates the history object for bookmarking, back-button etc.
			clickNext : false, 				// helper for making the image clickable
			insert    : '#mainImage', // 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.3);
				
				// 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 str1 = image.attr('src');
				var str2 = str1.replace('s.','l.');
				a1.attr('href', str2);
				a1.attr('title', thumb.attr('title'));
							
			},
			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.3';
				
				// 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.3); } // don't fade out if the parent is active
				)
			}
		});
	}
	
	// Form fuer Kontakt ist vorhanden
	if (gFormJQueryContact && (gFormJQueryContact == true))
	{
		$('#anfrageC').prettyComments();
		$('.inputTextAnfrage').prettyComments({animate: false, maxHeight:150});

		
		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.susanneschanda.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 Emailadresse 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}); 
		
		
		$("input").tooltip();
		$("img").tooltip({showURL: false});
		$("a").tooltip({showURL: false});
		$("div.navi").tooltip();

		var formtx = document.forms[0].anfrageC;
		formtx.focus();
		formtx.value += '';
	}
	
	
	// Scrollable ist vorhanden
	if (gScrollJQuery && (gScrollJQuery == true))
	{	
		// initialize scrollable 
		var api = $("div.scrollable").scrollable(
		{
			size: 1,
			vertical: true,
			api: true,
			clickable:	false	
		});
		api.movePage(0);
	}	
	
	// Scrollable ist vorhanden
	if (gScrollJQueryContact && (gScrollJQueryContact == true))
	{	
		// initialize scrollable 
		$("#wheeled").scrollable(
		{
			size: 1,
			vertical: true,
			clickable:	true	
		}).navigator().mousewheel();
	}	
	
});






// 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');
}

		
// stop hiding -->	
		
	