// JavaScript Document
function getWindowsDimensions() {
	var myWidth = 0, myHeight = 0;
	if	( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth,myHeight];
}

function size() {
	arDimensions = getWindowsDimensions();
	var headerFooterHeight = 210; /* 150 + 60 */
	var newHeight = arDimensions[1] - headerFooterHeight;
	// content
	document.getElementById('content').style.minHeight = newHeight - 40 + 'px'; /* 20 padding */
	initText();
}
function initText() {
	fontsz = readCookie('fontsz');
	document.body.style.fontSize = fontsz;
	
	fontMultiplier = fontsz == '16px' ? 1 : -1;
	document.getElementById('resizeText').innerHTML = fontMultiplier == 1 ? 'A-': 'A+'
}
function resizeText() {   
  var fontsz = "12px"; //Default to 1em   
  fontMultiplier = fontMultiplier != 1 ? 1 : -1;
 /* if (Cookie.get('site_font_size')) 
  {     
    // Use MooTools to get the cookie (if it exists)     
    fontsz = Cookie.get('site_font_size');   
  }  */ 
 /* fontsz = parseFloat(fontsz) + (fontMultiplier * 0.2) + "px";   // Change body text size   
  document.body.style.fontSize = fontsz;      //Set a new cookie with MooTools   
  */
 /* var myCookie = Cookie.set('site_font_size', fontsz, {     
    domain: 'mydomain.com',
    duration: 365 //Save for 365 days   
  }); */
  fontsz = (fontMultiplier == 1 ? 14 : 12) + "px";   // Change body text size
  createCookie('fontsz',fontsz);
   
  document.body.style.fontSize = fontsz;
  document.getElementById('resizeText').innerHTML = fontMultiplier == 1 ? 'A-': 'A+';
} 
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;
}

var fontMultiplier = 0;

/* members */
function showMember(name, imgid) {
	document.getElementById('memberInfo').style.display = 'block';
	$('#memberInfo').load('/svh/index.cfm/werkgroepen/showmember/?userFullname='+escape(name)+'&PhotoFileID='+imgid);
	//$('#memberInfo').style.top = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + 'px';
	//ColdFusion.navigate('/svh/includes/display_objects/custom/memberPhoto.cfm?userid='+id,'memberInfo');	
}
function hideMember() {
	document.getElementById('memberInfo').style.display = 'none';	
}


/* password init */
function initPassword() {
	var pw = document.getElementById('txtPassword');
	pw.style.background = (pw.value=='') ? 'url(/svh/images/loginForm_passwordbg.png) no-repeat' : 'none';
}
