// JScript File for Home.aspx
var varLoad = 'Free';
function StopPostBack()
{
    if(varLoad = 'Progress')
    {    
        alert('Please wait until the page loads/reloads before making any other selection.');
        return false;
    }
    else
    {
        varLoad = 'Free';
        return true;
    }
}
function openExternelWindow(ctUrl, ctWidth, ctHeight)
{
    try
    {
        //specify width and height
         if (ctHeight =='0')
        {  ctHeight='500'; }
        if(ctWidth == '0')
        {  ctWidth='600'; }
        //specify parameters
        var left   = (screen.width  - ctWidth)/2;
        var top    = (screen.height - ctHeight)/2;
        var params = 'width='+ctWidth+', height='+ctHeight;
        params += ', top='+top+', left='+left;
        params += ', directories=no';
        params += ', location=no';
        params += ', menubar=no';
        params += ', resizable=yes';
        params += ', scrollbars=yes';
        params += ', status=no';
        params += ', toolbar=no';
        //open window
        window.open('http://' + ctUrl , null, params);
    }
    catch(ex)
    {}
}
function Validate()
             {            
            var req = new XMLHttpRequest();
           // alert(document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber"));
            //req.open("GET", "SendStatus.aspx?text=" + document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber").value, true);
            //req.open("GET", "/SendStatus.aspx?m="+Math.random()+"offerNumber=" + document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber").value, true);
            req.open("GET", "/Angebot/Inline/"  + document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber").value + ".html", true);            
                req.onreadystatechange = function() {
                if (req.readyState == 4) 
                {
                   
                    if (req.responseText == "C0" || req.responseText == "R0") 
                    {     
                        ct_hide();              
                        return LoadPageDetailMissing('/MissingCruise.aspx',200,875);  
                    }
                    else if (req.responseText.substring(0,1) == "C")
                    {
                        window.location = "/Kreuzfahrt/"+ req.responseText.substring(1) +".html";                        
                    }
                    else if (req.responseText.substring(0,1) == "R")
                    {
                        //window.location = "/Route/"+ req.responseText.substring(1) +".html";    
window.location = "ResultList.aspx?rc="+ req.responseText.substring(1);                                            
                    }
                    else if(document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber").value=="")
                    {
                       alert("Angebotsnummer cannot be blank!"); 
                    }
                    else 
                    { 
                        alert("Not a Valid Angebotsnummer !");               
                        //window.location = "Cruise.aspx?id="+ document.getElementById("ctl00_CT_ContentPlaceHoder_txtOfferNumber").value +"";
                    }

                }
            }
            req.send(null);
 }  
 
 function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
function moveoutid()
{
	var sda = document.getElementById('xxx');
	var len = sda.length;
	var sda1 = document.getElementById('yyy');
	for(var j=0; j<len; j++)
	{
		if(sda[j].selected)
		{
			var tmp = sda.options[j].text;
			var tmp1 = sda.options[j].value;
			sda.remove(j);
			j--;
			var y=document.createElement('option');
			y.text=tmp;
			try
			{sda1.add(y,null);
			}
			catch(ex)
			{
			sda1.add(y);
			}
		}
	}
}

/* To change the background to TopCollection */
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) 
{
    //check if it is the dropdown that actually initiated the postback
    try
    {
        var dropDownID = 'ctl00$CT_ContentPlaceHoder$drdnSchiff';
        var isTop = document.getElementById('ctl00_CT_ContentPlaceHoder_hidIsTop').value;
        if (sender._postBackSettings.panelID.indexOf(dropDownID) >= 0) 
        {
            //To check whether it is a Top Collection Vessel
            if(isTop == "1")
                document.getElementsByTagName("body")[0].style.background='url(images/layout/body-bg-top.jpg) repeat-x top left #04386A';
            else
                document.getElementsByTagName("body")[0].style.background='url(images/layout/body-bg.jpg) repeat-x top left #0286cb';  

        }
     }
     catch(Err)
     {
     }
}
/*End */


  
  /*For world Map */
  var worlddiv = document.getElementById('CTWorldMap');
        function HideMap()
        {
            try
            {
                worlddiv.style.visibility = 'hidden';
            }
            catch(Err)
            {}
        }
        function ShowMap()
        {
            try
            {
                worlddiv.style.visibility = 'visible';
            }
            catch(Err)
            {}
        }        
 /*End*/
 
 /*For Banner*/
    function DivFormat(divtext)
    {
        if(divtext.length > 41)
        {
           homeBannerLine.style.height = '70px';           
        }	
        if(divtext.length > 82)
        {
           homeBannerLine.style.height = '105px';           
        }
    }
    
    function MidBannerPosition(positionText)
	    {
	        var GreyLineMidDiv =  document.getElementById('midBannerLine');
	        if(positionText != null && positionText != 'undefined')
	        {	               
	            if (positionText.substring(0,3) == 'Top')
	            {	            
	                GreyLineMidDiv.className = 'midbanner-line';
	            }
	            else if (positionText.substring(0,3) == 'Mid')
	            {	            
	                GreyLineMidDiv.className = 'midbanner-line-mid';
	            }
	            else if (positionText.substring(0,3) == 'Bot')
	            {	            
	                GreyLineMidDiv.className = 'midbanner-line-bot';
	            }
	        }
	    }
        function RunBanner() {
                document.getElementById('lnkMidLink').setAttribute("onclick", "window.location.href='" + arrURLMid[i] + "'");	            
	            document.getElementById('lnkMidImage').href = arrURLMid[i];
	            homeBannerLink.href = arrURLMid[i];
	            
	                switch (arrEffectsMid[i]) {
	                    case "wipelr":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'lr', '');	                    
	                        break;
	                    case "wiperl":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'rl', '');	                    	                    
	                        break;
	                    case "wipetb": 
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'tb', '');
	                        break;
	                    case "wipebt":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'bt', '');
	                        break;
	                    case "wipetlbr":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'tlbr', '');
	                        break;
	                    case "wipetrbl":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'trbl', '');
	                        break;
	                    case "wipebltr":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'bltr', '');
	                        break;
	                    case "wipebrtl":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'brtl', '');
	                        break;
	                    case "wipecv":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'cve', '');
	                        break;
	                    case "wipech":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'che', '');
	                        break;
	                    case "wipecc":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crosswipe(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', 'cc', '');
	                        break;
	                    case "swapmf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        swapfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', '');
	                        break;
	                    case "swapqf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        swapfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '1', '');
	                        break;
	                    case "swapsf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        swapfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '5', '');
	                        break;
	                    case "crossmf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crossfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '2', '');
	                        break;
	                    case "crossqf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crossfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '1', '');
	                        break;
	                    case "crosssf":
	                    homeBannerTitleDiv.innerHTML =  arrImageTextMid[i];	 
	                        crossfade(document.getElementById('ctl00_CT_ContentPlaceHoder_CTMidBanner'), imagepath + arrImagesMid[i], '5', '');
	                        break;
	                }
	            
	            MidBannerPosition(arrTextPositionMid[i]);
	            if(typeof arrImageTextMid[i] != 'undefined' && arrImageTextMid[i] != null && arrImageTextMid[i] != 'undefined')  
	            {  	        
	                DivFormat(homeBannerTitleDiv.innerHTML); 
	            }
	            i++;
	            if (i > arrImagesMid.length)
	            {
	               i = 0;	           
	            }
	        }

    /*End */
    
    /* For Calendar */
    
   /* End */