/*************************************************
  (c) 2003-2006 by LINee multimediaagency -
   www.linee.it - info@linee.it
   All rights reserved.
*************************************************/

function getContent(url, ajax_content_block, params) {
    //$('spinner').style.display = 'block'
    new Ajax.Updater(
        { success: ajax_content_block },
        url,
        {
            method: "get",
            parameters: params,
            onComplete: function(){
                //$(ajax_content_block).innerHTML = request.responseText
            }
        }
    )
}

function getCaptcha(url, ajax_content_block) {
    Element.remove('captcha_validation');
    new Ajax.Updater(
        { success: ajax_content_block },
        url,
        {
            method: "get",
            onComplete: function(){
                //$(ajax_content_block).innerHTML = request.responseText
            }
        }
    )
}



function open_privacy_tab()
{
    var graphic = $("box_center_content-graphic_content")
    var privacy = $("box_center_content-privacy_content")

    if (graphic && privacy)
    {
        if (privacy.className == "hidden")
        {
            graphic.className = "hidden"
            privacy.className = "visible"
        } else {
            graphic.className = "visible"
            privacy.className = "hidden"
        }
    }
}

function open_search_box()
{
    var search_box = $('box_form_find')
    if (search_box)
    {
        if (search_box.className == "box-search-visible")
        {
            search_box.className = "box-search-hidden"
        } else {
            search_box.className = "box-search-visible"
        }
    }
}

function history_back()
{
    window.history.back();
}

function _product_load_enlarge_photo(path, el)
{
    var links = document.getElementsByClassName("voce_corrente")

    for(var index=0; index<links.length; index++) {
        links[index].className = ""
    }

    $('enlarge_sheet_photos_photo').src = path
    el.className = "voce_corrente"
}

/*******************************************************************************
 * coockie management begin
 */

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function eraseCookie(name) {
  createCookie(name,"",-1);
}

/*******************************************************************************
 * coockie management end
 */


var new_windows = ""
// Apre la pagina a tutto schermo
function open_full_page(lang)
{

    eraseCookie('emu_app_session_id')
    // parametri
    h = 768;
    w = 1024;
    url = 'pre_main?lang=' + lang;

    new_windows = window.open(url, '_blank', 'height='+ h +', width='+ w +',  toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, top=0, left=0, screenX=0, screenY=0');
}

function window_resize()
{
  window.moveTo(0,0)
  window.resizeTo(screen.availWidth,screen.availHeight)
}
