
/*--------------------------------------------------------
<!-- Original:  Ronnie T. Moore, Editor -->
<!-- Web Site:  The JavaScript Source -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
--------------------------------------------------------*/
closetime = 3; 
/*Close window after __ number of seconds?
0 = do not close, anything else = number of seconds */

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=20,top=20,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup() {
url = "cover.html";
width = 700;
height = 550;
delay = 0; 
timer = setTimeout("Start(url, width, height)", delay*1000);
}

function dir_open(filename)
{
temp = window.open(filename,'top','width=750,height=650,toolbar=0,directories=0,menubar=0,status=0,resizable=yes,location=0,scrollbars=yes,left=10,top=10');temp.focus();
}

function closeWindow() {
        top.close();
}

function full_open(filename)
{
temp = window.open(filename,'top','width=950,height=600,toolbar=0,directories=0,menubar=0,status=0,resizable=yes,location=0,scrollbars=yes,left=0,top=0');temp.focus();
}

function small_open(filename)
{
temp = window.open(filename,'top','width=500,height=400,toolbar=0,directories=0,menubar=0,status=0,resizable=yes,location=0,scrollbars=yes,left=10,top=10');temp.focus();
}




/*-----------------------------------------------
Old scripts from somewhere. Not in use.
-----------------------------------------------*/

/* Browser/platform checkers */
var version = navigator.appVersion.charAt(0);

if (navigator.appName.indexOf('Microsoft') != -1)
{
	var isIE = true;
	var isNS = false;
	var isMoz = false;	
} 
else if ((navigator.appName.indexOf('Netscape') != -1) && (version == 4))
{
		var isNS = true;
		var isIE = false;
		var isMoz = false;		
} 
else if ((navigator.appName.indexOf('Netscape') != -1) && (version == 5))
{
		var isNS = false;
		var isIE = false;
		var isMoz = true;		
}

var isWin = navigator.userAgent.indexOf("Win") != -1;
var isMac = navigator.userAgent.indexOf("Mac") != -1;
var isUnix = navigator.userAgent.indexOf("X11") != -1;

/* Make a combo variable to identify */
var iBPmix = 0;
if (isWin)
{
	if (isIE)
	{
		iBPmix = 1;
	}
	if (isNS)
	{
		iBPmix = 2;
	}
}
if (isMac)
{
	if (isIE)
	{
		iBPmix = 3;
	}
	if (isNS)
	{
		iBPmix = 4;
	}
}
/* Proprietary functions for Goldsmiths */
function sendEmail(shortlistID)
{
	emailURL = '/email.asp';
	if (shortlistID > 0)
	{ emailURL += '?slid=' + shortlistID; }
	window.open(emailURL, 'emailer', 'width=360,height=320,scrolling=no');
}
 /* End proprietary functions */
// Netscape resizing bug fix
function WM_netscapeCssFix() {
  // This part was inspired by Matthew_Baird@wayfarer.com
  // It gets around another unfortunate bug whereby Netscape
  // fires a resize event when the scrollbars pop up. This
  // checks to make sure that the window's available size
  // has actually changed.
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth ||
document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}
function WM_netscapeCssFixCheckIn() {
  // This function checks to make sure the version of Netscape
  // in use contains the bug; if so, it records the window's
  // width and height and sets all resize events to be handled
  // by the WM_netscapeCssFix() function.
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn()
// End NS resizing bug fix

function checkrequired( formname) {

	var pass=0, box=0, theForm;
	theForm = document.forms[formname];

	if (document.images) {
		for (i=0; i < theForm.length; i++) {
			var tempobj=theForm.elements[i];
			if (tempobj.name.substring(0,1) == "*") {
						
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					pass=1;
					break;
	      }
	    } 
		}
		
		if (pass==1) {		
			shortFieldName=tempobj.name.substring(1,30).toUpperCase();
			alert("Please make sure the "+shortFieldName+" field is properly filled in.");
		} else {
			theForm.submit();
		}
	}			
}
function showBig(filename, imgno, sec, page)
{
	var winID = window.open("pic_viewer.asp?file=" + filename + "&imgnum=" + imgno + "&sec=" + sec + "&page=" + page, 'bigpic', 'width=250,height=250,scrollbars=no,resizable=yes,left=80,top=80');
}
function process_imgs_links( img, caption) {
	if (isNS) { // handle NS		
		document.bigimg.src = img;
		document.bigimg.alt = caption;
	} else if (isIE) { //handle IE
		document.bigimg.src = img;				
		document.bigimg.alt = caption;
	} else { // Handle Mozilla				
		document.getElementById("bigimg").src = img;		
		document.getElementById("bigimg").alt = caption;
	}									
}
/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function flashPopUp()
{
	var winID = window.open('tour.asp', 'bigpic', 'width=700,height=410,scrollbars=no,resizable=yes');
}
function bookingPopUp( ref)
{
	var winID = window.open( ref, 'Booking', 'width=700,height=410,scrollbars=yes,resizable=yes');
}