
	function submitNewsletterForm(){
	
		var mail = document.newsletterForm.mail.value;

		warnings = 0;
		if(!checkInputLength(document.newsletterForm.mail,1,'mailError'))
			warnings++;			
		if(!checkInputLength(document.newsletterForm.name,1,'nameError'))
			warnings++;			
		if((mail.indexOf(".") < 2) && (mail.indexOf("@") < 0)){
			$('#mailError2').show();
			warnings++;
		}
		else
			$('#mailError2').hide();
		if(warnings == 0)		
			$.ajax({
			  url: "ajax_manager.php",
			  cache: false,
			  data: "addMember=add&name="+name+"&mail="+mail,		  
			  type: "get",
			  success: function(response){
			  	$("#newsLetterResponse").html(response);
			  }
			});
	
	}

	function getGalleryImage(categoryID,imageID){
		$.ajax({
		  url: "ajax_manager.php",
		  cache: false,
		  data: "image="+imageID+"&category="+categoryID,		  
		  type: "get",
		  success: function(response){
		    $("#galleryImage").html(response);
		  }
		});
	}
	
	function submitenter(myfield,e)	{
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
	
		if (keycode == 13){
		   submitNewsletterForm();
		   return false;
		}
		else
		   return true;
	}
	
	function checkInputLength(inputElement,inputLength,errorElementID){
		
		errorElement = document.getElementById(errorElementID);
		if(inputElement.value.length < inputLength){
			errorElement.style.display = 'block';
			return false;
		}
		else{
			errorElement.style.display = 'none';
			return true;
		}
		
	}		
	
	function correctPNG(){
		for(var i=0; i<document.images.length; i++)	{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
				img.outerHTML = strNewHTML
				i = i-1
		
			}
		}	
	}	

 $(document).ready(function(){
    correctPNG();
  });
