function ShowContent(divId,ajaxIndex,url) {
	document.getElementById(divId).innerHTML = AjaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	AjaxObjects[ajaxIndex].response;
	}
	AjaxObjects[ajaxIndex] = false;
}

function Ajax(divId,url) {
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}	
	var ajaxIndex = AjaxObjects.length;
	document.getElementById(divId).innerHTML = '<img id="imagewait" src="/elementi/img/movewait.gif" alt="" />';
	AjaxObjects[ajaxIndex] = new sack();
	AjaxObjects[ajaxIndex].requestFile = url;
	AjaxObjects[ajaxIndex].onCompletion = function(){ ShowContent(divId,ajaxIndex,url); };
	AjaxObjects[ajaxIndex].runAJAX();
}

function getObjX(name) {
	if (document.getElementById) { this.obj = document.getElementById(name); this.style = document.getElementById(name).style; }
	else if (document.all) { this.obj = document.all[name]; this.style = document.all[name].style; }
	else if (document.layers) { this.obj = document.layers[name]; this.style = document.layers[name]; }
}

function OpenNewPage( pPageName ) { var pntrNewWindow = window.open(pPageName,'',''); }

function ShowPhoto(pPhotoName, pPhotoWidth, pPhotoHeight) {
	var iWindowXOffset = (window.screen.width - pPhotoWidth) / 2
	var iWindowYOffset = (window.screen.height - pPhotoHeight) / 2;
	if(navigator.appName.indexOf("Konqueror")!=-1) { iWindowXOffset += 18; iWindowYOffset += 96; }
	if(navigator.appName.indexOf("Netscape")!=-1) { if(Math.round(parseFloat(navigator.appVersion) * 1000)>=5000) { if(navigator.appVersion.indexOf("Mac")!=-1) { iWindowYOffset += 5; } } }
	if(navigator.appName.indexOf("Microsoft")!=-1) { if(navigator.appVersion.indexOf("Mac")!=-1) { iWindowXOffset -= 11; iWindowYOffset -= 11; } }
	var pntrWindow = window.open('','','width='+pPhotoWidth+',height='+pPhotoHeight+',top='+iWindowYOffset+',left='+iWindowXOffset+',screenX='+iWindowXOffset+',screenY='+iWindowYOffset+',location=0,directories=0,status=no,menuBar=no,scrollBars=no,resizable=no');
	pntrWindow.document.open()
	pntrWindow.document.write( "<html><head><title>Photo</title></head><body style='margin: 0px; padding: 0px; overflow: hidden;' onblur='self.close()' onmousedown='self.close()'><img src='"+pPhotoName+"'></body></html>" )
	pntrWindow.document.close()
	pntrWindow.focus();
}

function setimagefilter( pContainer ) {
	imageProductObj = document.getElementById(pContainer);
	if(imageProductObj){
		var productImages = imageProductObj.getElementsByTagName('IMG');
		for(var no=0;no<productImages.length;no++){
			if(productImages[no].id != 'attuale'){
				productImages[no].onmouseover = function(){ImageAlpha(this, 'e');};
				productImages[no].onmouseout = function(){ImageAlpha(this, 's');};
			}
		}
	}
}
function ImageAlpha(pImg, pAct) {
	if( pAct == "s" ) {
		pImg.style.filter = 'alpha(opacity=0)';
		pImg.style.opacity = 0;
	}else{
		pImg.style.filter = 'alpha(opacity=50)';
		pImg.style.opacity = 0.5;
	}
}

function setlinkblank() {
	linkObj = document.getElementById('container');
	if(linkObj){
		var linkLinkObj = linkObj.getElementsByTagName('A');
		for(var no=0;no<linkLinkObj.length;no++){
			if (linkLinkObj[no].hostname!="www.cogne.org"){
				var tempHref = linkLinkObj[no].href.toLowerCase();
				if (tempHref.indexOf('javascript')==-1 && tempHref.indexOf('mailto')==-1){
					linkLinkObj[no].target = '_blank';
				}
			}
		}
		//document.getElementById('inner').style.borderBottomColor='transparent';
	}
	linkObj = document.getElementById('w3c');
	if(linkObj){
		var linkLinkObj = linkObj.getElementsByTagName('A');
		for(var no=0;no<linkLinkObj.length;no++){
			linkLinkObj[no].target = '_blank';
		}
	}
}
