



/////////// BROWSER DETAILS //////////////
var browser = new Array();
browser["name"];
browser["version"];

var browserDims = new Array();



window.onload = function(){

	browserDimensions = getBrowserSize();
	userBrowser = detectBrowser();
	
	//setDivHeight();
	
	if(userBrowser.name == 'Apple Computer, Inc.'){
		
		
		if(document.getElementById("googleFrame")){
			document.getElementById("googleFrame").style.width = "530px";
			document.getElementById("googleFrame").style.height = "440px";
		}
		if(document.getElementById("googleMapFrame")){
			document.getElementById("googleMapFrame").style.padding = "5px";
		}
		
		
		
	}

	if(userBrowser.name == 'Netscape'){

		if(document.getElementById("googleFrame")){
			document.getElementById("googleFrame").style.width = "500px";
			document.getElementById("googleFrame").style.height = "420px";
		}
		if(document.getElementById("googleMapFrame")){
			document.getElementById("googleMapFrame").style.padding = "5px";
		}
	}
	
}

function detectBrowser(){
	browser["name"] = navigator.vendor;
	if(browser["name"] == undefined || browser["name"] == ''){
		browser["name"]  = navigator.appName;
	}
	browser["version"]=navigator.appVersion;
	var version=parseFloat(browser["version"]);
	//alert(browser);
	return browser;
}

function getBrowserSize() {

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  browserDims["height"] = myHeight;
  browserDims["width"] = myWidth;

  return browserDims;
}
/////////// END BROWSER DETAILS //////////////




//////////////FUNCTIONS FOR TOP LINKS/////////////
function changeBGOver(elem){
	
	for (i=1; i<=10; i++){
		if(i == elem){
			document.getElementById("topLink"+i).style.background = "url(/images/layout/linkBG_over.jpg)  repeat-x";
		}else{
			document.getElementById("topLink"+i).style.background = "url(/images/layout/linkBG_off.jpg)  repeat-x";
		}
	}

}

function changeBGOut(elem){
	document.getElementById("topLink"+elem).style.background = "url(/images/layout/linkBG_off.jpg)  repeat-x";
}


//////////////END FUNCTIONS FOR TOP LINKS/////////////


///////////////////////////////////////////////////////////////////////////////
///////////////////MODAL WINDOW SCRIPT///////////////////////////////////////////

function showVideo(vidPath,title){
	
	browserDimensions = getBrowserSize();
	//videoWin = null;
	
	//centre the window
	var openLeft = browserDimensions.width / 2 - 200;
	var openTop = browserDimensions.height / 2 + 300;
	
	videoWin = dhtmlmodal.open('productData', 'div', 'modalalertdiv', unescape(title), 'width=480px,height=300px,left='+openLeft+'px,top=100px,resize=0,scrolling=0',"recal");
	
	videoWin.style.zIndex=150;
 	
	videoWin.onclose=function(){
		
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			videoWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
		
		document.getElementById('contentFrame').src = "";
		}
		return true;
	}

	
	
	var vURL = "/views/dsp_noosaVid.cfm?videoPath="+vidPath;

	vbrowser = detectBrowser();
		
		//Added this because of a bug in safari that can't handle obj.src being set
		if (vbrowser.name == "Apple Computer, Inc."){
			videoWin.load('iframe', vURL, '');
			videoWin.frames[0].style.border = "0px";
			videoWin.moveTo("middle", "middle");
			videoWin.setSize(800,640);
			
			
		}
		else {

			document.getElementById('contentFrame').src = vURL;
		}
		
	

}

///////////////////////////////////////////////////////////////////////////////

////////////////////////SEARCH PAGE FUNCTIONS/////////////////////////////////

function changeSearchBG(elem){
	elem.style.background = "#FFFFFF";
}

function restoreSearchBG(elem){
	elem.style.background = "#F3F6F9";
}

function changeSearchPanel(elem){
	elem.style.background = "url(/images/layout/search/searchOn.png)";
}

function restoreSearchPanel(elem){
	elem.style.background = "url(/images/layout/search/searchOff.png)";
}

function changeSearchTab(elem){

	elem.style.color = '#1E3140';
	elem.style.background = "url(/images/layout/search/searchTabOn.png)";
	
}

