var menuItems = new Array(9);
var activeMenu = '';

/* to fill with short sections descriptions */
menuItems[0] = '<br/>We believe in sharing our knowledge with our clients';
menuItems[1] = '<br/>We are small enough to care but big enough to deliver';
menuItems[2] = 'We help our clients to make strategic decisions and to enable their business with the right solutions';
menuItems[3] = '<br/>We help clients become high-performance business';
menuItems[4] = '<br/>We believe in sharing our knowledge with our clients';
menuItems[5] = '<br/>We believe in long term partnerships to help our clients win';
menuItems[6] = '<br/>We believe in Respect, Learning, Team spirit, and Growth';
//menuItems[7] = '<br/>List to the latest Cambridge Podcast';
menuItems[7] = '<br/>Alumni Network. Let&rsquo;s stay connected!';

function fillArea(id,text) {
	var obj = document.getElementById(id);
	obj.innerHTML = text;
	if (activeMenu == '') {
		activeMenu = text;
	}
}

function clearArea(id) {
	fillArea(id,'&nbsp;');
}

/* debug function */
function objProperties(obj) {
    var temp = '';
    for (x in obj ) temp += x + ": " + obj[x] + "<br>";
    document.write(temp);
}

/* send the form apply in section career */
function sendResponse() {
	var lform = document.getElementById('apply');
	lform.submit();
}

function fillJobFilter(ovalue,cvalue) {
	var soffice = document.getElementById('office');
	var scomp = document.getElementById('competence');
	
	if (ovalue != '') {
		for (i=0; i < soffice.options.length; ++i) {
			if (soffice.options[i].value == ovalue) {
				soffice.options[i].selected = true;
				break;
			}
		}
	}
	if (cvalue != '') {
		for (i=0; i < scomp.options.length; ++i) {
			if (scomp.options[i].value == cvalue) {
				scomp.options[i].selected = true;
				break;
			}
		}
	}
}

function jobFilter() {
	var soffice = document.getElementById('office');
	var scomp = document.getElementById('competence');
	var newUrl = '/open_opportunities.php';
	if (soffice.value != '' && soffice.value != 'alloffices') {
		newUrl += '?office=' + soffice.value;
	}
	if (scomp.value != '' && scomp.value != 'allcompetences') {
		if (soffice.value != '' && soffice.value != 'alloffices') {
			newUrl += '&';
		} else {
			newUrl += '?';
		}
		newUrl += 'competence=' + scomp.value;
	}
	document.location = newUrl;
}

function sectionRollOver(anchor) {
	var div = anchor.parentNode;
	if (div.className == 'title') {
		div.className = 'title-rollover';
	} else {
		div.className = 'title';
	}
}

function includeFlashBanner() {
	var so = new SWFObject('news.swf', "flashnews", "370", "337", "7", "f2f2f2");
	so.write("flashobject");
}

function includeFlashSolutionsBanner() {
	var so = new SWFObject('solutions.swf', "flashnews", "370", "337", "7", "f2f2f2");
	so.write("flashobject");
}


/* New sections September 07 */
function myToggle() {
	var div = 'more-info';
	var link = 'toggle';
	if ($(div).style.display == 'block') {
		$(div).style.display = 'none';
		$(link).innerHTML = '+ More Info...'
	} else {
		$(div).style.display = 'block';
		$(link).innerHTML = '+ Main Info...'
	}
}

// shade-window
function closeInfoWindowOld() {
	var body = document.getElementsByTagName("body")[0];
	var node = document.getElementById('infoWindowShadow');
	body.removeChild(node);
	node = document.getElementById('infoWindowCenterDiv');
	body.removeChild(node);
}


function infoWindowOld(message) {
	if (message== '') {
		return;
	}

	var body = document.getElementsByTagName("body")[0];
	
	var ypos = '300;'; 
	
	var shadow = document.createElement("div");
	shadow.id = 'infoWindowShadow';
	var style = 'display: block; z-index: 100; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #000000; ';
	style += ' opacity: 0.6; filter:alpha(opacity=60); overflow: hidden; text-align: center;';
	shadow.style.cssText = style;
	
	var centerdiv = document.createElement("div");
	centerdiv.id = 'infoWindowCenterDiv';
	style = 'display: block; z-index: 110; position: absolute; top: 0; left: 0; width: 100%; height: 100%;';
	style += ' overflow: hidden; text-align: center;';
	centerdiv.style.cssText = style;
	
	var div = document.createElement("div");
	style = 'position: relative; top: ' + ypos + ' width: 363px; height: 149px; background-image: url("img/bg/bg_wininfo.jpg"); background-repeat: no-repeat;';
	style += ' margin-left: auto; margin-right: auto; padding: 20px 5px 20px 5px; font-family: Arial, Helvetica, Sans-Serif;';
	style += ' text-align: center; color: #000000; font-weight: normal; font-size: 12px;';
	//style += ' opacity: 1.0; filter:alpha(opacity=100);'
	div.style.cssText = style;
	div.innerHTML = message;
	div.innerHTML += '<br/><br/><br/><input type="button" onclick="closeInfoWindow(); return false;" value="   OK   " />'
	
	centerdiv.appendChild(div);
	body.appendChild(shadow);
	body.appendChild(centerdiv);
	
}

function __popup(message, windowShadowElement, windowCenterElement, windowMsgElement) {
	if (message == '') {
		return;
	}
	var shadow = document.getElementById(windowShadowElement);
	var infowin = document.getElementById(windowCenterElement);
	var infomsg = document.getElementById(windowMsgElement);
	infomsg.innerHTML = message;
	shadow.style.display = 'block';
	infowin.style.display = 'block';	
}

function infoWindow(message) {
	__popup(message, 'infoWindowShadow', 'infoWindowCenterDiv', 'infoWindowMsg');
}

function popupWindow(message) {
	__popup(message, 'popupWindowShadow', 'popupWindowCenterDiv', 'popupWindowMsg');
}

function __closePopup(windowShadowElement, windowCenterDiv) {
	var shadow = document.getElementById(windowShadowElement);
	var infowin = document.getElementById(windowCenterDiv);
	infowin.style.display = 'none';
	shadow.style.display = 'none';
}

function closePopupWindow() {
	__closePopup('popupWindowShadow', 'popupWindowCenterDiv');
}

function closeInfoWindow() {
	__closePopup('infoWindowShadow', 'infoWindowCenterDiv');
}

function delete_users_from_contest() {
	var str = '';
	var users = []
	var elem = document.frm_users.selection;
	if (confirm('Are you sure you want to delete all selected entries ?')) {
		for(var i = 0; i < elem.length; i++) {
			if (elem[i].checked) {
				users.push(elem[i].value);
			}
		}
		str = users.toString();
		if (str.length == 0) {
			return;
		}
		document.frm_users.records.value = str;
		document.frm_users.submit();
	}
}

function showSubMenu(subMenuId) {
	$("#submenu dd").each(
		function(dd) {
			if (!(subMenuId.match(this.id))) {
				$(this).slideUp();
			}
		}
	);
	$("#" + subMenuId).slideDown();
}