function check_login_user_Formular()
{
	if (document.login_user.name.value == "")
	{
		alert("Bitte geben Sie Ihren Benutzernamen ein!");
		document.login_user.name.focus();
		return false;
	}
	if (document.login_user.pass.value == "")
	{
		alert("Bitte Ihr Passwort eingeben!");
		document.login_user.pass.focus();
		return false;
	}
}
function clearonclick(el, def) {
	if(el.value == def) {
		el.value = '';
	}
	clearonclickpw(document.getElementById("password"));
}
function refill(el, def) {
	if(el.value == '') {
		el.value = def;
	}
	refillpw(document.getElementById("password"));
}
function clearonclickpw(el) {
	el.style.backgroundImage = "none";
}
function refillpw(el) {
	if(el.value == '') {
		el.style.backgroundImage = "url(/easyrss/general/pics/pwbg.gif)";
	}
}
function hover(x,c)
{
	x.style.backgroundColor=c;
}
function searchFormCheck(){
	if (document.search.q.value.length < 3)
	{
		alert("Ihre Suchanfrage muss mindestens 3 Zeichen lang sein!");
		document.search.q.focus();
		return false;
	}
	location.href='/easyrss/verzeichnis/search.jsp?td='+document.search.td.value+'&page=1&q='+escape(document.search.q.value);

}
function feedPSearch(){
	var query="";
	if (document.psearch.q.value.length < 3)
	{
		alert("Ihre Suchanfrage muss mindestens 3 Zeichen lang sein!");
		document.psearch.q.focus();
		return false;
	}
	query += document.psearch.q.value;
	var allorone = 0;
	if (document.psearch.alloroneselect[0].checked == true) {
		document.psearch.allorone.value = 0;
	} else if (document.psearch.alloroneselect[1].checked == true) {
		document.psearch.allorone.value = 1;
	} else {
    	alert("Bitte eine Auswahl treffen");
		return false;
	}
	var td="title";
	if (document.psearch.description.checked)
	{
		td += ",description";
	} 
	location.href='/easyrss/verzeichnis/search.jsp?allorone='+allorone+'&td='+td+'&q='+escape(query)+'&page='+document.psearch.page.value+'&nq='+escape(document.psearch.nq.value);
}
function sort_Channels_Formular()
{
	location.href='/easyrss/verzeichnis/channels.jsp?folder_name='+encodeURIComponent(document.sort_Channels.folder_name.value)+'&folder='+document.sort_Channels.folder.value+'&sorted='+document.sort_Channels.sorted.value+'&page='+document.sort_Channels.page.value;
}
function check_new_Channel_Formular()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	}
	if (document.new_Channel.folder.selectedIndex == 0)
	{
		alert("Bitte waehlen Sie eine geeignete Rubrik fuer den RSS Feed aus!");
		document.new_Channel.folder.focus();
		return false;
	}
	if (document.new_Channel.j_captcha_response.value == "")
	{
		alert("Bitte geben Sie den Code aus dem Bild ein!");
		document.new_Channel.j_captcha_response.focus();
		return false;
	}
	//location.href=('listPane', 'newChannelForm.jsp?url='+encodeURIComponent(document.new_Channel.url.value)+'&folder='+document.new_Channel.folder.value+'&j_captcha_response='+document.new_Channel.j_captcha_response.value);
}
function check_new_Channel_Formular_Preview()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	} else {
		window.open('/easyrss/feed_distribution.html?f=arial&fs=10&lc=%23000000&fc=%23000000&m=100&d=true&h=true&hd=true&integration=iframe&bgcolor=%23ffffff&url='+encodeURIComponent(document.new_Channel.url.value)+'', 'Vorschau', 'width=400,height=400,left=100,top=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes')
		return false;
	}
}
function displayDescription(text)
{
	document.getElementById("desc").innerHTML=text;
}
function setVoteStars(vote)
{
	for (i=1;i<=vote;i++)
	{
		document.getElementById("star"+i).src="/easyrss/images/star.gif";
	}
	for (i=vote+1;i<=7;i++)
	{
		document.getElementById("star"+i).src="/easyrss/images/star_gray.gif";
	}
}
function sendFeedback()
{
	var atSearch = /@/;
	var atResult = atSearch.exec(document.feedback.user_email.value);
	if (atResult == null)
	{
		alert("Bitte geben Sie eine gueltige E-Mail Adresse ein!");
		document.feedback.user_email.focus();
		return false;
	} else {
		return true;
	}

}
function check_register_user_Formular()
{
	if (document.register_user.name.value == "")
	{
		alert("Bitte einen Benutzernamen eingeben!");
		document.register_user.name.focus();
		return false;
	}
	var wsSearch = / /;
	var wsResult = wsSearch.exec(document.register_user.name.value);
	if (wsResult != null)
	{
		alert("Bitte geben Sie einen Benutzernamen ohne Leer- oder Sonderzeichen ein!");
		document.register_user.name.focus();
		return false;
	}
	if (document.register_user.pass.value.length < 5)
	{
		alert("Bitte ein mindestens 5-stelliges neues Passwort eingeben!");
		document.register_user.pass.focus();
		return false;
	}
	if (document.register_user.passrepeat.value == "")
	{
		alert("Bitte geben Sie die Wiederholung ihres neuen Passwortes ein!");
		document.register_user.passrepeat.focus();
		return false;
	}
	if (document.register_user.passrepeat.value != document.register_user.pass.value)
	{
		alert("Das neue Passwort und die Wiederholung stimmen nicht ueberein!");
		document.register_user.passrepeat.focus();
		return false;
	}
	if (document.register_user.email.value == "")
	{
		alert("Bitte geben Sie eine gueltige E-Mail Adresse ein!");
		document.register_user.email.focus();
		return false;
	}
	if (document.register_user.agb.checked == false)
	{
		alert("Sie muessen die AGB und Datenschutzbestimmungen lesen und akzeptieren!");
		return false;
	}
}
function showDistributionPreview(){
	var width=document.distribution.width.value;
	var height=document.distribution.height.value;
	var maxItems=document.distribution.maxItems.value;
	var url=encodeURIComponent(document.distribution.feedUrl.value);
	var headline = "false";
	if (document.distribution.headline.checked == true)
		headline = "true";
	var headlineDescription = "false";
	if (document.distribution.headlineDescription.checked == true)
		headlineDescription = "true";
	var description = "false";
	if (document.distribution.description.checked == true)
		description = "true";
	for (i = 0; i < document.distribution.integration.length; ++i)
    	if (document.distribution.integration.options[i].selected == true)
      		integration = document.distribution.integration.options[i].value;
	bgcolor=encodeURIComponent(document.distribution.bgcolor.value);
	fontcolor=encodeURIComponent(document.distribution.fontcolor.value);
	linkcolor=encodeURIComponent(document.distribution.linkcolor.value);
	for (i = 0; i < document.distribution.font.length; ++i)
    	if (document.distribution.font.options[i].selected == true)
      		font = document.distribution.font.options[i].value;
	for (i = 0; i < document.distribution.fontsize.length; ++i)
    	if (document.distribution.fontsize.options[i].selected == true)
      		fontsize = document.distribution.fontsize.options[i].value;
	window.open("/easyrss/feed_distribution.html?f="+font+"&fs="+fontsize+"&lc="+linkcolor+"&fc="+fontcolor+"&m="+maxItems+"&d="+description+"&h="+headline+"&hd="+headlineDescription+"&integration=iframe&url="+url+"&bgcolor="+bgcolor, "Vorschau", "width="+width+",height="+height+",left=100,top=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=auto,resizable=yes");
}

