bw = new checkBrowser();

function checkBrowser(){
	this.ver=navigator.appVersion;
	this.dom= (document.getElementById)? 1 : 0;
	this.ie5=((this.ver.indexOf("MSIE 5") >= 0) && this.dom)? 1 : 0;
	this.ie4=(document.all && !this.dom)? 1 : 0;
    this.ns6=(this.dom && parseInt(this.ver) >= 6)? 1 : 0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5)? 1 : 0;
	this.ns4=(document.layers && !this.dom)? 1 : 0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	
	this.editBody = function(rootName, code) {
		if (this.dom) {
			document.getElementById(rootName).innerHTML = code;
		} else if (this.ie4) {
			document.all[rootName].innerHTML = code;
		} else if (this.ns4) {
			document.layers[rootName].document.open();
			document.layers[rootName].document.write(code);
			document.layers[rootName].document.close();
		} 
	}
	this.getRef = function(rootName) {
		if (this.dom) {
			return  document.getElementById(rootName)
		} else if (this.ie4) {
			return document.all[rootName]
		} else if (this.ns4) {
			return document.layers[rootName];
		} 
	}
	
}

function styleFlash_DoFSCommand(command, args) {
	var tileNum = parseInt(args), div, script;
	//alert(args.substr(args.indexOf("|") + 1));
	
	if (command == "updateAd") {
		bw.editBody("dartLayer" + tileNum, args.substr(args.indexOf("|") + 1));
		
		//alert(document.all["dartLayer" + tileNum].innerHTML);
	}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub styleFlash_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call styleFlash_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write("</SCRIPT\> \n");
} 

function nav_rollovers(id, state)
{
	var isMac = navigator.userAgent.indexOf("Mac") != -1;
    
    var isSafari = navigator.userAgent.indexOf("Safari") != -1;

	var dropdownsID = id + "_dropdowns";
	
	var dropdownsElement = document.getElementById(dropdownsID);
	
	var iframeID = id + "_iframe";
	
	var iframeElement = document.getElementById(iframeID);
	
	var dropdown_height;
	
	var iframe_height;
	
	var linkID = id + "_link";
	
	var linkElement = document.getElementById(linkID);
	
	// if on state
	if (state == "on")
	{ 
		if (document.all && document.getElementById)
		{		
			dropdownsElement.style.display = 'block';
			
			if (!isMac)
			{
				dropdown_height = dropdownsElement.offsetHeight;
				
				iframe_height = dropdown_height - 25 + "px";
				
				iframeElement.style.height = iframe_height;
					
				iframeElement.style.display = 'block';
			}
		}
	}
	// if off state
	if (state == "off")
	{        
		if (document.all && document.getElementById)
		{
			dropdownsElement.style.display = 'none';
			
			if (!isMac)
				iframeElement.style.display = 'none';
		}
	}
		
	// if dropdown on state
	if (state == "drop_on")
	{
		if (!isSafari)
            linkElement.style.backgroundPosition = '0 -30px';
		
		if (document.all && document.getElementById)
		{
			dropdownsElement.style.display = 'block';
			if (!isMac)
				iframeElement.style.display = 'block';
		}
	}
	
	// if dropdown on state
	if (state == "drop_off")
	{
	    if (!isSafari)
            linkElement.style.backgroundPosition = '0 0';
		
		if (document.all && document.getElementById)
		{
			dropdownsElement.style.display = 'none';
			if (!isMac)
				iframeElement.style.display = 'none';
		}
	}

}

