function confirmDeleteQuestion(id_sitemap, language, id_invitation, option)
{
    var q = confirm("Are you sure you want to delete this question?");
    
    if (q)
    {
        window.location = ("save_form4.pl?id_sitemap=" + id_sitemap + "&language=" + language + "&id_invitation=" + id_invitation + "&option=" + option + "&button=delete");
    }
}

function openChild(file, window) 
{
    childWindow = open(file, window, 'resizable=yes,width=400,height=400,scrollbars=1');
    if (childWindow.opener == null) 
    {
    	childWindow.opener = self;
    }
}

function updateParent() 
{
    opener.document.parentForm.pf1.value = document.childForm.cf1.value;
    opener.document.parentForm.pf2.value = document.childForm.cf2.value;
    self.close();
    return false;
}

function copyValues()
{
    var amount = document.getElementById("amount");
    amount = amount.value;

    for (x = 0; x < amount; x++)
    {
        var name = "val" + x;
        var el = document.getElementById(name);        
        if (el.checked)
        {
            opener.document.parentForm.txtEmails.value += el.value + ";\n";
        }
    }
    opener.document.parentForm.selection.checked = true;
    window.close();
}

function toggleHidden(element)
{
	var el = document.getElementById(element);
	
	if (el)
	{
		if (el.style.display == "none")
		{
			el.style.display = "block";
		}
		else
		{
			el.style.display = "none";
		}
	}
}

function confirmRemoveCalendarItem(id_item, title)
{
	title = title.replace(/<br>/gi, "\n");	
	
	var del = "Are you sure you want to delete this event:\n\n";
	
	var msg = del + title;
	var q = confirm(msg);
	if (q)
	{
		window.location = "calendar_remove.pl?id_item=" + id_item;
	}
}