function generateDistributionCode(){
	var width=document.distribution.width.value;
	var height=document.distribution.height.value;
	var maxItems=document.distribution.maxItems.value;
	var url=encodeURIComponent(document.distribution.feedUrl.value);
	var headline = "false";
	if (document.distribution.headline.checked == true)
		headline = "true";
	var headlineDescription = "false";
	if (document.distribution.headlineDescription.checked == true)
		headlineDescription = "true";
	var description = "false";
	if (document.distribution.description.checked == true)
		description = "true";
	for (i = 0; i < document.distribution.integration.length; ++i)
    	if (document.distribution.integration.options[i].selected == true)
      		integration = document.distribution.integration.options[i].value;
	bgcolor=encodeURIComponent(document.distribution.bgcolor.value);
	fontcolor=encodeURIComponent(document.distribution.fontcolor.value);
	linkcolor=encodeURIComponent(document.distribution.linkcolor.value);
	for (i = 0; i < document.distribution.font.length; ++i)
    	if (document.distribution.font.options[i].selected == true)
      		font = document.distribution.font.options[i].value;
	for (i = 0; i < document.distribution.fontsize.length; ++i)
    	if (document.distribution.fontsize.options[i].selected == true)
      		fontsize = document.distribution.fontsize.options[i].value;
    if (integration == "iframe")
		document.code.textarea.value="<iframe width=\""+width+"\" height=\""+height+"\" src=\"http://www.easyrss.de/easyrss/feed_distribution.html?f="+font+"&fs="+fontsize+"&lc="+linkcolor+"&fc="+fontcolor+"&m="+maxItems+"&d="+description+"&h="+headline+"&hd="+headlineDescription+"&integration=iframe&url="+url+"&bgcolor="+bgcolor+"\" scrolling=\"auto\" frameborder=\"0\"></iframe>";
    else
		document.code.textarea.value="<script type=\"text/javascript\" src=\"http://www.easyrss.de/easyrss/feed_distribution.js?f="+font+"&fs="+fontsize+"&lc="+linkcolor+"&fc="+fontcolor+"&m="+maxItems+"&d="+description+"&h="+headline+"&hd="+headlineDescription+"&integration=javascript&url="+url+"&bgcolor="+bgcolor+"&width="+width+"\"></script>";
	return false
}
function check_newFeed()
{
	if (document.new_feed.name.value == "")
	{
		alert("Bitte geben Sie einen Namen ein!");
		document.new_feed.name.focus();
		return false;
	}
  	else
  	{
  		return true;
  	}
}