function cnt_rollover(state)
{
	var isSafari = navigator.userAgent.indexOf("Safari") != -1;
    
    var cntLogoElement = document.getElementById('cnt_logo');
	
	var cntDropdownElement = document.getElementById('dropdown_cntraveler');
	
	var iframeElement = document.getElementById("cnt_iframe");
	
	// if on state
	if (state == "on")
	{
		cntLogoElement.style.backgroundPosition = '0 -55px';
		 
		if (document.all && document.getElementById) {
			cntDropdownElement.style.display = 'block';
			iframeElement.style.display = 'block';
		}
	}
	// if off state
	if (state == "off")
	{
		cntLogoElement.style.backgroundPosition = '0 0';
		
		if (document.all && document.getElementById) {
			cntDropdownElement.style.display = 'none';
			iframeElement.style.display = 'none';
		}
	}
	
	// if off state
	if (state == "down")
	{
		cntLogoElement.style.backgroundPosition = '0 -110px';
	}
	
	// if dropdown on state
	if (state == "drop_on")
	{
        if (!isSafari)
            cntLogoElement.style.backgroundPosition = '0 -55px';

		if (document.all && document.getElementById) {
            cntDropdownElement.style.display = 'block';
			iframeElement.style.display = 'block';
		}

	}
	
	// if dropdown on state
	if (state == "drop_off")
	{
		if (!isSafari)
            cntLogoElement.style.backgroundPosition = '0 0';
		
		if (document.all && document.getElementById) {
            cntDropdownElement.style.display = 'none';
			iframeElement.style.display = 'none';
		}
	}

}
/* mstedman - 070705 - SCRIPT for Destination Finder checkboxes */
check = [];
function checkBox(id) {
	if( document.getElementById('inputCheck' + id).value != "true" ) {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_on.gif"; 
		document.getElementById('inputCheck' + id).value = "true"; 
		} else {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + id).value = "false";
		}
		
		if ( id == 2 || id == 3 || id == 4 || id == 5 || id == 6 || id == 7 || id == 8 ) {
		document.getElementById('imgCheck' + 1).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + 1).value = "false";
		}
		
		if ( id == 10 || id == 11 || id == 12 || id == 13 || id == 14 || id == 15 || id == 16 || id == 17 || id == 18 ) {
		document.getElementById('imgCheck' + 9).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + 9).value = "false";
		}
		
		if ( id == 20 || id == 21 || id == 22 || id == 23 || id == 24 || id == 25 || id == 26 || id == 27 || id == 28 || id == 29 || id == 30 || id == 31 ) {
		document.getElementById('imgCheck' + 19).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + 19).value = "false";
		}
		
		if ( id == 1 ) {
			for ( i=2; i<9; i++ ) {
		document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + i).value = "false";
			}
		}
		

		if ( id == 9 ) {
			for ( i=10; i<19; i++ ) {
		document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + i).value = "false";
			}
		}
		
		if ( id == 19 ) {
			for ( i=20; i<32; i++ ) {
		document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + i).value = "false";
			}
		}
		
		// Make sure that if nothing is selected, the default is selected for group 1
		if (id == 1 || id == 2 || id == 3 || id == 4 || id == 5|| id == 6 || id == 7 || id == 8 ) {
			var checkValue = "false";
			for ( i=1; i<9; i++ ) {
				if (document.getElementById('inputCheck' + i).value == "true") {
					checkValue = "true";
				}
			}
			
			if (checkValue == "false") {
				document.getElementById('imgCheck1').src = "/images/tools/navigation/box_on.gif";
				document.getElementById('inputCheck1').value = "true";
			}
		}
		
		// Make sure that if nothing is selected, the default is selected for group 2
		if (id == 9 || id == 10 || id == 11 || id == 12 || id == 13|| id == 14 || id == 15 || id == 16 || id == 17 || id == 18 ) {
			var checkValue = "false";
			for ( i=9; i<19; i++ ) {
				if (document.getElementById('inputCheck' + i).value == "true") {
					checkValue = "true";
				}
			}
			
			if (checkValue == "false") {
				document.getElementById('imgCheck9').src = "/images/tools/navigation/box_on.gif";
				document.getElementById('inputCheck9').value = "true";
			}
		}
		
		// Make sure that if nothing is selected, the default is selected fro group 3
		if (id == 19 || id == 20 || id == 21 || id == 22 || id == 23|| id == 24 || id == 25 || id == 26 || id == 27 || id == 28 || id == 29 || id == 30 || id == 31 ) {
			var checkValue = "false";
			for ( i=19; i<32; i++ ) {
				if (document.getElementById('inputCheck' + i).value == "true") {
					checkValue = "true";
				}
			}
			
			if (checkValue == "false") {
				document.getElementById('imgCheck19').src = "/images/tools/navigation/box_on.gif";
				document.getElementById('inputCheck19').value = "true";
			}
		}
		
		
		
	}
/* mstedman - 082905 - SCRIPT for Tools checkbox functionality */


/* mstedman - 070705 - SCRIPT for Hotel Finder checkboxes */

