// QUESTA FUNZIONE SERVE PER NON FARE RICARICARE LE IMMAGINI IN CACHE A IE6
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
//

var win=null;

function OpenNewWindow(mypage,myname,w,h,scroll,pos)
{
    if(pos=="random")
    {
        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
        TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
    }
    if(pos=="center")
    {
        LeftPosition=(screen.width)?(screen.width-w)/2:100;
        TopPosition=(screen.height)?(screen.height-h)/2:100;
    }
    else if((pos!="center" && pos!="random") || pos==null)
    {
        LeftPosition=0;
        TopPosition=20
    }

    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

    win=window.open(mypage,myname,settings);

    if(win.focus)
    {
        win.focus();
    }
}

function insertIdeaFormSubmit(){
	window.location='#';
	showLoadingDiv('loading',true);
	document.forms.postIdea.submit();
}

function registrationFormSubmit(){
	window.location='#';
	showLoadingDiv('loading',true);
	document.forms.regUser.submit();
}

// FORUM
var lastThread = '';
function addThread(idThread,valore){
	if (lastThread!="" && valore == 'view' ){
		thread_add = 'thread_add_' + lastThread;
		thread_post = 'thread_post_' + lastThread;
		document.getElementById(thread_add).style.display = '';
		document.getElementById(thread_post).style.display = 'none';
	}
	lastThread = idThread;
	thread_add = 'thread_add_' + lastThread;
	thread_post = 'thread_post_' + lastThread;
	if (valore == 'view') {
		document.getElementById(thread_add).style.display = 'none';
		document.getElementById(thread_post).style.display = '';
	}
	else {
		document.getElementById(thread_add).style.display = '';
		document.getElementById(thread_post).style.display = 'none';
	}
}
function validateform(idThread){
	titolo = "titolo_" + idThread;
	testo = "testo_" + idThread;
	argomento = "argomento_" + idThread;
	if(document.getElementById(titolo).value == '' || document.getElementById(testo).value == ''){
		alert('Inserire TITOLO e TESTO');
	}else{
		document.forms[argomento].submit();
	}
}
// FORUM



function showLoadingDiv(id, show){
	div = document.getElementById(id);
	if (show){

		/*div_height = parseInt(div.style.height);
		div_width = parseInt(div.style.width);
		
        var IpopTop = (document.body.clientHeight /2)-(div_height/2);
        var IpopLeft = (document.body.clientWidth/2)-(div_width/2);
        
        div.style.left = IpopLeft + document.body.scrollLeft + "px";
        div.style.top = IpopTop + document.body.scrollTop + "px";*/			
        
        div.style.display = "block";
	
	}else{
		div.style.display = "none";		
	}
}
