﻿function OpenPics(url, iwidth, iheight)
{
	window.open(url,"afbeelding","width="+iwidth+",height="+iheight+",left=125,top=100");
}

function openPopup(src) {
	if (src.indexOf("commercial")>=0)
		window.open(src, 'popup', 'width=519, height=475, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no'); 
	else
		window.open(src, 'popup', 'width=452, height=475, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no'); 
}

function HighlightMenuItem() {

   /*
	jQuery('#menu_az').fadeOut('fast').addClass('active')
					.fadeIn('fast')
					.fadeOut('fast')
					.fadeIn('fast')
					.fadeOut('fast')
					.fadeIn('fast');
					*/
/*	jQuery('#menu_az').animate({"opacity":"toggle"}, "slow");		*/
for (i=1;i<15;i++)
{
jQuery('#menu_az a').animate({ color: "#ffffff" }, 150);
jQuery('#menu_az a').animate({ color: "#2e3192" }, 150);

}

	
	//setTimeout('jQuery(\'#menu_az\').removeClass(\'active\')', 5000);
}

function switchFaqItems(el)
{
	//IE6 problem 
	var y = document.getElementById("sidebar")
	document.body.className = "ping"
	document.body.className = "pong"
	//End IE6 problem
	var x = document.getElementById('ul_' + el.name);
	x.style.display = (x.style.display=='none')?'':'none';
}

document.getElementsByClassName = function (needle)
{
    var s, i, r = [], l = 0, e;
    var re = new RegExp('(^|\\s)' + needle + '(\\s|$)');

    if (navigator.userAgent.indexOf('Opera') > -1)
    {
        s = [document.documentElement || document.body], i = 0;

        do
        {
            e = s[i];

            while (e)
            {
                if (e.nodeType == 1)
                {
                    if (e.className && re.test(e.className)) r[l++] = e;

                    s[i++] = e.firstChild;
                }

                e = e.nextSibling;
            }
        }
        while (i--);
    }
    else
    {
        s = document.getElementsByTagName('*'), i = s.length;

        while (i--)
        {
            e = s[i];
            if (e.className && re.test(e.className)) r[l++] = e;
        }
    }

    return r;
}

function hideFaqItems()
{
	var x = document.getElementsByClassName("faqitem")
	var i = x.length

	while (i--)
	{
		x[i].style.display = 'none';
	}
	var y = document.getElementsByClassName("faqlinks")
	var j = y.length
	while (j--)
	{
		y[j].className = 'faqlinks_js';
		y[j].onclick = function() { switchFaqItems(this); return false; }
	}
	
	var z = FaqAnchorPresent()
	if (z > 0)
	{
		document.getElementById("ul_faqitem_"+z).style.display = 'block';
	}
}

function FaqAnchorPresent()
{
	var x = document.location + '';
	if (x.indexOf("#faqitem_")>0) return x.substring(x.indexOf("#faqitem_")+9,x.length)
	return 0	
}

function showPrintLink()
{
	var li = document.createElement("li"), a = document.createElement("a"), text = document.createTextNode("print"), x = document.getElementById("utils")
	if (x)
	{
		a.href = "#"
		a.onclick = function() { window.print(); return false; }
		a.title = "print"
		a.className = "last"
		a.appendChild(text)
		li.appendChild(a)
		x.appendChild(li)
	}
}

function showTestResultPrintLink()
{
	var a = document.createElement("a"), img = document.createElement("img"), x = document.getElementById("rapport_buttons")
	if (x)
	{
		a.href = "#"
		a.onclick = function() { window.print(); return false; }
		a.title = "print dit rapport"
		img.src = "/lib/images/rapport_buttons_print.png"
		img.alt = "print dit rapport"
		a.appendChild(img)
		x.insertBefore(a,x.getElementsByTagName("a")[0]);
	}
}

function switchFieldsOntvanger()
{

	var x = document.getElementById("fields_ontvanger")

	x.style.display = (x.style.display=='none')?'block':'none';
}

function hideFieldsOntvanger()
{
	var x = document.getElementById("fields_ontvanger")
	if (x)
	{
		var y = document.getElementById("frm_stuurKopie")
		if (y) if (!y.checked) x.style.display = 'none';
	}
}

function IsRadioButtonChecked(field)
{
	var x = document.forms[1].elements[field];
    for (var i = 0; i < x.length; i++)
    {
	    if (x[i].checked == true)
	    {
	        return true;
	    }
    }
    
    return false;
}

function createPopupsTest()
{
	var x = document.getElementsByClassName("test_video")
	if (x)
	{
		var i = x.length
		while (i--)
		{
			x[i].onclick = function() { openPopup(this.href); return false; } 
		}
	}
}

document.getElementsByClassName = function (needle)
{
    var s, i, r = [], l = 0, e;
    var re = new RegExp('(^|\\s)' + needle + '(\\s|$)');

    if (navigator.userAgent.indexOf('Opera') > -1)
    {
        s = [document.documentElement || document.body], i = 0;

        do
        {
            e = s[i];

            while (e)
            {
                if (e.nodeType == 1)
                {
                    if (e.className && re.test(e.className)) r[l++] = e;

                    s[i++] = e.firstChild;
                }

                e = e.nextSibling;
            }
        }
        while (i--);
    }
    else
    {
        s = document.getElementsByTagName('*'), i = s.length;

        while (i--)
        {
            e = s[i];
            if (e.className && re.test(e.className)) r[l++] = e;
        }
    }

    return r;
}

