// JavaScript Document
/*Investis script*/

var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,scrollbars=1,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

function disclaimWin(theUrl, winName) 
{
window.open(theUrl,winName,'toolbar=yes,status=yes,width=565,height=275,directories=no,SCROLLbars=yes,resize=no,menubar=yes,top=10,left=10')
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popupPrint(str_url, str_name, int_width, int_height) 
{
	var winX = (screen.width - int_width) / 2;
	var winY = (screen.height - int_height) / 2;
	str_WinParams = 'height=' + int_height +',width=' + int_width + ',top=' + winY+',left=' + winX + ',menubar=0,scrollbars=1,resizable=1,toolbar=1,location=0,status=0';
	win = window.open(str_url, str_name, str_WinParams);
}

function launch(str_url, str_name, int_width, int_height) 
{
	var winX = (screen.width - int_width) / 2;
	var winY = (screen.height - int_height) / 2;
	str_WinParams = 'height=' + int_height +',width=' + int_width + ',top=' + winY+',left=' + winX + ',menubar=0,toolbar=0,scrollbars=1,resizable=1,status=0';
	win = window.open(str_url, str_name, str_WinParams);
	if ((parseInt(navigator.appVersion) >= 4)|| (navigator.appName = 'Netscape')) { win.window.focus(); }
}


		var da = (document.all) ? 1 : 0;
		var pr = (window.print) ? 1 : 0;
		var mac = (navigator.userAgent.indexOf("Mac") != -1); 
		
		function printPage() {
		  if (pr) // NS4, IE5
		    window.print()
		  else if (da && !mac) // IE4 (Windows)
		    vbPrintPage()
		  else // other browsers
		    alert("Sorry, your browser doesn't support this feature.");
		  return false;
		}
		
		if (da && !pr && !mac) with (document) {
		  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
		  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
		  writeln('Sub window_onunload');
		  writeln('  On Error Resume Next');
		  writeln('  Set WB = nothing');
		  writeln('End Sub');
		  writeln('Sub vbPrintPage');
		  writeln('  OLECMDID_PRINT = 6');
		  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
		  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
		  writeln('  On Error Resume Next');
		  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
		  writeln('End Sub');
		  writeln('<' + '/SCRIPT>');
		}
		
/*Show hide TAB*/
function findElementById( elementId )
{
	var theElement = null;
	try
	{
		if( document.getElementById )
			theElement = document.getElementById( elementId );
		else
			theElement = document.all[ elementId ];
	}
	catch( e )
	{
		theElement = null;
	}
	return theElement;
}


function showTab(id)
{
	findElementById("ctn_" + id).style.display = "block";
	findElementById("tab_" + id).src = getBaseUri() + "campari_en/images/tab_" + id + "_on.gif";
	
	findElementById("tab_" + id).blur();
	
}

function hideTab(id)
{
	findElementById("ctn_" + id).style.display = "none";
	findElementById("tab_" + id).src = getBaseUri() + "campari_en/images/tab_" + id + "_off.gif";
	
}

/* Menu sx show/hide */
function hideMenuOverlay(){
	var area = findElementById ( "menu_area" );
	area.style.display = "none";
	var box = findElementById( "menu_box" );
	box.style.left = (0-252) + "px";
	box.style.visibility = "hidden";
}

function toggle_menu(id) {

	var area = findElementById ( "menu_area" );
	if (area.style.visibility == "visible") {
		slide_menu( id, 1 );
	} else {
		slide_menu( id, 0 );
	}

}

var precHeight = null;
function slide_menu( id, menu_dir ){
	var area = findElementById ( "menu_area" );
	var box = findElementById( id );
	var mainbox = findElementById( "main" );
	var menu_header = findElementById( "menu_header" );
	var menu_body = findElementById( "menu_body" );
	var menu_footer = findElementById( "menu_footer" );
	if(menu_dir == 0){
		area.style.display = "block";
		box.style.visibility = "visible";
		area.style.visibility = "visible";
	}
	if(precHeight==null){
		precHeight = mainbox.offsetHeight;
		if(box.offsetHeight <= mainbox.offsetHeight){
			area.style.height = (mainbox.offsetHeight+9) + "px";
			menu_body.style.height = (area.offsetHeight-(menu_header.offsetHeight+menu_footer.offsetHeight)) + "px";
		}else{
			area.style.height = (box.offsetHeight) + "px"
			mainbox.style.height = (area.offsetHeight-9) + "px";
		}
	}
		
	left = parseInt( box.offsetLeft, 10 );

	if(menu_dir==0 && left < 0){
		if( (left+10) < 0 )
		{
			left = left + 10;
			currentActionTimeOutId = setTimeout("slide_menu('" + id  + "', 0 )", 10);
		}
		else
		{
			left = 0;
			var imgMenuClick = findElementById( "img_menu_click" );
			var linkMenuClick = findElementById( "menu_click" );
			imgMenuClick.src = getBaseUri() + "campari_en/images/ico_arrow_bar_open.gif";
			linkMenuClick.slideid = id;
			linkMenuClick.onclick = function (){ slide_menu( this.slideid , 1 ); }
			clearTimeout( currentActionTimeOutId );
			currentActionTimeOutId = null;
		}
		box.style.left = left + "px";
		
	}else if((menu_dir==1) && (left <= 0)){
		
		if( (left-10) > (0-212) ){
			left = left - 10;
			currentActionTimeOutId = setTimeout("slide_menu('" + id  + "', 1 )", 10);
		}else{
			left = (0-212);
			var imgMenuClick = findElementById( "img_menu_click" );
			var linkMenuClick = findElementById( "menu_click" );
			imgMenuClick.src = getBaseUri() + "campari_en/images/ico_arrow_bar_close.gif";
			linkMenuClick.slideid = id;
			linkMenuClick.onclick = function (){ slide_menu( this.slideid , 0 ); }
			clearTimeout( currentActionTimeOutId );
			currentActionTimeOutId = null;
			mainbox.style.height = precHeight + "px";
			precHeight = null;
			box.style.visibility = "hidden";
			area.style.display = "none";
		}
		box.style.left = left + "px";
	}
}