﻿function createHidden(namesValues){
    if (document.createElement){
		var theForm = document.forms[0];
		var arr = namesValues.split(',');
		for(i=0;i<arr.length;i++){
			var tokens=arr[i].split("=");
			var obj=document.getElementById(tokens[0]);
			if (obj){
				obj.value='';
				obj.value=tokens[0];
			}else{
				var newField = document.createElement("input");
				newField.type = "hidden";
				newField.name = tokens[0];
				newField.id = tokens[0];
				newField.value = tokens[1];
				theForm.appendChild(newField);
			}
		}
	}
}
function openSWF(context,swfName){
    window.open (context+"filmati/flash.aspx?video="+swfName,"mywindow","location=1,status=1,scrollbars=1,width=800,height=600"); 
}
function getXY(){
var winl = (screen.width-1200)/2;
var wint = (screen.height-1200)/2;
return new Array(wint,winl)
}
function callSrv(id){
    var imgLoading = document.getElementById('loading'); 
    if (imgLoading) imgLoading.style.display='block';
    var pos = getXY();
    var divResult = document.getElementById('divAccessori'); //riferimento al div contenitore
    divResult.style.top = pos[0] + "px";
    divResult.style.left = pos[1] + "px";
    divResult.style.display = "block";        
    callServer(id,'')
}
function getResult(arg,context) {
    var imgLoading = document.getElementById('loading'); 
    if (imgLoading) imgLoading.style.display='none';
    var divResult = document.getElementById('divAccessori'); //riferimento al div che conterrà i risultati
    var mainDiv = document.getElementById('mainContenitore'); //riferimento al div che conterrà i risultati
    var content = unescape(arg);
    mainDiv.innerHTML = content;
    divResult.style.display = 'block';
    mainDiv.style.display = 'block';    
}
function closeDivAccessori(){
    document.getElementById('mainContenitore').innerHTML = '';
    document.getElementById('mainContenitore').style.display='none';
    document.getElementById('divAccessori').style.display='none';
}
var idTimeout,idSpan,testo;
function showRata(idSpan_,testo_){
    idSpan=idSpan_;
    testo=testo_;
    var sp = document.getElementById(idSpan)
    sp.style.display='block';
    sp.innerHTML='wait...';
    idTimeout=window.setTimeout('_showRata()',1000);
}
function _showRata(){
    var sp = document.getElementById(idSpan);
    sp.innerHTML = testo;
    window.clearTimeout(idTimeout);
}