function check_newAggregator()
{
	if (document.new_aggregator.name.value == "")
	{
		alert("Bitte geben Sie einen Namen ein!");
		document.new_aggregator.name.focus();
		return false;
	}
  	else
  	{
  		return true;
  	}
}

function check_newItem()
{
	if (document.new_item.title.value == "")
	{
		alert("Bitte geben Sie einen Titel fuer den Eintrag ein!");
		document.new_item.title.focus();
		return false;
	}
  	else
  	{
		location.href='/easyrss/rsstools/editMyFeedItems.jsp?addItem=1&title='+document.new_item.title.value+'&feed_name='+document.new_item.feed_name.value+'&feed_id='+document.new_item.feed_id.value;  		
  		return true;
  	}
}

function check_new_Aggregator_Item()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	}
  	else
  	{
		return true;
  	}
}

function check_deleteFeed(id)
{
	Check = confirm("Wollen Sie diesen Feed mitsamt seinen Inhalten wirklich loeschen?");
	if (Check == false)
	{
  		return false;
  	}
  	else
  	{
		location.href='/easyrss/rsstools/editMyFeeds.jsp?deleteFeed=1&feed='+id;  		
  		return true;
  	}
}

function check_deleteAggregator(id)
{
	Check = confirm("Wollen Sie diesen Aggregator wirklich loeschen?");
	if (Check == false)
	{
  		return false;
  	}
  	else
  	{
		location.href='/easyrss/rsstools/editMyAggregators.jsp?deleteAggregator=1&aggregator_id='+id;  		
  		return true;
  	}
}

function check_deleteItem(id, feed_id, feed_name)
{
	Check = confirm("Wollen Sie diesen Eintrag wirklich aus dem Feed loeschen?");
	if (Check == false)
	{
  		return false;
  	}
  	else
  	{
		location.href='/easyrss/rsstools/editMyFeedItems.jsp?deleteItem=1&item_id='+id+'&feed_name='+feed_name+'&feed_id='+feed_id;  		
  		return true;
  	}
}
function check_convert_Channel_Formular()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	}
	for (i = 0; i < document.new_Channel.format.length; ++i)
    	if (document.new_Channel.format.options[i].selected == true)
      		format = document.new_Channel.format.options[i].value;
	window.open('/easyrss/rssconverter?url='+encodeURIComponent(document.new_Channel.url.value)+'&type=.'+format);
	return false;
}
function check_rss2pdf_Formular()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	}
	window.open('/easyrss/rssconverter?url='+encodeURIComponent(document.new_Channel.url.value)+'&type=.pdf');
	return false;
}
function check_delete()
{
	Check = confirm("Wollen Sie diesen Feed wirklich loeschen?");
	if (Check == false)
	{
  		return false;
  	}
  	else
  	{
  		return true;
  	}
}
function check_newFolder()
{
	if (document.new_folder.parent.selectedIndex == 0)
	{
		alert("Bitte waehlen Sie einen Ordner aus!");
		document.new_folder.parent.focus();
		return false;
	}
	if (document.new_folder.new_name.value == "")
	{
		alert("Bitte geben Sie einen Namen ein!");
		document.new_folder.new_name.focus();
		return false;
	}
  	else
  	{
  		return true;
  	}
}
function check_deleteFolder(id)
{
	Check = confirm("Wollen Sie diesen Ordner mitsamt seinen Inhalten wirklich loeschen?");
	if (Check == false)
	{
  		return false;
  	}
  	else
  	{
		location.href='/easyrss/rssreader/editFolders.jsp?folder_delete=1&folder_id='+id;  		
  		return true;
  	}
}

