﻿function Close(RedirectUrl)
{
    var con = confirm("Weet u zeker dat u de vacature wilt sluiten?");
    if(con)
    {
        if(RedirectUrl)
        {
            window.location = ""+RedirectUrl;
        }
        else
        {
            window.location.reload();
        }
    }
    else
    {
        window.location.href = "#";
    }
}

function ShowHide(Obj, FAQimg)
{
    if(!document.getElementById(Obj).style.display)
    {
        document.getElementById(Obj).style.display = "none";
        document.getElementById(FAQimg).innerHTML = "<img src='../../WhiteLabel/Images/Icons/expand.jpg' alt='Uitklappen' title='Uitklappen' />";
    }
    else if(document.getElementById(Obj).style.display == "none")
    {
        document.getElementById(Obj).style.display = "block";
        document.getElementById(FAQimg).innerHTML = "<img src='../../WhiteLabel/Images/Icons/collapse.jpg' alt='Inklappen' title='Inklappen' />";
    }
    else
    {
        document.getElementById(Obj).style.display = "none";
        document.getElementById(FAQimg).innerHTML = "<img src='../../WhiteLabel/Images/Icons/expand.jpg' alt='Uitklappen' title='Uitklappen' />";
    }
}

/*------------------------- Popup div functions ---------------------------*/

function changeBorder(obj, colorBorder)
{           
    obj.style.border = 'solid 1px '+colorBorder;
}

function HideContent(d)
{
	if(d.length < 1)
		return;
	
	document.getElementById(d).style.display = "none";
}

var cX = 0; var cY = 0;
function UpdateCursorPosition(e)
{ 
    cX = e.pageX; cY = e.pageY;    
}

function UpdateCursorPositionDocAll(e)
{   
    cX = event.clientX; cY = event.clientY + document.documentElement.scrollTop;
}

function AssignPosition(d) 
{
    document.getElementById(d).style.left = (cX+20) + "px";
    document.getElementById(d).style.top = (cY+10) + "px";
}

if(document.all) { 
    document.onmousemove = UpdateCursorPositionDocAll; 
}
else { 
    document.onmousemove = UpdateCursorPosition; 
}
			
function ShowContent(d)
{		
    if(document.all)
        document.onmousemove = UpdateCursorPositionDocAll;
    else
        document.onmousemove = UpdateCursorPosition;
			
	AssignPosition(d);
	
	if (d.length < 1)
	    return;
	
	document.getElementById(d).style.display = "block";
}

/*---------------------------------------------------------------------------*/
/* Asterix Validation related scripts */
function validateTextBox(textbox,image)
{
    var txt = document.getElementById(textbox).value;
    if( txt=="")
        document.getElementById(image).style.visibility="visible";
    else
        document.getElementById(image).style.visibility="hidden";
}

function validateCheckBox(checkBox, image)
{
    var chk = document.getElementById(checkBox);
    if (chk.checked == false)
        document.getElementById(image).style.visibility="visible";
    else
        document.getElementById(image).style.visibility="hidden";
}

function validateRadioButton(radioButtonGroup,image)
{
    var rdg1 = document.getElementById(radioButtonGroup + "_0");
    var rdg2 = document.getElementById(radioButtonGroup + "_1");
    if( rdg1.checked == false && rdg2.checked == false)
        document.getElementById(image).style.visibility="visible";
    else
        document.getElementById(image).style.visibility="hidden";
}

function validateSelectInput(selectName, image)
{
    var select = document.getElementById(selectName);
    if (select.options[0].selected == false)
        document.getElementById(image).style.visibility = "hidden";
    else
        document.getElementById(image).style.visibility = "visible";
}

/*---------------------------------------------------------------------------*/