// JavaScript Document

  /* -------------------------------------------------

START:: EXTERNAL LINKS

------------------------------------------------- */
function linksExternal(){

   if (document.getElementsByTagName){
     var anchors = document.getElementsByTagName("a");
     for (var i=0; i<anchors.length; i++){
	       var anchor = anchors[i];
		   if (anchor.getAttribute("rel") == "_external"){
			   anchor.target = "_blank";
           }
      }
    }
}
/* -------------------------------------------------

END:: EXTERNAL LINKS

------------------------------------------------- */

$(window).load(function () {
 
});

/* -------------------------------------------------

START:: DOCUMENT READY

------------------------------------------------- */
$(document).ready(function(){
	
	
			$(".catalog").fancybox({
				'width'				: '100%',
				'height'			: '100%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});	
//		
//$('#mainMenu li a,#subMenu li a, #logo a').click(function() { 
//	//globalBlock("globalWrapper","Παρακαλώ περιμένετε ...");
//
//		$('#wrapper').block
//		({ message: '<div class="globalLoader"><div id="globalLoaderImg"><img src="_images/ajaxLoader.gif" /></div><div id="globalLoaderMsg"> Bitte warten ... </div></div>',
//
//    // set these to true to have the message automatically centered 
//    centerX: true, // <-- only effects element blocking (page block controlled via css above) 
//    centerY: false,
//			 css: {border: 'none',
//			 	   padding: '10px',
//				   color: "#c79500",
//				   backgroundColor: "#000",
//				   width: "180px",height : "22px",top: "180px",left: "50%",border: "1px solid #242323",
//				   '-webkit-border-radius': '10px', 
//                   '-moz-border-radius': '10px',
//				   '-khtml-border-radius': '10px',
//				   'border-radius': '10px'
//				   
//				   },
//			
//			overlayCSS:  { 
//			backgroundColor: '#000', 
//			opacity:         0.6
//			}
//		});
//	
//	
//}); 












	$("#developedBy").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-29" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

	
//	if ($("#swfHolder").length > 0){	
//		$('#swfHolder').flash({swf: '_swfs/dionysos_intro.swf',height:480,width:300});
//	}
	

	linksExternal();

	$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',slideshow:10000});

	if ($("#imageGallery").length > 0 || $(".lightBoxUrl").length > 0){
		$('#imageGallery a.lightBoxImg, a.lightBoxUrl').lightBox({
			overlayBgColor: '#ccc',
			overlayOpacity: 0.6,
			imageBlank: '_images/_lightBox/lightbox-blank.gif', 
			imageLoading: '_images/_lightBox/lightbox-ico-loading.gif',
			imageBtnClose: '_images/_lightBox/lightbox-btn-close.gif',
			imageBtnPrev: '_images/_lightBox/lightbox-btn-prev.gif',
			imageBtnNext: '_images/_lightBox/lightbox-btn-next.gif',
			containerResizeSpeed: 350,
			txtImage: 'Image',
			txtOf: 'from'						 
		});			
	}
	
	
	if($("#takeAwayForm").length > 0){
		
		var form= $("#takeAwayForm").validate({
		submitHandler: function(form){$(form).ajaxSubmit({
		beforeSubmit:function(){
		$("#formResults").show();	
		//globalBlock("holder");
		},
		success:function(){
		
		//globalUnblock("holder");
		
		$("#name, #email").val("");
		$("#name").focus();
		$("#Nachricht").html("");
		
		window.setTimeout(function() {
		$("#results").slideUp();
		}, 3000);
		
		
		return false;
		},
		target: "#formResults"
		});
		
		},
		rules: {
				name: "required",
				Nachricht: "required",
				email: {
						"required": true,
						"email": true
						}
				}
				
		});// end: Validator	
	}
	
	
	
	
	if($("#newsLetterForm").length > 0){
		
		var form= $("#newsLetterForm").validate({
		submitHandler: function(form){$(form).ajaxSubmit({
		beforeSubmit:function(){
		$("#formResults").show();	
		//globalBlock("holder");
		},
		success:function(){
		
		//globalUnblock("holder");
		
		$("#name, #email").val("");
		$("#name").focus();
		
		window.setTimeout(function() {
		$("#results").slideUp();
		}, 3000);
		
		
		return false;
		},
		target: "#formResults"
		});
		
		},
		rules: {
				name: "required",
				email: {
						"required": true,
						"email": true
						}
				}
				
		});// end: Validator	
	}

});
  
