// common.js

var newWindow = '';
var swImg; 

function comingSoon()
{
	alert("Coming Soon!");
}
function imgPreload()
{
  if (document.images)
  {
    var imgName = imgPreload.arguments[0];
    var cnt;
    swImg[imgName] = new Array;
    for (cnt = 1; cnt < imgPreload.arguments.length; cnt++)
    {
      swImg[imgName][imgPreload.arguments[cnt]] = new Image();
      swImg[imgName][imgPreload.arguments[cnt]].src = imgPreload.arguments[cnt];
    }
  }
}

function imgFind(doc, imgName)
{
  for (var i=0; i < doc.layers.length; i++)
  {
    var img = doc.layers[i].document.images[imgName];
    if (!img) img = imgFind(doc.layers[i], imgName);
    if (img) return img;
  }
  return null;
}

function imgSwap(imgName, imgSrc)
{
  if (document.images)
  {
    var img = document.images[imgName];
    if (!img) img = imgFind(document, imgName);
    if (img) img.src = imgSrc;
  }
}

function openPhotoGalleryWindow(photoFile) 
{
    url = "photoGallery/" + photoFile;
    window.open(url, 'photoGallery', 'width=1000,height=950,left=20,top=20,scrollbars=no,menubar=no, resizable=no,location=no,toolbar=no');

	if (!newWindow.closed && newWindow.location)
	{
		newWindow.location.href = url;
	}
	else
	{
		newWindow=window.open(url,'photoGallery', 'width=1000,height=950,left=20,top=20,scrollbars=no,menubar=no, resizable=no,location=no,toolbar=no');
		if (!newWindow.opener) 
		{
		newWindow.opener = self;
		}
	}
	if (window.focus) 
	{
	    newWindow.focus()
	}
}

function openVirtualTourWindow(url,target)
{
    window.open(url, target, 'width=1000,height=950,left=20,top=20,scrollbars=no,menubar=no, resizable=no,location=no,toolbar=no');

	if (!newWindow.closed && newWindow.location)
	{
		newWindow.location.href = url;
	}
	else
	{
		newWindow=window.open(url,target, 'width=1000,height=950,left=20,top=20,scrollbars=no,menubar=no, resizable=no,location=no,toolbar=no');
		if (!newWindow.opener) 
		{
		newWindow.opener = self;
		}
	}
	if (window.focus) 
	{
	    newWindow.focus()
	}
}

function preloadNavigationImages()
{
    swImg=new Array;
    imgPreload('HOME_ROLLOVER', 
               'image/parsonage/home_on.gif', 
               'image/parsonage/home_off.gif');
    imgPreload('FEATURES_ROLLOVER', 
               'image/parsonage/features_on.gif', 
               'image/parsonage/features_off.gif');
    imgPreload('LOCATION_ROLLOVER', 
               'image/parsonage/location_on.gif', 
               'image/parsonage/location_off.gif');
    imgPreload('AVAILABILITY_ROLLOVER', 
               'image/parsonage/availability_on.gif', 
               'image/parsonage/availability_off.gif');
    imgPreload('RATES_ROLLOVER', 
               'image/parsonage/rates_on.gif', 
               'image/parsonage/rates_off.gif');
    imgPreload('CONTACT_ROLLOVER', 
               'image/parsonage/contact_on.gif', 
               'image/parsonage/contact_off.gif');
    imgPreload('PHOTO_GALLERY_ROLLOVER', 
               'image/parsonage/photoGallery_on.gif', 
               'image/parsonage/photoGallery_off.gif');
    imgPreload('VIRTUAL_TOUR_ROLLOVER', 
               'image/parsonage/virtualTour_on.gif', 
               'image/parsonage/virtualTour_off.gif');
    imgPreload('LINKS_ROLLOVER', 
               'image/parsonage/links_on.gif', 
               'image/parsonage/links_off.gif');
    imgPreload('HOME_PORTAL_ROLLOVER', 
               'image/parsonage/homePortal_fish_on.gif', 
               'image/parsonage/homePortal_fish_off.gif');
    imgPreload('EMAIL_ROLLOVER', 
               'image/parsonage/email_fish_on.gif', 
               'image/parsonage/email_fish_off.gif');
    imgPreload('SITE_MAP_ROLLOVER', 
               'image/parsonage/siteMap_fish_on.gif', 
               'image/parsonage/siteMap_fish_off.gif');
}
