
/* Bookmark function for WSideBarBookMark */
function bookMarkSite() {
	var url = "http://www.ikzoekchristelijkehulp.nl";
	var title = "ikzoekchristelijkehulp.nl"; 
	
	if (window.sidebar || (window.opera && window.print)) { // firefox
		alert("Klik op OK en druk op de toetsen CTRL + D om ikzoekchristelijkehulp.nl aan uw favorieten toe te voegen.");
		//window.sidebar.addPanel(title, url, ""); //not supported, link is opened in sidebar 
	/*	
	} else if(window.opera && window.print) { // opera
		var el = document.createElement('a');
		el.setAttribute('href', url);
		el.setAttribute('title', title);
		el.setAttribute('rel','sidebar');
		el.click();
	*/	
	} else if(document.all) { // internet explorer
		window.external.AddFavorite(url, title);
	}
}

/* 
	Subscribe to newsletter function for WSideBarNewsLetter
	
	Currently no other way to do this without extending the mailing list manager software. The mailinglist software
	does not have an external subscribe interface (xml or SOAP etc).
	since Prado doesn't support multiple forms we can not simply add another form with the correct action target.
	So this function creates a form dynamically with the required fields (char. encoding and mailinglist group are hardcoded).
	After the form is submitted it is destroyed immediately.
*/
function openNewsLetterWindow(formNameEl, formEmailEl) {
	
	Prado.Validation.validate(null, "NewsLetter");
	
	if (Prado.Validation.isValid(null, "NewsLetter")) {
		var name = Form.Element.getValue(formNameEl);
		var email = Form.Element.getValue(formEmailEl);
		
		var formEl = document.createElement("form");
		formEl.setAttribute("method", "post");
		formEl.setAttribute("action", "http://mailing.ikzoekchristelijkehulp.nl/");
		formEl.setAttribute("target", "_new");
		formEl.setAttribute("name", "newsletter_form");
		formEl.setAttribute("id", "newsletter_form");
		formEl.setAttribute("style", "display: hidden;");
		
		var nameEl = document.createElement("input");
		nameEl.setAttribute("type", "hidden");
		nameEl.setAttribute("name", "name");
		nameEl.setAttribute("value", name);
		formEl.appendChild(nameEl);
		
		var emailEl = document.createElement("input");
		emailEl.setAttribute("type", "hidden");
		emailEl.setAttribute("name", "email");
		emailEl.setAttribute("value", email);	
		formEl.appendChild(emailEl);
		
		var formatEl = document.createElement("input");
		formatEl.setAttribute("type", "hidden");
		formatEl.setAttribute("name", "format");
		formatEl.setAttribute("value", "html");		
		formEl.appendChild(formatEl);
		
		var groupsEl = document.createElement("input");
		groupsEl.setAttribute("type", "hidden");
		groupsEl.setAttribute("name", "groups[]");
		groupsEl.setAttribute("value", "3");
		formEl.appendChild(groupsEl);
		
		var submitEl = document.createElement("input");
		submitEl.setAttribute("type", "submit");
		submitEl.setAttribute("name", "submit");
		formEl.appendChild(submitEl);
		
		document.body.appendChild(formEl);
		
		//for compatability reasons with IE6/7 we use click on the submit btn. element directly
		//do not use formEl.submit.click() because in Firefox submit function is overridden by the submit button,
		//IE however does not overrride it.
		submitEl.click(); 
		
		//remove the form from the document tree
		document.body.removeChild(formEl);
	}
}