function checkBoxHotel(id) {
	if( document.getElementById('inputCheck' + id).value != "true" ) {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_on.gif"; 
		document.getElementById('inputCheck' + id).value = "true"; 
		} else {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + id).value = "false";
		}
		
		if ( id == 2 || id == 3 || id == 4 ) {
		document.getElementById('imgCheck' + 1).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + 1).value = "false";
		}
		
		if ( id == 6 || id == 7 || id == 8 || id == 9 ) {
		document.getElementById('imgCheck' + 5).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + 5).value = "false";
		}
		
		if ( id == 1 ) {
			for ( i=2; i<5; i++ ) {
		document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + i).value = "false";
			}
		}
		
		if ( id == 5 ) {
			for ( i=6; i<10; i++ ) {
		document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + i).value = "false";
			}
		}
		
		// Make sure that if nothing is selected, the default is selected for group 1
		if (id == 1 || id == 2 || id == 3 || id == 4 ) {
			var checkValue = "false";
			for ( i=1; i<5; i++ ) {
				if (document.getElementById('inputCheck' + i).value == "true") {
					checkValue = "true";
				}
			}
			
			if (checkValue == "false") {
				document.getElementById('imgCheck1').src = "/images/tools/navigation/box_on.gif";
				document.getElementById('inputCheck1').value = "true";
			}
		}
		
		// Make sure that if nothing is selected, the default is selected for group 1
		if (id == 5 || id == 6 || id == 7 || id == 8 || id == 9 ) {
			var checkValue = "false";
			for ( i=5; i<10; i++ ) {
				if (document.getElementById('inputCheck' + i).value == "true") {
					checkValue = "true";
				}
			}
			
			if (checkValue == "false") {
				document.getElementById('imgCheck5').src = "/images/tools/navigation/box_on.gif";
				document.getElementById('inputCheck5').value = "true";
			}
		}
	}
/* mstedman - 082905 - SCRIPT for Tools checkbox functionality */


function checkboxToForm(id) {
	if (id == "hotel") {
		
		for ( i=1; i<10; i++ ) {
			if( document.getElementById('inputCheck' + i).value == "true" ) {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_on.gif"; 
			} else {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
			}
		}
		
	} else if (id == "destination") {
		
		for ( i=1; i<32; i++ ) {
			if( document.getElementById('inputCheck' + i).value == "true" ) {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_on.gif"; 
			} else {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
			}
		}
	} else if (id == "widget") {
		
		for ( i=1; i<10; i++ ) {
			if( document.getElementById('inputCheck' + i).value == "true" ) {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_on.gif"; 
			} else {
			document.getElementById('imgCheck' + i).src = "/images/tools/navigation/box_off.gif";
			}
		}
	} 
}

function checkWidgetForm() {
			box1 = document.getElementById('inputCheck1').value;
			box2 = document.getElementById('inputCheck2').value;
			box3 = document.getElementById('inputCheck3').value;
			box4 = document.getElementById('inputCheck4').value;
			box5 = document.getElementById('inputCheck5').value;
			box6 = document.getElementById('inputCheck6').value;
			box7 = document.getElementById('inputCheck7').value;
			box8 = document.getElementById('inputCheck8').value;
			box9 = document.getElementById('inputCheck9').value;
			
			if ( box1=="false" && box2=="false" && box3=="false" && box4=="false" && box5=="false" && box6=="false" && box7=="false" && box8=="false" && box9=="false" ) {
						document.getElementById('anyThemeGroupSelection').value = "true";
					}
			document.tripFinder.submit();

}

check = [];
function checkBoxWidget(id) {
	if( document.getElementById('inputCheck' + id).value != "true" ) {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_on.gif"; 
		document.getElementById('inputCheck' + id).value = "true"; 
		} else {
		document.getElementById('imgCheck' + id).src = "/images/tools/navigation/box_off.gif";
		document.getElementById('inputCheck' + id).value = "false";
		}
}
/* mstedman - 082905 - SCRIPT for Tools checkbox functionality */


	
	
/* Open slideshow window */


var popUpWin=0;
function openSlideshowAudio(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}



var popUpWin=0;
function openSlideshow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width=780,height=644,left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


// script for drop down, can be externalized to .js file


/* Gold List Browse By Destination */

