// notpad information
function OpenScrollingPopup(URL, width, height) {
	window.self.name = "main";
	var now = new Date();
	var remote = window.open(URL, "popup" + now.getTime(), "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=1,status=1,menubar=0,scrollbars=yes");
}
// ----- END: FOR OPENING GENERAL POPUP WINDOWS -----



// ----- BEGIN: FOR HIDING/SHOWING LAYERS -----
function showLayer(strLayerName) {
	if(document.all)
		document.all[strLayerName].style.display = 'block';
	else if(document.layers)
		document.layers[strLayerName].display = 'block';
}
function hideLayer(strLayerName) {
	if(document.all)
		document.all[strLayerName].style.display = 'none';
	else if(document.layers)
		document.layers[strLayerName].display = 'none';
}
// ----- END: FOR HIDING/SHOWING LAYERS -----



function swapImage(strImgName, strImgSrc) {
	if(document.images)
		document.images[strImgName].src = strImgSrc;
}

 

// ----- BEGIN: FOR GETTING COOKIES -----
function getCookie(strName) {
	var strCookie = document.cookie;
	if(strCookie.length == 0) return '';
	var strValue = '';
	var intStart = strCookie.indexOf(strName + '=');
	if(intStart > -1) {
		intStart += strName.length + 1;
		var intEnd = strCookie.indexOf(';', intStart + 1);
		if(intEnd == -1) intEnd = strCookie.length;
		strValue = strCookie.substring(intStart, intEnd);
	}
	return strValue;
}

function setCookie(strName, strValue, strExp) {
	document.cookie = strName + '=' + strValue
			+ (document.location.hostname == 'www.topnotchaccommodations.com' ? '' : '')
			+ (strExp == '' ? '' : ';expires=' + strExp);
}


function setCookieWithPath(strName, strValue, strPath, strExp) {
	document.cookie = strName + '=' + strValue
			+ (document.location.hostname == 'www.topnotchaccommodations.com' ? '' : '')
			//+ (strPath == '' ? '' : ';path=' + strPath)
			+ (strExp == '' ? '' : ';expires=' + strExp);
}

function deleteCookie(strName) {
	var dtmExp = new Date();
	dtmExp.setTime(dtmExp.getTime() - 3600000); // 1 hr ago
	setCookieWithPath(strName, '', '/', dtmExp.toGMTString())
}
// ----- END: FOR GETTING COOKIES -----










function OpenWindow(page,width,height) { var cal = window.open(page, "popup", "directories=no,resizable=1,height=" + height + ",location=no,menubar=no,scrollbars=yes,status=no,width=" + width + ""); }


function PopUp(URL,Window,w,h,x,y) {
	var popupwin = window.open(URL,Window,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h+",left="+x+",top="+y);
}


//----------------------------------------------------------------------------
// Code to determine the browser and version.
//----------------------------------------------------------------------------


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


// popup help menus
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}



//--------------------------------------------------------------
// rotating images.
//--------------------------------------------------------------

// image fade rotation
//new fadeshow(fadeimages, 500, 333, 1, 7000, 1, "R")  "R" is random , leave blank for not random
var fadeimages=new Array()
fadeimages[0] = ["image/outdoor/PB148505-osk.jpg", "", "","Discover your vacation home away from home"]     
fadeimages[1] = ["image/outdoor/PB148621-osk.jpg", "", "", "Private Pool Vacation Homes in Orlando"]          
fadeimages[2] = ["image/reunion-1/reunionclubbuilding.jpg", "", "","Reconnect on your next Orlando family vacation"] 
fadeimages[3] = ["image/reunion-1/Reunion7405.jpg", "", "","Reserve the vacation home of your choice"]
fadeimages[4] = ["image/indoor/2635guestlamp.jpg", "", "","Find your Orlando vacation getaway"]     
fadeimages[5] = ["image/scroll/2628MasteriPhone.jpg", "", "","Enjoy family fun in an Orlando vacation rental"]  

 
var fadebgcolor = "ffffff"

////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src= 'http://www.topnotchaccommodations.com/' + theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px" alt="'+this.theimages[picindex][3]+'" width=550>'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}


