function setMargin()
{
	if (window.screen.height > 768) {
		var x = (window.screen.height - 768) /2;
			document.getElementById("defaultContent").style.marginTop = x;
	} else if (window.screen.width <= 800) {
			alert("Deze website is het beste te bekijken met een hogere resolutie.");
	}
	window.moveTo(0,0);
	window.resizeTo(screen.width,screen.height);
}

function imgSwap(oImg)
{
   var strOver  = "_on";    // image to be used with mouse over
   var strOff = "_off";     // normal image
   var strImg = oImg.src;
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff);
   else
      oImg.src = strImg.replace(strOff,strOver);
}



// Begin a XMLHTTP object. (first time M$ has done something good :-P)
// This is found on the net
function create_http_object()
{
    // This array is a list of all/most possible XMLHTTP types
    var ActiveXTypes = [
        "Microsoft.XMLHTTP",
        " MSXML2.XMLHTTP.5.0",
        "MSXML2.XMLHTTP.4.0",
        "MSXML2.XMLHTTP.3.0",
        "MSXML2.XMLHTTP" 
    ];

    // Loop through the ActiveXTypes array and 
    for( var i = 0; i < ActiveXTypes.length; i++ ) 
    {
        // try to use the current XMLHTTP object,
        // if not it's not possible try the next
        try
        {
            return new ActiveXObject( ActiveXTypes[i] );
        }
        catch( e )
        { }
    }

    // none of them worked, try the function XMLHttpRequest()
    try
    {
        return new XMLHttpRequest();
    }
    catch( e )
    { }

    // It seems that the browser doesn't support AJAX Stuff
    return false;
}

// Make requests using "create_http_object()" 
// Also found on the net, but a bit changed
function make_request(VUrl, VCallBack, VPostValues)
{
    // Here we create xmlhttp the object 
    var Http = create_http_object();

    // don't do make any request if the browser doesn't support AJAX
    if(!Http)
    {
        return false;
    }

    // If we received anything back call up the chosen function 
    Http.onreadystatechange = function()
    {
        if(Http.readyState == 4)
        {
            // Call the function if the status is ok (200)
            if(Http.status == 200)
            {
                GetVideoResponse( Http.responseText);
            }
            else
            {
                // Seems there was an error.. 
                alert('Error! ('+Http.status+')');
            }
        }
    }

    // Make sure the post values are filled out or on null..
    if(!VPostValues)
    {
        VPostValues = null; 
    }
    // Open the appriopriate URL
    Http.open('POST', VUrl, true);
    // Set the request header for a form sent by POST 
    Http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    // send the post values
    Http.send (VPostValues);
}

function redirect(Page)
{


    // call the properties of ourputdiv
    // var VOutputDiv = document.getElementById('contentPanel');
    // make the outputdiv visible
    // VOutputDiv.style.display = '';
    // set the innerhtml of outputdiv on loading..
    // VOutputDiv.innerHTML  = '<img src="loading.gif">';

    // finally make the request to the page, and call back the function GetVideoResponse 
    make_request('getPage.php', null,  'page='+Page);
}

function GetVideoResponse(VInput)
{
    // Call the properties of outputdiv
    var VOutputDiv = document.getElementById('contentPanel');
    // set the innerHTML of the outputdiv to the links
    VOutputDiv.innerHTML = VInput;
}