function browserConf() {  
    if (this.loaded) {} else {  
        var str = navigator.appVersion;  
        this.macIE = str.match(/msie(.*)mac/i) != null;  
        this.loaded = true;  
    }  
    return this;  
}

function setText(option, text) {
	if (browserConf().macIE) {
		option.text = option.value = text;
	} else {
		option.innerHTML = text;
	}
}

function _escapeCharCode(text) {
    for (var idx = text.indexOf('&#'); idx != -1; ) {
        var endIdx = text.indexOf(';', idx);
        var str = String.fromCharCode(parseInt(text.substring(idx+2)));
        text = text.substring(0, idx) + str + text.substring(endIdx+1);
        idx=text.indexOf('&#');
    }
    return text;

    var result = text.replace(/&#\d+;/g, 
                function (str0, p1, p2, offset, s) {
                    var str = str0.substring(2, str0.length-1);
                    str = String.fromCharCode(str);
                    return str;
                }
             );
    return result;
}

// cspSelectName: select tag name for Country/StateProvince
function populateRegionSelect(formName, cspSelectName, citySelectName) {
	var regions = window.regions;
	//	error check
	if (regions) {} else {
		return;
	}
    var f = document.forms[formName];
    var s = f.elements[cspSelectName];
    f.cspSelectName = cspSelectName;
    f.citySelectName = citySelectName;
    document.cities=[];
	
	//	clear current options
	s.options.length = 0;

	var o = new Option("Select one", '');
	s.options[s.options.length] = o;
	//o.value = "";
	//setText(o, "Select one");
	
	for (var i=0; i < regions.length; i++) {
            var region = regions[i];
        
	    o = new Option(_escapeCharCode(region.display), region.value);
	    s.options[s.options.length] = o;
	    //o.value = region.value;
	    //setText(o, "-" + region.display);
            //  tweak region option display here
            o.style.fontSize = "12px";
        
            if (region.csps.length == 0 &&
                    region.backupCities) {   //  region.backupCities check is necessary temporarily while the JSP script code is being updated
                //  1-country region with no StateProvince, like Mexico
                o.disabled = false;
                o.cities = region.backupCities;
            } else {
                o.disabled = true;
                for (var j=0; j < region.csps.length; j++) {
                    var csp = region.csps[j];
                    var val = region.value + "/" + csp.value;
                    document.cities[s.options.length] = csp.cities;
        	    o = new Option(_escapeCharCode("&#160;&#160;&#160;" + csp.display), val);
        	    s.options[s.options.length] = o;
        	    //o.value = region.value + "/" + csp.value;
		    //setText(o,csp.display);
                    o.cities = csp.cities;

                    //  tweak csp option display here
                }
            }
	}
	
	s.onchange = selectCsp;
	disableSearchForm(s.form);
	
//	f.onsubmit = submitSearch;
}

function _endsWith(test) {
    return this.lastIndexOf(test) == (this.length - 1);
}
String.prototype.endsWith = _endsWith;

function selectCsp() {

        removeMessage(document.getElementById("messageBox"));

	var sCsp = this;
	var sCity = sCsp.form.elements[sCsp.form.citySelectName];

	var cspOption = sCsp.options[sCsp.selectedIndex];
	var cspValue = cspOption.value;

    if (!cspValue.endsWith("/") ) {
        cspValue += "/";
    }

    cspOption.cities = (cspOption.cities) ? cspOption.cities : document.cities[sCsp.selectedIndex];//	fallback for mac ie

	//	error check for state value, not necessary as city is disabled if state == ""
	if (cspValue == "" || !cspOption.cities) {
		disableSearchForm(sCsp.form);
		return;
	}
	enableSearchForm(sCsp.form);

	//	error check
	if (sCity) {} else {
		return;
	}
    
	//	reset select
	sCity.options.length = 0;
	var o = new Option("All", cspValue);
	sCity.options[0] = o;
	//o.value = cspValue;
	//setText(o,"All");
    //  tweak city option display here
	
	for (var i=0; i < cspOption.cities.length; i++) {
            var city = cspOption.cities[i];
	    o = new Option(_escapeCharCode(city.display), cspValue + city.value);
	    sCity.options[sCity.options.length] = o;
	    //o.value = cspValue + city.value;
	    //setText(o, city.display);
            //  tweak city option display here
	}
}

