// ************* FRAME BUSTER *************
// This automatically kills frames if someone has had the 
// audacity to open our site in their frames.
if (parent.frames.length > 0)
{
parent.location.href = location.href;
}


var browser=navigator.userAgent.toLowerCase();
var isFF=((browser.indexOf('mozilla')!=-1) && (browser.indexOf('spoofer')==-1) && (browser.indexOf('compatible')==-1) && (browser.indexOf('opera')==-1) && (browser.indexOf('webtv')==-1) && (browser.indexOf('hotjava')==-1));
var isIE=((browser.indexOf("msie")!=-1) && (browser.indexOf("opera")==-1));
var isOP=(browser.indexOf("opera")!=-1);


// ************* NEW WINDOW *************
// This is used for opening a link in a new window (since we cant use target="_blank" in xhtml)
function jump(sLocation)
{
window.open(sLocation, '_blank');
}

// ************* POPUP WINDOW *************
// This is used for generating a pop-up window
function winPop(sLocation,sWidth,sHeight,sScrollbars)
{
window.open(sLocation, '', 'toolbar=0,resizable=1,scrollbars=' + sScrollbars + ',left=2,top=2,width=' + sWidth + ',height=' + sHeight);
}

// ************* POPUP WINDOW WITH STATUS BAR *************
// This is used for generating a pop-up window
function winPopWithStatus(sLocation,sWidth,sHeight,sScrollbars)
{
window.open(sLocation, '', 'toolbar=0,resizable=1,status=1,scrollbars=' + sScrollbars + ',left=2,top=2,width=' + sWidth + ',height=' + sHeight);
}

// ************* POPUP IMAGE WINDOW *************
// This is used for poping up a window with a large image
// when the user clicks a thumbnail.
function imagePop(imgFile,imgWidth,imgHeight)
{
window.open('/includes/viewimage.asp?page=' + escape(location.href) + '&img=' + imgFile, '', 'toolbar=0,resizable=0,scrollbars=0,left=2,top=2,width=' + imgWidth + ',height=' + imgHeight);
}

// ************* POPUP VR WINDOW *************
// This is used for poping up a window of virtual tours
// when the user clicks a thumbnail.
function vrPop(imgId)
{
window.open('/includes/virtual_tour_view.asp?id=' + imgId, '', 'toolbar=0,resizable=0,scrollbars=0,left=2,top=2,width=490,height=330');
}

// ************* SUBSCRIBER FUNCTIONS *************
// These are used with the email subscriber box.
function submitEmail(){
window.open('','PopUp','resizable=1,scrollbars=1,width=600,height=470'); 
document.getElementById('subscribe').target = 'PopUp';
document.getElementById('subscribe').submit();
}

function clearField(){
if (document.getElementById('subscribe').EAddy.value =='Your email here!')
	 { 
		(document.getElementById('subscribe').EAddy.value ='');
	 }
}
function galleryEmailSubmit(){
window.open('/email_add.asp','PopUp','resizable=0,scrollbars=1,width=500,height=300');
}
SwapMap = 0;

function swapMap(sDirectory){
	if (SwapMap == 0){
	document.images.LocationMap.src = '/images/' + sDirectory + '/map_on.gif';
	SwapMap = 1;
	}else{
	document.images.LocationMap.src = '/images/' + sDirectory + '/map.gif';
	SwapMap = 0;
	}
}

function launchSelfDrive(){
	window.open('/includes/self_drive_virtual_tour.asp','PopUp','resizable=0,scrollbars=0,left=2,top=2,width=750,height=550');
}

function SendWithUrl(sNewLocation)
{window.location.href = sNewLocation + '?page=' + escape(document.location);}  

function CreatePDF(){
	alert('PDF will now be created - this may take a few moments.\nWhen the download box appears, please select "Save" to save the file to your computer.');
}

function CaratTrack(sTrackingId){
	var dd = new Date();
	var ord = Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%10000000;
	var adsfac_image = new Image(1,1);
	adsfac_image.src = 'http://adsfac.net/pct_mx.asp?L='+sTrackingId+'&amp;ref='+escape(top.document.referrer)+'&amp;url='+escape(top.document.URL)+'&amp;ord='+ord;
}


function openflashpopup(el,filepath){
	var flashelementtext = "\<div style\=\"text\-align\:right\; padding\-right\:10px\;\"\>\<a href\=\#\ onclick\=\"closeflashpopup\(this\)\; return false\;\"><img src=\"\/images\/icons\/close.gif\" border\=\"0\" \/\>\<\/a\><\/div\><object classid\=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase\=\"http\:\/\/download\.macromedia\.com\/pub\/shockwave\/cabs\/flash\/swflash\.cab\#version=7\,0\,0\,0\" height\=\"330\" width\=\"409\"\>\<param name\=\"movie\" value\=\"" + filepath + "\" \/\>\<param name\=\"quality\" value\=\"high\" \/\>\<embed height\=\"330\" pluginspage\=\"http:\/\/www\.macromedia\.com\/go\/getflashplayer\" quality\=\"high\" src\=\"" + filepath + "\" type\=\"application\/x-shockwave-flash\" width\=\"409\" \/\>\<\/object\>";
	   		
	el.parentNode.parentNode.getElementsByTagName('div')[0].innerHTML=flashelementtext;
	el.parentNode.parentNode.getElementsByTagName('div')[0].style.display='block';	
}

function closeflashpopup(el) {		
	el.parentNode.parentNode.style.display='';	
	el.parentNode.parentNode.innerHTML='';		
}