// ########################################################################################################
//
// Copyright 2008 by Roger Steen - www.webideen.de
//
// im Auftrag von
// SPENDWERK GmbH, Agentur für Sozialmarketing, Reindorfer Schulweg 42 b, 21266 Jesteburg, www.spendwerk.de
//
// ########################################################################################################

function openVideo(videoID, language) {
	//new Effect.Opacity('content', { from: 1.0, to: 0.2, duration: 1.0 });
	new Effect.Opacity('header', { from: 1.0, to: 0.2, duration: 1.0 });
	new Effect.Opacity('footer', { from: 1.0, to: 0.2, duration: 1.0 });
	new Effect.Opacity('youtube', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('protest')))
		new Effect.Opacity('protest', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('fotoalbumspezial')))
		new Effect.Opacity('fotoalbumspezial', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('stopitstatements')))
		new Effect.Opacity('stopitstatements', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('stopitfotos')))
		new Effect.Opacity('stopitfotos', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('ecard')))
		new Effect.Opacity('ecard', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('linklistindex1')))
		new Effect.Opacity('linklistindex1', { from: 1.0, to: 0.2, duration: 1.0 });
	if (isNaN(document.getElementById('linklistindex2')))
		new Effect.Opacity('linklistindex2', { from: 1.0, to: 0.2, duration: 1.0 });
	var element0 = Builder.node('div', { id:'video', style: 'background-image:url(images/trans.gif); position:absolute; text-align:left;  top:0px; left:0px; width:1000px; height:710px;'}, '');
	$('overlay').insert(element0);

	new Ajax.Request('getvideo.php?videoID='+videoID+'&language='+language, {
	  method: 'get',
	  onSuccess: function(transport) {
			var contact = $('video');
	    contact.update(transport.responseText);
	  }
	});
}

function loadAlbum(albumid, page) {
	new Ajax.Request("getfotoalbum.php?albumid="+albumid+"&page="+page, {
	  method: "get",
	  onSuccess: function(transport) {
			var fotoalbum = $("fotoalbum");
	    fotoalbum.update(transport.responseText);
	  }
	});
}

function loadAlbumSpezial(albumid, page) {
	new Ajax.Request("getfotoalbumspezial.php?albumid="+albumid+"&page="+page, {
	  method: "get",
	  onSuccess: function(transport) {
			var fotoalbum = $("fotoalbum");
	    fotoalbum.update(transport.responseText);
	  }
	});
}

function closeButton() {
	$('video').remove();
	//new Effect.Opacity('content', { from: 0.2, to: 1.0, duration: 1.0 });
	new Effect.Opacity('header', { from: 0.2, to: 1.0, duration: 1.0 });
	new Effect.Opacity('footer', { from: 0.2, to: 1.0, duration: 1.0 });
	new Effect.Opacity('youtube', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('protest')))
		new Effect.Opacity('protest', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('fotoalbumspezial')))
		new Effect.Opacity('fotoalbumspezial', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('stopitstatements')))
		new Effect.Opacity('stopitstatements', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('stopitfotos')))
		new Effect.Opacity('stopitfotos', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('ecard')))
		new Effect.Opacity('ecard', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('linklistindex1')))
		new Effect.Opacity('linklistindex1', { from: 0.2, to: 1.0, duration: 1.0 });
	if (isNaN(document.getElementById('linklistindex2')))
		new Effect.Opacity('linklistindex2', { from: 0.2, to: 1.0, duration: 1.0 });
}

function FensterOeffnen (Adresse,Titel) {
  MeinFenster = window.open(Adresse, Titel, "width=1000, height=600, status=no, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=yes");
  MeinFenster.focus();
}

function isEMailValid(s) {
  var a = false;
  var res = false;
  if (typeof(RegExp) == 'function') {
    var b = new RegExp('abc');
    if (b.test('abc') == true) {
      a = true;
    }
  }
  
  if (a == true) {
    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)(\\@)([a-zA-Z0-9\\-\\.]+)(\\.)([a-zA-Z]{2,4})$');
    res = (reg.test(s));
  } else {
    res = (s.search('@') >= 1 && s.lastIndexOf('.') > s.search('@') && s.lastIndexOf('.') >= s.length-5)
  }
  return(res);
} 
