function updateFotoField(value,size) {
	if(typeof(minsize) != "undefined" && typeof(maxsize) != "undefined"){  
		if (size>minsize && size<=maxsize) {
			var colspan=dijit.byId("colspan");
			if (colspan) {
				colspan.setValue(2);
			}
		}
	} 
	var fld=dojo.byId('burl');
	fld.value=value;
	var form = dijit.byId("myForm");
	var subB = dojo.byId("subButton");
	subB.setAttribute("disabled",!form.isValid());
	
	var cont=dijit.byId("myTabContainer");
	var pane=dijit.byId("datiPane");
	cont.selectChild(pane);
	cont = dojo.byId("imgTab");
	cont.innerHTML="<img src='"+value+"' />";
	fld.focus();
}

function popunico(str,h,v) { 
//! Il comando scrollbars indica se vi desiderano o meno le barre di scorrimento
//! Il comando resizable determina se la finestra puņ essere ridimensionata trascinandola oppure no
//! width e height determina rispettivamente la larghezza e l'altezza della finestra popup in pixels
//! top e left determinano il posizionamento del popup in pixels rispettivamente dall'alto e dal lato sinistro dello monitor
//! Il comando status determina se si desidera o meno che sia presente la barra di stato
//! Il comando location determina se deve apparire o meno la barra degli indirizzi
//! Il comando toolbar determina se deve apparire o meno la barra dei comandi
nomevar = window.open(str,'paginafissa','scrollbars=no,resizable=yes,width='+h+',height='+v+',top=10,left=10,status=no,location=no,toolbar=no'); 
nomevar.focus(); 

} 

function linksubmit(where,tipo,album,fotonum,maxnum)
{
	if (where=='sw')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.album.value=album;
		document.gotoform.fotonum.value=fotonum;
		document.gotoform.maxnum.value=maxnum;
		document.gotoform.action='showfoto.php';
	}
	if (where=='th')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.album.value=album;
		document.gotoform.fotonum.value=fotonum;
		document.gotoform.action='showthumb.php';
	}
	if (where=='ct')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.album.value=album;
		document.gotoform.fotonum.value=fotonum;
		document.gotoform.action='showcont.php';
	}	
	if (where=='ft')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.action='foto.php';
	}
	if (where=='fc')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.action='contrib.php';
	}
	if (where=='fr')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.action='fotostory.php';
	}	
	if (where=='si')
	{
		document.gotoform.tipo.value=tipo;
		document.gotoform.action='amiche.php';
	}
	document.gotoform.submit();
}
function SetMainDivSize(full)
{
	var winW = 630, winH = 460, x,y,l;

	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName=="Netscape") 
 		{
  			winW = window.innerWidth;
  			winH = window.innerHeight;
 		}
 		if (navigator.appName.indexOf("Microsoft")!=-1) 
 		{
  			winW = document.body.offsetWidth;
  			winH = document.body.offsetHeight;
 		}
	}
//	document.write( "Window width = "+winW+"<br>"+"Window height = "+winH);

	y=650;
//	if (y<600)
//		y=600;	
	l=winW-405;
	if (l<750)
		l=750;
	if (full==1)
		y='100%'
	else
		y+='px';
//	document.write('-H='+winH+'-W='+winW+'<BR>');
	document.write(	'<style type="text/css">');
	document.write( '#menu {width: 100%;  }');
	document.write( '#corpo { width: '+l+'px; }');

	document.write( '#dx {  left:'+(l+200)+'px; }');
	document.write( '#corpolarge { width: '+(winW-25)+'px; }');
	document.write( '#corpolargedx { width: '+(winW-225)+'px; }');
	document.write( '#corpolargesx { width: '+(winW-225)+'px; }');
	document.write( '</style>');
}

function GetParamsAndSave()
{
	window.NoTestMouse=true;
	GetParams();
}

function GetParams()
{
//	alert(window.NoTestMouse);
	if (window.NoTestMouse==null)
		window.NoTestMouse=false;
//	alert(window.NoTestMouse);
		
	
	_nodnmsg="Non fare il furbetto, queste immagini non si possono scaricare!!!";
	if (!window.NoTestMouse)
	{
		if (document.layers) 
		{
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown=disableNS;
		} 
		else 
		{
			document.onmouseup=disableNS;
			document.oncontextmenu=disableIE;
		}
		document.oncontextmenu=new Function("alert(_nodnmsg);return false")
	}
	useparent=0;
	if (useparent==1)
		_l=parent.document.location.toString().split("?");
	else
		_l=document.location.toString().split("?");
 	
	_param ="";
	if(_l[1])
	{
 		_param = _l[1].split("&"); /* now _param is an array of all parameters */
	}
}

function disableIE() 
{
	if (document.all) 
	{
		alert(_nodnmsg);
		return false;
	}
}

function disableNS(e) 
{
	if (document.layers||(document.getElementById&&!document.all)) 
	{
    		if (e.which==2||e.which==3) 
		{
			alert(_nodnmsg);
			return false;
		}
  	}
}

function Email()
{
        document.write('<div align=\"center\"><a href=\"mailto:'+_email+'\"><img src=\"img/email.gif\" width=\"90\" height=\"66\" border=\"0\"></a></div>');
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
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];}
}


function validateEmail(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

function validateUrl(s) {
	var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
    return regexp.test(s);
}
	  
function showdialogParam(url,titolo,w,h) {
	if (currentDialog!=null) {
		currentDialog.destroy();
	}
	var cont="<iframe scrolling='no' frameborder='no' style='width: "+(w-30)+"px; height: "+(h-50)+"px;'  src='"+url+"'></iframe>"
	var st="width: "+w+"px; height: "+h+"px;";
  	currentDialog = new dijit.Dialog({title:titolo,content:cont,style:st,id:"dataDialog"});
  	currentDialog.show()
}

function showdialog(url,titolo) {
	showdialogParam(url,titolo,1100,600);
}
function dialogClose(act,idx)
  {
  parent.currentDialog.hide();
  if (act!="")
    {
    parent.perform('backControl',act,idx);
    }
  }
  


function selImageTab() {
	var cont=dijit.byId("myTabContainer");
	var pane=dijit.byId("fotoPane");
	cont.selectChild(pane);
}
function perform(name,act,idx)
  {
  if (name=="backControl")
    {
    document.datainput.act.value=act;
    document.datainput.idx.value=idx;
    document.datainput.submit();
    }
  else
    {
//		var node =  dijit.byId("datainput");
	var node=dojo.byId("datainput");
	if (node.isValid())
      {
      document.datainput.act.value=act;
      document.datainput.idx.value=idx;
      document.datainput.submit();
      }
    else
      {
      alert("Controllare i valori scorretti evidenziati.");
      }
    }
  }