function restoreSearchTab(elem){
	elem.style.color = '#ffffff';
	elem.style.background = "url(/images/layout/search/searchTabOff.png)";
}

function searchDisplayChange(id){

	//document.getElementById("searchOpener").style.display = 'none';
	//document.getElementById("searchOr").style.display = 'none';
	
	if(id == "searchAll" || id == "searchAllTab"){
		document.getElementById("searchControlAll").style.display = 'block';
		document.getElementById("searchControlBooking").style.display = 'none';
		document.getElementById('searchHeading').src = "/images/layout/accommBooking/accomSearchAll.jpg";
	}
	
	if(id == "searchBookings" || id == "searchBookingTab"){
		document.getElementById("searchControlBooking").style.display = 'block';
		if(document.getElementById("searchControlAll")){
			document.getElementById("searchControlAll").style.display = 'none';
			document.getElementById('searchHeading').src = "/images/layout/accommBooking/accomSearchOnline.jpg";
		}
	}
	if(id == "searchBookings2" || id == "searchBookingTab"){
		document.getElementById("searchControlBooking2").style.display = 'block';
		if(document.getElementById("searchControlAll")){
			document.getElementById("searchControlAll").style.display = 'none';
			document.getElementById('searchHeading').src = "/images/layout/accommBooking/accomSearchOnline.jpg";
		}
	}
}


function updateMapContent(category){

	var location = document.getElementById("location"); 
   	var locationValue = location.options[location.selectedIndex].value; 
	
	var itemType = document.getElementById("type"); 

	if(itemType.options){
   		var itemValue = itemType.options[itemType.selectedIndex].value; 
	}else{
		var itemValue = 0;
	}
//alert("/index.cfm/googlemap/showAllListings/"+locationValue+"/"+itemValue);
   		document.getElementById("googleFrame").src = "/index.cfm/googlemap/showAllListings/"+locationValue+"/"+itemValue+"/"+category;
}


function updateHomeMapContent(){

	var category = document.getElementById("category"); 
   	var categoryValue = category.options[category.selectedIndex].value; 

	var location = document.getElementById("location"); 
   	var locationValue = location.options[location.selectedIndex].value; 
	
	var itemType = document.getElementById("type"); 
	if(itemType){
		if(itemType.options){
	   		var itemValue = itemType.options[itemType.selectedIndex].value; 
		}else{
			var itemValue = 0;
		}
	}else{
		itemValue = 0;
		}
	
	//alert(categoryValue +" - " + locationValue +" - " + itemValue);

   		document.getElementById("googleFrame").src = "/index.cfm/googlemap/showSelectListings/"+locationValue+"/"+itemValue+"/"+categoryValue;
}


function showMapListing(listingID){
		document.getElementById("googleFrame").src = "/index.cfm/googlemap/showListing/"+listingID;

}

///////////////////////////////////////////////////////////////////////////////

//////////////////////// NOOSA GALLERY MODAL WINDOW ///////////////////////////
function showGalleryImage(imageRef,imageDesc,imageHeight, imageWidth){
	
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	var width = imageWidth+20;
	var height = imageHeight+20;

	if (vbrowser.name == "Microsoft Internet Explorer"){
		var modalHeight = imageHeight+24;
	} else {
		var modalHeight = imageHeight+20;
	}

	imageWin = dhtmlmodal.open('galleryImage', 'div', 'modalAlertGalleryDiv', imageDesc, 'border=1px,width='+width+'px,height='+modalHeight+'px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('contentFrame').src = "";
		}
		return true;
	}
	
	var vURL = imageRef;
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', vURL, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('galleryContentFrame').style.width = width+"px";
		document.getElementById('galleryContentFrame').style.height = height+"px";		
		document.getElementById('galleryContentFrame').src = vURL;
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////// SLIDEMENU FOR WEDDIGS CONFERENCE SECTION ////////////////////

function subMenuItem(targetDiv){	
	document.getElementById(targetDiv).style.display = "block";
}
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
/////////////////////// ROOM OVERVIEW SHOW / HIDE /////////////////////////////
///////////////////////////////////////////////////////////////////////////////

