﻿<!--
var WindowTemp;
function popup_open(popupfile, popupname, popupwidth, popupheight, resize, status, scroll, tool, menu)
{
	//titlebar=0;
	var winleft = (screen.width - popupwidth) / 2;
	var wintop = (screen.height - popupheight) / 2;
	var params = "width=" + popupwidth + ",height=" + popupheight + ",top=" + wintop + ",left=" + winleft + ",resizable=" + resize + ",status=" + status + ",scrollbars=" + scroll + ",toolbar=" + tool + ",location=0,directories=0,menubar=" + menu + "";
	if((navigator.appName.indexOf("Explorer")!=-1)&&(parseInt(navigator.appVersion.substring(0,1))<4))
	{
		newwin = window.open(popupfile,popupname,params);
	}
	else
	{
		if(WindowTemp)
		{
			if(!WindowTemp.closed)
			{
				WindowTemp.close();
				WindowTemp="";
			}
		}

		newwin = window.open(popupfile,popupname,params);
		WindowTemp = newwin;
		WindowTemp.name = "WindowTemp";
		newwin="";
	}
}

function TransformEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			for (j = 0; j < document.forms[0].length; j++)
			{
				if (document.forms[0].elements[j].name == myObj.name)
				{
					document.forms[0].elements[j+1].focus();
					break;
				}
			}
			return false;
		}
	}
}

function BlockEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			return false;
		}
	}
}

function showWellDiv(idDiv, howMany)
{
	
	for (i = 0; i < howMany; i++)
	{
		document.getElementById('div' + i).style.display =  "none";
		document.getElementById('arrow' + i).style.display = "none";
	}
	
	document.getElementById('def').style.display = "none";
	
	document.getElementById('div' + idDiv).style.display = "block";
	document.getElementById('arrow' + idDiv).style.display = "block";
}

function hideWellDiv(howMany)
{
	
	for (i = 0; i < howMany; i++)
	{
		document.getElementById('div' + i).style.display =  "none";
		document.getElementById('arrow' + i).style.display = "none";
	}
	
	document.getElementById('def').style.display = "block";
}

/* visualizzazione del contenuto */
function ViewPopUpContent(sPgId, sLanguageId, sProductDetailsContainer, sProductDetailsView)
{
    try
    {
        var divProductDetailsContainer = document.getElementById(sProductDetailsContainer);
        divProductDetailsContainer.style.visibility="hidden";
        divProductDetailsContainer.style.display="none";

        var divProductDetailsView = document.getElementById(sProductDetailsView);
        divProductDetailsView.innerHTML = "";

        var oXHR = zXmlHttp.createRequest();
        oXHR.open("get", "/common/include/get-product-content-popup.aspx?lid=" + sLanguageId + "&pid=" + sPgId, true);
        oXHR.onreadystatechange = function () {
            if (oXHR.readyState == 4)
            {
                if (oXHR.status == 200 || oXHR.status == 304)
                {
                    var txtToView = oXHR.responseText;
                    if (txtToView != "")
                    {
                        divProductDetailsView.innerHTML = txtToView;

                        divProductDetailsContainer.style.visibility="visible";
                        divProductDetailsContainer.style.display="block";
                    }
                }
                else
                {
                    divProductDetailsView.innerHTML = "An error occurred: " + oXHR.statusText; //statusText is not always accurate

                    divProductDetailsContainer.style.visibility="visible";
                    divProductDetailsContainer.style.display="block";
                }
            }
        };
        oXHR.send(null);
    }
    catch (e) { }

    return false;
}

/* abilitazione dei flash */
function ContentResponseForActivation(divToInsertContentId, htmlContentToActivate)
{
    try
    {
        var divToInsertContent = document.getElementById(divToInsertContentId);
        divToInsertContent.innerHTML = htmlContentToActivate;
    }
    catch (e) {}
}

//-->


function startInnerPopup() {
    $(document).ready(function () {
        $('div#innerpopup a.close').click(function() {
            $("div#innerpopup").hide("slow");
        });
        
        setTimeout("$('div#innerpopup').show('slow');", timeIn);
        setTimeout("$('div#innerpopup').hide('slow');", timeIn + timeOut);
    });
}