//------------------------------------------------------------------
// rotating images and text
// text on the index page
//-------------------------------------------------------------------

var delay = 7000; //set delay between message change (in miliseconds)
var maxsteps = 40; // number of steps to take to change from start color to endcolor
var stepdelay = 60; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor = new Array(255,255,255); // start color (red, green, blue)
var endcolor = new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();

begintag = '<div style="padding:5px;text-align:center;"><table cellpadding=3 width=350 cellspacing=0 border=0 align=center><tr><td valign=top align=center>'; //set opening tag, such as font declarations

closetag = '</td></tr></td></table></div>';

var scrollerwidth='150px'; //set scroller width
var scrollerheight='150px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////

//var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;

/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length)
    index=0
	var strImage = "";
	
	if (fcontent[index][1].length > 0) {
	     strImage = "<img src=http://www.topnotchaccommodations.com/images/" + fcontent[index][1] + " style=\"border:1px solid #000;\"  hspace=10 alt=\"" + fcontent[index][2] + "\"></td></tr><tr><td valign=top align=center><br>"
        
	 }
	
  if (DOM2){
     
    //document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML= begintag + strImage + fcontent[index][0] + closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML = begintag + strImage + fcontent[index][0] + closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter = setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}




function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function StopFlashMovie()
{
	var flashMovie = getFlashMovieObject("flashmovie1");
	flashMovie.StopPlay();
}


function center(object)
 {
  //object.style.marginLeft = "-" + parseInt(object.offsetWidth / 2) + "px";
  //object.style.marginTop = "-" + parseInt(object.offsetHeight /2 ) + "px";
 }
 
 var loadedvideo;
 var videoplayer;
 function videoBox(videoload,player){
  	var videobox = document.getElementById("videobox");  
	loadedvideo = videoload;
	videoplayer = player;
	document.getElementById("slideshow-box").style.display = "none"; 
	document.getElementById("videobox").style.display = "block"; 

	
	strTablestart = "<table bgcolor=#FFFFFF width=550 height=359 border=0 cellpadding=1 cellspacing=0><tr><td rowspan=3><img src=http://www.topnotchaccommodations.com/images/site/spacer.gif width=1 height=359></td><td><img src=http://www.topnotchaccommodations.com/images/site/spacer.gif width=550 height=1></td></tr><tr><td><a href=javascript:closeVideo();>Close Video</a></td></tr><tr><td  align=center>"

    strTableEnd = "</td></tr></table>"
	
	if (player=="1") {
	document.getElementById("videobox").innerHTML = strTablestart + "<object width=495 height=333 id=flashmovie1><param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"" + videoload + "&autoplay=1\"></param><embed src=\"" + videoload + "&autoplay=1\" type=\"application/x-shockwave-flash\" width=\"495\" height=\"333\"  name=\"flashmovie1\"></embed></object>" + strTableEnd; 


	 } else if (player=="2")  {
	 
	 
document.getElementById("videobox").innerHTML = strTablestart + "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"flashmovie1\" codebase=\"http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab\" width=\"320\" height=\"240\"> <param name=\"movie\" value=\"http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" /> <param name=\"quality\" value=\"high\" /> <param name=\"bgcolor\" value=\"#000000\" /> <param name=\"allowScriptAccess\" value=\"always\" /> <param name=\"allowFullScreen\" value=\"false\" /> <param name=\"flashvars\" value=\"guid=" + videoload + "&environment=&host=www.topnotchaccommodations.com&forcePlay=false&autoPlay=true&autoPlayAudio=true\" /> <embed src=\"http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"320\" height=\"240\" name=\"flashmovie1\" align=\"middle\" play=\"true\" loop=\"false\" quality=\"high\" allowScriptAccess=\"always\" allowFullScreen=\"true\" flashvars=\"guid=" + videoload + "&environment=&host=www.topnotchaccommodations.com&forcePlay=false&autoPlay=true&autoPlayAudio=true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\"> </embed></object>" + strTableEnd;
//document.getElementById("videobox").innerHTML = strTablestart + "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"500\" height=\"333\" id=\"slide\" align=\"middle\">
//<param name=\"allowScriptAccess\" value=\"sameDomain\" />
//<param name=\"movie\" value=\"http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" quality="high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"400\" height=\"300\" name=\"slide\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
//</object>" + strTableEnd;
	 

     } else {
	 
	 document.getElementById("videobox").innerHTML = strTablestart + "<object width=\"400\" height=\"300\" id=\"flashmovie1\"><param name=\"movie\" value=\"/http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" /><embed src=\"/http://www.topnotchaccommodations.com/floridavacation/file/slide.swf\" width=\"400\" height=\"300\" name=\"flashmovie1\"  allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" /></object>" + strTableEnd;
	 
   }

 }

 function closeVideo(){
    videoBox(loadedvideo,3);
	document.getElementById("videobox").style.display = "none"; 
	document.getElementById("slideshow-box").style.display = "block"; 
	document.getElementById("slideshow-box").style.marginTop = "10px";
	//StopFlashMovie();
	
	
 }

 
// httprequest ajax calls
// load page for get gata
	

function wp_HttpRequest( mcfg ) {
	
	var self = this;
	var obj = null;
	var data = null;
	
	var cfg = {
		mode : (mcfg.mode == "dom") ? "dom" : "text",
		autoload : (mcfg.autoload==false)?false:true,
		url : mcfg.url ? mcfg.url : "",
		parameters : mcfg.parameters ? mcfg.parameters : "",
		method : (mcfg.method == "post") ? "post" : "get",
		form : mcfg.form ? mcfg.form : "",
		cache : (mcfg.cache==false)?false:true,
		onload : mcfg.onload,
		onerror : mcfg.onerror,
		spanid : mcfg.spanid
	};
	
	// -- debug
	try{var debug = new wp_Log();}catch(e){var debug = new Object();debug.log = function(){};};
	this._function = "wp_HttpRequest";
	this.debug = debug;
	// --
	
	init();
	
	function init() {

		if( cfg["autoload"] && cfg["url"]) {
			createConnection();
			load();
		}
	}
	
	function createConnection() {
	
		if( cfg["mode"] == "dom" ) {
			// -- Loading data as dom structure
			if( document.implementation && document.implementation.createDocument ) {
				obj = document.implementation.createDocument("", "", null);
				obj.onload = onload(); // -- mozilla doesn't support "readystatechange" on this object
			} else if( window.ActiveXObject ) {
				obj = new ActiveXObject("Microsoft.XMLDOM");
			} else {
				// -- no support
				obj = null;
			}
		} else {
			// -- Loading data as text
			if(window.XMLHttpRequest && !(window.ActiveXObject)) {
				obj = new XMLHttpRequest();
			} else if(window.ActiveXObject) {
			
				var ver = new Array("Msxml6","Msxml5","Msxml3","Msxml2","Msxml4","Microsoft");
				var i = 0;
				
				do {
					try {
						obj = new ActiveXObject(ver[i++]+".XMLHTTP");
					} catch(e) {
						obj = null;
					}
				} while( !obj && i<ver.length );
			}
			// --
		}
		
		if( !obj && cfg["onerror"] ) {
			cfg["onerror"]();
		}
		
		if( obj ) {
			obj.onreadystatechange = onstatechange;
		}
	}
	
	// -- public functions ------------------------------
	this.cancel = function() {
		if( obj )
			obj.abort();
	}
	
	function load( location, parameters ) {
		
		location = location ? location : cfg.url;
		
		// -- Kolla så vi har en url...
		if( !location ) {
			return false;
		}
		// --
		
		// -- Har vår url parametrar?
		if( location.indexOf("?") > -1 ) {
			//-- Ja, splitta...
			parameters = location.split("?")[1];
			location = location.split("?")[0];
		} else if( !parameters ) {
			// -- Nej, ladda parametrar från constructor
			parameters = cfg.parameters;
		}
		
		if( !cfg.cache ) {
			if( parameters.length ) {
				parameters += "&";
			}
			parameters += "__wp_nocache=";
			parameters += Math.random();	
		}
		
		debug.log(self,parameters);
		
		if( cfg.mode == "dom" ) {
			obj.load( url );
		} else {			
			createConnection();
			location = location + ((parameters.length) ? ("?" + parameters) : "");
			obj.open("GET", location, true);
			obj.send(null);
		}
	}
	this.load = load;
	
	this.submit = function( form, field, action ) {
	
		form = form ? form : cfg.form;
		var parameters = null;
		var data = "";
		
		// -- Försök skapa wp_Form objekt
		var wpform = null;
		
		debug.log(self,"trying to create wp_Form with: "+form);
		
		try {
			wpform = new wp_Form({ id : form });
		} catch( err ) {
			// -- wp_Form.js verkar inte finnas...
			debug.log(self,"FATAL: wp_Form missing...");
		}
		// --
		
		// -- Finns det något formulär att skicka?
		if( !wpform || !form || (field && !document[form][field]) ) {
		
			if( cfg.onerror ) {
				cfg.onerror();
			}
			return;
		}
		// --
		
		// -- bestäm action --
		action = action ? action : cfg.action;
		action = action ? action : document.getElementById(form).action;
		action = action ? action : "/";
		// --
		
		// -- skicka hela formuläret eller endast ett fält?
		if( field ) {
			parameters = wpform.collect( field );
		} else {
			parameters = wpform.collect();
		}
		// --
		
		// -- Bygg...
		for( param in parameters ) {
			if( typeof parameters[param] != "function" ) {
				
				if( data ) {
					data += "&";
				}
				
				if( typeof parameters[param] == "string" ) {
					data += (param + "=" + escape( parameters[param] ));
				} else {
					for( var count = 0; count < parameters[param].length; count++ ) {
						if( data && count ) {
							data += "&";
						}
						data += (param + "=" + escape( parameters[param][count] ));
					}
				}
			}
		}
		
		if( !cfg.cache ) {
			if( data.length ) {
				data += "&";
			}
			data += "__wp_nocache=";
			data += Math.random();	
		}
		
		debug.log(self,"data: "+data);
		// --
		
		// -- posta --
		debug.log(self,"Posting " + data.length + " bytes of data to: "+action);
		
		createConnection();
		obj.open("POST", action, true);
		obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		obj.setRequestHeader("Content-length", data.length);
		obj.setRequestHeader("Connection", "close");
		obj.send( data );
		// --
	};
	// --------------------------------------------------
	
	// -- event functions -------------------------------
	function onstatechange() {
	
		if( cfg["onstatechange"] ) {
			cfg["onstatechange"]( obj.readyState );
		}
		
		if(obj.readyState == 4) {
			onload();
		}
	}
	
	function onload() {
	
		var doc = null;
		
		if( typeof DOMParser == "function" ) {
			var dp = new DOMParser();
			doc = dp.parseFromString( obj.responseText, "text/xml" );
		} else if( window.ActiveXObject ) {
			doc=new ActiveXObject("Microsoft.XMLDOM");
			doc.async="false";
			doc.loadXML(obj.responseText);
		}
		this.dom = doc.documentElement;
		this.text = obj.responseText;
		this.id = cfg["spanid"]
		
		debug.log(self,"Recieving "+this.text.length +" bytes of data");
		
		if( cfg["onload"] ) {
			cfg["onload"]( this );
		}
	}
	// --------------------------------------------------
	
}


function getServerName(){
    var str = window.location.protocol + '//' + window.location.hostname;
	//alert(str)
    return str;
}

function show800Data( obj) {
            var strHtml;
			var strXML = obj.text.toString();
	        document.getElementById(obj.id).innerHTML = strXML;

    } 
	
	
		function abort800( obj ) {
			obj = null;
		}
		

function get800data(strKeyword,id){

		var strURL = "/webservice/getCampaintfnumber.aspx?";
        var url = getServerName() + strURL;
        url += "q=" + strKeyword
		
		
		var get800number = new wp_HttpRequest({
			autoload : false,
			cache : false,
			onload : show800Data,
			onerror : abort800,
			spanid : id
		});
		
		
		get800number.load(url);
		
	
}



// property rollovers

function preloadpropertyImages() {
	if (document.images) {
		p1 = newImage("/images/homes/Reserve_Your_Vacation_Home_o.jpg");
		p2 = newImage("/images/homes/Instant_Quote_Vacation_Home_o.jpg");
		p3 = newImage("/images/homes/Check_Vacation_Dates_o.jpg");
		p4 = newImage("/images/homes/Vacation_Nightly_Rate_o.jpg");
		p5 = newImage("/images/homes/Vacation_Home_Reviews_1_o.jpg");
		p6 = newImage("/images/homes/Send_Home_Friend_o.jpg");
		p7 = newImage("/images/homes/Vacation_Planner_Request_o.jpg");
		p8 = newImage("/images/homes/Property_Contact_Us_o.jpg");
        p9 = newImage("/images/homes/Reserve_Vacation_Now_o.jpg");

	}
}


	
document.write("<scr" + "ipt src=\"http\:\/\/www.topnotchaccommodations.com/js/prototype.js\" type=\"text/javascript\"></sc" + "ript>")
document.write("<scr" + "ipt src=\"http\:\/\/www.topnotchaccommodations.com/js/scriptaculous.js?load=effects\" type=\"text/javascript\"></sc" + "ript>")

/* main page video box (domestic & intl) 
===================================================================== */
var MpVpCurPage = 1;
var MpVpLock = false;
function MpVpBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * MpVpNext() and MpVpPrev()
 * are called from previous and next buttons
 */
function MpVpNext( lnk ) {
	MpVpBlur( lnk );
	if((MpVpCurPage < 2)&&(!MpVpLock)) {  // change this to 3
		MpVpSlideLeft();
	}
}

function MpVpPrev( lnk ) {
	MpVpBlur( lnk );
	if((MpVpCurPage > 1)&&(!MpVpLock)) {
		MpVpSlideRight();
	}
}

/*
 * MpVpPage( intPage )
 * called from clicking on gray dot icon
 */
function MpVpPage( intPage, lnk ) {
	MpVpBlur( lnk );
	if((MpVpCurPage != intPage)&&(!MpVpLock)) {
		if(MpVpCurPage < intPage) {
			if((intPage - MpVpCurPage) > 1) {
				MpVpSlideDoubleLeft();
			}
			else {
				MpVpSlideLeft();
			}
		}
		else {
			if((MpVpCurPage - intPage) > 1) {
				MpVpSlideDoubleRight();
			}
			else {
				MpVpSlideRight();
			}
		}
	}
}

function LockMpVp( intDur ) {
	var LockDur = intDur * 100;
	MpVpLock = true;
	setTimeout(function() { MpVpLock = false; },LockDur);
}
function MpVpSlideLeft() {
	LockMpVp(3);
	new Effect.MoveBy( 'MpVidCtnt0', 0, -540 , {duration: 0.3} );
	new Effect.MoveBy( 'MpVidCtnt1', 0, -540 , {duration: 0.3} );
	//new Effect.MoveBy( 'MpVidCtnt2', 0, -336 , {duration: 0.3} );
	MpVpCurPage++;
	MpVpUpdateBtns();
}

function MpVpSlideDoubleLeft() {
	LockMpVp(6);
	new Effect.MoveBy( 'MpVidCtnt0', 0, -1100 , {duration: 0.6} );
	new Effect.MoveBy( 'MpVidCtnt1', 0, -1100 , {duration: 0.6} );
	//new Effect.MoveBy( 'MpVidCtnt2', 0, -672 , {duration: 0.6} );
	MpVpCurPage++;
	MpVpCurPage++;
	MpVpUpdateBtns();
}

function MpVpSlideRight() {
	LockMpVp(3);
	new Effect.MoveBy( 'MpVidCtnt0', 0, 540 , {duration: 0.3} );
	new Effect.MoveBy( 'MpVidCtnt1', 0, 540 , {duration: 0.3} );
	//new Effect.MoveBy( 'MpVidCtnt2', 0, 336 , {duration: 0.3} );
	MpVpCurPage--;
	MpVpUpdateBtns();
}

function MpVpSlideDoubleRight() {
	LockMpVp(6);
	new Effect.MoveBy( 'MpVidCtnt0', 0, 540 , {duration: 0.6} );
	new Effect.MoveBy( 'MpVidCtnt1', 0, 540 , {duration: 0.6} );
	//new Effect.MoveBy( 'MpVidCtnt2', 0, 672 , {duration: 0.6} );
	MpVpCurPage--;
	MpVpCurPage--;
	MpVpUpdateBtns();
}


function MpVpUpdateBtns() {
	if(MpVpCurPage > 1) {
		$('v_right_arrow').style.cursor ='default';
		$('v_right_arrow').src = 'http://www.topnotchaccommodations.com/images/site/spacer.gif';

	}
	else {
		$('v_right_arrow').style.cursor ='default';
		$('v_right_arrow').src = 'http://www.topnotchaccommodations.com/images/new/v_image_right.gif';
		$('v_right_arrow').onmouseover = function() {}
		$('v_right_arrow').onmouseout = function() {}
	}

	if(MpVpCurPage < 2) {
		$('v_right_arrow').style.cursor ='default';
		$('v_right_arrow').src = 'http://www.topnotchaccommodations.com/images/new/v_image_right.gif';

	}
	else {
		$('v_right_arrow').style.cursor ='default';
		$('v_right_arrow').src = 'http://www.topnotchaccommodations.com/images/site/spacer.gif';

	}
}
/* end main page video box
===================================================================== */


function allDigits(str)
{
	return inValidCharSet(str,"-.0123456789");
}


function allNumbers(str)
{
	return inValidCharSet(str,"0123456789");
}
function allDigits_positive(str)
{
	return inValidCharSet(str,".0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

function validRequired(formField)
{
	var result = true;
	
	if (formField.value == "")
	{
		result = false;
	}
	
	return result;
}

	  
	  
function validPositiveNum(formField)
{
	var result = true;

	if (!validRequired(formField))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits_positive(formField.value))
 		{	
			result = false;
		}
	} 
	
	return result;
}
	
	
function validNum(formField)
{
	var result = true;

	if (!validRequired(formField))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{	
			result = false;
		}
	} 
	
	return result;
}



