﻿// Common Functions included on every page

   var mb = new MessageBuffer();
   var fieldGroup = new Group('SearchSpecialRate', 'One or more errors has been detected in the home search special rate');   
    
   function initPage() {
       fieldGroup.addField('SearchResult.state', 'lblState', 'ROWINDEX_POS_VALUEREQUIRED' , 'ROWINDEX_NEG_VALUEREQUIRED', '<img src=/images_unique/icon_error_blt.gif border=0 align=absmiddle />&#160;Please select a state.<br />');
   }

    function submitForm(){
    // if called from the cruise search or vacation search
        if(isValidZip(document.AdvancedForm.shoppingZipCode.value))
        {
            hide_inlinemsg('errShowZipMsg');
            return true;
        }
        else
        {
            display_inlinemsg('errShowZipMsg'); 
            return false;
        }               
    }
    
    function openVacwin(win)
    {
        var winDesc = 'resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,width=880,height=700';
        HelpWin = window.open(win,"ICT",winDesc);
        HelpWin.focus();
    }


    // Following is the function to get the Alumni cookie value (true/false) 
	function getCookie(name){
		var cookiename = name + "=";
		var dc = document.cookie;
		var begin, end;
		if (dc.length > 0){
			begin = dc.indexOf(cookiename);
			if (begin != -1) {
				begin += cookiename.length;
				end = dc.indexOf(";" , begin);
				if (end == -1) {
					end = dc.length;
				}
				return unescape(dc.substring(begin, end));
			}
		}
		return null;
	}				

	function getvalues()
	{
		var Alumnivalue = getCookie("IncludeAlumniRates");
		if (Alumnivalue == "true"){
		document.getElementById("group2").style.display = "block";
		}
	}

	//Following is the function to display the Alumni Cruiseline Checkboxes depending on the Alumni Dropdown (Yes/No)

	function ShowItem(dropdown, group)
	{
		var group2VisSetting = (group == "group2") ? ((dropdown.value == "true") ? "" : "none") : "none"
		document.getElementById("group2").style.display = group2VisSetting
	}
