﻿
/*var app_wnd = this;


if (app_wnd != null && app_wnd.opener == null)
{
    wnd_cur_url = app_wnd.document.URL;
    if (wnd_cur_url.indexOf('tempdoc') != -1)
        app_wnd.location.href = 'ricerca_semplice.aspx';
}*/


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];}
}

//apre la finestra schedaspoglio con lo spoglio inviato come parametro
function ShowSpoglio(tipo, id_madre, id_spoglio, id_rivista)
{
	window.open("schedaSpoglio.aspx?tipo=" + tipo + "&id_madre=" + id_madre + "&id_spoglio=" + id_spoglio + "&id_rivista=" + id_rivista, "spoglio", "menubars=no,scrollbars=yes,toolbar=no,resizable=yes,HEIGHT=700,WIDTH=1000","");
	return false;
}
//Me.mirab_proj.user.m_msgToUser

function OpenInfoPopup(dont_auto_close)
{
var dateObjectName = new Date()
var sufix = dateObjectName.getTime ()

  if (dont_auto_close == 1)
    window.open("popup.aspx?dont_auto_close=1","info_popup_"+sufix, "top=100,left=200,width=400,height=250,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
  else  
    window.open("popup.aspx","info_popup_"+sufix, "top=100,left=200,width=400,height=250,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
}

//apre la finestra schedasMadre con la madre inviata come parametro
function ShowMadre(tipo, id_madre, id_rivista)
{
	window.open("schedaMadre.aspx?tipo=" + tipo + "&id_madre=" + id_madre + "&id_rivista=" + id_rivista, "madre", "menubars=no,scrollbars=yes,toolbar=no,resizable=yes,HEIGHT=700,WIDTH=1000","");
	return false;
}

//apre la finestra schedasArticoli con tutti gli articoli che si trovano nel array vArticoli
//l'array è stato creato dal xsl che ha messo un elemento per ogni articolo collegato
//soltanto le schede mel avranno articoli collegati...per adesso
function ShowArticoli(pArticoli)
{
    window.open("schedaArticoli.aspx?articoli=" + pArticoli, "spoglio", "menubars=no,scrollbars=yes,toolbar=no,resizable=yes,HEIGHT=700,WIDTH=1000","");
	return false;
}


// Aprono la pagina info
function open_galluzzo(hdnId)
{
    //var gal_win = window.open ("http://sismel.it/ticataintro.asp?hdnId="+ hdnId,hdnId, "width=1000,height=600,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
    var gal_win = window.open ("http://sismel.it/ticata.asp?hdnaction=COLSER&hdncolragid=2",hdnId, "width=900,height=600,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
    gal_win.focus()
}


function open_db(db_name)
{
    window.open ("info.aspx?info=" + db_name,db_name, "width=800,height=400,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
}

function open_contatti()
{
    var newwin = window.open ("contatti.aspx",'contatti', "width=400,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
    newwin.focus();
}


function open_credits()
{
    var newwin = window.open ("credits.aspx",'credits', "width=800,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
    newwin.focus();
}


function close_galluzzo_pages(redirect_page)
{

    var url_opener = opener.document.URL;
    var main_win;

    if (url_opener.indexOf('schedaMadre.aspx') != -1)
    {
        main_win = opener.opener;
        window.setTimeout('opener.close()', 5);
    }
    else
        main_win = opener;  
        
    main_win.location.href = redirect_page;
    window.setTimeout('window.close()', 5);    
}


function open_help(lang)
{
    var newwin = window.open("help.htm","help",  "width=1000,height=750,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
    //newwin.focus();
}


// *****************************************************************************************************************************************************




function IMG1_onclick() {

}

function Submit1_onclick() {

}

var iniDate = new Date();
var strSessionID;		
		
		
function testmyvar(test)
{
mh = test;
}		
		
function updateClientTime(lbl, pIniDate, sess_tout, sessionid)
{
	curDate = new Date();
/*		strHours = curDate.getHours() - pIniDate.getHours();
	strMins = curDate.getMinutes() - pIniDate.getMinutes();
	strSecs = curDate.getSeconds() - pIniDate.getSeconds();
*/		

 /*  if (navigator.appName == "Netscape" )
   {
       //alert(window.onbeforeunload);
        window.onbeforeunload = doUnload;
   }    */

    strSessionID =sessionid;
	strHours = '';
	strMins = '';
	strSecs = '';
	
	var diff = new Date(curDate - pIniDate);
	
	iHours = diff.getHours() - 1;
	
	if (iHours < 10)
		strHours= '0' + iHours;
	else
		strHours= iHours;
		
	iMins = diff.getMinutes();
	
	if (iMins >= sess_tout && sessionid != "")
	{
	    if (window.location.href.indexOf('/admin/') != -1)
	        window.location.href = "adm_exp_session.aspx?sexpid=" + sessionid;
	    else
    	    window.location.href = "exp_session.aspx?sexpid=" + sessionid;
    	    
	    return false;
	}
   	
	if (iMins < 10)
		strMins= '0' + iMins;
	else
		strMins= iMins;
	
	iSecs = diff.getSeconds();
	
	if (iSecs < 10)
		strSecs= '0' + iSecs;
	else
		strSecs= iSecs;

	try
	{
		elapTime = strHours +':' + strMins +':' + strSecs //+ '<br>(session expires after ' + sess_tout + ' minutes)';
		document.getElementById(lbl).innerHTML = elapTime;
	}
	catch(e)
	{
		document.getElementById(lbl).innerText=e.name;
	}
	
	
	setTimeout('updateClientTime("'+lbl+'",iniDate,' + sess_tout +', "'+sessionid+'")',1000);
}


function doUnload()
{

 if (window.event.clientX > 1000 && window.event.clientY < 0)
 {
    if (strSessionID != "")
    {
        window.location.href = "exp_session.aspx?sexpid=" + strSessionID+"&shutdown=1";
        //alert("Un'attimo ... ");
        return false;
    }
 }
}


function OpenView(urlview)
{
	window.open(urlview,'',"width=800,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
}

function OpenBlobView(pid, admin)
{
    if (admin==1)
        window.open("AMContent.aspx?cid="+pid,'',"width=800,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
    else
        window.open("MContent.aspx?cid="+pid,'',"width=800,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
}


function OpenStream(t,pid, docid)
{
    window.open('vitem.aspx?t="'+t+'"&id='+pid+'"&doc='+docid,docid,"width=800,height=650,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes"); 
}


function reset_form_data_fields() //forms[0]
{ 
        i =0;
        for (i = 0  ; i<=document.forms[0].elements.length - 1; i++)
        {
            if (document.forms[0].elements[i].type == 'text')
                document.forms[0].elements[i].value = '';
            else
            if (document.forms[0].elements[i].type == 'checkbox')
             	document.forms[0].elements[i].checked = false;
//'            else" + vbCrLf
//'            {" + vbCrLf
//'                alert(document.forms[0].elements[i].id);" + vbCrLf
//'                alert(document.forms[0].elements[i].type);" + vbCrLf
        }   //for()" + vbCrLf

   document.forms[0].elements ['" + m_MyPOSTBACK + "'].value = '" + C_PBACK_EVENT_RESET_TABLE + "|0';
        document.forms[0].submit();
}

function activate_field(ctrl_id, set_value, alert_on) //forms[0]
{
    var_ctrl = document.getElementById(ctrl_id); //.value = 'FROMLIST_ID_AND_INFO|247|""Palestina""'

    if (var_ctrl != undefined) {
        var_ctrl.value = set_value;




    }
    else
        if (alert_on == 1)
        alert("controllo con id " + ctrl_id + " non existe ");
}



function toggle_ip_textbox(cbo_ctrl_id, txt_ctrl_id, lnk_id, range_parent_block)
{
    cbo = document.getElementById(cbo_ctrl_id);
    txt = document.getElementById(txt_ctrl_id);
    lnk = document.getElementById(lnk_id);
    block_cell = document.getElementById(range_parent_block);
            
    if (cbo != undefined && txt != undefined && lnk != undefined)
    {
        if (cbo.selectedIndex == 0) //certificato eletronico
        {
            txt.style.display = 'none';
            lnk.style.display = 'none';
            
            block_cell.style.display = 'none';
        }
        else
        if (cbo.selectedIndex == 1) //single ip
        {
            block_cell.style.display = 'none';
            
            lnk.style.display = 'block';
            txt.style.display= 'block';
            
            if (txt.value == '')
                txt.value = '   .   .   .   ';
                
            txt.focus();
        }
        else
        if (cbo.selectedIndex == 2) //range ip
        {
            txt.style.display = 'none';
            lnk.style.display = 'none';
            
            block_cell.style.display = 'block';
        }
    }
    return true;
}


function select_connection_block(cbo_ctrl_id, single_parent_block, range_parent_block)
{
    cbo = document.getElementById(cbo_ctrl_id);
    single_cell = document.getElementById(single_parent_block);
    range_cell = document.getElementById(range_parent_block);
            
    if (cbo != undefined && txt != undefined && lnk != undefined)
    {
        if (cbo.selectedIndex == 0) //certificato eletronico
        {
            single_cell.style.display = 'none';
            range_cell.style.display = 'none';
        }
        else
        if (cbo.selectedIndex == 1) //single ip
        {
            single_cell.style.display = 'block';
            range_cell.style.display = 'none';
        }
        else
        if (cbo.selectedIndex == 2) //range ip
        {
            single_cell.style.display = 'none';
            range_cell.style.display = 'block';
        }
    }
    return true;
}

function delete_row(table_id, rowIndexToCancel)
{
    rg_tbl = document.getElementById(table_id);
    
    if (rg_tbl != null)
    {
        if (rowIndexToCancel < rg_tbl.rows.length)
            rg_tbl.deleteRow(rowIndexToCancel);
    }
    
    return false;
}



function add_new_row(table_id, start_inputfield_name, end_inputfield_name)
{
    rg_tbl = document.getElementById(table_id);
    
    if (rg_tbl != null)
    {
        var iIndex = rg_tbl.rows.length;
        
        rg_tbl.insertRow(-1);
        
        var tr = rg_tbl.rows[iIndex];
        
        //tr.setAttribute("background_color", "txt_ip_fine_" + iIndex);
        
        var fCell = tr.insertCell(-1);
        var sCell = tr.insertCell(-1);
        var tCell = tr.insertCell(-1);
        
        //fCell.innerHTML = '<input id="txt_ip_"' + iIndex + '" type="text" value="txt">';
        //adding checkbox to first column
        var txt = document.createElement('input');
        txt.setAttribute("id", start_inputfield_name + iIndex);
        txt.setAttribute("name", start_inputfield_name + iIndex);
        txt.setAttribute("value", "   .   .   .   " );
        txt.setAttribute("type", "text");
        //txt.setAttribute("class", "inserimento");
        txt.setAttribute("width","119px");
        
        fCell.appendChild(txt);

        var txt2 = document.createElement('input');
        txt2.setAttribute("id", end_inputfield_name + iIndex);
        txt2.setAttribute("name", end_inputfield_name + iIndex);
        txt2.setAttribute("value", "   .   .   .   " );
        txt2.setAttribute("type", "text");
        //txt2.setAttribute("class", "inserimento");
        txt2.setAttribute("width","119px");
        
        sCell.appendChild(txt2);

        var cmd = document.createElement('input');
        cmd.setAttribute("id", "delete_row" + iIndex);
        cmd.setAttribute("name", "delete_row" + iIndex);
        cmd.setAttribute("type", "button");
        cmd.setAttribute("value", "-");
        cmd.setAttribute("width","20px");
        
        //var onClickCmd = "return delete_row('"+ table_id + "'," + iIndex + ");";
        //cmd.setAttribute("onClick",onClickCmd);
        cmd.onclick = Function('delete_row('+ '"' + table_id +'"'+','+iIndex+')')
        //cmd.addEventListener ("onclick",delete_row(table_id,iIndex), true);

        tCell.appendChild(cmd);
    }

}


function open_ips_help(lang)
{
    if (lang == 'it')
        window.open("help_iprng_it.htm",'',"width=451,height=400,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
    else
        window.open("help_iprng_en.htm",'',"width=451,height=400,scrollbars,menubar=no,status=no,toolbar=no,resizable=yes");
}


function SetValue(ctrlId,ctrl_content)
{
    try
    {
        //alert(ctrl_content);
	    document.getElementById(ctrlId).value = ctrl_content;
	    return true;
    }
    catch (e)
    {
         alert("unexpect event setting value on control");
    }
}

function set_ip(txt_ctrl_id,ip_value)
{
    txt = document.getElementById(txt_ctrl_id);

    if (txt != undefined)
    {
        txt.value = ip_value;
    }
}



//RIP + code
/*function open_popup_selector(dset, field_name)
{ 
   var strImgPath = "show_list.aspx?sdata=" + dset+ "&field_name='"+field_name+"'";
   //alert(strImgPath);
	window.open(strImgPath); //, "Seleziona dalla lista","menubar=no,scrollbar=yes,toolbar=no,resizable=yes","");
	//window.open(strImgPath, strDecorName,"menubar=no,scrollbar=yes,toolbar=no,resizable=yes","");
}*/

function open_popup_selector(dset, field_name, ctitle, caller,proj_filter)
{
    var strImgPath = "show_list.aspx?sdata=" + dset + "&field_name='" + field_name + "'&ctitle='" + ctitle + "'&caller=" + caller + "&prj_filter=" + proj_filter;
   //alert(strImgPath);
	window.open(strImgPath); //, "Seleziona dalla lista","menubar=no,scrollbar=yes,toolbar=no,resizable=yes","");
	//window.open(strImgPath, strDecorName,"menubar=no,scrollbar=yes,toolbar=no,resizable=yes","");
}

var nav = window.Event ? true : false;

if (nav) 
{
    try
    {
        window.captureEvents(Event.KEYDOWN);
        window.onkeydown = NetscapeEventHandler_KeyDown;
    }
    catch (e)
    {
        ;
    }
} 
else 
{
    document.onkeydown = MicrosoftEventHandler_KeyDown;
}

function NetscapeEventHandler_KeyDown(e) 
{



if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') 
{ 
	try
	{
		document.getElementById('ctl00_ing_postback_action').value = 'CR_key';
		return true; 
	} 
	catch (e)
	{
	;
	}
}
return true;
}

function MicrosoftEventHandler_KeyDown() 
{
if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
{
	try
	{
		document.getElementById('ctl00_ing_postback_action').value = 'CR_key';
		return true;
	}
	catch(e)
	{
		;
	}
}
return true;
}

// ======================================================================================================================================================================


/*
 * This is the function that actually highlights a text string by
 * adding HTML tags before and after all occurrences of the search
 * term. You can pass your own tags if you'd like, or if the
 * highlightStartTag or highlightEndTag parameters are omitted or
 * are empty strings then the default <font> tags will be used.
 */
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag) 
{
  // the highlightStartTag and highlightEndTag parameters are optional
  if ((!highlightStartTag) || (!highlightEndTag)) {
    highlightStartTag = "<font style='color:blue; background-color:yellow;'>";
    highlightEndTag = "</font>";
  }
  
  // find all occurences of the search term in the given text,
  // and add some "highlight" tags to them (we're not using a
  // regular expression search, because we want to filter out
  // matches that occur within HTML tags and script blocks, so
  // we have to do a little extra validation)
  var newText = "";
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
    
  while (bodyText.length > 0) {
    i = lcBodyText.indexOf(lcSearchTerm, i+1);
    if (i < 0) {
      newText += bodyText;
      bodyText = "";
    } else {
      // skip anything inside an HTML tag
      if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
        // skip anything inside a <script> block
        if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
          newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
          bodyText = bodyText.substr(i + searchTerm.length);
          lcBodyText = bodyText.toLowerCase();
          i = -1;
        }
      }
    }
  }
  
  return newText;
}


/*
 * This is sort of a wrapper function to the doHighlight function.
 * It takes the searchText that you pass, optionally splits it into
 * separate words, and transforms the text on the current web page.
 * Only the "searchText" parameter is required; all other parameters
 * are optional and can be omitted.
 */
function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)
{
  // if the treatAsPhrase parameter is true, then we should search for 
  // the entire phrase that was entered; otherwise, we will split the
  // search string so that each word is searched for and highlighted
  // individually
  if (treatAsPhrase) {
    searchArray = [searchText];
  } else {
    searchArray = searchText.split(" ");
  }
  
  if (!document.body || typeof(document.body.innerHTML) == "undefined") {
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i < searchArray.length; i++) {
    bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
  }
  
  //alert(bodyText);
  document.forms[0].ctl00_ContentPlaceHolder1_txtDebug.value=bodyText;
  //document.body.innerHTML = bodyText;
  return true;
}


/*
 * This displays a dialog box that allows a user to enter their own
 * search terms to highlight on the page, and then passes the search
 * text or phrase to the highlightSearchTerms function. All parameters
 * are optional.
 */
function searchPrompt(defaultText, treatAsPhrase, textColor, bgColor)
{
  // This function prompts the user for any words that should
  // be highlighted on this web page
  if (!defaultText) {
    defaultText = "";
  }
  
  // we can optionally use our own highlight tag values
  if ((!textColor) || (!bgColor)) {
    highlightStartTag = "";
    highlightEndTag = "";
  } else {
    highlightStartTag = "<font style='color:" + textColor + "; background-color:" + bgColor + ";'>";
    highlightEndTag = "</font>";
  }
  
  if (treatAsPhrase) {
    promptText = "Please enter the phrase you'd like to search for:";
  } else {
    promptText = "Please enter the words you'd like to search for, separated by spaces:";
  }
  
  searchText = prompt(promptText, defaultText);

  if (!searchText)  {
    alert("No search terms were entered. Exiting function.");
    return false;
  }
  
  return highlightSearchTerms(searchText, treatAsPhrase, true, highlightStartTag, highlightEndTag);
}


/*
 * This function takes a referer/referrer string and parses it
 * to determine if it contains any search terms. If it does, the
 * search terms are passed to the highlightSearchTerms function
 * so they can be highlighted on the current page.
 */
function highlightGoogleSearchTerms(referrer)
{
  // This function has only been very lightly tested against
  // typical Google search URLs. If you wanted the Google search
  // terms to be automatically highlighted on a page, you could
  // call the function in the onload event of your <body> tag, 
  // like this:
  //   <body onload='highlightGoogleSearchTerms(document.referrer);'>
  
  //var referrer = document.referrer;
  if (!referrer) {
    return false;
  }
  
  var queryPrefix = "q=";
  var startPos = referrer.toLowerCase().indexOf(queryPrefix);
  if ((startPos < 0) || (startPos + queryPrefix.length == referrer.length)) {
    return false;
  }
  
  var endPos = referrer.indexOf("&", startPos);
  if (endPos < 0) {
    endPos = referrer.length;
  }
  
  var queryString = referrer.substring(startPos + queryPrefix.length, endPos);
  // fix the space characters
  queryString = queryString.replace(/%20/gi, " ");
  queryString = queryString.replace(/\+/gi, " ");
  // remove the quotes (if you're really creative, you could search for the
  // terms within the quotes as phrases, and everything else as single terms)
  queryString = queryString.replace(/%22/gi, "");
  queryString = queryString.replace(/\"/gi, "");
  
  return highlightSearchTerms(queryString, false);
}


/*
 * This function is just an easy way to test the highlightGoogleSearchTerms
 * function.
 */
function testHighlightGoogleSearchTerms()
{
  var referrerString = "http://www.google.com/search?q=javascript%20highlight&start=0";
  referrerString = prompt("Test the following referrer string:", referrerString);
  return highlightGoogleSearchTerms(referrerString);
}

function SetCss(objID,cssName)
{
    try
    {
       document.getElementById(objID).className = cssName;
    }
    catch (e)
    {
        alert("errore:SetCss");
    }
}

//Funzione di jquery per mostrare e nascondere dei div.
//Si usa nella visualizzazioen degli autori per mostrare/nascondere i manoscritti associati alle opere
//si usa nella home per mostrare/nascondere gli esempi
function showSlidingDiv(id)
{
    $(id).animate({"height": "toggle"}, { duration: 500 });
}

//Funzione di jquery per mostrare e nascondere dei div.
//Si usa nella visualizzazioen degli autori per mostrare/nascondere i manoscritti associati alle opere
function showRepertoriDiv(id) {
    switch (id) {
        case "latini":
            $("#ctl00_ContentPlaceHolder1_home_repertori_default").hide();
            $("#home_repertori_italiani").hide();
            $("#home_repertori_agiografici").hide();
            $("#home_repertori_francesi").hide();
            $("#home_repertori_manoscritti").hide();
            $("#home_repertori_latini").show();
            break;
        case "italiani":
            $("#ctl00_ContentPlaceHolder1_home_repertori_default").hide();
            $("#home_repertori_latini").hide();
            $("#home_repertori_agiografici").hide();
            $("#home_repertori_francesi").hide();
            $("#home_repertori_manoscritti").hide();
            $("#home_repertori_italiani").show();
            break;
        case "agiografici":
            $("#ctl00_ContentPlaceHolder1_home_repertori_default").hide();
            $("#home_repertori_latini").hide();
            $("#home_repertori_italiani").hide();
            $("#home_repertori_francesi").hide();
            $("#home_repertori_manoscritti").hide();
            $("#home_repertori_agiografici").show();
            break;
        case "francesi":
            $("#ctl00_ContentPlaceHolder1_home_repertori_default").hide();
            $("#home_repertori_latini").hide();
            $("#home_repertori_italiani").hide();
            $("#home_repertori_agiografici").hide();
            $("#home_repertori_manoscritti").hide();
            $("#home_repertori_francesi").show();
            break;
        case "manoscritti":
            $("#ctl00_ContentPlaceHolder1_home_repertori_default").hide();
            $("#home_repertori_latini").hide();
            $("#home_repertori_italiani").hide();
            $("#home_repertori_agiografici").hide();
            $("#home_repertori_francesi").hide();
            $("#home_repertori_manoscritti").show();
            break;
    }
   
}


//Funzione di jquery per mostrare e nascondere dei div.
//Si usa nella visualizzazioen degli autori per mostrare/nascondere i manoscritti associati alle opere
function showSlidingDiv2(id, toggle_flag, collapser_to_flag) {
    $(id).animate({ "height": "toggle" }, { duration: 500 });

    var stdName = String(id);

    var iHeight = '2px';

    if (stdName != null) {
        stdName = stdName.substring(1);

        var toggle_ctrl;
        var ingDiv = document.getElementById(stdName);
        iHeight = ingDiv.style.height;
    }

    if (toggle_flag != '') {
       var toggle_ctrl = document.getElementById(toggle_flag);

        try {
            if (iHeight == '1px')
                toggle_ctrl.value = '1';
            else
                toggle_ctrl.value = '0';
        }
        catch (e) {

        }
    } //toggle hidden runat-server-control flag

    if (collapser_to_flag != '') {
       var collapser_ctrl = document.getElementById(collapser_to_flag);

       try {

           var strCaption = collapser_ctrl.innerHTML;
           
        
            if (iHeight == '1px')   //put (-)
            {
                strCaption = strCaption.replace("[+]", "[-]");
            }
            else                    //put (+)
            {
                strCaption = strCaption.replace("[-]", "[+]");
            }

            collapser_ctrl.innerHTML = strCaption;
        }
        catch (e) {

        }
    }
    return false;

}