function validcardnumber(strOrig) {
	if(strOrig.length==0) return false;

	var strChar;
	var strValidChars = "1234567890*";
	for (var i = 0; i < strOrig.length; i++) {
		strChar = strOrig.substring(i, i+1);
		if (strValidChars.indexOf(strChar, 0) == -1)
			return false;
	}
	return true;
}


function showhide (show,hide) 
{
	show_obj = document.getElementById(show);
	hide_obj = document.getElementById(hide);
		
	show_obj.style.display = "block";
	hide_obj.style.display = "none";
}
 
function showhide1 (show,hide)
{
        show_obj = document.getElementById(show);
        hide_obj = document.getElementById(hide);

        show_obj.style.display = "";
        hide_obj.style.display = "none";
}
function httpOnLoad() {
		
			if (location.href.substr(0,5).toLowerCase() == 'http:')  {
					var str = window.location.href;
			    	window.location.href = str.replace("http:","http:");
			}
}
	
	
// --------------------------------------------------------
// index search
// --------------------------------------------------------
// --------------------------------------------------------
// set the java calendar
// --------------------------------------------------------
if (document.getElementById('txtStartDate') != null) {
document.getElementById('txtStartDate').focus()

var javaCalendar = (window.JavaCalendar) ? new JavaCalendar() : "NoJS";
function javaCalendarButtonElementClick(b, v, l, params, stayOpen){
 if(javaCalendar){
 	javaCalendar.stayOpen = stayOpen; javaCalendar.showPopUp(b, v, l, params);
 }
 
 	}
 }
 


