window.addEvent('domready', function(){
	init_vergelijk();
});

function init_vergelijk() {
	selectedletters = 0;
	letterstop = $$('#lettertop');
	lettersbottom = $$('#letterbottom');
	if (letterstop.length < 1) { return; }
	vergelijkcontent = $$('#vergelijkcontent');
	letterstop.each(function(item, index) {
		item.addEvents({
			'click': function() {
				vergelijkcontent.each(function(item) {
					item.style.display = 'none';
				});
				letterstop.each(function(item) {
					item.style.display = 'block';
				});
				vergelijkcontent[index].style.display = 'block';
				selectedletters = index;
			},
			'mouseover': function() {
				letterstop[index].style.backgroundColor = '#fafafa';
				if (index == letterstop.length) {
					letterstop[index].className = '';
				} else {
					letterstop[index].className = '';
				}
			}
	});
});
	lettersbottom.each(function(item, index) {
	    item.addEvents({
		    'click': function() {
			    vergelijkcontent.each(function(item) {
				    item.style.display = 'none';
			    });
			    letterstop.each(function(item) {
				    item.style.display = 'block';
			    });
			    lettersbottom.each(function(item) {
				    item.style.display = 'block';
			    });			
			    vergelijkcontent[index].style.display = 'block';
//				if (index == letterstop.length) {

//				}
//                else {
//					letterstop[index].className = '';
//					lettersbottom[index].className = '';
//				}
			    selectedletters = index;
			},
			'mouseover': function() {
				lettersbottom[index].style.backgroundColor = '#fafafa';
				if (index == letterstop.length) {
					lettersbottom[index].className = '';
				} else {
					lettersbottom[index].className = '';
				}
			}
    });
});
}
var confirmationResult = false; // unconfirmed
function IsConfirmed()
{
    return confirmationResult;
}

// [ cao samenvatting module ]


function PopupLoonTabel(id)
{
    
     window.open("/Layouts/frm_loontabellen.aspx" + "?cao_id=" + id , null, "width=800,height=540,status=no,toolbar=no,menubar=no,location=0,titlebar=no,channelmode=no,scrollbars=yes");
}

function loonTabel(item)
{
    window.open(item, "_blank", "width=800,height=540,status=no,toolbar=no,menubar=no,location=0,titlebar=no,channelmode=no,scrollbars=yes");
}
function toevoegCAO(itemId)
{
    //item.className = 'smoothbox';
    window.open('/layouts/frm_toevoegCAO.aspx?id=' +itemId, null, "width=400,height=200,status=no,toolbar=no,menubar=no,location=0,titlebar=no,channelmode=no,scrollbars=yes");
}
function voegCAOtoe(itemId)
{
    //item.className = 'smoothbox';
    window.open('/layouts/frm_ToevoegCAO.aspx?height=200&width=400&id='+itemId, null, "width=400,height=200,status=no,toolbar=no,menubar=no,location=0,titlebar=no,channelmode=no,scrollbars=yes");
}

function verwijderCAO(item)
{
    toevoegCAO(item);
   
}

function vergelijkerCAO(strRandom,gekozenCAO,gekozenRubriek,gekozenCAOType)
{
    window.open("/Layouts/frm_CAOvergelijkPOP.aspx?cao="+gekozenCAO+"&rubriek="+gekozenRubriek+"&caotype="+gekozenCAOType, "" ,"width=810,height=540,status=no,toolbar=no,menubar=no,location=0,titlebar=no,scrollbars=yes");
   
    //window.open("/Layouts/frm_CAOvergelijkPOP.aspx?cao="+gekozenCAO+"&rubriek="+gekozenRubriek+"&caotype="+gekozenCAOType, strRandom ,"width=798,height=540,status=no,toolbar=no,menubar=no,location=0,titlebar=no,channelmode=no,scrollbars=yes");
}

function geldigYear(id, control, qsCAO, qsType, qsParent)
{
	document.location.href='/historisch overzicht.aspx?id=' + id + '&amp;year=' + control.options[control.selectedIndex].value + '&amp;cao=' + qsCAO + '&amp;type=' + qsType + '&amp;parent=' + qsParent;
}

function GotoUrlFromHistory(urlPage, type)
{
	if (type == 'ori')
		window.open(urlPage);
	else
		document.location.href=urlPage;	
}

function FilterBerichten(sortVeld,sortDir,berichttype)
{
    //alert("sortVeld="+sortVeld+"\nsortDir="+sortDir+"\nberichttype="+berichttype);
    //string url = ;
    var sortV = sortVeld;
    var sortD = sortDir;
    var bericht = berichttype;
    
    var url = "/Default.aspx?Sort=datum&PrevSort=" + sortV + "&Dir=" + sortD + "&Betreft=" + bericht + "&Page=1";

    document.location.href = url;
}


