function goLightbox(chap) {
	$('lightbox').className='perIcoBoxOn';
	$('fourIco').className='fourIcoOff';
	setVal(chap);
	showLightbox(false);
}

function hoverIco(id,chap) {
	$(id).className='headIconOn' + chap;
}

function outIco(id,chap) {
	$(id).className='headIcon' + chap;
}

function setVal(chap) {
	document.getElementById('icoBox').className='lightbox' + chap;
	document.getElementById('perIcoTitle').className='perIcoTitle' + chap;

	setLinks(chap);

	if (chap == 'Design') {
		document.getElementById("perIcoVerhaal").innerHTML = "◇&nbsp;<b>富有激情</b>的设计策划，让人留下一种<b>强烈震撼、发人深省、令人难忘</b>的印象。"+
		"<br>◇&nbsp;成功的设计策划应该紧扣受众目标，充分有效利用内外部资源，并通过创造性劳动来制定方案;"+
		"<br>◇&nbsp;成功的设计策划应该是对企业及其产品有个全面认识，对市场深入的调查与研究，并通过设计策划的主题、策略、诉求、创意表现、促销效果、品牌树立、社会文化等诸多方面来完成传播，来达到即定的目的。"+
		"<br>◇&nbsp;为此每天我们都在努力，这意味着：<BR>&nbsp;&nbsp;&nbsp;&nbsp;<b>——&nbsp;&nbsp;我们不会随意发布作品，除非我们因为作品而骄傲！</b>";
	}
	if (chap == 'Development') {
		document.getElementById("perIcoVerhaal").innerHTML = "◇&nbsp;基于Web互联网的软件将是未来的<b>主导</b>。"+
		"<br>◇&nbsp;明天，互联网将会成为您的办公室。<b>您</b>可以从地球上任何地点的互联网接入。您可以决定什么类型的软件，明天、今天<b>准确</b>的出现在您的办公室。"+
		"<br>◇&nbsp;我们建立<b>简单高效</b>的软件，满足您的需要，帮助您实现您的<b>目标</b>。"+
		"<br>◇&nbsp;基于网络的应用，您可以信任、主导、依靠。<br><BR>&nbsp;&nbsp;&nbsp;&nbsp——&nbsp;&nbsp;因为这一切将有我们来为您实现，从事软件开发正是我们热爱和擅长的。";
	}
	if (chap == 'Consulting') {
		document.getElementById("perIcoVerhaal").innerHTML = "◇&nbsp;系统集成是一种<b>思想、观念和哲理</b>，是一种指导信息系统的总体规划、分步实施的方法和策略，它不仅包含技术而且更包含<b>艺术</b>成分。"+
		"<br><br>◇&nbsp;系统集成能够最大限度地提高系统的有机构成、系统的效率、系统的完整性、系统的灵活性等，简化系统的复杂性，并最终为企业提供一套<b>切实可行</b>的完整的解决方案。";
	}
	if (chap == 'Training') {
		document.getElementById("perIcoVerhaal").innerHTML = "◇&nbsp;我们<b>乐于</b>分享交流，将摸索出的经验和积累的知识，<b>传播</b>给更多、更需要的人们。"+
		"<br>◇&nbsp;我们可以帮助您引进新技术，提出基于行业最佳做法的建议，提高您的团队绩效，并帮助<b>培养</b>一种可持续发展的企业文化和敏捷的思维。"+
		"<br>◇&nbsp;无论在技术还是心理上，我们都希望每位朋友和您一样，<b>保持</b>积极、友好的态度。"+
		"<br>◇&nbsp;提高您的团队，从今天您<b>赋予</b>他们的新知识和高效经验开始。";
	}
}

function setLinks(chap) {
	$('linkDesign').className = (chap=='Design' ? 'linkOff' : '');
	$('linkProgramming').className = (chap=='Development' ? 'linkOff' : '');
	$('linkConsulting').className = (chap=='Consulting' ? 'linkOff' : '');
	$('linkTraining').className = (chap=='Training' ? 'linkOff' : '');
}




