//for shortcut menu
var hover=false;
var menuht=430;
function hideMenu(){
	var lyr="lyrShortcuts";
	var m=document.getElementById(lyr);if(!m){return;}
	if(hover){showMenu(lyr);return;}
	if(m.style.display=='none'){return;}var h=parseInt(m.style.height);
	if(h>3){m.style.height=(h-3)+'px';to=setTimeout('hideMenu()',10);}
	else{m.style.display='none';}
}
function showMenu(){
	var lyr="lyrShortcuts";
	var m=document.getElementById(lyr);if(!m){return;}
	var h=parseInt(m.style.height);m.style.display='';
	if(isNaN(h)){m.style.height=3+'px';to=setTimeout('showMenu()',10);}
	else if(h<menuht){m.style.height=(h+3)+'px';to=setTimeout('showMenu()',10);}
	else{m.style.height=menuht+'px';}
	first=true;
}


function chgMenuLeftBkg(row, c){
	var obj=document.getElementById('td_menutext_'+row);
	if(!obj){return;}
	obj=obj.style;if(!obj){return;}
	obj.backgroundColor=c;

	obj=document.getElementById('td_menuarrow_'+row);
	if(!obj){return;}
	obj=obj.style;if(!obj){return;}
	obj.backgroundColor=c;
}
function chgMenuTopBkg(obj,c){
	if(!obj){return;}
	obj=obj.style;if(!obj){return;}
	obj.backgroundColor=c;
}
function chgLogoBorder(id,c){
	var obj=document.getElementById('td_logo_'+id);
	if(!obj){return;}
	obj.className=c;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function showHideRow(id) {
	var r=document.getElementById(id);if(!r) return;
	if(r.style.display=='none') {r.style.display='';}
	else{r.style.display='none';}
}
function showHideAll(d,root){
	var r;if(d=='show'){d='';}else if(d=='hide'){d='none';}else {return;}
	for(var i=1;i<20;i++){
		r=document.getElementById(root+i);if(r) {r.style.display=d;}}
}
function hideItem(id) {
	var r=document.getElementById(id);if(!r) return;
	r.style.display='none';
}

//notices and warnings
function emailPopup(id) {
	var conf='';
	if(id==1){ //external email link - investment mgr
		conf='Please note that by using this link you will not be communicating with LPEQ but with the third party investment manager of a PEIT.\nAccordingly, LPEQ can accept no responsibility for how any information or personal data that is contained in your e-mail is used.'}
	else if(id==2) { //media centre/research warning
		conf='LPEQ does not produce any "investment research" itself and the information contained in this section is for general information only and does not constitute advice.'}
	else if(id==3) { //internal email link
		conf='When you e-mail us using this link you will be providing to us personal information relating to you.  We will only use your information in order to respond to any query you make, however your information may be forwarded to one or more members of LPEQ and or their third party investment managers. By submitting your information, you agree that it will be governed in accordance with our privacy policies and practices.  The information you submit may be transferred to other countries that may not have laws protecting personal information equivalent to your own.';}
	else if(id==4){ //external email link - analyst
		conf='Please note that by using this link you will not be communicating with LPEQ but with a third party who is an investment analyst.\nAccordingly, LPEQ can accept no responsibility for how any information or personal data that is contained in your e-mail is used.'}
	else if(id==5){ //external email link - investment mgr of BSPEL
		conf='Please note that by using this link you will not be communicating with LPEQ but with private equity investment company.\nAccordingly, LPEQ can accept no responsibility for how any information or personal data that is contained in your e-mail is used.'}
	else {
		return false;}
	if(!confirm(conf)){return false;}
	return true;
}
function openDetails() {
	window.open('details.html', 'details','width=410px,height=610px,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no');
	return;
}
function notice(id) {
	var msg='';
	if(id==1){ //external website link
		msg='You are now leaving the LPEQ website and are being redirected to a PEIT member website - before using this external website, please ensure you read and understand its Terms and Conditions.'}
	else {
		return;}
	alert(msg);
}
function setLeft(r,lt){
	var x=document.getElementById('tblmain');if(x){
	if(x.style.width>x.offsetParent.clientWidth){x=lt;}
	else{x=((x.offsetParent.clientWidth-740)/2)+lt;}r.style.left=x;}
}
function launchDialog(url,h,w,a) {
	var ret='';
	ret=window.showModalDialog(url,a,'dialogHeight:'+h+';dialogWidth:'+w+';scroll:yes;help:no;resizable:no;center:yes;');
	if (ret==undefined) ret='';
}
function launchWindow(url,h,w,n) {
	var ret='';
	win=window.open(url,n,'height='+h+',width='+w+',scrollbars=yes;help:no;resizable:yes;center:yes');
	win.focus();
}


function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
}
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
	object.visibility='visible';
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	if(opacity>0){object.display='';}else{object.display='none';}
}

function getQueryVariable(variable) { 
	var query = window.location.search.substring(1); 
	var vars = query.split("&"); 
	for (var i=0;i<vars.length;i++) { 
		var pair = vars[i].split("="); 
		if (pair[0] == variable) { 
			return pair[1]; 
		} 
	} 
} 

function showNextMsg(dt,msg){
//displays the next message in the fade-out box
	opacity('lyrNameChg',100,0,500);
	var msgdt=document.getElementById('tdMsgDate');
	if(msgdt){msgdt.innerHTML='<p class="content-bold">'+dt+'</p>';}
	var m=document.getElementById('tdMsg');
	if(m){m.innerHTML='<p class="content_red_bold">'+msg+'</p>';}
	opacity('lyrMsg',0,100,500);
	setTimeout('opacity(\'lyrMsg\', 100, 0, 1500)', 20000);
}
