var tipafriend_popup_open_js = 'jQuery(\'#popbox-wrap\').fadeIn(500);setVisibility(\'popbox-wrap\', \'block\');document.getElementById (\'recommend_name\').focus();';
var votepage_popup_open_js = 'jQuery(\'#popbox-wrap1\').fadeIn(500);setVisibility(\'popbox-wrap1\', \'block\');document.getElementById (\'voteform_bewertung_1\').focus();';


function setVisibility(id, visibility) {
	obj = document.getElementById(id);
	if (!obj) return;
	
	obj.style.display = visibility;
}



function ValidateForm_bewertung(obj) {											

	if (!obj) obj = document.Bewertungsformular;

	validity = true;
	missinginfo = "";
	flag="";								

	if (!obj.bewertung[0].checked && !obj.bewertung[1].checked && !obj.bewertung[2].checked)
		{
			validity = false; missinginfo += "Bitte wählen Sie eine Bewertung." + "\n";										
		}		
			
	if (missinginfo != "") 
		{
			alert(missinginfo);
			return false;
		}
	else 
		{
			e_mail_adresse = obj.bewertung_email.value;
			if (e_mail_adresse == 'E-Mailadresse' || e_mail_adresse == 'Your e-mail address' ) e_mail_adresse = '';
			if (!check_empty_bewertung(e_mail_adresse))
				{
					bestaetigung = window.confirm("Wollen Sie wirklich keine E-Mailadresse angeben?");
				}						

			if (check_empty_bewertung(e_mail_adresse)) 
				{
					if (!isMailAddress_bewertung(e_mail_adresse))
					{
						validity = false; missinginfo += "Ihre E-Mailadresse ist ungueltig." + "\n";
					}					

					if (missinginfo != "") 
						{
							alert(missinginfo);
							return false;
						}													
					else return true;
				}

			if(bestaetigung) {
				return true;
			}
			else {
				obj.bewertung_email.focus();
				return false;
			}		

		}
		
}		
		
function check_empty_bewertung(text)
{
	return (text.length > 0);
}

function isMailAddress_bewertung(myvalue)
{									
	pos=myvalue.indexOf("@");
	var arr=new Array();
	for (var i=0; i<myvalue.length; i++)
	{
	  arr[i]=myvalue.charAt(i);
	}
	str=arr.reverse().join("");
	pos2=str.indexOf(".");
	if ((pos<1)||((pos2!=2)&&(pos2!=3)&&(pos2!=4)))
	  return false;
	else
	  return true;
}		


function infoboxShowAuthor () {	

	if (document.getElementById ('infobox-author')) {		
		setVisibility ('infobox-author', 'block');
		document.getElementById ('tab_author').className = 'active';
	}
	
	if (document.getElementById ('infobox-verwandte')) {
		setVisibility ('infobox-verwandte', 'none');				
		document.getElementById ('tab_verwandte').className = '';		
	}
	
}

function infoboxShowVerwandte () {
	
	if (document.getElementById ('infobox-verwandte')) {
		setVisibility ('infobox-verwandte', 'block');		
		document.getElementById ('tab_verwandte').className = 'active';
	}
	
	if (document.getElementById ('infobox-author')) {		
		setVisibility ('infobox-author', 'none');		
		document.getElementById ('tab_author').className = '';
	}
	
}

function infoboxSetTabOnLoad () {
	if (document.getElementById ('infobox-author')) infoboxShowAuthor();
	if (document.getElementById ('infobox-verwandte')) infoboxShowVerwandte();
	
	if (document.getElementById ('infobox-author') && document.getElementById ('infobox-verwandte'))
	  document.getElementById ('infobox').className = 'infobox2';
}


function aufklappenVerwandteInhalte () {
	vi_lis = document.getElementsByTagName("li");
	for(a = 0; a < vi_lis.length; a++) {
		if(vi_lis[a].className == "vi_invisible") vi_lis[a].className = "vi_visible";
	}
	setVisibility ('vi_aufklappen', 'none') ;
	setVisibility ('vi_zuklappen', 'block') ;		
}

function zuklappenVerwandteInhalte () {
	vi_lis = document.getElementsByTagName("li");
	for(a = 0; a < vi_lis.length; a++) {
		if(vi_lis[a].className == "vi_visible") vi_lis[a].className = "vi_invisible";
	}
	setVisibility ('vi_aufklappen', 'block') ;
	setVisibility ('vi_zuklappen', 'none') ;	

}

function checkSearchSubmission (sword_id, default_value) {
	
	obj = document.getElementById (sword_id);
	if (!obj) {
		alert ('Interner Fehler - kein Feld mit ID '+sword_id);
		return (false);
	}
	
	value = obj.value;
	if (value == '' || value == default_value) {
		alert ('Bitte geben Sie einen Suchbegriff ein!');
		return (false);
	}
	else return (true);

}

