var inter;
function inizialize(){
	moveTriangle();
	for(var e=0;e<lFoto.length;e++){
  		if(document.all)
  			var f=document.all["contFoto"+e];
  		else
			var f=document.getElementById("contFoto"+e);
		f.style.display="none";
	}

	if(document.all){
  		var d=parent.document.all.contRight;
  		var d1=document.all.contGallery_1;
  		d.style.height=d1.offsetHeight+"px";
  	}
  	else{
  		var d=document.getElementById("contRight");
  		var d1=document.getElementById("contGallery_1");
		d.style.height=d1.offsetHeight+"px";
  	}
}

function moveTriangle(){
	if(numL){
/*		if(document.all){
			var t=document.all.puntCat;
			var c=document.all["l"+numL];
		}
		else{*/
			var t=document.getElementById("puntCat");
			var c=document.getElementById("l"+numL);
		//}
		t.style.left=c.offsetLeft+"px";
	}
}

function apriPopUp(inValue,inTipo,inCod){
  switch(inValue){
  case 'contatti':
		if(inTipo!='')
  		str='?tipo='+inTipo+'&l='+inCod;
		else
			str='';
  	var r=window.open('contatti.php'+str,'contatti','width=400,height=300');
  	r.focus();
	break;
	case 'credits':
  	if(inTipo!='')
  		str='?tipo='+inTipo+'&l='+inCod;
		else
			str='';
    var r=window.open('credits.php'+str,'credits','width=400,height=200');
    r.focus();
	break;
	case 'info':
    var r=window.open('info.php#'+inTipo,'credits','width=400,height=250,scrollbars=yes');
    r.focus();
	break;
	case 'privacy':
		if(inTipo!='')
  		str='?tipo='+inTipo+'&l='+inCod;
		else
			str='';
    var r=window.open('privacy.php'+str,'privacy','width=400,height=350,scrollbars=no');
    r.focus();
	break;
	case 'richiedi':
  	var r=window.open('richiedi.php','richiedi','width=400,height=350,scrollbars=no');
    r.focus();
	break;
  }
	return false;
}

function ordina(inValue,inValue1){
	var p=window.open('ordina_foto.php?f='+inValue+'&fid='+inValue1,'ordina','width=550,height=450,scrollbars');
	p.focus();
  return false;
}

function vota(inValue,inValue1,inValue2){
	var p=window.open('vota_foto.php?f='+inValue+'&tipo='+inValue1+'&fid='+inValue2,'vota','width=550,height=450,scrollbars');
	p.focus();
  return false;
}

function download(inValue,inValue1,inValue2){
	var p=window.open('download_foto.php?f='+inValue+'&eid='+inValue1+'&fid='+inValue2,'download','width=550,height=450,scrollbars');
	p.focus();
  return false;
}

function apriComing(inHome,inId){
  var p=window.open('coming_soon.php?tipo='+inHome+'&id='+inId,'coming','width=450,height=300,scrollbars');
	p.focus();
  return false;
}

function ascoltaAudio(inAudio){
  var p=window.open('ascolta_audio.php?file='+inAudio,'audio','width=200,height=80');
	p.focus();
  return false;
}

function guardaVideo(inVideo){
  var p=window.open('video.php?file='+inVideo,'video','width=400,height=400');
	p.focus();
  return false;
}

/**
 *
 * @access public
 * @return void
 **/
function viewS(inValue,inValue1){
	if(document.all){
		var a=document.all["dis"+inValue];
		var b=document.all[inValue1];
		for(var c=0;c<=10;c++){
			var tmp=document.all["dis"+c];
			if(tmp)
				tmp.style.display="none"
		}
	}
	else{
		var a=document.getElementById("dis"+inValue);
		var b=document.getElementById(inValue1);
		for(var c=0;c<=5;c++){
			var tmp=document.getElementById("dis"+c);
			if(tmp)
				tmp.style.display="none"
		}
	}
	if(a){
		if(document.all){
			a.style.left=(b.offsetParent.offsetLeft)+"px";
			a.style.display="block";
		}
		else{
			a.style.left=b.offsetLeft+"px";
			a.style.display="block";
		}
	}
	clearInterval(inter);
}
function viewSU(inValue){
	clearInterval(inter);
	if(document.all){
		var a=document.all["dis"+inValue];
	}
	else{
		var a=document.getElementById("dis"+inValue);
	}
	if(a)
		a.style.display="block";
}

