// common.js
//
// Portions Copyright (c) 2004-2006 Lavitsky Computer Laboratories, Inc. All Rights Reserved.
//
// This file contains Original Code and/or Modifications of Original Code as defined in
// and that are subject to the Lavitsky Computer Laboratories, Inc. Source License Version 1.0
// (the 'License'). You may not use this file except in compliance with the License. Please
// obtain a copy of the License at http://www.lavitsky.com/lclsl/ and read it before using
// this file.
//
// The Original Code and all software distributed under the License are distributed on an
// 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND LCL HEREBY
// DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and limitations under
// the License.

var message=""

function autoIframe(frameId)
{
	try
	{
		frame = document.getElementById(frameId);
		innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
		objToResize = (frame.style) ? frame.style : frame;
		objToResize.height = innerDoc.body.scrollHeight + 10;
	}
    catch(err)
    {
		window.status = err.message;
    }
}

function getexpirydate(nodays)
{
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}
			
function getcookie(cookiename) 
{
	var cookiestring=""+document.cookie;
	var index1=cookiestring.indexOf(cookiename);
	if (index1==-1 || cookiename=="") return "";
	var index2=cookiestring.indexOf(';',index1);
	if (index2==-1) index2=cookiestring.length;
	return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function setcookie(name,value,duration)
{
	cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
	document.cookie=cookiestring;
	if(!getcookie(name))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function gotoPage (URL)
{
	parent.location=URL;
}
			
function changePages (topURL, bottomURL)
{ 
	parent.frmspotlist.location=topURL;
	parent.frmspotdetail.location=bottomURL;
	return false;
}	    
	   

function mykeyhandler(evt) 
{
	bCancel = false;
	
	if (!evt)
	{
		IE = true;
		evt = window.event;
	}
	else
	{
		IE = false;
	}
	
	if (evt)
	{	
		switch (evt.keyCode)
		{
			case 8:
				if (evt.srcElement.type != "text" && evt.srcElement.type != "textarea" && evt.srcElement.type != "password")
				{
					// When backspace is pressed
					bCancel = true;
				}
				break;
			case 78:
				if (evt.ctrlKey)
				{
					// When ctrl is pressed N
					bCancel = true;
				}
				break;
			case 82:
				if (evt.ctrlKey)
				{
					// When ctrl is pressed with R
					bCancel = true;
				}
				break;
			case 116:
				// When F5 is pressed
				bCancel = true;
				break;			
		}
	}
	
	if (bCancel)
	{
		if (IE)
		{
			evt.keyCode = 0;
		}
		evt.cancelBubble = true;
		evt.returnValue = false;
		return false;
	}
	else
	{
		return true;
	}
}

document.onkeydown = mykeyhandler;
javascript:window.history.forward(1);

		
