// JavaScript Document
function maak_frame(){
	if(window.navigator.appName == "Microsoft Internet Explorer")
	iframe.document.designMode = "on";
	
	if(window.navigator.appName == "Netscape")
	document.getElementById('iframe').contentDocument.designMode = "on";
	
	//document.getElementById('iframe').contentWindow.document.body.innerHTML=document.getElementById('Omschrijving');
}

function vet() {
  document.getElementById("iframe").contentWindow.document.execCommand("bold", false, null);
}
function schuin() {
  document.getElementById("iframe").contentWindow.document.execCommand("italic", false, null);
}
function onderstreept() {
  document.getElementById("iframe").contentWindow.document.execCommand("underline", false, null);
}
function copy() {
  document.getElementById("iframe").contentWindow.document.execCommand("copy", false, null);
}
function cut() {
  document.getElementById("iframe").contentWindow.document.execCommand("cut", false, null);
}
function past() {
  document.getElementById("iframe").contentWindow.document.execCommand("paste", false, null);
}
function positie(positie) {
 // deze functie is gemaakt voor alle uitlijningen, door een parameter in de functie mee te geven
  document.getElementById("iframe").contentWindow.document.execCommand("Justify"+ positie, false, null);
}
function opslaan2() {
  document.getElementById("iframe").contentWindow.document.execCommand("Save");
}
function kleur() {
  var kleur = prompt("Voer hieronder de kleur in het Engels of in HEX in:", "");
  if(kleur != null)
    document.getElementById("iframe").contentWindow.document.execCommand("ForeColor", false, kleur);
}
function achtergrond() {
  var kleur = prompt("Voer hieronder de kleur in het Engels of in HEX in:", "");
  if(kleur != null)
    document.getElementById("iframe").contentWindow.document.execCommand("BackColor", false, kleur);
}
function hyperlink() {
 // per browser appart wegens de var url (kijk maar gewoon)
 if(window.navigator.appName == "Microsoft Internet Explorer"){
  document.getElementById("iframe").contentWindow.document.execCommand("createLink");
 }else{
  url = prompt("Voor de URL in:", "http://");

  document.getElementById("iframe").contentWindow.document.execCommand("createLink", false, url);
 }
}
function terug() {
 document.getElementById("iframe").contentWindow.document.execCommand("undo", false, null);
}
function vooruit() {
 document.getElementById("iframe").contentWindow.document.execCommand("redo", false, null);
}
function sup() {
 document.getElementById("iframe").contentWindow.document.execCommand("superscript", false, null);
}
function sub() {
 document.getElementById("iframe").contentWindow.document.execCommand("subscript", false, null);
}
function lettertype(LetterType) {
 if(LetterType != "")
   document.getElementById("iframe").contentWindow.document.execCommand("FontName", false, LetterType);
}
function lettergrootte(LetterGrootte) {
 if(LetterGrootte != "")
   document.getElementById("iframe").contentWindow.document.execCommand("FontSize", false, LetterGrootte);
}
function opslaan() {
 var htmlCode = document.getElementById('iframe').contentWindow.document.body.innerHTML;
 //ia = htmlcode.length
 document.getElementById("Omschrijving").value = htmlCode;
 document.myform.submit();
 //document.getElementById("form1").submit();
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function confirmDelete(delUrl,Message) {
  if (confirm(Message)) {
    document.location = delUrl;
  }
}

function confirmDelete2()
{
    return confirm("Are you sure you want to delete this picture?");
} 

function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(document.theForm.Check_All.value=="Check All"){
	CheckValue = true;
   document.theForm.Check_All.value="UnCheck All";
}else{
	CheckValue = false;
	document.theForm.Check_All.value="Check All";
}
  if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

function toggle_it(itemID,rr){ 
  // Toggle visibility between none and inline 
  //output_text = itemID+'1';
  //alert(output_text);
  if ((document.getElementById(itemID+'1').style.display == 'none')) 
  { 
  for(var i = 1; i < rr; i++)
	//window.location.reload(true);
	document.getElementById(itemID+i).style.display = ''; 
  } else { 
  for(var i = 1; i < rr; i++)
	document.getElementById(itemID+i).style.display = 'none'; 
  } 
} 

function Check2()
{
if(document.theForm.Check_All.value=="Check All"){
   document.theForm.Check_All.value="UnCheck All";
    for (i=0,n=document.theForm.elements.length;i<n;i++)
        if (document.theForm.elements[i].name.indexOf('id[]') !=-1)
            document.theForm.elements[i].checked = true;
			
}else{			
   document.theForm.Check_All.value="Check All";
    for (i=0,n=document.theForm.elements.length;i<n;i++)
        if (document.theForm.elements[i].name.indexOf('id[]') !=-1)
            document.theForm.elements[i].checked = false;	
}
}

function goToURL(url) { window.location = url; }