function hiS(inValue,inNum){
	if(inNum!=0)
		inNum=1000;
	inter=setInterval("hideSub("+inValue+")",inNum);
}

function hideSub(inValue){
	if(document.all){
		var a=document.all["dis"+inValue];
	}
	else{
		var a=document.getElementById("dis"+inValue);
	}
	clearInterval(inter);
	if(a)
		a.style.display="none";

}

function openCD(inType,inNum){
	var p=window.open('add_cd.php?type='+inType+'&cid='+inNum,'CC','width=500,height=450,scrollbars');
	p.focus();
  return false;
}


function opFG(op,num){
	if(document.all)
		var f=document.all["contFoto"+num];
	else
		var f=document.getElementById("contFoto"+num);
	if(op=='o')
		f.style.display="block";
	else if(op=='c')
		f.style.display="none";

	if(document.all){
  		var d=parent.document.all.contRight;
  		var d1=document.all.contGallery_1;
  		d.style.height=d1.offsetHeight+"px";
  	}
  	else{
  		var d=document.getElementById("contRight");
  		var d1=document.getElementById("contGallery_1");
  		d.style.height=d1.offsetHeight+"px";
  	}

	return false;
}

function setImgP(){
	if(document.all){
		var myDiv=document.all.big_img;
		var myFrame=document.all.contRight;
		var myPre=document.all.img_preload;
	}
	else{
		var myDiv=document.getElementById("big_img");
		var myFrame=document.getElementById("contRight");
		var myPre=document.getElementById("img_preload");
	}


    if(document.all){
    	var x=myFrame.offsetLeft-myPre.width-210;
    	//var y=document.body.scrollTop+myFrame.offsetTop
    	var y=document.body.scrollTop+222;
    }
    else{
    	var x=myFrame.offsetLeft-myPre.width-210;
		var y=myFrame.offsetTop+top.scrollY-50;
	}

    myDiv.style.width=myPre.width+90+"px";
	myDiv.style.height=myPre.height+90+"px";
	/*myDiv.style.width=10+"px";
	myDiv.style.height=10+"px";*/
	myDiv.style.border="";

    myDiv.style.left=x+"px";
    myDiv.style.top=y+"px";

    myDiv.style.display="block";


}

function setImgB(){
	if(document.all){
		var myDiv=document.all.big_img;
		var myFrame=document.all.contRight;
		var myImg=document.all.imgBig;
	}
	else{
		var myDiv=document.getElementById("big_img");
		var myFrame=document.getElementById("contRight");
		var myImg=document.getElementById("imgBig");
	}

	myImg.style.display="block";
    if(document.all){
    	var x=myFrame.offsetLeft-myImg.width;
		var y=document.body.scrollTop+222;
	}
    else{
    	var x=myFrame.offsetLeft-myImg.width;
    	var y=myFrame.offsetTop+top.scrollY;
    }

	myDiv.style.width=myImg.width+"px";
	myDiv.style.height=myImg.height+"px";
	myDiv.style.border="5px solid #FFFFFF";

    myDiv.style.left=x+"px";
    myDiv.style.top=y+"px";

    myDiv.style.display="block";



}

function view_big_img(inImg){
	if(document.all){
		var myDiv=document.all.big_img;
		var myFrame=document.all.clFoto;
		var myPreD=document.all.div_preload;
	}
	else{
		var myDiv=document.getElementById("big_img");
		var myFrame=document.getElementById("clFoto");
		var myPreD=document.getElementById("div_preload");
	}

	myPreD.style.display="block";
	myDiv.style.display="block";

	var myImg=document.createElement("img");
	myImg.onload=function(){
		if(document.all)
			var myPreD=document.all.div_preload;
		else
			var myPreD=document.getElementById("div_preload");
		myPreD.style.display="none";
		setImgB();
	}
	myImg.setAttribute("id","imgBig");
	myImg.src="resizeImage.php?file="+inImg+"&tipo=view_big";
	myImg.style.display="none";

	myDiv.appendChild(myImg);

	setImgP();

	return false;
}

function hide_big_img(){
	if(document.all){
		var myDiv=document.all.big_img;
		var myPreD=document.all.div_preload;
		var myImg=document.all.imgBig;
	}
	else{
		var myDiv=document.getElementById("big_img");
		var myPreD=document.getElementById("div_preload");
		var myImg=document.getElementById("imgBig");
	}

	myImg.onload="";
	myDiv.removeChild(myImg);
	myDiv.style.display="none";
	return false;
}