//Confirm box bestand verwijderen
function ConfirmDelete()
{
var name=confirm("Verwijderen kan niet ongedaan worden gemaakt. Weet je zeker dat je door wilt gaan?")
if (name==true)
{
return true
}
else
{
return false
}
}

//Browser
function BrowserName()
{
	var Name = navigator.appName
	return Name
}

function BrowserIsIE()
{
	if (BrowserName() == 'Microsoft Internet Explorer')
	{
	return true
	}
	else
	{
	return false
	}
}

function BrowserIsFF()
{
	if (BrowserName() == 'Netscape')
	{
	return true
	}
	else
	{
	return false
	}
}

//Forum - FormCheck
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function checkFields() {
missinginfo = "";
if (document.form.name123.value == "") {
missinginfo += "\n     -  Name";
}
if(document.form.subject.value == "") {
missinginfo += "\n     -  Subject";
}
if(document.form.comments123.value == "") {
missinginfo += "\n     -  Comments";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

function checkEmptyFields(thisform) {
	with(thisform)
missinginfo = "";
if (thisform.poster.value == null || thisform.poster.value == "") {
missinginfo += "Naam\n";
}
if(thisform.titel.value == null || thisform.titel.value == "") {
missinginfo += "Titel\n";
}

if (missinginfo != "") {
	alertmessage = "";
	alertmessage = "Verslag niet verzonden. \n\n" + missinginfo;
alert(alertmessage);
return false;
}
else return true;
}

function openWindow5(url) {
  popupWin = window.open(url,'new_page','width=420,height=400')
}


//Agenda scripts
        function deleteEntry(eNumber,recur)
            {
            if (recur == 'True')
                {
                if (confirm('Are you sure you want to delete this entry?\nThis entry is recurring\nAll recurring entries will be deleted...'))
                    document.location.href = 'calAdd.asp?SelectedDate=<%=SelectedDate%>&eNumber=' + eNumber + '&FormMode=DELETE';
                }
            else 
                if (confirm('Are you sure you want to delete this entry?'))
                    document.location.href = 'calAdd.asp?SelectedDate=<%=SelectedDate%>&eNumber=' + eNumber + '&FormMode=DELETE';
            return; 
            }
        function addEntry()
            {
            document.location.href = 'calAdd.asp?SelectedDate=<%=SelectedDate%>&FormMode=ADD';
            }
        function editEntry(eNumber,recur)
            {
            document.location.href = 'calAdd.asp?SelectedDate=<%=SelectedDate%>&eNumber=' + eNumber + '&FormMode=EDIT';
            }
        function changeDate(newDate)
            {
            document.location.href = 'calList.asp?SelectedDate=' + newDate;
            }
        function changeDate(newDate)
            {
            document.location.href = 'calList.asp?SelectedDate=' + newDate;
            }
	
//KrantUpload
function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.krantuploadform.File1.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=450px; dialogHeight:150px; center:yes";
      window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
    }
    else
    {
      window.open('<% = barref %>&b=NN','','width=450,height=150', true);
    }
  }
  return true;
}


//documentenUpload
function ShowDocumentProgress(barref)
{
  strAppVersion = navigator.appVersion;
  if (document.documentform.File1.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=450px; dialogHeight:150px; center:yes";
      window.showModelessDialog(barref+"&b=IE",null,winstyle);
    }
    else
    {
      window.open(barref+"&b=NN",'','width=450,height=150', true);
    }
  }
  return true;
}

//redirect naar beheer bij indrukken van alt+ctrl+shift+B
function Devel(e) 
{
if (!e) e = window.event;
if (e.altKey && e.ctrlKey && e.shiftKey && e.keyCode == 66) 
{
window.location = "http://www.odomaasland.nl/beheer/index.asp"
}
}

//nieuw window
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//Toon Foto
function ToonFoto(FotoURL,Breedte,Hoogte)
{
	gfmwindow = window.open(FotoURL,'Grootformaat','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+Breedte+',height='+Hoogte+'');
	gfmwindow.focus();
}

//Maximaliseert hoogte in pixels bij gegeven marge
function MaxHeight(Hoogte,Marge)
{
		if(Hoogte > screen.availHeight-Marge)
		{
			Hoogte = screen.availHeight-Marge;
		}
		return Hoogte;
}

//Maximaliseert breedte in pixels bij gegeven marge
function MaxWidth(Breedte,Marge)
{
		if(Breedte > screen.availWidth-Marge)
		{
			Breedte = screen.availWidth-Marge;
		}
		return Breedte;
}

//Resize window tot maximum
function ResizeFotoToMax(Breedte,Hoogte,Marge)
{
	window.moveTo(Marge/2,Marge/2);
	window.resizeTo(MaxWidth(Breedte,Marge),MaxHeight(Hoogte,Marge));
}

//Verander visibility van div
function ChangeVisibility(divID)
{
	if (BrowserIsIE()||BrowserIsFF())
	{
		if (document.getElementById(divID).style.visibility=='visible')
	{
		document.getElementById(divID).style.visibility='hidden'
	}
	else
	{
		document.getElementById(divID).style.visibility='visible'
	}
	}
}

//verandert de positie van een div naar de x,y coordinaten van de mouse pointer
function SetPositionToPointer(divID,xOffset,yOffset,event)
{	
	if (BrowserIsIE())
	{
	x = event.screenX + document.documentElement.scrollLeft + xOffset;
	y = event.screenY + document.documentElement.scrollTop + yOffset;
	}
	if (BrowserIsFF())
	{	
	x = event.pageX + xOffset;
	y = event.pageY + yOffset +120
	}
	document.getElementById(divID).style.left = x + 'px';
	document.getElementById(divID).style.top = y + 'px';
}

//ODO VA uitklap
function ShowMore(div_id) 
{
if (document.getElementById(div_id).style.display == "none")
	{
  document.getElementById(div_id).style.display = "block";
	if (div_id.length == 1)
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "bold";
		document.getElementsByName('link_' + div_id)[0].style.fontSize = "11pt";
		}
	else
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "bold";
		}	
	}
