// JavaScript Document
function PrintPagina(divID) {
	if (document.getElementById != null) {
		var html = '<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">\n<html xmlns="http:\/\/www.w3.org\/1999\/xhtml">\n<head>\n';
		//if (document.getElementsByTagName != null) {
			//var headTags = document.getElementsByTagName("head");
			//if (headTags.length > 0)
				//html += headTags[0].innerHTML;
		//}
		html += '\n<link rel="stylesheet" href="site\/css\/protocollen.css" type="text\/css" \/>\n</he' + 'ad><body>\n';
		var PrintKlaarElem = document.getElementById(divID);
		if (PrintKlaarElem != null) {
			html += PrintKlaarElem.innerHTML;
		}
		html += '\n</bo' + 'dy>\n</ht' + 'ml>';
		var printWin = window.open("","PrintPagina");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (AutoPrint)
			printWin.print();
	}
}

function startOnlineEditor(subject)
	{
		editInSiteURL = 'index.php?subject=' + subject + '&editinsite=1';
		newWindow=window.open(editInSiteURL,'_top');
	}


var keypressed_A = false;
var keypressed_B = false;

function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }




function startOnKeyCombination(e)
	{

	var evt = e || window.event;

	//18 = ALT
	//17 = CTRL
	//83 = s
	//32 = spatiebalk

		
		if (evt.keyCode == 17 || evt.keyCode == 83 || evt.keyCode == 32 || evt.keyCode == 18){
			if (evt.keyCode == 17 || evt.keyCode == 18) {keypressed_A = true;}
			if (evt.keyCode == 83 || evt.keyCode == 32) {keypressed_B = true;}
		}
		else {
			keypressed_A = false;
			keypressed_B = false;
		}
		if (keypressed_A && keypressed_B) {
			keypressed_A = false;
			keypressed_B = false;
			startOnlineEditor(subject);
		}
	}

function PrintThisPage(obj) 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById(obj).cloneNode(true); 
   
   var childNodes = sWinHTML.getElementsByTagName('*');
   
   for(var i = 0; i < childNodes.length; i++) {
		if( childNodes[i].className == 'skip') {
			//alert(childNodes[i].innerHTML)
			childNodes[i].style.display = 'none';
			//var d = childNodes[i].parentNode;
			//d.removeChild(childNodes[i]);
		} else {

		}
   }

   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><head>')
	   winprint.document.write('<link rel="stylesheet" href="site/css/template/template_default.css" type="text/css" />') 
	   winprint.document.write('<style type="text/css">body {font-family: Verdana; }</style>')		   
	   winprint.document.write('</head>')
	   winprint.document.write('<body>')   
       winprint.document.write(sWinHTML.innerHTML);          
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
	   winprint.print();
}


function enterPressed(e) {
	var key=e.keyCode || e.which;
	if (key==13){
		return true;
	}	
}








//forum bbcodes

function forumMessageAddTags(Tag,fTag,obj) 
{ 


  obj.focus(); 
  if (document.selection && document.selection.createRange)  // Internet Explorer 
  { 
sel = document.selection.createRange(); 
if (sel.parentElement() == obj)  sel.text = Tag + sel.text + fTag; 
  } 

  else if (typeof(obj) != "undefined")  // Firefox 
  { 
var longueur = parseInt(obj.value.length); 
var selStart = obj.selectionStart; 
var selEnd = obj.selectionEnd; 

obj.value = obj.value.substring(0,selStart) + Tag + obj.value.substring(selStart,selEnd) + fTag + obj.value.substring(selEnd,longueur); 
  } 

  else obj.value += Tag + fTag; 

  obj.focus(); 
} 