function CenteredWindow(myurl, myname, mywidth, myheight, scroll) {
	var winl = (screen.width - mywidth) / 2;
	var wint = ((screen.height - myheight) / 2) - 20;
	winprops = 'height='+myheight+',width='+mywidth+',top='+wint+',left='+winl+',screenX'+winl+',screenY='+wint+',scrollbars='+scroll+',resizable=no,status=no';
	mywin = window.open(myurl, myname, winprops);
	if (parseInt(navigator.appVersion) >= 4) { mywin.window.focus(); }
}


function reloadForNewResolution(omslagpunt) {
	if ((clW > omslagpunt && document.body.clientWidth <= omslagpunt) ||
	    (clW <= omslagpunt && document.body.clientWidth > omslagpunt)) {
		      clW = document.body.clientWidth;
		      document.location.href=document.URL;
	}
}


function clearFormField(field, default_value) {
    if (field.value == default_value) {
        field.value = '';
    }
}


function restoreFormField(field, default_value) {
    if (field.value == '') {
        field.value = default_value;
    }
}


function autoTab(input,len,e) {
	var keyCode = (isNN()) ? e.which : e.keyCode;
	var filter  = (isNN()) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if (input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	return true;
}


function containsElement(arr,ele) {
	var found = false, index = 0;
	while (!found && index < arr.length) {
		if (arr[index] == ele) {
			found = true;
		} else {
			index++;
		}
	}
	return found;
}


function getIndex(input) {
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1) {
		if (input.form[i] == input) {
			index = i;
		} else {
			i++;
		}
	}
	return index;
}


function isNN() {
    return (navigator.appName.indexOf("Netscape")!=-1);
}


function formatDecimalEuropean(num) {
	num = num.toString().replace(/\,/g,'.');
	if(isNaN(num)) return num;
	if (num == '') return '';
	if (num == 0) return '0,00';
	if (num < 0) {
   		var cents = Math.abs(Math.ceil((num*100-0.5)%100));
		num = Math.ceil((num*100-0.5)/100).toString();
		if (num >= 0) {
			num = '-' + num;
		}
	} else {
   		var cents = Math.floor((num*100+0.5)%100);
		num = Math.floor((num*100+0.5)/100).toString();
	}
	if(cents < 10) cents = "0" + cents;
	return (num + ',' + cents);
}


function formatDecimalAmerican(num) {
	num = formatDecimalEuropean(num);
	return num.replace(/\,/g,'.');
}


function explodeJsCalendarDate(dateValue, idDay, idMonth, idYear) {
    dateArray = dateValue.split('-');
    document.getElementById(idDay).value=dateArray[0];
    document.getElementById(idMonth).value=dateArray[1];
    document.getElementById(idYear).value=dateArray[2];
}


function isOpera() {
    return navigator.appName.indexOf('Opera') > -1;
}


function isMSIE() {
    return navigator.appName.indexOf('Microsoft Internet Explorer') > -1;
}


function isMozilla() {
    return navigator.appName.indexOf('Netscape') > -1;
}


function calculateTotalOffset(element) {
	var totalOffset = 0;
	while (element) {
		totalOffset += element.offsetTop;
		element = element.offsetParent;
	}
	return totalOffset;
}


function calculateTotalOffsetLeft(element) {
	var totalOffset = 0;
	while (element) {
		totalOffset += element.offsetLeft;
		element = element.offsetParent;
	}
	return totalOffset;
}


function trimString(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}


function trimField(fieldId) {
	if ($(fieldId) && $F(fieldId)) {
		$(fieldId).value = trimString($F(fieldId));
	}
}


function externalLinks() {
	var hrefs = document.getElementsByTagName('a');
	for (var i=0; i<hrefs.length; i++) {
		if (hrefs[i].rel && hrefs[i].rel == 'external') {
			hrefs[i].target = '_blank';
		}
	}
}


function clearAllChildren(parent) {
	if ($(parent)) {
		while($(parent).firstChild) {
			$(parent).removeChild($(parent).firstChild);
		}
	}
}


