function refreshContent(content_source) {
  var main_bg = $("#main_bg");
  var main_content = $("#main_content");
  if ($("#menu_left").length != 0)  {
  content_source_bg = content_source.concat("_bg.php");  
  content_source_mc = content_source.concat("_mc.php");  
    main_bg.fadeOut("slow", function(){
     main_bg.load(content_source_bg,false, function() {
	   setTimeout(function(){
		 main_bg.fadeIn("slow");
		},2200);
    });
  });
  main_content.fadeOut("slow", function(){
	$("#sec_content").empty();
    main_content.load(content_source_mc,false, function() {
		 setTimeout(function(){
			main_content.fadeIn("slow");
		},2200);

    });
  });
  } else {
	refreshFullContent(content_source);
  }
  return false;
}

function refreshFullContent(content_source) {
  var container = $("#container");
  content_source = content_source.concat(".php");
  container.fadeOut("slow", function(){
    container.load(content_source,false, function() {
       setTimeout(function(){
			container.fadeIn("slow");
		},2200);
    });
  });
  return false;
}

function refreshShortContent(content_source) {
  var main_content = $("#main_content");
  var sec_content = $("#sec_content");
  content_source_sc = "project_sc.php?id=" + content_source;  
  content_source_mc = "project_mc.php?id=" + content_source;   
    main_content.fadeOut("slow", function(){
     main_content.load(content_source_mc,false, function() {
		 setTimeout(function(){
			main_content.fadeIn("slow");
		},2200);
    });
  });
  sec_content.fadeOut("slow", function(){
    sec_content.load(content_source_sc,false, function() {
		sec_content.fadeIn("slow");
    });
  });
  return false;
}


function toggleField(field_id) {
	$(".fields").hide("slow");
	$(field_id).show("slow");
  return false;
}

function toggleLong() {
	$("#long_container").toggle("slow");
  return false;
}

function showImage(image_name) {
	$("#img_container").empty();
	var imgstr = '<a href=\"#\" onclick=\"return hideImage();\"><img src="'+image_name+'" /></a>';
	$('#img_container').append(imgstr);
	$("#img_container").show("slow");
  return false;
}
function hideImage() {
	$("#img_container").val("");
	$("#img_container").hide("slow");
  return false;
}

function hideProjects(){
 $("#cols_projects").hide();
}


function myPopup(url) 
{
 var width  = 1000;
 var height = 600;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'ARTificialSPACE', params);
 if (window.focus) {newwin.focus()}
 return false;
}

function checkForm(){
var anrede  = document.contact_form.Anrede.value;
var vorname = document.contact_form.Vorname.value;
var nachname = document.contact_form.Nachname.value;
var email = document.contact_form.EMail.value;

var returnval = true;

if ( anrede == "") {
   returnval = false;
   alert("Anrede falsch !");

}
else if ( vorname == "") {
   returnval = false;
   alert("Vorname leer !");

}
else if ( nachname == "") {
   returnval = false;
   alert("Nachname leer !");
}
else if ( email == "") {
   returnval = false;
   alert("Email leer !");
}
return returnval;
}

function checkRecommend(){
var Empfaenger = document.rec_form.Empfaenger.value;
var AbsenderEmail = document.rec_form.AbsenderEmail.value;
var AbsenderName = document.rec_form.AbsenderName.value;

var returnval = true;

if ( Empfaenger == "") {
   returnval = false;
   alert("Empfaenger leer !");

}
else if ( AbsenderEmail == "") {
   returnval = false;
   alert("Absender Email leer !");

}
else if ( AbsenderName == "") {
   returnval = false;
   alert("Absender Name leer !");
}

return returnval;
}