function showRoomOverview(roomID){

	if(document.getElementById('roomOverview'+roomID).style.display == "none"){
	
		document.getElementById('plusimg'+roomID).src = "/images/layout/minusimg.jpg";
		document.getElementById('roomOverview'+roomID).style.display = "block";
		
	}else{
	
		document.getElementById('plusimg'+roomID).src = "/images/layout/plusimg_off.jpg";
		document.getElementById('roomOverview'+roomID).style.display = "none";
		
	}

}

///////////////////////////////////////////////////////////////////////////////

function swapImg(elem){
	if(elem.id == "moreInfoImage"){
		if(elem.className == 'moreInfoImage'){
			elem.className = 'moreInfoImageHover';
		}else{
			elem.className = 'moreInfoImage';
		}
	}
	
	if(elem.id == "viewMap"){
		if(elem.className == 'viewMapImage'){
			elem.className = 'viewMapImageHover';
		}else{
			elem.className = 'viewMapImage';
		}
	}
}

//////////////////////////////////////////////////////////////////////////////////

//////////////////////// NOOSA GALLERY MODAL WINDOW ///////////////////////////

function showOperatorDetail(urlParam,listingName){
	
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('operatorDetails', 'div', 'operatorModaldiv', listingName, 'border=1px,width=700px,height=680px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('content').src = "";
		}
		return true;
	}
	
	var vURL = urlParam;
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', vURL, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
	
		document.getElementById('content').src = vURL;
	}
}

///////////////////////////////////////////////////////////////////////////////


//////////////////////// LISTING GOOGLE MAP ///////////////////////////

function showGoogleMap(urlParam,listingName){
	// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('mapDetails', 'div', 'mapModaldiv', listingName + ' - map', 'border=0px,width=680px,height=400px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('mapcontent').src = "";
		}
		return true;
	}
	
	var vURL = urlParam;
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('mapcontent').src = urlParam;
	}
}

///////////////////////////////////////////////////////////////////////////////

function showCancelPolicy(opName){

// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('cancelPolicyDetails', 'div', 'cancelAlert', opName+' - Cancellation Policy', 'border=1px,width=680px,height=215px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('contentFrame').src = "";
		}
		return true;
	}
	
	var vURL = "/views/bookeasy/dsp_cancellation.cfm";
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('contentFrame').src = vURL;
	}
}

////////////////////////////////////////////////////////////////////////////////

function showSecurityNotice(){

// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('securityDetails', 'div', 'securityAlert', 'Security', 'border=1px,width=680px,height=215px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('securityContentFrame').src = "";
		}
		return true;
	}
	
	var vURL = "/views/bookeasy/dsp_security.cfm";
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('securityContentFrame').src = vURL;
	}
}
////////////////////////////////////////////////////////////////////////////////

function showTermsNotice(){

// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('termsDetails', 'div', 'termsAlert', 'Terms & Conditions', 'border=1px,width=680px,height=500px,top=60px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('termsContentFrame').src = "";
		}
		return true;
	}
	
	var vURL = "/views/dsp_termsConditions.html";
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('termsContentFrame').src = vURL;
	}
}

////////////////////////////////////////////////////////////////////////////////


function showHideSearch(){
	if(document.getElementById('searchShowHide').style.display == "none"){
		document.getElementById('searchBut').style.display = "none";
		document.getElementById('searchShowHide').style.display = "block";
	}else{
	document.getElementById('searchShowHide').style.display = "none";
	}
	

}

////////////////////////////////////////////////////////////////////////////////

function setDivHeight(){

var vheight;
var linkBox = document.getElementById('contentLinkBox');
var infoBox = document.getElementById('contentInfoBox');

	if(linkBox.offsetHeight > infoBox.offsetHeight){
		
		//vheight = ((document.getElementById('contentLinkBox').offsetHeight)+'px');
		document.getElementById('contentInfoBox').style.height = ((document.getElementById('contentLinkBox').offsetHeight - 50)+'px');
		
		if(userBrowser.name == "Microsoft Internet Explorer"){
			document.getElementById('contentInfoBox').style.backgroundColor = "#dee5ee";

		}
		
	}else{
		//vheight = ((document.getElementById('contentInfoBox').offsetHeight)+'px');
		document.getElementById('contentLinkBox').style.height =   ((document.getElementById('contentInfoBox').offsetHeight)+'px');

	}
	
	//alert("link box " +document.getElementById('contentLinkBox').offsetHeight+"\n Info Box: " +document.getElementById('contentInfoBox').offsetHeight);
}