function pause(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) {
 			return;
		}
	}
}


function prettyTime(time, timeNotation, showZero) {
	time = time.toString().replace(/,/g, '.').replace(/;/g, ':');
	if (time != '') {
		if (timeNotation == 'decimal') {
			if (time == "0") {
				time = "0:00";
			}
			if (time.indexOf('.') == -1) {
				// van 'hour' naar 'decimal'
				var colon = time.indexOf(':');
				if (colon == 0) {
					time = "0" + time;
				}
				var timeArray = time.split(':');
				var hours = parseInt(timeArray[0], 10);
				var minutes = (timeArray[1] ? parseInt(timeArray[1], 10) : 0);
				if (isNaN(hours) || isNaN(minutes)) {
					return '';
				} else {
					time =  hours + (minutes/60);
				}
			}
			time = Math.round(time*100)/100;
			if (time == parseInt(time)) {
				time = time+".00";
			}
			var timeArray = time.toString().split('.');
			if (timeArray[1].length == 1) {
				time = time+"0";
			}
			if (currentLanguage == 'nl') {
				time = time.toString().replace('.', ',');
			}
		} else if (timeNotation == 'hour') {
			if (time.indexOf(':') == -1) {
				// van 'decimal' naar 'hour'
				var point = time.indexOf('.');
				if (point == 0) {
					time = "0" + time;
				}
				var timeArray = time.split('.');
				var hours = parseInt(timeArray[0], 10);
				var minutes = Math.round((time - hours)*100);
				minutes = Math.round(minutes * 0.6);
				if (isNaN(hours) || isNaN(minutes)) {
					return '';
				} else {
					if (minutes == 60) {
						hours++;
						minutes = 0;
					}
					if (minutes.toString().length == 0) {
						minutes = '00';
					} else if (minutes.toString().length == 1) {
						minutes = '0' + minutes;
					}
					time = hours + ":" + minutes;
				}
			} else {
				var timeArray = time.split(':');
				var hours = parseInt(timeArray[0], 10);
				if (isNaN(hours)) {
					hours = 0;
				}
				var minutes = parseInt(timeArray[1], 10);
				if (minutes > 60) {
					var moreHours = parseInt(minutes/60);
					hours += moreHours;
					minutes = minutes - (moreHours*60);
				}
				if (minutes == 60) {
					hours++;
					minutes = 0;
				}
				if (minutes.toString().length == 0) {
					minutes = '00';
				} else if (minutes.toString().length == 1) {
					minutes = '0' + minutes;
				}
				time = hours + ":" + minutes;
			}
		}
	}
	if ((time == '0.00' || time == '0:00') && !showZero) {
		time = '';
	}
	return time;
}


function _fixYear(year) {
	return (year < 1000) ? year + 1900 : year;
}


function isValidDate(year, month, day) {
	// month argument must be in the range 1-12
	month = month - 1;  // javascript month range : 0-11
	var tempDate = new Date(year,month,day);
	if ((_fixYear(tempDate.getYear()) == year) && (month == tempDate.getMonth()) && (day == tempDate.getDate())) {
		return true;
	} else {
		return false;
	}
}


function datumDeel(datum, deel) {
	var j, m, d, datumArray = datum.split('-');
	deel = deel.toLowerCase();
	if (datum.toString().match(/^\d{4}-\d{1,2}-\d{1,2}$/)) {
		j = datumArray[0];
		d = datumArray[2];
	} else if (datum.toString().match(/^\d{1,2}-\d{1,2}-\d{4}$/)) {
		d = datumArray[0];
		j = datumArray[2];
	} else {
		return '';
	}
	m = datumArray[1];
	if (deel == 'dag' || deel == 'day' || deel == 'd') {
		return d;
	} else 	if (deel == 'maand' || deel == 'month' || deel == 'm') {
		return m;
	} else 	if (deel == 'jaar' || deel == 'year' || deel == 'j' || deel == 'y') {
		return j;
	} else {
		return '';
	}
}


