
// Function to open Download Photos Modal Window
//----------------------------------------------------
function OpenDownloadPage(tourID , tour_type) {
//midFrame.Attributes("src") = FramPage.aspx

/*

TODO : hide and redirect 3dvista flash on click then 
// bring it back DHTML window close
document.getElementById("3dvista").style.display = 'none'; 
document.getElementById('3dvista').src = 'blank';
*/

  w = screen.width-200;
  h = screen.height-200;

  win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:"Download High Quality Photos"});
    var destURL = '/dhptools/mPhotoDownload.php?i='+tourID+'&type='+tour_type;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

// Function to open Aerial View
//----------------------------------------------------
//javascript:void(window.open('/dhptools/map.php?id=<?php echo $prop_id; ?>','map','width=600,height=400'));
function OpenAerialView(pid) {
  w = 620;
  h = 420;

  win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:"Aerial View"});
    var destURL = '/dhptools/map?id='+pid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

// Function to open My Bio
//----------------------------------------------------
function OpenMyBio(aid, fname, lname) {
  w = 600;
  h = 400;
	title = 'About '+fname+ ' ' + lname;
  win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});
    var destURL = '/dhptools/mybio?id='+aid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}


// Function to Seller Description
//----------------------------------------------------
function OpenSellerDesc(pid) {
  w = 600;
  h = 400;
  title = 'Seller Description';
  win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});
    var destURL = '/dhptools/sellerDesc?i='+pid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

// Function to Email Agent 
//----------------------------------------------------
function OpenEmailAgent(aid, destName,pid) {
  w = 500;
  h = 400;
  title = 'Email '+destName;

 win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});
    var destURL = '/dhptools/EmailAgent?i='+aid+'&p='+pid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();

}


// Function to mortcalc
//----------------------------------------------------
function OpenMortCalc(price) {
  w = 550;
  h = 290;
  title = 'Mortgage Caclulator';

 win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});
    var destURL = '/dhptools/MortgageCalculator?i='+price;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

function SaveToFavorites(pid){
  w = 430;
  h = 240;
  title = 'Save To My Favorites';
 win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});

    var destURL = '/dhptools/SaveMyFavorites?i='+pid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

// Function to mortcalc
//----------------------------------------------------
function OpenPrint(pid) {
  w = 775;
  h = 300;
  title = 'Print Property';

 win = new Window({className: "alphacube", width:w, height:h, destroyOnClose: true, recenterAuto:false, minimizable:false, maximizable:false, title:title});
    var destURL = '/dhptools/Print?i='+pid;
win.setURL(destURL);
win.showCenter("modal");
WindowCloseKey.init();
}

function flashFunction(str)
{
//alert(str);
	// execute void functions
	if(str.indexOf("void") != -1) { 
	eval(str);
	} 
	
	// btn 6
	else if(str.indexOf("button_6") != -1) { 
	var arbtn = str.split("\|");
	OpenMortCalc(arbtn[1]);
		return(true);
	}
	
	// btn 8
	else if(str.indexOf("button_8") != -1) { 
	var arbtn = str.split("\|");
	OpenDownloadPage(arbtn[1] , arbtn[2]);
	return(true);
	}
	
	// btn 7
	else if(str.indexOf("button_7") != -1) { 
	var arbtn = str.split("\|");
	OpenAerialView(arbtn[1]);
		return(true);
	}
	
	// btn 10
	else if(str.indexOf("button_10") != -1 || str.indexOf("button_email") != -1 ||
				 str.indexOf("right_pane_email") != -1) { 
	var arbtn = str.split("\|");
	OpenEmailAgent(arbtn[1], arbtn[2],arbtn[3]); //OpenAerialView(arbtn[1]);
	return(true);
	}
	
	// print icon btn
	else if(str.indexOf("button_print") != -1 || str.indexOf("button_3") != -1 ) { 
	var arbtn = str.split("\|");
	OpenPrint(arbtn[1]);
		return(true);
	}

	// DHP email tour button (mailto:)
	else if(str.indexOf("button_mailto") != -1 ) { 
	var arbtn = str.split("\|");
	window.location = arbtn[1];
		return(true);
	}

	

}