function enableSearchForm(theForm) {
	theForm.notComplete = false;
	for (var i = 0; i < theForm.elements.length; i++) {
		var ele = theForm.elements[i];
		ele.disabled = false;
	}
}

/* the form will not disable if noValidate is true */
function disableSearchForm(theForm) {
	if (theForm.noValidate) {
		theForm.notComplete = false;
		return;
	}
	
	theForm.notComplete = true;
	for (var i = 0; i < theForm.elements.length; i++) {
		var ele = theForm.elements[i];
		if (ele.name == theForm.cspSelectName) {
                    //  cspSelect needs to be enabled all time
		    ele.disabled = false;
		} else {
		    ele.disabled = true;
		}
	}
}

function submitSearch(f) { 
 
     if (f.notComplete) { 
          var msg = "Please select a country or a state."; 
          showMessage(msg, document.getElementById("messageBox")); 
          return false; 
     } 
 
    var s = f.elements[f.citySelectName]; 
    var o = s.options[s.selectedIndex]; 
    var url = "/bestof/goldlist/regions/" + o.value; 
    location = url; 
    return false; 
} 
 
function showMessage(text, container) { 
    if (container) { 
		container.style.display = 'inline';
        container.innerHTML = text; 
    } else { 
        alert(text); 
        return; 
    } 
} 

function removeMessage(container) {
    if (container) {
        //container.innerHTML = '';
		container.style.display = 'none';
    }
}

/* END error messaging */

/* END Gold List Browse By Destination */

/* Widget Open/Close Function */
function toggleBox(widgetId, state) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[widgetId].visibility = state ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(widgetId);
        obj.style.visibility = state ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[widgetId].style.visibility = state ? "visible" : "hidden";
    }
}
/* End of Widget Open/Close Function */


/* 	Where Are, Word Trips Contest Entry Forms
	Move to seperate js file */
	
usaList = new Array("Select your state", "Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming")
usaURL = new Array("", "AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY")

canadaList = new Array("Select your province", "Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland and Labrador","Northwest Territories","Nova Scotia","Nunavuta","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon")
canadaURL = new Array("", "AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT")

otherList = new Array("")
otherURL = new Array("")

function setState()
{
    
	var formObj = document.sweepsForm;
	var formName = formObj.name;
	var listObj = formObj.state;

    var country = formObj.country.options[formObj.country.selectedIndex].value
 var selectedState = "";
    listObj.length = 0;

    if (country == "US")
    {
listObj.disabled = false;        
for (var i = 0; i < usaList.length; i++){
          listObj.options[i] = new Option(usaList[i], usaURL[i]);
        }
    }
    else if (country == "CA")
    {
listObj.disabled = false;        
for (var i = 0; i < canadaList.length; i++){
           listObj.options[i] = new Option(canadaList[i], canadaURL[i]);
        }
    }
    else
    {
        listObj.options[0] = new Option(otherList[0], otherURL[0]);
		listObj.disabled = true;
    }
 var selectedYear = "YYYY";

	 if (selectedYear == "") {
	formObj.yearOfBirth.value = "YYYY";
	}
	else if (selectedYear != "YYYY"){
	formObj.yearOfBirth.value = selectedYear;
	}

 
 if (selectedState != ""){
    for(var i = 0; i < listObj.length; i++){
       if(listObj.options[i].value == ""){
         listObj.options[i].selected = true;
       }
    }
 } else {
  listObj.options[0].selected = true; 
 }

    if (navigator.appVersion.charAt(0) != "5" || navigator.appVersion.indexOf("Mac") != -1)
    {
        if (navigator.appVersion.indexOf("Mac") != -1)
        return;
        if (navigator.appName == "Netscape")
        {
            history.go(0)
        }
    }

}

function clearYYYY(form){
	var fyear = form.yearOfBirth.value;
	
	if(fyear == "YYYY"){
		form.yearOfBirth.value = "";
		return true;
	}
	else
		return true;

}
/* 	END Where Are, Word Trips Contest Entry Forms */

/* nav bar elements */
function gotoEmailAFriend() {
				window.location = "/tools/emailafriend?referringPage=" + escape(location.href);
		}
function gotoPrint(){
				var newLocation = window.location.href;
				if (newLocation.lastIndexOf("/") == newLocation.length - 1)
						newLocation = newLocation.slice(0, -1);
				newLocation += (window.location.search != "" ? "&" : "?");
				newLocation += "print=true";
				window.location = newLocation;
		}
