function showRef(no) {
	var myFx = new Fx.Style('referenzen', 'opacity');
	myFx.start(1,0).chain(function() {
	var mySendRequest = new Ajax('/referenzenviewer.php', {
				postBody: 	{	'no': no
						
						},
						update: 'referenzen'
	}).request().chain(function(){
		
				//$('contactform').setHTML('<table width="100%" height="100%" border="0" id="contactformtable"><tr><td align=center valign=center>' + lng_thankyou + '</td></tr></table>');
			myFx.start(0,1);
		});
	});
}

function showImg(img, imgtext) {
	img = '/referenzen/' + img;
	
	var bigimgfade = new Fx.Style('bigimg', 'opacity');
	
	$('bigimg').setStyle('background', 'url(\'./images/loading.gif\') center center no-repeat');
	
	this.preload = new Image();
	this.preload.src = img;
	this.preload.onload = function() {
		
		bigimgfade.start(1,0).chain(function() {
			$('bigimg').setHTML('<table width=100% height=100%><tr><td align=center valign=center><img src="' + img + '"></td></tr></table>');
			$('imgtext').setHTML(imgtext);
			
			bigimgfade.start(0,1);
		});
	}
}
		
function showRefNews(no) {
	var myFx = new Fx.Style('referenzen', 'opacity');
	myFx.start(1,0).chain(function() {
	var mySendRequest = new Ajax('/newsviewer.php', {
				postBody: 	{	'no': no
						
						},
						update: 'referenzen'
	}).request().chain(function(){
		
				//$('contactform').setHTML('<table width="100%" height="100%" border="0" id="contactformtable"><tr><td align=center valign=center>' + lng_thankyou + '</td></tr></table>');
			myFx.start(0,1);
		});
	});
}

function showNews(img, imgtext) {
	img = '/referenzen/' + img;
	
	var bigimgfade = new Fx.Style('bigimg', 'opacity');
	
	$('bigimg').setStyle('background', 'url(\'./images/loading.gif\') center center no-repeat');
	
	this.preload = new Image();
	this.preload.src = img;
	this.preload.onload = function() {
		
		bigimgfade.start(1,0).chain(function() {
			$('bigimg').setHTML('<table width=100% height=100%><tr><td align=center valign=center><img src="' + img + '"></td></tr></table>');
			$('imgtext').setHTML(imgtext);
			
			bigimgfade.start(0,1);
		});
	}
		
	var myFx = new Fx.Style('bigimg', 'opacity');
	$('bigimg').setStyle('background', '');
	
}

function startform(){
		
		$('contactformsubmit').addEvent("click", function(){
			contactForm.contactFormSubmit();
			return false;
		});
		
	}

var contactForm = {
	
	contactFormSubmit: function() {
		
		if ($('contactname').value != '' && $('contactemail').value != '' && $('contactmessage').value != '' && $('contactphone').value != '') {
			var mySendRequest = new Ajax('/ajax-send-contactform.php', {
				postBody: 	{	'name': $('contactname').value,
							'company': $('contactcompany').value,
							'email': $('contactemail').value,
							'phone': $('contactphone').value, 
							'message': $('contactmessage').value
						}
			}).request();
			var myFx = new Fx.Style('contactform', 'opacity');
			myFx.start(1,0).chain(function() {;
				$('contactform').setHTML('<table width="100%" height="100%" border="0" id="contactformtable"><tr><td align=center valign=center>' + lng_thankyou + '</td></tr></table>');
			var myFx2 = new Fx.Style('contactform', 'opacity');
			myFx2.start(0,1);
			});
			
		} else {
			
			contactForm.showerrorBox();
		
		}
		
		return false;
	},
	
	showerrorBox: function() {
		
		var myFx = new Fx.Style('errorbox', 'opacity');
		myFx.start(0,0.8);
	//	var myFx = Fx.Style('errorbox', 'opacity').custom(0,0.8);
		
	},
	hideerrorBox: function() {
		var myFx = new Fx.Style('errorbox', 'opacity');
		myFx.start(0.8,0);
	}
};