function changebeds(){

StyleIndex = document.SearchSet2.Style.selectedIndex;
if (StyleIndex == 0) {
NewBed = new Array;
NewBed[0] = new Option('All','0'); 
NewBed[1] = new Option('2','2'); 
NewBed[2] = new Option('3','3'); 
NewBed[3] = new Option('4','4'); 
NewBed[4] = new Option('5','5');  
NewBed[5] = new Option('6','6'); 
NewBed[6] = new Option('7','7'); 

} else if (StyleIndex == 4) { // 4
NewBed = new Array;
NewBed[0] = new Option('All','0');  
NewBed[1] = new Option('2','2'); 
NewBed[2] = new Option('3','3'); 

} else if (StyleIndex == 5) { // 4
NewBed = new Array;
NewBed[0] = new Option('All','0');  
NewBed[1] = new Option('2','2'); 
NewBed[2] = new Option('3','3');

} else {  

NewBed = new Array;
NewBed[0] = new Option('All','0'); 
NewBed[1] = new Option('2','2'); 
NewBed[2] = new Option('3','3'); 
NewBed[3] = new Option('4','4'); 
NewBed[4] = new Option('5','5');  
NewBed[5] = new Option('6','6'); 
NewBed[6] = new Option('7','7'); 

}


bedsearch = document.SearchSet2.Bed_select.options.length;

	for (i=bedsearch; i > 0; i--) {
		document.SearchSet2.Bed_select.options[i] = null;
	}


	for (i=0; i < NewBed.length; i++) {
		document.SearchSet2.Bed_select.options[i] = NewBed[i];
	}


}
// --------------------------------------------------------
// end index search
// --------------------------------------------------------
// search ajax
function getServerName(){
    var str = window.location.protocol + '//' + window.location.hostname;
	//alert(str)
    return str;
}
function getSelectedCheckbox(buttonGroup) {
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { 
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            retArr.length = lastElement;
            retArr[lastElement] = i;
            lastElement++;
         }
      }
   } else { 
      if (buttonGroup.checked) { 
         retArr.length = lastElement;
         retArr[lastElement] = 0; 
      }
   }
   return retArr;
} 
function getSelectedCheckboxValue(buttonGroup) {
   var retArr = new Array(); 
   var selectedItems = getSelectedCheckbox(buttonGroup);
   if (selectedItems.length != 0) { 
      retArr.length = selectedItems.length;
      for (var i=0; i<selectedItems.length; i++) {
         if (buttonGroup[selectedItems[i]]) { 
            retArr[i] = buttonGroup[selectedItems[i]].value;
         } else {
            retArr[i] = buttonGroup.value;
         }
      }
   }
   return retArr;
} 

