function showhide(element) { 
	if (document.getElementById(element).style.display == 'none') {
		document.getElementById(element).style.display = 'block';
	} else {
		document.getElementById(element).style.display = 'none';
 	}
} 


function changeView(targetId) {
  var obj = document.getElementById('gercountry');
  if (obj != null) obj.style.display = (targetId=='gercountry')? 'block' : 'none';
  var obj = document.getElementById('autcountry');
  if (obj != null) obj.style.display = (targetId=='autcountry')? 'block' : 'none';
  var obj = document.getElementById('checountry');
  if (obj != null) obj.style.display = (targetId=='checountry')? 'block' : 'none';
  var obj = document.getElementById('international');
  if (obj != null) obj.style.display = (targetId=='international')? 'block' : 'none';
}
       
function changeView2(targetId) {  
  var obj = document.getElementById('detailsearch0');
  if (obj != null) obj.style.display = (targetId=='detailsearch0')? 'block' : 'none';
  var obj = document.getElementById('detailsearch1');
  if (obj != null) obj.style.display = (targetId=='detailsearch1')? 'block' : 'none';
  var obj = document.getElementById('detailsearch2');
  if (obj != null) obj.style.display = (targetId=='detailsearch2')? 'block' : 'none';
  var obj = document.getElementById('detailsearch3');
  if (obj != null) obj.style.display = (targetId=='detailsearch3')? 'block' : 'none';      
  var obj = document.getElementById('detailsearch4');
  if (obj != null) obj.style.display = (targetId=='detailsearch4')? 'block' : 'none'; 
}

function hideAll() {
  var obj = document.getElementById('gercountry');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('autcountry');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('checountry');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('international');
  if (obj != null) obj.style.display = 'none';

  return true;
}
        
function hideAll2() {
  var obj = document.getElementById('detailsearch0');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('detailsearch1');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('detailsearch2');
  if (obj != null) obj.style.display = 'none';
  var obj = document.getElementById('detailsearch3');
  if (obj != null) obj.style.display = 'none';      
  var obj = document.getElementById('detailsearch4');
  if (obj != null) obj.style.display = 'none';   	

  return true;
}
      
function changeView3(targetId) {  
  var obj = document.getElementById('detailsearchs');
  if (obj != null) obj.style.display = (targetId=='detailsearchs')? 'block' : 'none';
  var obj = document.getElementById('detailsearchs1');
  if (obj != null) obj.style.display = (targetId=='detailsearchs1')? 'block' : 'none';
  var obj = document.getElementById('detailsearchs2');
  if (obj != null) obj.style.display = (targetId=='detailsearchs2')? 'block' : 'none';
  var obj = document.getElementById('detailsearchs3');
  if (obj != null) obj.style.display = (targetId=='detailsearchs3')? 'block' : 'none';      
}

var textaereaDefaultsArray = new Array();

function checkTextaereaValue(defaultString, e) {
  if(e.value==defaultString) e.value='';
}

function checkAllTextaereas() {
  if(typeof(FCKeditorAPI) != 'undefined'){
    var coverletter = FCKeditorAPI.GetInstance('coverletter') ;
    var profile = FCKeditorAPI.GetInstance('profile') ;
    var retraining_content = FCKeditorAPI.GetInstance('retraining_content') ;  
    
    if (retraining_content != null ) {
      if (retraining_content.GetHTML() == "<p>Bitte tragen Sie hier Ihr eine Beschreibung Ihres Forbildungsangebotes ein.</p>"){
        retraining_content.SetHTML("");
      }
    }
    
    if (profile != null ) {
      if (profile.GetHTML() == "<p>Please enter your company profile.</p>"  || profile.GetHTML() == "<p>Bitte tragen Sie hier Ihr Firmenprofil ein.</p>" || profile.GetHTML() == "<p>Bitte geben Sie die Beschreibung des Unterprofils ein.</p>"  || profile.GetHTML() == "<p>Please enter your client's profile.</p>"
          || profile.GetHTML() == "Please enter your company profile."  || profile.GetHTML() == "Bitte tragen Sie hier Ihr Firmenprofil ein." || profile.GetHTML() == "Bitte geben Sie die Beschreibung des Unterprofils ein."  || profile.GetHTML() == "Please enter your client's profile."){
        profile.SetHTML("");
      }
    }
    
    if (coverletter != null ) {
      if (coverletter.GetHTML() == "<p>Bitte tragen Sie hier Ihr pr&auml;gnantes und aussagekr&auml;ftiges Bewerbungsanschreiben ein.</p>" || coverletter.GetHTML() == "<p>Please enter your concise and meaningful cover letter.</p>"){
        coverletter.SetHTML("");
      }
    }
  };  

  
  var m = document.getElementsByTagName('textarea');
  if (m != null) {
    for(var i=0;i<m.length;i++){
      checkTextaereaValue(textaereaDefaultsArray[m[i].name], m[i]);
    }
  }
  if(typeof(FCKeditorAPI) != 'undefined'){
    checkAllIframes();
  }
}

// In TinyMCE an 'mousedown'-Event gebunden
function checkObjInnerText(obj){
  // alert(obj);
  if (obj.innerText) { // IE, Opera; 
    if (obj.innerText.indexOf("Bitte")==0 || obj.innerText.indexOf("Please")==0 ) obj.innerText=""; 
  } else { 
    if (obj.textContent) 
      if (obj.textContent.indexOf("Bitte")==0 || obj.textContent.indexOf("Please")==0 ) obj.textContent="";
  }
}

function checkAllIframes() {

  var descriptionad = FCKeditorAPI.GetInstance('descriptionad') ;
  if (descriptionad != null ) {
    if (descriptionad.GetHTML() == "<p>Bitte geben Sie hier Ihren Ausschreibungstext ein.</p>" || descriptionad.GetHTML() == "<p>Please enter your offer text.</p>"){
      descriptionad.SetHTML("");
    }  
  }

  var m = document.getElementsByTagName('iframe');
  if (m != null) {
    for(var i=0;i<m.length;i++){
      if (m[i].contentDocument) checkObjInnerText(m[i].contentDocument.body);
      else if (m[i].Document) checkObjInnerText(m[i].Document.body);
    }
  }
}

function showBuySelect(targetId) {

  $("#shopColumnLeft .groupField").each(function(){
    $(this).attr("class", (targetId == $(this).attr("id"))? 'dunkelOrange groupField' : 'hellOrange groupField');
  }); 

}

function showBuySelectRight(targetRight) {  

  $("#shopColumnRight .productField").each(function(){
    var target = targetRight+'_selected';
    if (targetRight == $(this).attr("id")) {
      $(this).show();
    } else {
      $(this).hide();
    }
  }); 

}


