function functionHomepage(){	
	var button=document.getElementById("generalfrm:homepageButton");
	button.click();

}
function functionAboutus(){	
	var button=document.getElementById("generalfrm:aboutusButton");
	button.click();

}
function functionOurteam(){	
	var button=document.getElementById("generalfrm:teamButton");
	button.click();

}
function functionEvents(){	
	 var button=document.getElementById("generalfrm:eventsButton");
	button.click();

}
function functionMediarelations(){	
	var button=document.getElementById("generalfrm:mediaButton");
	button.click();

}
function functionSoftware(){	
	var button=document.getElementById("generalfrm:softwareButton");
	button.click();

}
function functionRetail(){	
	var button=document.getElementById("generalfrm:retailButton");
	button.click();

}
function functionNetworking(){	
	var button=document.getElementById("generalfrm:networksButton");
	button.click();

}
function functionSupport(){	
	var button=document.getElementById("generalfrm:assistanceButton");
	button.click();

}
function functionWebdesign(){	
	var button=document.getElementById("generalfrm:designButton");
	button.click();

}
function functionSAP(){	
	var button=document.getElementById("generalfrm:consultancyButton");
	button.click();

}
function functionClients(){	
	var button=document.getElementById("generalfrm:clientsButton");
	button.click();

}
function functionPartners(){	
	var button=document.getElementById("generalfrm:partnersButton");
	button.click();

}
function functionSolutions(){	
	var button=document.getElementById("generalfrm:solutionsButton");
	button.click();

}
function functionCareers(){	
	var button=document.getElementById("generalfrm:careersButton");
	button.click();

}
function functionContact(){	
	var button=document.getElementById("generalfrm:contactButton");
	button.click();

}

function functionGallery(){	
	var button=document.getElementById("generalfrm:photoButton");
	button.click();

}

function functionHistoryGallery(){	
	var button=document.getElementById("generalfrm:photoHistory");
	button.click();

}

var winRef;
function openwindow(url,wndName,width,height) {
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
   
    if (winRef != null && winRef.closed == false){
    	winRef.close();
    }
    
    winRef = window.open(url,wndName,"dialog=1,modal=1,menubar=1,resizable=1,status=1,width="+width+",height="+height+",left="+left+",top="+top+",screenX="+left+",screenY="+top);
    winRef.focus();
}

function goToGA() {
	document.getElementById("googleanalyticslogin").action="https://www.google.com/accounts/ServiceLoginBoxAuth";
	document.getElementById("googleanalyticslogin").submit();
}

function functionFocus(id){
  var componentFull=getElementByPartId(id+":full");
  var componentShort=getElementByPartId(id+":short");
  var linkMore=document.getElementById("linkMore"+id);
  var linkLess=document.getElementById("linkLess"+id);	
  componentFull.style.display="block";
  componentShort.style.display="none";
  linkLess.style.display="block";
  linkMore.style.display="none";
}

function functionUnFocus(id){
  var componentFull=getElementByPartId(id+":full");
  var componentShort=getElementByPartId(id+":short");
  var linkMore=document.getElementById("linkMore"+id);
  var linkLess=document.getElementById("linkLess"+id);	
  componentFull.style.display="none";
  componentShort.style.display="block";
  linkLess.style.display="none";
  linkMore.style.display="block";
}

function hideWaitMessage(){
	  var wait=document.getElementById("generalfrm:waitMessage");
	  if(wait)
	  wait.style.display="none";
	  var waitCV=document.getElementById("generalfrm:downloadMessage");
	  if(waitCV)
		  waitCV.style.display="block";
	  var linkCV=document.getElementById("generalfrm:closeWindow");
	  if(linkCV)
		  linkCV.style.display="block";
	
	}
function showWaitMessage(){
	  var wait=document.getElementById("generalfrm:waitMessage");
	  if(wait)
	  wait.style.display="block";
	
	}
function functionFocusJob(id){
	  var componentFull=document.getElementById("moreDiv");
	  var linkMore=document.getElementById("linkMore"+id);
	  var linkLess=document.getElementById("linkLess"+id);	
	  componentFull.style.display="block";
	  linkLess.style.display="block";
	  linkMore.style.display="none";
	}