////////////////////////////////////////////////////////////////////////////////

function showQuestion(){

// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('anyQuestions', 'div', 'anyQuestionModal', 'Any Questions?', 'border=1px,width=680px,height=400px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('questionContent').src = "";
		}
		return true;
	}
	
	var vURL = "/views/dsp_anyQuestions.cfm";
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('questionContent').src = vURL;
	}
}

////////////////////////////////////////////////////////////////////////////////

function closeVeil(url){
	parent.dhtmlmodal.close(parent.document.getElementById('mapDetails'));
	parent.document.getElementById('interVeil').style.display= "none";
	parent.document.location.href= url;
	
}


function showSearchForm(){
	searchDisplayChange('searchBookings');
	document.location.hash = "searchAgain";
}

function rollOver(elem){

	if(elem.src.indexOf("jpg") > 0){
		fileType = "jpg";
	}else{
		fileType = "png";
	}
	
//alert(elem.src.indexOf("off") );
	if(elem.src.indexOf("off") > 0){
		elem.src = "/images/layout/"+elem.id+"_on."+fileType;
	}else{
		elem.src = "/images/layout/"+elem.id+"_off."+fileType;
	}
}
function rollOverPlus(elem){

	if(elem.src.indexOf("jpg") > 0){
		fileType = "jpg";
	}else{
		fileType = "png";
	}
	
//alert(elem.src.indexOf("off") );

	if(elem.src.indexOf("off") > 0){
		elem.src = "/images/layout/plusimg_on."+fileType;
	}else if (elem.src.indexOf("on") > 0){
		elem.src = "/images/layout/plusimg_off."+fileType;
	}else{
		elem.src = "/images/layout/minusimg.jpg";
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function showMedia(mediaID){


	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	imageWin = dhtmlmodal.open('media', 'div', 'featuredMediaModal', '', 'border=1px,width=780px,height=600px,top=100px,resize=0,scrolling=0,center=1');
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('mediaContent').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('questionContent').src = "";
		}
		return true;
	}
	
	var vURL = "/views/dsp_featuredMedia.cfm?fmdID="+mediaID;
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('mediaContent').src = vURL;
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function flyout(){
	if(document.getElementById('noosaElse').style.display == 'block'){
		document.getElementById('noosaElse').style.display = 'none';
	}else{
		document.getElementById('noosaElse').style.display = 'block';
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function showMFTermsNotice(){
	var vURL = "/mayfiestaComp/termsConditions.html";

	// alert(urlParam);
	browserDimensions = getBrowserSize();
	vbrowser = detectBrowser();

	//imageWin = dhtmlmodal.open('termsDetails', 'div', 'termsAlert', 'Terms & Conditions', 'border=1px,width=680px,height=500px,top=60px,resize=0,scrolling=0,center=1');
	imageWin = dhtmlmodal.open('termsDetails', 'iframe', vURL, 'Ultimate Noosa Mayfiesta 2010 Getaway Competition - Terms & Conditions', 'border=1px,width=680px,height=500px,top=60px,resize=0,scrolling=0,center=1');
	t, contenttype, contentsource, title, attr, recalonload
 	
	imageWin.onclose=function(){
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			imageWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
			document.getElementById('termsContentFrame').src = "";
		}
		return true;
	}
	
	//Added this because of a bug in safari that can't handle obj.src being set
	if (vbrowser.name == "Apple Computer, Inc."){
		alert('hiqq!');

		imageWin.load('iframe', urlParam, '');
		imageWin.frames[0].style.border = "0px";
		imageWin.moveTo("middle", "middle");
		imageWin.setSize(width,height);		
	} else {
		document.getElementById('termsDetailsFrame').src = vURL;
	}
}

////////////////////////////////////////////////////////////////////////////////