function check_renameFolder()
{
	if (document.rename_folder.new_name.value == "")
	{
		alert("Bitte geben Sie einen Namen ein!");
		document.rename_folder.new_name.focus();
		return false;
	}
  	else
  	{
		location.href='/easyrss/rssreader/renameFolder.jsp?new_name='+document.rename_folder.new_name.value+'&name='+document.rename_folder.name.value+'&id='+document.rename_folder.id.value;
  		return true;
  	}
}
function check_new_Reader_Abo_Formular()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_Channel.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_Channel.url.focus();
		return false;
	}
	else if (document.new_Channel.folder.selectedIndex == 0)
	{
		alert("Bitte waehlen Sie einen geeigneten Ordner fuer den RSS Feed aus!");
		document.new_Channel.folder.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function check_new_Reader_OPML_Formular()
{
	var httpSearch = /^http/;
	var httpResult = httpSearch.exec(document.new_OPML.url.value);
	if (httpResult == null)
	{
		alert("Bitte geben Sie eine gueltige Adresse ein!");
		document.new_OPML.url.focus();
		return false;
	}
	if (document.new_OPML.folder.selectedIndex == 0)
	{
		alert("Bitte waehlen Sie einen geeigneten Ordner fuer die RSS Feeds aus!");
		document.new_OPML.folder.focus();
		return false;
	}
	showUrlPane('/easyrss/rssreader/waitOPML.jsp','OPML Import','510px','200px');
}

function check_export_OPML_Formular()
{
	if (document.export_OPML.folder.selectedIndex == 0)
	{
		alert("Bitte waehlen Sie einen geeigneten Ordner fuer die RSS Feeds aus!");
		document.export_OPML.folder.focus();
		return false;
	} else {
		return true;
	}
}
function check_forgot_password_Formular()
{
	if (document.forgot_password.username.value == "")
	{
		alert("Bitte geben Sie einen Benutzernamen ein!");
		document.forgot_password.username.focus();
		return false;
	}
	setPaneUrl('listPane', 'forgotPassword.jsp?username='+encodeURIComponent(document.forgot_password.username.value));
}
function check_change_password_Formular()
{
	if (document.change_password.newpass.value.length < 5)
	{
		alert("Bitte ein mindestens 5-stelliges neues Passwort eingeben!");
		document.change_password.newpass.focus();
		return false;
	}
	if (document.change_password.newpassrepeat.value == "")
	{
		alert("Bitte geben Sie die Wiederholung ihres neuen Passwortes ein!");
		document.change_password.newpassrepeat.focus();
		return false;
	}
	if (document.change_password.newpassrepeat.value != document.change_password.newpass.value)
	{
		alert("Das neue Passwort und die Wiederholung stimmen nicht ueberein!");
		document.change_password.newpassrepeat.focus();
		return false;
	}
	return true;
}
function followLink(url){
	window.open(url);
}
function displayReaderContent(id)
{
	if (document.getElementById('content'+id).style.display == "none")
	{
		document.getElementById('content'+id).style.display='block';
	} else
	{
		document.getElementById('content'+id).style.display='none';
	}
	document.getElementById('div'+id).style.fontWeight='normal';
	document.getElementById('read'+id).style.display='block';
	document.getElementById('unread'+id).style.display='none';
}
function vote(id,voteValue,returnUrl)
{
	location.href='/easyrss/verzeichnis/vote.jsp?id='+id+'&vote_value='+voteValue+'&returnUrl='+returnUrl;
}
function deadlink(id)
{
	location.href='/easyrss/verzeichnis/deadLink.jsp?id='+id;
}
