/******************************************************************************
* functions.js								      *
*                                                                             *
* Copyright 2006 by vikarta.com				      *
* Visit http://www.vikarta.com					      *
*                                                                             *
* Provides functions for the website which will work on both Netscape	      *
* Communicator and Internet Explorer browsers (version 5.5 and up).  	      *
*									      *
******************************************************************************/

//-----------------------------------------------------------------------------
// Date Script
//-----------------------------------------------------------------------------

function current_date()
{
var day=new Array();
day[0]="Sunday";day[1]="Monday";day[2]="Tuesday";day[3]="Wednesday";day[4]="Thursday";day[5]="Friday";day[6]="Saturday";
var months=new Array(13);
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="September";
months[9]="October";
months[10]="November";
months[11]="December";
var time=new Date();
var lmonth=months[time.getMonth()];
var tday=day[time.getDay()];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write("<font color='#FFFFFF' face='Verdana, Arial, Helvetica, sans-serif' font-size=10px> <b>"+tday+",&nbsp; "+lmonth+" "+date+",&nbsp; "+year+"</font> </b>");
}

//-----------------------------------------------------------------------------
// VacationRental Newsletter
//-----------------------------------------------------------------------------
function top10Deals()
{
 if (window.document.newsletter.name.value =="") 
 {
 alert("Please make sure Name is not left blank");
 window.document.newsletter.name.focus();
 return (false);
 }
  if (window.document.newsletter.from.value.indexOf('.')=="-1" || window.document.newsletter.from.value.indexOf('@')=="-1") 
 {
 alert("Please enter your Email properly!");
 window.document.newsletter.from.focus();
 return (false);
 }
 return true
}

//-----------------------------------------------------------------------------
// Email,Print and Bookmark
//-----------------------------------------------------------------------------


var selectedFeature = 1;

var printWin;
var fdIndex = 1;
var hIndex = 1;
var curMap = "hotel";

function selectFeature(id)
{
	if (id != selectedFeature)
	{
		document.getElementById("feature"+selectedFeature).className = "";
		document.getElementById("featureLink"+selectedFeature).className = "";
		document.getElementById("feature"+id).className = "selected";
		document.getElementById("featureLink"+id).className = "selected";
		selectedFeature = id;
		document.getElementById("featureContent").scrollTop = 0;
	}
}

function sendToFriend(cityName)
{
	var link = "http://" + window.location.host + window.location.pathname;
	var queryParams = window.location.search.substring(1).split("&");

	if (window.location.search != "")
	{	
		if (queryParams.length > 0)
			link += "?";
			
		for (var i=0; i<queryParams.length; i++){
			if (queryParams[i].indexOf("emlcid") == -1 && queryParams[i].indexOf("fname") == -1){
				if (i > 0) 
					link += "&";
			}
			link += queryParams[i];
		}
	}
	
	var subj = ""
	if (cityName == "")
	{
		subj = "Check out AlwaysOnVacaiton Destinattion Guides";
	}
	else
	{
		subj = "Check out the Destinattion Guides to " +  cityName;
	}
	window.location = "mailto:?subject=" + subj + "&body=" + escape(link);
}

function bookmarkPage()
{
	var url = window.location.href;
	var title = document.title;
	
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
	else
		alert("Your browser doesn't support automatic bookmarking. Please use your browser's Bookmarks menu to bookmark this site.");
}

function printPage()
{
	var url = document.location.href + "&print=1&fdindex=" + fdIndex + "&hindex=" + hIndex + "&map=" + curMap;
	printWin = window.open(url, "printWin", "width=697,height=500,resizable=1,scrollbars=1");
	printWin.focus();
}

function popup(url, width, height, params){
	var winWidth = (width != null) ? width : 685;
	var winHeight = (height != null) ? height : 650;
	var winParams = "width=" + winWidth + ",height=" + winHeight;
	if (params != null){
		winParams += "," + params;
	} else {
		winParams += ",scrollbars=no";
	}
	
	var newWin = window.open(url, "expPop", winParams);
	newWin.focus();
}

function win_open(href, width, height)
{
	if (width == '' && height == '')  
	{
		window.open(href, '_blank', 'toolbar=no,location=no,status=yes,menubar=no,personalbar=no,scrollbars=yes,resizable=yes,screenx=50,left=50,screenY=50,top=50');
	} 
	else
	{
		window.open(href, '_blank', 'toolbar=no,location=no,status=yes,menubar=no,personalbar=no,scrollbars=yes,width=' + width + ',height=' + height + ',resizable=yes,screenx=50,left=50,screenY=50,top=50')
	}
}

function openPage(href) {
	if(href!=""){
		window.open(href, '_blank', 'width="800",height="600",toolbar=yes,location=yes,status=yes,menubar=yes,personalbar=yes,scrollbars=yes,resizable=yes,screenx=50,left=50,screenY=50,top=50');
	}
}

function openFullPage(href) {
	if(href!=""){
		var wOptions = "toolbar=yes,location=yes,status=yes,menubar=yes,personalbar=yes," +
			"scrollbars=yes,resizable=yes,outerHeight=" + screen.availHeight + ",outerWidth=" +
			screen.availWidth + ",screenX=0,screenY=0,height=" + screen.availHeight + ",width=" +
			screen.availWidth + ",left=0,top=0";
		window.open(href, '_blank', wOptions);
	}
}

//-----------------------------------------------------------------------------
// photoSlideshow
//-----------------------------------------------------------------------------

var photos=new Array()
var photoslink=new Array()
//define images. You can have as many as you want:

photos[0]="images/Davenport3BedroomsSleeps6_6.jpg"

photos[1]="images/Davenport3BedroomsSleeps6_2.jpg"

photos[2]="images/Davenport3BedroomsSleeps6_3.jpg"

photos[3]="images/Davenport3BedroomsSleeps6_4.jpg"

photos[4]="images/Davenport3BedroomsSleeps6_5.jpg"

var which=0
//Specify whether images should be linked or not (1=linked)
var linkornot=0
//Set corresponding URLs for above images. Define ONLY if variable linkornot equals "1"
photoslink[0]=""
photoslink[1]=""
photoslink[2]=""
photoslink[3]=""
//do NOT edit pass this line
var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}
function applyeffect(){
if (document.all && document.images.photoslider.filters){
document.images.photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
document.images.photoslider.filters.revealTrans.stop()
document.images.photoslider.filters.revealTrans.apply()
}
}
function playeffect(){
if (document.all && document.images.photoslider.filters)
document.images.photoslider.filters.revealTrans.play()
}
function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}
function backward(){
if (which>0){
which--
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}
function forward(){
if (which<photos.length-1){
which++
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}
function transport(){
window.location=photoslink[which]
}
