var $path = new Array();
function init() {
	MM_preloadImages('assets/tabs-oil-hover.gif','assets/tabs-natural_gas-hover.gif','assets/tabs-production_quality-hov.gif','assets/tabs-refining_industry-hove.gif','assets/tabs-eni_it-hover.gif');
	
	var $href = window.location.href;
	$path = $href.substring($href.lastIndexOf('/') + 1, $href.lastIndexOf('.')).split('-');
}

function follow($ptag, $ppathindex, $ppathvalue) {
	if (arguments.length == 2) {
		$pathindex = arguments[0];
		$pathvalue = arguments[1];
	} else {
		$pathindex = arguments[1];
		$pathvalue = arguments[2];
	}
	$path[$pathindex] = $pathvalue;
	$tmp = new Array();
	for ($i = 0; $i <= $pathindex; $i++) $tmp[$i] = $path[$i];
	$path = $tmp;
	window.location.href = $path.join('-') + '.htm';
}

//windows.js

function _openWindow(pURL, pName, pFeatures) {
	//window.open(pURL, pName, pFeatures).focus();
	window.open(pURL, pName, pFeatures);
}
function _preventCaching() {
	var d = new Date();
	var s = d.getFullYear().toString();
	s += d.getMonth().toString();
	s += d.getDate().toString();
	s += d.getHours().toString();
	s += d.getMinutes().toString();
	s += d.getSeconds().toString();
	return s;
}
function _align(pWidth) {
	return (window.screen) ? Math.round((screen.availWidth - pWidth) / 2) : 0;
}
function _valign(pHeight) {
	return (window.screen) ? Math.round((screen.availHeight - pHeight) / 2) : 0;
}
function mPopup(pURL, pWidth, pHeight) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, _preventCaching(), features);
}
function mGhostPopup(pURL) {
	var w = 300;
	var h = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + w + ',';
	features += 'innerWidth=' + w + ',';
	features += 'height=' + h + ',';
	features += 'innerHeight=' + h + ',';
	
	var x = 4000;
	var y = 4000;
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, _preventCaching(), features);
}
function mPopupEx(pURL, pName, pWidth, pHeight) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupEx2(pURL, pName, pWidth, pHeight, pScrollBars) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += (pScrollBars) ? 'scrollbars=yes,' : 'scrollbars=no';
	features += 'resizable=no,';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupEx3(pURL, pName, pWidth, pHeight, pResizable) {
	if (pWidth == 100) pWidth = 300;
	if (pHeight == 100) pHeight = 300;
	var features = 'fullscreen=no,';
	features += 'channelmode=no,';
	features += 'toolbar=no,';
	features += 'location=no,';
	features += 'directories=no,';
	features += 'status=no,';
	features += 'menubar=no,';
	features += 'scrollbars=yes,';
	features += (pResizable) ? 'resizable=yes,' : 'resizable=no';
	features += 'width=' + pWidth + ',';
	features += 'innerWidth=' + pWidth + ',';
	features += 'height=' + pHeight + ',';
	features += 'innerHeight=' + pHeight + ',';
	
	var x = _align(pWidth);
	var y = _valign(pHeight);
	
	features += 'top=' + y + ',';
	features += 'screenY=' + y + ',';
	features += 'left=' + x + ',';
	features += 'screenX=' + x;
	
	_openWindow(pURL, pName, features);
}

function mPopupClose() {
	window.top.close();
}

function mResize(pWindow, pWidth, pHeight) {
	var w = pWidth + 10;
	var h = pHeight + 29;
	if (navigator.userAgent.indexOf('SV1') != -1) h += 20;
	pWindow.resizeTo(w, h);
	pWindow.moveTo(_align(w), _valign(h));
}

// MM

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}