
function openCabinDetails( idpackage, idcabin )
{
  var params = '?popup=cabin&idpackage=' + idpackage + '&id=' + idcabin;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openCabinDetailsForShip( idship, idcabin )
{
  var params = '?popup=cabin&idship=' + idship + '&id=' + idcabin;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openCabinPlanDetails( idpackage, idcabin )
{
  var params = '?popup=cabinplan&idpackage=' + idpackage + '&id=' + idcabin;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openCabinPlanDetailsForShip( idship, idcabin )
{
  var params = '?popup=cabinplan&idship=' + idship + '&id=' + idcabin;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openPublicAreaDetails( idpackage, idpublicarea )
{
  var params = '?popup=publicarea&idpackage=' + idpackage + '&id=' + idpublicarea;
  openPopUpDetails(params, 390, 590, 'no' );
}
				 
function openPublicAreaDetailsForShip( idship, idpublicarea )
{
  var params = '?popup=publicarea&idship=' + idship + '&id=' + idpublicarea;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openDeckPlanDetails( idpackage, iddeck )
{
  var params = '?popup=deckplan&idpackage=' + idpackage + '&id=' + iddeck;
  openPopUpDetails(params, 390, 590, 'no' );
}
function openCruiseGallery( idpackage, idcruise )
{
  var params = '?popup=cruisegallery&idpackage=' + idpackage + '&id=' + idcruise;
  openPopUpDetails(params, 390, 590, 'no' );
}
function openShipGallery( idpackage, idship )
{
  var params = '?popup=shipgallery&idpackage=' + idpackage + '&id=' + idship;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openShipGalleryByShip( idship )
{
  var params = '?popup=shipgallery&idship=' + idship + '&id=' + idship;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openPhotoGallery( idphotogallery )
{
  var params = '?popup=photogallery&idphotogallery=' + idphotogallery + '&id=' + idphotogallery;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openPress( id )
{
  var params = '?popup=press&idpress=' + id + '&id=' + id;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openTestedForYou( id )
{
  var params = '?popup=testedForYou&idtestedforyou=' + id + '&id=' + id;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openPortOfCallDetails( idPortOfCalldetail )
{
  var params = '?popup=portofcalldetail&idpackage=-1&id=' + idPortOfCalldetail;
  openPopUpDetails(params, 390, 590, 'no' );
}

function openPopUpDetails( params, width, height, scroolbars )
{
  page ='../aspx/PopUpDetails.aspx' + params;
  openPopUp( page, width, height, scroolbars );
}

function openPrintEstimate( idEstimate )
{
  page ='../aspx/EstimateSummary.aspx?idEstimate=' + idEstimate + '&mode=print';
  popup = openPopUp( page, 650, 750, 'yes');
  popup.print();

}

function openSendEstimate( idEstimate )
{
  page ='../aspx/EstimateSendEmail.aspx?idEstimate=' + idEstimate;
  popup = openPopUp( page, 600, 550, 'yes');
}

function swapImage( filename )
{
  var imgMain = document.getElementById( 'image_main' );
  if( imgMain == null )
    return;
 imgMain.src = '../aspx/showimage.aspx?f=../uploads/' + filename + '&w=360&h=250';
}

/* generic function to open popup */
function openPopUp( url, width, height, scroolbars, windowname )
{
  width = ( width == null ) ? 300 : width;
  height = ( height == null ) ? 490 : height;
  scroolbars = ( scroolbars == null ) ? "no" : scroolbars;
  if( windowname == null )
    windowname = '_blank';
  popup=window.open( url, windowname, 'toolbar=no,scrollbars=' + scroolbars + ',location=no,directories=no,width=' + width + ',height=' + height ); 
  popup.focus();
  return popup;
}


/* generic function to open div */

function showHideBox( bodyId, imgId)
{
  
  
  var b = document.getElementById( bodyId ).className;
  var i = document.getElementById( imgId ).className;
  
 
 
 if ( i == 'titleClose' )
 {
  
   document.getElementById( imgId ).className = 'titleOpen';
   document.getElementById( bodyId ).className = 'boxVisible';
   
 }
  else
 {
  
   document.getElementById( imgId ).className = 'titleClose';
   document.getElementById( bodyId ).className = 'boxHide';
   
 }
}


function showMenu(obj)
  {
    var e = obj.style.height;
        
    if(e == '25px')      
    {
      obj.style.height = '100%';
    }
    
    if(e == '100%')      
    {
      obj.style.height = '25px';
    }
    else{
      obj.style.height = '100%';
    }
  }
  
  function printPackage() {
    var conjunction = window.location.href.indexOf('?') > 0 ? '&' : '?';
    var url = window.location.href + conjunction + 'print=1';
    if ($('packageDescriptionBox').getStyle('display') != 'none') {
        url += '&packageDescriptionBox=1';
    }
    var cabins = $A($$('tbody'));
    cabins.each(function(obj) {
        if ($(obj).identify().startsWith('category_')) {
            if ($(obj).getStyle('display') != 'none')
                url = url + '&' + $(obj).identify() + '=1';
        }
    });


    openPopUp(url, 850, 590, 'yes');
}


function arrangePrint() {
    var query = $H(window.location.href.toQueryParams());
    query.each(function(pair) {
        if ($(pair.key) != null) {
            $(pair.key).show();
//            if (pair.key == 'packageDescriptionBox')
//                $(pair.key).removeClassName('boxHide');
        }
    });
//    $('packageConditionsBox').show();
    window.print();
}

function showHideCabinCategory( idtbody )
{
  var tbody = document.getElementById('category_' + idtbody);
  var tdtitle = document.getElementById('title_' + idtbody);
  if ( tbody.style.display == '' )
  {
    tbody.style.display = 'none';
    tdtitle.className = 'titleclose';
   }
  else
  {
    tbody.style.display = '';
    tdtitle.className = 'titleopen';
   }
}  

function showHideWucSearchTab( idWucSearchToShow, idWucSearchToHide )
{
  var wucSearchToShow = document.getElementById( idWucSearchToShow );
  if( wucSearchToShow != null )
  {
    wucSearchToShow.style.display = 'block';
  }
  var wucSearchToHide = document.getElementById( idWucSearchToHide );
  if( wucSearchToHide != null )
  {
    wucSearchToHide.style.display = 'none';
  }
}

/*MENU A TENDINA*/
startList = function() {
    if (document.all && document.getElementById) {
        navRoot = document.getElementById("nav");
        for (i = 0; i < navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName == "LI") {
                node.onmouseover = function() {
                    this.className += " over";
                }
                node.onmouseout = function() {
                    this.className = this.className.replace(" over", "");
                }
            }
        }
    }
}
window.onload = startList;



function fillBox(id, defaultText)
{
  if($(id).value == "")
  {
    $(id).value = defaultText;
  }
  else if($(id).value == defaultText)
  {
    $(id).value = "";
  }

}

  function switchInput(toHide, toShow, foc){
                $(toHide).style.display='none';
                $(toShow).style.display='';
                if(foc == 'true')$(toShow).focus();
            }