function checksearchform(){
var checkBoxArr = getSelectedCheckboxValue(document.Search_xml.PageDataID);
if (checkBoxArr.length == 0) { 

		alert("No Properties were selected. Please select up to 3 properties if available."); 
		return false;
		
	} else if (checkBoxArr.length == 1) {
	
	    alert("Sorry you cannot compare homes if there is only one property"); 
	    return false;
	
	} else if (checkBoxArr.length > 3) {
	
	    alert("You have sleceted more then 3 properties. Please remove one"); 
	    return false;
}
}


function showData( obj ) {
            var strHtml;
			var strXML = obj.text.toString();
            strHtml = strXML; 
			//strHtml += ("</td></tr><tr><td align='right'>Select two or three vacation homes to compare amenities <input type='submit' value='Compare Vacation Homes' class=bungreenGoBtn></td></tr></table></form>"); 
			 document.getElementById('loadingData').innerHTML = '';
			 document.getElementById('propertylist').innerHTML = strHtml;

    } 
	
	
		
		function abort( obj ) {
			document.getElementById('loadingData').innerHTML = '';
			document.getElementById('propertylist').innerHTML = "Sorry, Could not finish your query, please try again";
			
			obj = null;
		}
		
		var get = new wp_HttpRequest({
			autoload : false,
			cache : false,
			onload : showData,
			onerror : abort
		});
		
		
