if (window.navigator.userAgent.indexOf("MSIE")>=1)
{
var IE1024="1024B.css";
var IE1152="1152B.css";
var IE1280="1280B.css";
var IE1360="1360B.css";
var IE1366="1366B.css";
var IE1440="1440B.css";
var IE1680="1680B.css";
var IEother="800B.css";

ScreenWidth(IE1024,IE1152,IE1280,IE1360,IE1366,IE1440,IE1680,IEother)
}else{
if (window.navigator.userAgent.indexOf("Firefox")>=1)
{
file://Firefox
var Firefox1024="1024B.css";
var Firefox1152="1152B.css";
var Firefox1280="1280B.css";
var Firefox1360="1360B.css";
var Firefox1366="1366B.css";
var Firefox1440="1440B.css";
var Firefox1680="1680B.css";
var Firefoxother="800B.css";

ScreenWidth(Firefox1024,Firefox1152,Firefox1280,Firefox1360,Firefox1366,Firefox1440,Firefox1680,Firefoxother)
}else{
file://Other
var Other1024="1024B.css";
var Other1152="1152B.css";
var Other1280="1280B.css";
var Other1360="1360B.css";
var Other1366="1366B.css";
var Other1440="1440B.css";
var Other1680="1680B.css";
var Otherother="800B.css";
ScreenWidth(Other1024,Other1152,Other1280,Other1360,Other1366,Other1440,Other1680,Otherother)
}
}

function ScreenWidth(CSS1,CSS2,CSS3,CSS4,CSS5,CSS6,CSS7,CSS8)
    {if (screen.width == 1024){setActiveStyleSheet(CSS1);}
else{if (screen.width == 1152){setActiveStyleSheet(CSS2);}
else{if (screen.width == 1280){setActiveStyleSheet(CSS3);}
else{if (screen.width == 1360){setActiveStyleSheet(CSS4);}
else{if (screen.width == 1366){setActiveStyleSheet(CSS5);}
else{if (screen.width == 1440){setActiveStyleSheet(CSS6);}
else{if (screen.width == 1680){setActiveStyleSheet(CSS7);}
else{setActiveStyleSheet(CSS8);}
  }}}}}}
}

function setActiveStyleSheet(title){ 
document.getElementsByTagName("link")[0].href="/include/"+title; 
}

//
// Sets the size of div id 'content'
//
function setContentSize()
{
	// current windowsize
	var winwidth = windowSize('width');
	var winheight = windowSize('height');

	// stylesheet vertical and logo size
	var minwidth = parseInt(getStyle(document.getElementById('vertical'), "width"));
	var minheight = parseInt(getStyle(document.getElementById('Content'), "top")); // height of the header

	var contentPaddingTop = 0;//20; // get dynamically?
	var contentPaddingBottom = 0;//20; // get dynamically?

	// ie differs in width and height detection
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		contentPaddingTop = 0;
		contentPaddingBottom = 0;
	}

	// set content size
	//setStyle('Content', "width", (winwidth - minwidth) + "px"); // replaced with CSS change. Inline style code changes cannot be undone/overwritten by stylesheets which causes printing problems!

	var theRules = new Array();

	for (var o = 0; o < document.styleSheets.length; o++)
	{
		if(document.styleSheets[o].href != null && document.styleSheets[o].href.indexOf("screen.css") != -1)
		{
			if (document.styleSheets[o].cssRules)
				theRules = document.styleSheets[o].cssRules;
			else if (document.styleSheets[o].rules)
				theRules = document.styleSheets[o].rules;
		}
	}

	var i;
	for(i=0; theRules[i]; i++)
	{
		if(theRules[i].selectorText == '#Content')
		{
			theRules[i].style.width = (winwidth - minwidth) + "px";
		}
	}
	setStyle('Content', "height", (winheight - minheight) - contentPaddingTop - contentPaddingBottom + "px");
	//alert((document.getElementById('modExternalPageTop'));
	//if((document.getElementById('modExternalPageTop'))

	var modExternalPageTopHeight;
	modExternalPageTopHeight = getStyle(document.getElementById('modExternalPageTop'), "height");
	if(modExternalPageTopHeight != undefined)
	{
		modExternalPageTopHeight = parseInt(modExternalPageTopHeight);
	}
	else
	{
		modExternalPageTopHeight = 0;
	}

	// in case of externalmodule
	try{
		setStyle('modExternalPage', "height", parseInt(getStyle(document.getElementById('Content'), "height")) - modExternalPageTopHeight - 4 + "px");
	}catch(err){}

	// also set bar sizes. in ie7 they disappear when coolmenus4 is hovered and exited. width 999px fixes this, but doesnt work with anchor links (<a name="">)
	setStyle('horizontal', "width", winwidth + "px");
	setStyle('vertical', "height", winheight + "px");
}

function getStyle(el, style)
{
try{
   if(!document.getElementById) return;

     var value = el.style[toCamelCase(style)];

    if(!value)

        if(document.defaultView)

            value = document.defaultView.

                 getComputedStyle(el, "").getPropertyValue(style);



        else if(el.currentStyle)

            value = el.currentStyle[toCamelCase(style)];

     return value;
}catch(err){}
}

function setStyle(objId, style, value) {

	try{
   		document.getElementById(objId).style[style] = value;
    }catch(err) {}
}

function toCamelCase( sInput ) {

    var oStringList = sInput.split('-');

    if(oStringList.length == 1)

        return oStringList[0];

    var ret = sInput.indexOf("-") == 0 ?

       oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];

    for(var i = 1, len = oStringList.length; i < len; i++){

        var s = oStringList[i];

        ret += s.charAt(0).toUpperCase() + s.substring(1)

    }

    return ret;

}

function windowSize(what) {

	var winWidth = 0;
	var winHeight = 0;


	// Niet Internet Explorer

	if(typeof(window.innerWidth) == 'number'){
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;}

	// Internet Explorer 6 - Standards Compliant

	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){

		winWidth = document.documentElement.clientWidth;
		winHeight = document.documentElement.clientHeight;}

	// Internet Explorer 4+

	else if(document.body && (document.body.clientWidth || document.body.clientHeight)){

		winWidth = document.body.clientWidth;
		winHeight = document.body.clientHeight;}

	// Teruggeven

	if(what == 'width'){
		return winWidth;}
	else if(what == 'height'){
		return winHeight;}

}