function showCloseButtonPopup()
{
	var a = document.createElement("a"), text = document.createTextNode("sluiten"), x = document.getElementById("closebutton")
	if (x)
	{
		a.href = "#"
		a.onclick = function() { window.close(); return false; }
		a.title = "sluiten"
		a.appendChild(text)
		x.appendChild(a)
	}
}
function initFlash() { 
	var vichomepage = 0;
	if (jQuery('body').attr('class')=='vic') vichomepage = 1;
	
    jQuery('#headerflash').flashembed(
    {
        src: '/lib/flash/headerbanner_quiz.swf',
        version: [9, 115],
        height: 185,
        width:919,
        expressInstall: '/lib/flash/expressinstall.swf',
        onFail: function(version){
			jQuery('#headerflash').append(jQuery('#headerflash noscript').text());
        },
        wmode: 'transparent',
        scale: 'noscale'
    },
    {	//dit zijn flashvars
        v: quizVraagID
	    , a: quizAntwoord
		,startpagina: vichomepage
    });
    
    //cookies
    var VICgesproken = false;
    if (jQuery.cookie('VIC') == 'gesproken') VICgesproken = true;
    //alert(VICgesproken);

   jQuery('#contentflash').flashembed(
    {
        src: '/lib/flash/3xkloppen_content.swf',
        version: [9, 115],
        id: 'walter',
        height: 470,
        width: 350,
        expressInstall: '/lib/flash/expressinstall.swf',
        onFail: function(version){
			jQuery('#contentflash').append(jQuery('#contentflash noscript').text());
        },
        wmode: 'transparent',
        scale: 'noscale'
    },
    {	//dit zijn flashvars
       vic: VICgesproken
       ,v: quizVraagID
	    , a: quizAntwoord
		,startpagina: vichomepage

    });
    jQuery('#contentflash').css('top','-38px').css('right','-155px');

	jQuery('#vraagvandedagflash').flashembed(
    {
        src: '/lib/flash/vraagvandedag.swf',
        version: [9, 115],
        id: 'walter',
        height: 230,
        width: 400,
        expressInstall: '/lib/flash/expressinstall.swf',
        onFail: function(version){
			jQuery('#vraagvandedagflash').append(jQuery('#vraagvandedagflash noscript').text());
        },
        wmode: 'transparent',
        scale: 'noscale'
    },
    {	//dit zijn flashvars
     vic: VICgesproken,
       v: quizVraagID
	    , a: quizAntwoord

   });

   /*jQuery('#flashbannerbootcamp').flashembed({
       src: '/lib/flash/Bootcamp-234x60.swf'
	    , version: [9, 115]
	    , wmode: 'transparent'


   }, {
   clickTag: 'http://www.internetbootcamp.nl'
   });*/
	
   jQuery('#flashbannerbootcamp').flashembed({
       src: '/lib/flash/BannerLoader.swf'
	    , version: [9, 115]
	    , wmode: 'transparent'


   }, {
	xmlPath:'/lib/xml/slideshow.xml'
   });

}
function swfft2(divid, w, h) { 
//alert('swfft2 functie aangeroepen');
	var z = w; //breedte voor flash zonder px  
    w = (isNaN(w)) ? w : w + 'px'; h = (isNaN(h)) ? h : h + 'px';
    jQuery('#' + divid + ' embed').css({ 'width': w, 'height': h });
    jQuery('#' + divid + ' object').css({ 'width': w, 'height': h });
    jQuery('#' + divid).css({ 'width': w, 'height': h });
    if (blnIE6)
    {
		var alertA = jQuery('#' + divid + ' embed').width() + '\n'+ jQuery('#' + divid + ' object').height();
		var alertB = jQuery('#' + divid + ' object').width() + '\n'+ jQuery('#' + divid + ' object').height();
		var alertC = jQuery('#' + divid).width() + '\n'+ jQuery('#' + divid + ' object').height();
		//alert( 'alerts: ' + alertA + '\n' + alertB + '\n' + alertC);
    }
    //var ele = document.getElementById('walter');
    //ele.width = z;

}

window.addEvent('domready', function() {
    jQuery.noConflict();
    
    blnIE6 = (jQuery.browser.msie) && (jQuery.browser.version == 6)
    hideFaqItems();
    showPrintLink();
    createPopupsTest();
    showTestResultPrintLink();
    hideFieldsOntvanger();
    showCloseButtonPopup();
    initFlash();
    
    if (!(jQuery.cookie('VIC') == 'gesproken'))
    {
		jQuery.cookie('VIC', 'gesproken', { path: '/' }); 
    }
    

    // var so_container = document.getElementById("header_banner")
    //if (so_container) {
    //    var so = new SWFObject("/lib/flash/headerbanner.swf", "headerbanner", "719", "109", "8", "#ffffff");
    //     so.addParam("wmode", "transparent");
    //     so.write("header_banner");
    // }

});