var oInterval="";
function fnStopInterval() {
 if(oInterval!="") {
   window.clearInterval(oInterval);
   oInterval="";
 }
}
function CompareChange(){
 	document.getElementById('loadingData').innerHTML = "";
 	fnStopInterval();
 	oInterval=window.setInterval("fnRecycle()",2000);
}
function fnRecycle(){
    fnStopInterval();
    CompareChange_start();
 }
 
var spinningimage = newImage("http://www.topnotchaccommodations.com/images/site/loading.gif");

function CompareChange_start(orderby)
{
document.getElementById('loadingData').innerHTML = "<div class='loadingText'><img src='http://www.topnotchaccommodations.com/floridavacation/file/loading.gif' align=absmiddle> loading New Data</div>";
var formObj = document.AvailSearchX
var strURL = "/inc/availproperties.aspx?"
var url = getServerName() + strURL;
url += seturl;
var selectedBeds = formObj.Bed.options[formObj.Bed.options.selectedIndex].value;
url += "&bed=" + selectedBeds
var selectedbath = formObj.Bath.options[formObj.Bath.options.selectedIndex].value;
url += "&bath=" + selectedbath
url += "&arrivaldate=" + searchdatearrival;
url += "&departuredate=" + searchdatedeparture
var selectedMasterBedrooms = formObj.MasterBedrooms.options[formObj.MasterBedrooms.options.selectedIndex].value;
url += "&masters=" + selectedMasterBedrooms
var selectedExecutive;
if (formObj.Executive.checked) {selectedExecutive = "Yes"};
url += "&Executive=" + selectedExecutive;
var selectedResort;
if (formObj.Resort.checked) {selectedResort = "Yes"};
url += "&Resort=" + selectedResort;
var selectedLuxury;
if (formObj.Luxury.checked) {selectedLuxury = "Yes"};
url += "&Luxury=" + selectedLuxury;
var selectedSelect;
if (formObj.Select.checked) {selectedSelect = "Yes"};
url += "&Select=" + selectedSelect;
var selectedTownHomes;
if (formObj.TownHomes.checked) {selectedTownHomes = "Yes"};
url += "&TownHomes=" + selectedTownHomes;
var selectedGameRoom;
if (formObj.GameRoom.checked) {selectedGameRoom = "Yes"};
url += "&GameRoom=" + selectedGameRoom;
var selectedHomeTheatre;
if (formObj.HomeTheatre.checked) {selectedHomeTheatre = "Yes"};
url += "&HomeTheatre=" + selectedHomeTheatre;
var selectedComputer;
if (formObj.Computer.checked) {selectedComputer = "Yes"};
url += "&Computer=" + selectedComputer;
var selectedWirelessInternet;
if (formObj.WirelessInternet.checked) {selectedWirelessInternet = "Yes"};
url += "&WirelessInternet=" + selectedWirelessInternet;
var selectedVideoGame;
if (formObj.VideoGame.checked) {selectedVideoGame = "Yes"};
url += "&VideoGame=" + selectedVideoGame;
var selectedBBQGrill;
if (formObj.BBQGrill.checked) {selectedBBQGrill = "Yes"};
url += "&BBQGrill=" + selectedBBQGrill;
var selectedFormalLivingRoom;
if (formObj.FormalLivingRoom.checked) {selectedFormalLivingRoom = "Yes"};
url += "&FormalLivingRoom=" + selectedFormalLivingRoom;
var selectedFormalDiningRoom;
if (formObj.FormalDiningRoom.checked) {selectedFormalDiningRoom = "Yes"};
url += "&FormalDiningRoom=" + selectedFormalDiningRoom;
var selectedResort_amen;
if (formObj.Resort_amen.checked) {selectedResort_amen = "Yes"};
url += "&Resort_amen=" + selectedResort_amen;
var selectedSteamShower;
if (formObj.SteamShower.checked) {selectedSteamShower = "Yes"};
url += "&SteamShower=" + selectedSteamShower;
var selectedPrice = formObj.price_search.options[formObj.price_search.options.selectedIndex].value;
url += "&price=" + selectedPrice
var selectedsqfeet = formObj.sqfeet.options[formObj.sqfeet.options.selectedIndex].value;
url += "&squarefoot=" + selectedsqfeet
url +="&O=" + orderby
get.load(url);
}

function upperCaseLine(strText) {

	  var words = strText.split(" ");
	  var output;
      for (var i = 0; i < words.length; i++) {
         words[i] = words[i].substr(0, 1).toUpperCase() + words[i].substr(1);
      }
	  output = words.join(" ");
      return output
}
