﻿// JScript File

// Ondersteuning "meer..."-link
var prevDiv = null;
var prevTit = null;
function displayDiv(contnum) {
	if (prevDiv != null) prevDiv.style.display = 'none';
	if (prevTit != null) prevTit.style.display = 'block';
	prevDiv = document.getElementById('content' + contnum);
	try { prevTit = document.getElementById('title' + contnum); } catch (e) { }
	prevDiv.style.display = 'block';
	try { prevTit.style.display = 'none'; } catch (e) { }
	prevDiv.scrollTop = 0;
}

// Mail functie tegen spam
function MailTo(strName,strDomain,strExt) {
	if (strExt.typeOf=='undefined'||strExt=='')
	var strExt = 'nl';
	if (strDomain.typeOf=='undefined'||strDomain=='')
	var strDomain = 'volmachtbeheer';
	location.href = 'mailto:'+strName+'@'+strDomain+'.'+strExt;
}

// Voor linker menu
function toggleItem(index) {
	var arrowID = 'divArrow' + index;
	var elemID = 'divItem' + (index + 1);
	var a = document.getElementById(arrowID);
	var v = document.getElementById(elemID);
	if (v.style.display == 'none') {
		a.style.backgroundImage = 'url(' + baseDir + 'App_Themes/Default/Images/menudown.gif)';
		v.style.display = 'block';
	} else {
		a.style.backgroundImage = 'url(' + baseDir + 'App_Themes/Default/Images/menuright.gif)';
		v.style.display = 'none';
	}
}

// Element laten zien of verbergen
function toggleVisible(elemID) {
	var v = document.getElementById(elemID);
	if (v.style.display == 'none') {
		v.style.display = 'block';
	} else {
		v.style.display = 'none';
	}
}

// TinyMCE standaard initialisatie
function initTinyMCE(elm) {
	tinyMCE.init({
	mode : "exact",
	elements: elm,
	theme : "advanced",
	plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
	content_css : baseDir + "Css/TinyMCE.css",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing: true,
	convert_urls: false
	});
}

function initTinyMCEsm(elm) {
	tinyMCE.init({
		mode: "exact",
		elements: elm,
		theme: "advanced",
		plugins: "pagebreak,style,layer,table,save,advhr,inlinepopups,media,paste,visualchars,nonbreaking,xhtmlxtras,template",
		content_css: baseDir + "Css/TinyMCE.css",
		theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,image,|,link,unlink,code,|,formatselect",
		theme_advanced_buttons2: "",
		theme_advanced_buttons3: "",
		theme_advanced_buttons4: "",
		theme_advanced_toolbar_location: "top",
		theme_advanced_toolbar_align: "left",
		theme_advanced_statusbar_location: "",
		theme_advanced_resizing: false,
		theme_advanced_blockformats : "h1,h4"
	});
}

function initTinyMCEmailer(elm) {
	tinyMCE.init({
	mode : "exact",
	elements: elm,
	theme : "advanced",
	plugins : "pagebreak,style,layer,table,save,advhr,inlinepopups,media,contextmenu,paste,visualchars,nonbreaking,xhtmlxtras,template",
	content_css: baseDir + "Css/TinyMCE_mailer.css",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,image,|,link,unlink,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "",
	theme_advanced_resizing : false,
	convert_urls : false,
	extended_valid_elements: "style"
	});
}

// popups

function showBack() {
	var b = document.getElementById('popupBackDiv');
	b.style.width = '100%';
	b.style.height = '100%';
	b.style.display = 'block';
}

function hideBack() {
	var b = document.getElementById('popupBackDiv');
	b.style.display = 'none';
}

function showPopup(width, height) {
	showBack();
	var w = document.getElementById('popupWinDiv');
	w.style.width = width;
	w.style.height = height + 20;
	w.style.left = document.body.clientWidth / 2 - width / 2;
	w.style.top = '60px';
	w.style.display = 'block';
}

function hidePopup() {
	if (popupwin != '') {
		var w = document.getElementById(popupwin);
		w.style.display = 'none';
	}
	hideBack();
}

function setPopupContents(s) {
	var w = document.getElementById('popupWinContentDiv');
	w.innerHTML = '<img src=' + s + ' />';
}

function showDivAsPopup(divid, width, height) {
	popupwin = divid;
	showBack();
	var w = document.getElementById(divid);
	w.style.position = "absolute";
	w.style.width = width;
	//w.style.height = height + 20;
	w.style.left = document.body.clientWidth / 2 - width / 2;
	w.style.top = '200px';
	w.style.zIndex = '100';
	w.style.display = 'block';
	w.style.backgroundColor = '#FFF';
	w.style.border = 'solid 1px #888';
}

