




function openwindow(url,name,height,width, scrollbars) 
{ 
	leftpos = (screen.width/2) - (width/2);
	features = "width=" + width + ",height=" + height + ",left=" + leftpos + ",top=200,scrollbars=" + scrollbars;
	window.open(url,name,features);
}



function openCalendar (controlname)
{
	openwindow('/calendar.aspx?control=' + controlname,'calendar',168,265,'no');
}

function openPostcodeSearch (postcode)
{
	openwindow('/postcodesearch.aspx?postcode=' + postcode.replace(' ',''),'postcodesearch',300,500,'no');
}


function openMap(location)
{
	window.open(location, 'GuernseyMap', 'width=1024, height=768, menubar=yes, scrollbars=no, resizable=yes');
    return false;
}


function openVideo(island)
{
	window.open('/flash/video/' + island + '.html', 'VisitGuernsey_Video', 
		'width=360, height=340, menubar=no, scrollbars=no, resizable=no');
}


function openPostcard(imageid)
{
	window.open('/postcards/display.aspx?id=' + imageid, 'VisitGuernsey_Postcard', 
		'width=550, height=680, menubar=no, scrollbars=yes, resizable=no');
}

function openPanorama(Id)
{
	window.open('/panoramas/display.aspx?id=' + Id, 'VisitGuernsey_Panorama', 
		'width=700, height=394, menubar=no, scrollbars=no, resizable=yes');
}


function openOnlineBooking(location)
{
    window.open(location, 'OnlineBooking', 'width=550, height=600, menubar=no, scrollbars=yes, resizable=yes, status');
    return false;
}

function countSelectedHotels()
{
     var ctl_id_template = "ctl00_ContentPlaceHolder1_dlHotel_ctl{0}_cbCompare";
     var noSelected = 0;
     for(var i = 0; i<150; i++)
     {
        var strnumber = "";
        if(i < 10)
        {
            strnumber = "0" + i;
        }
        else
        {
            strnumber = i.toString();
        }
        var thisCB = document.getElementById(ctl_id_template.replace("{0}", strnumber));
        if(thisCB != null)
        {
            if (thisCB.checked)
            {
                noSelected++;
            }
        }
        else
        {
            break;
        }
     }
     return noSelected;
}

function ShowHideCompare()
{
    var CompareDiv = document.getElementById("GoCompare");
    if(countSelectedHotels() > 1)
    {
        CompareDiv.style.display = "block";
    }
    else
    {
        CompareDiv.style.display = "none";
    }
}

