﻿//All the JS Functions for Cruise page 

/*window.onload=ptree;
function ptree(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}*/

      
function openGeneralDisclamierWindow()
{ 
    var url="GeneralDisclamer.htm" ;
    winNew = window.open(url,"Disclaimer","height=675,width=850,left=50,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
    winNew.focus();
}

function openExcursionsWindow(cid,sid)
{
   var url="/Excursion.aspx?sid=" + sid + "&cid=" + cid ;
   winNew =window.open(url,"Excursion","height=600,width=660,left=0,top=0,status=no,scrollbars =yes,menubar=no,location=no,toolbar=no");
   winNew.focus();
}
function BackToStyleTeaser(Divid)
 {
 document.getElementById(Divid).style.background="none";
 document.getElementById(Divid).style.cssText ="teaser-box";  
 }

function openPriceCalenderWindow(cid)
{
   var url="/CruisePrices.aspx?id=" + cid ;
   winNew = window.open(url,"CruisePrice","height=500,width=205,left=0,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openCabinCategoryWindow(catid,vid)
{
    var url="/CabinType.aspx?catid=" + catid + "&vid=" + vid;
    winNew = window.open(url,"CabinCategory","height=320,width=640,left=0,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
    winNew.focus();
}

/*function openDeckImageWindow(did,vid)
{
    var url="DeckImage.aspx?did=" + did + "&vid=" + vid;
   window.open(url,"DeckImage","height=600,width=600,left=0,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
     winNew.focus();
}*/

function openVesselWindow(vid,dec)
{ 
   var url="/Vessel.aspx?id=" + vid ;
   if(dec==1)
   {
     url=url + "&dec=1";
   }
   winNew = window.open(url,"Vessel","height=675,width=824,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openQuoteWindow(cid,kid)
{
   var url="/QuoteClear.aspx?cls=1&cid=" + cid + "&katid=" + kid;
   winNew =window.open(url,"Quote","height=600,width=1000,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openCallBackWindow(cid)
{
   var url="/Callback.aspx?cid=" + cid;
   winNew = window.open(url,"CallBack","height=500,width=700,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openBusTransferWindow(cid)
{ 
   var url=""+cid;
   winNew =window.open(url,"BusTransfer","height=675,width=850,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openCruiseListWindow(cid)
{
   var url="/RegionCruiseList.aspx?sort=MON&cid=" + cid ;
   winNew = window.open(url,"RegionList","height=650,width=850,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
   winNew.focus();
}

function openWindow(node,param)
{ 
    var newWindow,newWindow1,newWindow2;
    if(node=="about")
    {
        window.open("cruisetour_info.htm","about","height=675,width=850,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");        
    }
    else if(node=="callback")
    {
        var url="/Callback.aspx?cid=" + param
        window.open(url,"callback","height=500,width=700,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");
    }
    else if(node=="catalog")
    {
        window.open("/Contacts.aspx","catalog","height=675,width=850,left=100,top=0,status=yes,toolbar=no,scrollbars =yes,menubar=no,location=no");          
    }
 }
 

 function slow(ele) 
 { 
    ele.scrollAmount = 0; 
 }
 
 function fast(ele) 
 {
     ele.scrollAmount = 3; 
 }
 function LoadPageDetail(title,h,w)
{

  var divInfos = document.getElementById('zdiv');
  divInfos.style.height = h+15 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');
  Frameinfos.style.height = h + 'px';
  Frameinfos.src = title;
//  //Hide scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {
//        document.documentElement.scroll = "no";
//        document.documentElement.style.overflow = "hidden";
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//        document.body.scroll = "no";
//        document.body.style.overflow = "hidden";
//    }  
  popup= $find('CTModalPopupBehavior');   
  popup.show();  
  return  false;
}
 function LoadPageDetailPopupUrl(title,h,w,url)
{
  var divInfos = document.getElementById('zdiv');
  divInfos.style.height = h+15 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');
  Frameinfos.style.height = h + 'px';
 Frameinfos.src = '/UrlLoader.aspx?UrlData='+url+'';
//  //Hide scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {
//        document.documentElement.scroll = "no";
//        document.documentElement.style.overflow = "hidden";
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//        document.body.scroll = "no";
//        document.body.style.overflow = "hidden";
//    }  
  popup= $find('CTModalPopupBehavior');   
  popup.show();  
  return  false;
}


 function LoadPageDetailMissing(title,h,w)
{

  var divInfos = document.getElementById('zdivMissing');
  divInfos.style.height = h+15 + 'px';
//  	divInfos.style.top = '67px';
//	divInfos.style.left = '475px';
  var  Frameinfos = document.getElementById('frameInfosMissing');
  Frameinfos.style.height = h + 'px';
  Frameinfos.src = title;
//  //Hide scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {
//        document.documentElement.scroll = "no";
//        document.documentElement.style.overflow = "hidden";
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//        document.body.scroll = "no";
//        document.body.style.overflow = "hidden";
//    }  
  popup= $find('CTModalPopupBehaviorMissing');   
  popup.show();  
  return  false;
}
function LoadPageDetailFromResult(title,h,w)
{  
var divInfos = document.getElementById('zdiv');
divInfos.style.height = h+15 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');
  Frameinfos.style.height = h + 'px';
  Frameinfos.style.width = w + 'px';
  Frameinfos.src = title;
  popup= $find('CTModalPopupBehavior');   
  popup.show();
  return false;  
}
function LoadPageDetailFromQuote(title,h,w)
{  
var divInfos = document.getElementById('zdiv');
divInfos.style.height = h+15 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');
  Frameinfos.style.height = h + 'px';
  Frameinfos.style.width = w + 'px';
  Frameinfos.src = title;
  popup= $find('CTModalPopupBehavior');   
  popup.show();
  return false;  
}
function LoadPageDetailFromMissing(title,h,w)
{
 
 var  Frameinfos = document.getElementById('frameInfosMissing');
 Frameinfos.style.height = h + 'px';
 Frameinfos.style.width = w + 'px';
 Frameinfos.src = title;
 popup= $find('CTModalPopupBehaviorMissing');   
 popup.show();
 return false;  
}

function CloseDivZ()
{
if(parent.$find('CTModalPopupBehavior')!=null)
    {
 parent.$find('CTModalPopupBehavior').hide();
 }
 if(parent.$find('CTModalPopupBehaviorMissing')!=null)
 {
 parent.$find('CTModalPopupBehaviorMissing').hide();
 }
 if(parent.document.getElementById('frameInfos')!=null)
 {
 var  Frameinfos = parent.document.getElementById('frameInfos');
 Frameinfos.src = 'about:blank'; 
 }
 if(parent.document.getElementById('frameInfosMissing')!=null)
 {
 var  FrameinfosMissing = parent.document.getElementById('frameInfosMissing');
 FrameinfosMissing.src = 'about:blank'; 
 } 
 if(parent.$find('CTVesselPopupBehavior')!=null)
    {
 parent.$find('CTVesselPopupBehavior').hide();
 }
 if(parent.document.getElementById('frameVessel')!=null)
 {
 var  FrameVessel = parent.document.getElementById('frameVessel');
 FrameVessel.src = 'about:blank'; 
 } 
 if(parent.$find('CTVesselPopupBehaviorSchiffe')!=null)
    {
 parent.$find('CTVesselPopupBehaviorSchiffe').hide();
 }
 if(parent.document.getElementById('frameVesselSchiffe')!=null)
 {
 var  FrameVessel = parent.document.getElementById('frameVesselSchiffe');
 FrameVessel.src = 'about:blank'; 
 } 
 
// //Show scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {  
//        parent.parent.document.documentElement.scroll = 'yes';
//        parent.parent.document.documentElement.style.overflow = 'auto';  
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//       parent.parent.document.body.scroll = 'yes';
//        parent.parent.document.body.style.overflow = 'auto';
//    }
 }


function LoadCabinCategoryWindow(catid,vid)
{
  
  var divInfos = document.getElementById('zdiv');  
  divInfos.style.overflow = 'hidden';
  divInfos.style.height = 350 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');  
  Frameinfos.style.height = 350 + 'px';
  Frameinfos.src = "/CabinType.aspx?catid=" + catid + "&vid=" + vid;
  popup= $find('CTModalPopupBehavior');
  popup.show();
//  //Hide scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {
//        document.documentElement.scroll = "no";
//        document.documentElement.style.overflow = "hidden";
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//        document.body.scroll = "no";
//        document.body.style.overflow = "hidden";
//    }
  return false;
}

 function LoadQuoteWindow(cid,kid)
{
  
  var divInfos = document.getElementById('zdiv');  
  divInfos.style.overflow = 'hidden';
  divInfos.style.height = 650 + 'px';
  var  Frameinfos = document.getElementById('frameInfos');
  Frameinfos.style.height = 650 + 'px';  
  Frameinfos.src = "/QuoteClear.aspx?cls=1&cid=" + cid + "&katid=" + kid;
  popup= $find('CTModalPopupBehavior');
  popup.show();
//  //Hide scrollbars of container window
//    if(document.documentElement && document.documentElement.scrollTop)//applies for HTML tag
//    {
//        document.documentElement.scroll = "no";
//        document.documentElement.style.overflow = "hidden";
//    } 
//    else if(document.body)// applies for BODY tag
//    {
//        document.body.scroll = "no";
//        document.body.style.overflow = "hidden";
//    }
  return false;
}


  function ct_show(){
    var oNodeToRemove = parent.document.getElementById("CTScroll");
        oNodeToRemove.innerHTML="";
	    oNodeToRemove.style.display="none";
    }
    
 function showNotes(noteString, e){      
           
            var posx = 0;
            var posy = 0;
            e = (window.event) ? window.event : e;
            posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;       
            var finalString ="";
            finalString += noteString
            document.getElementById("divNote").innerHTML = finalString;
            document.getElementById("divNote").style.visibility="visible";
            document.getElementById("divNote").style.top=posy + "px";
            document.getElementById("divNote").style.left=posx  + "px"; 
            //alert(finalString.length);
            var Result=finalString.length/70;
            if(finalString.length<30)
            {
            document.getElementById("divNote").style.width="200px";
            }
            else
            {
             document.getElementById("divNote").style.width="400px";
            }            
            Result=(Result*15)+5;
            document.getElementById("divNote").style.height=Result  + "px"; 
            
//            if(finalString.length<100)
//            {
//            alert(finalString.length);
//            }
//            if(finalString.length=>100 && finalstring.length<=200)
//            {
//               alert(finalString.length);
//            }
//             if(finalString.length>=201 && finalstring.length<=300)
//            {
//               alert(finalString.length);
//            }
//             if(finalString.length>=301 && finalstring.length<=400)
//            {
//               alert(finalString.length);
//            }
//             if(finalString.length>=401 && finalstring.length<=500)
//            {
//               alert(finalString.length);
//            }
//             if(finalString.length>=501 && finalstring.length<=600)
//            {
//               alert(finalString.length);
//            }
//             if(finalString.length>=601 && finalstring.length<=700)
//            {
//               alert(finalString.length);
//            }
        }
        
        function HideNotes(){
                    
             document.getElementById("divNote").innerHTML = "";            
             document.getElementById("divNote").style.visibility = "hidden";        
        }    
  
    function showTip(e, text)     
    {    
               e = (e == null) ? window.event : e;           
               target = (e.target) ? e.target : e.srcElement;
               document.getElementById('text').innerHTML = text;
               document.getElementById('tooltip').style.left = target.offsetLeft + 10 + 'px';           
               document.getElementById('tooltip').style.top = target.offsetTop + 20 + 'px';           
               document.getElementById('tooltip').style.display='block';
               document.getElementById('ctl00_CT_ContentPlaceHoder_gvDailyPrograms_ctl10_lblHtmlText').style.display='none'           
               target.onmouseout = function() 
               {
                document.getElementById('tooltip').style.display='none'
               };     
    }   
    
    
    /* For CruisePrices.aspx */
    function refreshParent(cruiseid) 
    {
    self.parent.location.href = "/Kreuzfahrt/" & cruiseid & ".html";
    }
    /*End*/
    
    /*For Vessel.aspx Page*/
    function openNewWindow(URLtoOpen, windowName, windowFeatures) 
        {             
         var popup= parent.$find('CTDeckPopupBehavior1');
         var divInfos = parent.document.getElementById('divDeck1');
         var Frameinfos = parent.document.getElementById('frmDeck1');         
         var req = new XMLHttpRequest();
         req.open("GET", "/GetImageWidth.aspx?m="+ Math.random()  +"&FileName=" + URLtoOpen, true); 
         
         req.onreadystatechange = function() {
                if (req.readyState == 4) 
                {
                var HightWidth = req.responseText;
                var Dimension = HightWidth.split(":");
                var popupWidth =  parseFloat(Dimension[1])+ 10; 
                if  (popupWidth > 875)      
                popupWidth = 875;
                if  (popupWidth < 260)  
                popupWidth = 260;
                divInfos.style.height = 800 + 'px';
                divInfos.style.width = popupWidth + 'px';
                divInfos.style.position = 'fixed'; 
                divInfos.style.top = '5%'; 
                divInfos.style.left = '20%';
                divInfos.style.right = '5%'; 
                divInfos.style.bottom = '5%';
                Frameinfos.style.height = 800 + 'px';
                Frameinfos.style.width = popupWidth + 'px';
                }
            }
            req.send(null); 
           Frameinfos.src = '/Deck.aspx?sr='+ URLtoOpen;
           popup.show();
        }
        
        
  function LoadVesselPage(title,h,w)
  {
      var divInfos = document.getElementById('divVessel');
      divInfos.style.height = h+15 + 'px';
      var  Frameinfos = document.getElementById('frameVessel');
      Frameinfos.style.height = h + 'px';
      Frameinfos.src = title;
      popup= $find('CTVesselPopupBehavior');   
      popup.show();  
      return  false;
 }
 function LoadVesselPageSchiffe(title,h,w)
  {
      var divInfos = document.getElementById('divVesselSchiffe');
      divInfos.style.height = h+15 + 'px';
      var  Frameinfos = document.getElementById('frameVesselSchiffe');
      Frameinfos.style.height = h + 'px';
      Frameinfos.src = title;
      popup= $find('CTVesselPopupBehaviorSchiffe');   
      popup.show();  
      return  false;
 }

  /*End*/