function functionUnFocusJob(id){
	  var componentFull=document.getElementById("moreDiv");
	  var linkMore=document.getElementById("linkMore"+id);
	  var linkLess=document.getElementById("linkLess"+id);
	  componentFull.style.display="none";
	  linkLess.style.display="none";
	  linkMore.style.display="block";
	}

function getElementByPartId(partId){
	var elements=document.getElementsByTagName("span");
	for(var i=0;i<elements.length;i++){
		if(elements[i].id.match(partId))
			return elements[i];
	}
	return null;
}

function getElementDivByPartId(partId){
	var elements=document.getElementsByTagName("div");
	for(var i=0;i<elements.length;i++){
		if(elements[i].id.match(partId))
			return elements[i];
	}
	return null;
}

function keypressed(e){
    var evtobj=window.event? event : e;
    if(evtobj!=null){
    if(evtobj.keyCode=='13') {
    if(document.getElementById("generalfrm:enterLogin"))
        document.getElementById("generalfrm:enterLogin").click();    	
    	else
    	if(getElementLinkByPartId("generalfrm:footer"))
    	getElementLinkByPartId("generalfrm:footer").click();
    }
    }

}
    
function getElementLinkByPartId(partId){
var elements=document.getElementsByTagName("a");
    var id="";
    var locLk;
for(var i=0;i<elements.length;i++){
            locLk=elements[i];
            id=locLk.id;
	if(id.match(partId))
		return elements[i];
}
return null;
}
	
	
function StyleByBrowser(style) {
	var ua, s, i;
	this.isIE = false;
	this.version = null;

	ua = navigator.userAgent;

	s = "MSIE";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return style+"IE";
	}
	
	return style;
}

function timedMsg()
{
setTimeout("openwindow('applyJob.jsf','apply',800,600)",100);
}

function reQuery(){
	var button=document.getElementById("generalfrm:requeryButton");
	if (button!=null){
		button.click();
	}
}

var maxWidth = 500;
var maxHeight = 400;

function scaleSize(maxW, maxH, currW, currH){

	var ratio = currH / currW;
	
	if(currW >= maxW && ratio <= 1){
	currW = maxW;
	currH = currW * ratio;
	} else if(currH >= maxH){
	currH = maxH;
	currW = currH / ratio;
	}

	return [currW, currH];
}

function changeSelectedPic(elm){
	var ie = (document.all)? true:false;
	if (ie){
		changeSelectedPicIE(elm);
	}else{
		changeSelectedPicNotIE(elm);
	}
}
function changeSelectedPicNotIE(elm){
	document.getElementById("generalfrm:selectedPic").src = elm.src;
	
	var newImg = new Image();
	newImg.src = elm.src;
	
	newImg.onload = function(){
		 {
			var width = newImg.width;
			var height = newImg.height;
			var newSize = scaleSize(maxWidth, maxHeight, width, height);
			document.getElementById("generalfrm:selectedPic").width = newSize[0];
			document.getElementById("generalfrm:selectedPic").height = newSize[1];
		 }
		 ;
	};
}

function changeSelectedPicIE(elm){
	document.getElementById("generalfrm:selectedPic").src = elm.src;
	var newImg = new Image();
	newImg.src = elm.src;
	var width = newImg.width;
	var height = newImg.height;
	var newSize = scaleSize(maxWidth, maxHeight, width, height);
	document.getElementById("generalfrm:selectedPic").src = newImg.src;
	document.getElementById("generalfrm:selectedPic").width = newSize[0];
	document.getElementById("generalfrm:selectedPic").height = newSize[1];
}

function scaleFirstImage(){
	var elm = document.getElementById("generalfrm:selectedPic");
	if (elm != null){
		var width = elm.width;
		var height = elm.height;
		var newSize = scaleSize(maxWidth, maxHeight, width, height);
		document.getElementById("generalfrm:selectedPic").width = newSize[0];
		document.getElementById("generalfrm:selectedPic").height = newSize[1];
	}
}