/* END nav bar elements */

/* E-mail A Friend */
/* for slide show */
function gotoEmailAFriendSlideShow() {
				opener.window.location = "/tools/emailafriend?referringPage=" + escape(location.href) +
                                                         "&goBackToPage=" + escape(opener.window.location.href);
				opener.window.focus();
		}
/* END for slide show */

function addRecipient(recipientName, recipientEmail, selectHidden) {

	var recipientNameObj = document.getElementById(recipientName);
	recipientNameObj.style.display = "block";

	var recipientEmailObj = document.getElementById(recipientEmail);
	recipientEmailObj.style.display = "block";

        document.getElementById("recipeForm").elements[selectHidden].value = "true";
}

function deleteRecipient(recipientName, recipientEmail, selectName, selectEmail, selectHidden) {

	var recipientNameObj = document.getElementById(recipientName);	
	recipientNameObj.style.display = "none";
	document.getElementById("recipeForm").elements[selectName].value= "";	

	var recipientEmailObj = document.getElementById(recipientEmail);	
	recipientEmailObj.style.display = "none";
	document.getElementById("recipeForm").elements[selectEmail].value= "";	

        document.getElementById("recipeForm").elements[selectHidden].value = "";
}
/* END E-mail A Friend */

var dartCalls = new Array();
var dartCounter = 0;


/* Widget Open/Close Function */
function toggleBox(widgetId, state) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[widgetId].visibility = state ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(widgetId);
        obj.style.visibility = state ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[widgetId].style.visibility = state ? "visible" : "hidden";
    }
}
/* End of Widget Open/Close Function */


/* Hotel Finder Pulldown */
function showHotels(){
        var location= document.hotel_categories_form.hotel_category.options[document.hotel_categories_form.hotel_category.selectedIndex].value;
        if(location != "")
        {
            window.location.href=location;
        }
}
/* END - Hotel Finder Pulldown */

/* Print page function */
function printpage() {
		window.print();  
	}
/* End Print Page */

/* DOM scripting for map/cities layout */
function alignColumnMaps() {
		var cities=document.getElementById('adg_cities');
		var map=document.getElementById('adg_maps');

		A=cities.offsetHeight;
		B=map.offsetHeight;

		if(B>A) {
			cities.style.height=B;
		}
 }
 
 /* Parses URL Pathname
	Author: Jamie L. Marin, Senior Web Developer
	Date: June !5, 2005
*/

/* Sets varibles for URI pathname and pathname length */
var browserURI = location.pathname;
var uriLength = browserURI.length;

/* Creates Array */
var directories = new Array();

/* Find out indexes of first, next, and last slashes */
var startSlash = browserURI.indexOf('/');
var nextSlash =  browserURI.indexOf('/', startSlash + 1);
var lastSlash = browserURI.lastIndexOf('/');
var slashCount = 0;

/* test for one deep section */ 
if (startSlash == lastSlash)
{
	directories[slashCount] = location.pathname.slice(startSlash + 1);
}


/* Loop to define sections from 1 to N */
while (startSlash != lastSlash || nextSlash != -1)
{
	directories[slashCount] = location.pathname.substring(startSlash + 1,nextSlash);	
	
	if (lastSlash + 1 != uriLength)
		directories[slashCount +1] = browserURI.slice(nextSlash + 1);
		
	startSlash = nextSlash;
	nextSlash =  browserURI.indexOf('/', startSlash + 1);		
	slashCount++;	
}

/* Set User Friendly Variables */
var firstDir = directories[0];
var lastDir = directories[directories.length-1];

/* Slideshow Function */
function slideshowLink(url) { //v3.0
	if (window.opener && !window.opener.closed) {
	opener.location.href = url;
	} else {
	window.open("/", "concierge");
	}
	window.close();
}

function clearAllDropdowns(form){
    for(i=0; i<form.elements.length; i++){
        if(form.elements[i].type.indexOf('select') == 0){
            form.elements[i].selectedIndex = 0;
        }
    }
}

/*
Exit Popup
*/

var noPopFlag = false;
var monitorPage = "/exitpop/exitPopMonitor.html";

// Google|Partner safe - no popup if pathname includes "partner"
var partnerURIpath = location.pathname;
var partnerURI = partnerURIpath.indexOf("partner");

