var w=screen.availWidth; var h=screen.availHeight

function popup(indirizzo,nome,larghezza,altezza) 
{
	if(indirizzo.indexOf('www.armes.it') == -1)
	{
		indirizzo = "http://www.armes.it/"+ indirizzo;
		
	} 	
	window.open(indirizzo,nome,"location=no,status=yes,resizable=no,width="+larghezza+",height="+altezza+",top="+(h-altezza)/2+",left="+(w-larghezza)/2);
}

var wF=(window.screen.width - 10); var hF=(window.screen.height - 40)
function aprifull(theURL,winName,altro) {
  window.open(theURL,winName, "width="+wF+",height="+hF+",top=0,left=0,toolbar=yes");
}

var old = '';
function SwitchMenu(obj){
	if(old!='' && old!=document.getElementById(obj)){
		old.style.display = "none";
	}
	if(document.getElementById){
	var el = document.getElementById(obj);
		if(el.style.display != "block"){
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
	old = el;
	InitialiseScrollableArea()
}
function calcolo(obj){
	if(document.getElementById){
	var el = document.getElementById('divPupUp');
		if(el.style.display != "block"){
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
	if(document.getElementById){
	var el = document.getElementById('bdivPupUp');
		if(el.style.display != "block"){
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}
function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion ;
    this.dom=document.getElementById?1:0 ;
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) ;
    return this ;
} 
bw=new verifyCompatibleBrowser() ;
 
 
var speed=50 ;
 
var loop, timer ;
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' ;
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight ;
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight ;
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object" ;
    eval(this.obj + "=this") ;
    return this ;
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y ;
    this.css.left=this.x ;
    this.css.top=this.y ;
} 
 
function MoveAreaDown(move){ 
    if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
    this.MoveArea(0,this.y-move) ;
    if(loop) setTimeout(this.obj+".down("+move+")",speed) ;
    }
} 
function MoveAreaUp(move){ 
    if(this.y<0){ 
    this.MoveArea(0,this.y-move) ;
    if(loop) setTimeout(this.obj+".up("+move+")",speed) ;
    } 
} 
 
function PerformScroll(speed){ 
    if(initialised){ 
        loop=true; 
        if(speed>0) objScroller.down(speed) ;
        else objScroller.up(speed) ;
    } 
} 
 
function CeaseScroll(){ 
    loop=false ;
    if(timer) clearTimeout(timer) ;
} 
var initialised; 
function InitialiseScrollableArea(){ 
    objContainer=new ConstructObject('divContainer') ;
    objScroller=new ConstructObject('divContent','divContainer') ;
    objScroller.MoveArea(0,0) ;
    objContainer.css.visibility='visible' ;
    initialised=true; 
}
function InitialiseScrollableAreaPopUp(){ 
    objContainer=new ConstructObject('divContainerPopUp') ;
    objScroller=new ConstructObject('divContentPopUp','divContainerPopUp') ;
    objScroller.MoveArea(0,0) ;
    objContainer.css.visibility='visible' ;
    initialised=true; 
}  
function InitialiseScrollableAreaPopUpNew(obj1,obj2){ 
    objContainer=new ConstructObject(obj1) ;
    objScroller=new ConstructObject(obj2,obj1) ;
    objScroller.MoveArea(0,0) ;
    objContainer.css.visibility='visible' ;
    initialised=true; 
} 

function openpopupprod(cat,lang){
popup('popup_prod.php?lang='+ lang+'&cat=' + cat,'','730','494');
}


function openpopupintro(lang){
popup('popup_introautomatici.php?lang='+ lang,'','730','494');
}

function openpopupprodid(prd_id,lang){
popup('popup_prod.php?lang='+ lang+'&prd_id=' + prd_id,'','730','494');
}

function openpopgalleryref(tiporef,prd_id,cbx_Settore ,cbx_tipologia  ,cbx_unita ,cbx_geo_est  ,cbx_geo_it,lang  ){
popup('popup_galleria.php?lang='+ lang+'&t=r&tr='+tiporef+'&ref_prd_id='+prd_id+'&cbx_Settore='+cbx_Settore+'&cbx_tipologia='+cbx_tipologia+'&cbx_unita='+cbx_unita+'&cbx_geo_est='+cbx_geo_est+'&cbx_geo_it=' + cbx_geo_it,'','730','494');
}

function openpopgalleryrefnew(cli_ima , tipo_settore ,k,lang   ){
k--;
popup('popup_galleria_ref.php?lang='+ lang+'&t=r&tr=imma&cli_ima='+cli_ima+'&tipo_settore='+tipo_settore+'&k='+k,'','730','494');
}

function openpopupnews(nw_id,lang){
popup('popup_news.php?nw_id=' + nw_id +'&lang='+ lang,'','730','494');
}

function confirmdelete(obj,urlo,lang_n){
strQeust=new Array(4);
strQeust[0]="Confermi l'eliminazione di ";
strQeust[1]="de-Confermi l'eliminazione di ";
strQeust[2]="fr-Confermi l'eliminazione di ";
strQeust[3]="en-Confermi l'eliminazione di ";
if (confirm(strQeust[lang_n]+obj+"?") ){
alert(urlo);
window.location=urlo;
}
}

function showHideDel(id,status){
if (status=='showdel'){
document.getElementById("deldiv"+id).style.display="block";
document.getElementById("elediv"+id).style.display="none";
}
else{
document.getElementById("deldiv"+id).style.display="none";
document.getElementById("elediv"+id).style.display="block";
}
}
