function OpenPopular () {
    //todo: aanroep flash voor sortering op aantal stemmen
    FlashCall ('showPopularItem', '0');
    document.getElementById ('ImgPopular').src = m_strPopRd;
    document.getElementById ('ImgLatest').src = m_strLatBl;
    document.getElementById ('ItemsPopular').style.display = 'block';
    document.getElementById ('ItemsLatest').style.display = 'none';
}
function OpenLatest () {
    //todo: aanroep flash voor sortering op Id, aflopend
    FlashCall ('showNewItem', '0');
    document.getElementById ('ImgLatest').src = m_strLatRd;
    document.getElementById ('ImgPopular').src = m_strPopBl;
    document.getElementById ('ItemsLatest').style.display = 'block';
    document.getElementById ('ItemsPopular').style.display = 'none';
}
function ShowPopularAndLatest () {
    document.getElementById ('Articles').style.display = 'none';
    document.getElementById ('PopularLatest').style.display = 'block';
}
function ShowArticles () {
    document.getElementById ('PopularLatest').style.display = 'none';
    document.getElementById ('Articles').style.display = 'block';
}
function ShowArticle (p_intId) {
    FlashCall ('showPage', p_intId);
}
function ShowLatest (p_intId) {
    FlashCall ('showNewItem', p_intId);
}
function ShowPopular (p_intId) {
    FlashCall ('showPopularItem', p_intId);
}
function fromSwf (p_strValue) {
    switch (p_strValue) {
        case 'pageOpen':
            ShowArticles ();
            break;
        case 'pageClose':
            ShowPopularAndLatest ();
            break;
        default:
            break;
     }
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