var allcookies = document.cookie;
var stopFlag = allcookies.indexOf("exitpop=");

if (stopFlag == -1 && partnerURI == -1){

    onunload = launchMonitor;

}

function launchMonitor(){
if (!noPopFlag){
var ext = "";
ext = window.open(monitorPage,"ext","toolbar=no,menubar=no,status=no,directories=no,location=no,scrollbars=no,resizable=no,width=1,height=1,left=11000,top=11000,screenX=11000,screenY=11000");
self.focus(); 
}
}

function condenet_noPop(value){ 
noPopFlag = value;
}

function gotoContent() {
    var printLocation = window.location.href;
    var printIndex = printLocation.indexOf('print=true')
    printLocation = printLocation.slice(0,printIndex - 1);
    window.location =printLocation;
}

/* Function ads the AdTest footer if the first directory in the URL is 'ads' */
function adTest() {
	if(firstDir == 'ads') {
		document.write('<div id="adtestFooter"><a href="/ads/">http://www.concierge.com/ads/</a><br><a href="/ads/cntraveler">http://www.concierge.com/ads/cntraveler</a><br><a href="/ads/destination">http://www.concierge.com/ads/destination</a><br><a href="/ads/destination/newyork">http://www.concierge.com/ads/destination/newyork</a><br><a href="/ads/deals">http://www.concierge.com/ads/deals</a><br><a href="/ads/cntraveler/whereareyou">http://www.concierge.com/ads/cntraveler/whereareyou</a><br><a href="/ads/tools/currency">http://www.concierge.com/ads/tools/currency</a><br><a href="/ads/cntraveler/articles/detail?articleId=6010&pageNumber=2">http://www.concierge.com/ads/cntraveler/articles/detail?articleId=6010&pageNumber=2</a><br><a href="/ads/destination/turks_caicos/photos/slideshow?">http://www.concierge.com/ads/destination/turks_caicos/photos/slideshow?</a><br></div>');
	}
}
/* Robert Eilam Function to open and close a list of links or expand a div */
function display(id, alink) {//Get ul id, Get link id
 
var CurrState = document.getElementById(id).style.display;
    
     if(CurrState == "none") {//On click if "Display = none" 
          document.getElementById(id).style.display = "block"; //Set the "Display = block"
          document.getElementById(alink).childNodes[0].nodeValue="close"; //Set the link text to Close
          
          
     } else if (CurrState == "block") {//On click if "Display = block" 
          document.getElementById(id).style.display = "none"; //Set the "Display = none"
          document.getElementById(alink).childNodes[0].nodeValue="more..."; //Set the link text to More 
     }
     
}
/*End of display function */

/*Script to randomize constant spotlight promotions*/
function randImg(num){

var myImages = Array();
var titles = Array();
var blurbs = Array();
var result = Array();
var links = Array();

links[0] = "http://www.eccodomani.com/";
links[1] = "http://www.style.com/promo/vo5/";
links[2] = "http://www.iconoclaststv.com/";
links[3] = "http://www.fashionrocks06.com/";

myImages[0] = "/images/promo/promo_ecco.jpg";
myImages[1] = "/images/promo/promo_v05.jpg";
myImages[2] = "/images/promo/promo_fashionrocks.jpg";
myImages[3] = "/images/promo/promo_goose.jpg";

titles[0] = "Ecco Domani";
titles[1] = "VO5";
titles[2] = "Grey Goose";
titles[3] = "Fashion Rocks";

blurbs[0] = "Liquid Style in action&mdash;meet the 2006 Ecco Domani Fashion Foundation winners and see the future of fashion!";
blurbs[1] = "Win an iPod soundsystem! Vote for the next VO5 Red Hot Rising Star and you could be a winner. Take a listen, the choice is up to you!";
blurbs[2] = "Win a star&ndash;studded getaway to an ICONOCLASTS premiere event and see today&rsquo;s most intriguing and provocative creative leaders. Brought to you by Grey Goose Vodka";
blurbs[3] = "Your backstage pass to the star&mdash;studded night of style and sound&ndash;Get down with Fashion Rocks performers and rock out to today’s hottest new bands.";

result[0] = myImages[num];
result[1] = titles[num];
result[2] = blurbs[num];
result[3] = links[num];

return result;
}
/* End Script to randomize constant spotlight promotions*/