else
	{
  document.getElementById(div_id).style.display = "none";
	if (div_id.length == 1)
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "normal";
		document.getElementsByName('link_' + div_id)[0].style.fontSize = "9pt";
		}
	else
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "normal";
		}
  }
}


var hh = 50;
function ShowBox(MaxHeight)
{
	alert(hh);
//Depending on the amount of text, set the maximum height here in pixels
     if(hh==MaxHeight)
     {
     clearInterval(inter);
     return;
     }
 
     obj = document.getElementById("Lees_5584");
     //obj.style.visibility = 'visible';
     hh+=2;
     obj.style.height = hh + 'px';
}

function setHeight(div_id,Height)
{
	document.getElementById(div_id).style.height = Height +'px';
}

function increaseHeight(div_id,maxHeight)
{
	var strcurrentHeight = new String(document.getElementById(div_id).style.height);
	var currentHeight = new Number(strcurrentHeight.replace('px',''));
	if (currentHeight >= maxHeight)
	{
		clearInterval(inter);
		return;
	}
	//alert(Number(currentHeight)+10);
	//alert(Number(currentHeight.replace('px',''))+10+'px');
	document.getElementById(div_id).style.height = currentHeight+25+'px';
}
//ODO uitklap
function ShowMoreSmooth(div_id) 
{
if (document.getElementById(div_id).style.display == "none")
	{
  document.getElementById(div_id).style.display = "block";
  targetHeight = document.getElementById(div_id).offsetHeight;
  document.getElementById(div_id).style.height = '0px';
  //inter = setInterval('Showbox'{50}, 500);
  //inter = setTimeout("ShowBox(5000)" ,20);
  //var i=150;
  di = 10;
  
  //alert(targetHeight);
  //for (i=0;i<=targetHeight;i=i+di)
	//{
	//inter = setTimeout("setHeight('"+div_id+"',"+i+")",2000);
	//}
	
  inter = setInterval("increaseHeight('"+div_id+"',"+targetHeight+")",10);
  if (div_id.length == 1)
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "bold";
		document.getElementsByName('link_' + div_id)[0].style.fontSize = "11pt";
		}
	else
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "bold";
		}	
	}
else
	{
  document.getElementById(div_id).style.display = "none";
	if (div_id.length == 1)
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "normal";
		document.getElementsByName('link_' + div_id)[0].style.fontSize = "9pt";
		}
	else
		{
		document.getElementsByName('link_' + div_id)[0].style.fontWeight = "normal";
		}
  }
}

function expand(div_id) 
{    
	var idarray
	idarray = div_id.split('-')
	for (x in idarray)
	{
		if (idarray[x].length == 1)
			{
			document.getElementsByName('link_' + idarray[x])[0].style.fontWeight = "bold";
			document.getElementById(idarray[x]).style.display = "block";
			document.getElementsByName('link_' + idarray[x])[0].style.fontSize = "11pt";
			}
		else
			{
			document.getElementsByName('link_' + idarray[x])[0].style.fontWeight = "bold";
			document.getElementById(idarray[x]).style.display = "block";
			document.getElementById(idarray[x].slice(0,1)).style.display = "block";
			document.getElementsByName('link_' + idarray[x].slice(0,1))[0].style.fontWeight = "bold";
			document.getElementsByName('link_' + idarray[x].slice(0,1))[0].style.fontSize = "11pt";
			}	
	}
}



//Hippe Ajax functies
//************
var xmlHttp
function toonWedstrijden(param)
{
if (param.value=="")
{ 
document.getElementById("wedstrijdoutput").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="wedstrijdoverzicht.asp"
url=url+"?param="+param
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("wedstrijdoutput").innerHTML=xmlHttp.responseText 
} 
} 

function GetXmlHttpObject()
{var objXMLHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  objXMLHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    
	try
      {      objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      alert("Your browser does not support AJAX!");      
	  return false;      }    
  }  
  }  
  return objXMLHttp
}
//*****************

function PPlink2(element)
{	var fpath = "www.odomaasland.nl";
	var fsubdir = "praatpalen";
	var fname = "praatpaal";
	var ftype = "pdf";
	element.href = 'http://' + fpath + '/' + fsubdir + '/' + fname + '.' + ftype;
	return true;
}

function PPVAlink(element)
{	var fpath = "www.odomaasland.nl";
	var fsubdir = "praatpalen";
	var fname = "ODO_Vraag_en_Antwoord_11-12";
	var ftype = "pdf";
	element.href = 'http://' + fpath + '/' + fsubdir + '/' + fname + '.' + ftype;
	return true;
}

function change_meta_tag(tagName,tagValue)
{
	var metaArray = document.getElementsByName(tagName);
  for (var i=0; i<metaArray.length; i++) {
		metaArray[i].content = tagValue;
  }
}
