// #@(#)vacdetails.js	1.3 15:09:04,09/08/04 (yy/mm/dd)
// SWT-1017 (MJL)
var alertStatus = false;
var alertText = '';

// SWT-1017
// Disable clicking on links etc. in preview mode
function clickHandler(evt) 
{
	if (evt.stopPropagation) 
	{
	        evt.stopPropagation();
	        evt.preventDefault();
	}

	alert(alertText);
	return false;
}

// SWT-1017
function initClickPrevention() 
{
	if(!alertStatus)
	{
		return;
	}

	if (document.layers) 
	{
		window.captureEvents(Event.CLICK);
		window.onclick = clickHandler;
	}
	else if (document.all && !document.getElementById) 
		document.onclick = clickHandler;
	else if (document.all)
		document.attachEvent('onclick', clickHandler);
	else if (document.addEventListener)
		document.addEventListener('click', clickHandler, true);
}

// SWT-1017
function DirectWindow(name)
{
    // toolbar=1  for back/forward buttons with FF & IE6
    // location=1 for back/forward buttons with IE7 
    // status=1   for IE6
    features = "toolbar=1,location=1,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=795,height=500,top=0,left=0,resizable=1";
    myWindow = window.open(name,"my_jobsite_sub_window",features);
    myWindow.focus();
}

// SWT-1017
function jobsite_click_disabled() 
{
	return alertStatus;
}

// SWT-1017 (MJL)
// While the two data elements are probably globally scoped,
// this function is there for use when setting them
function setAlertStatusAndText(theAlertStatus, theAlertText)
{
	if(!isBoolean(theAlertStatus) || !isString(theAlertText))
	{
		return false;
	}

	alertStatus = theAlertStatus;
	alertText = theAlertText;
	return true;
}

// SWT-1017 (MJL)
// A simple type check, just so other code looks nicer
function isBoolean(testValue)
{
	if(testValue && typeof testValue == "boolean")
	{
		return true;
	}
	else
	{
		return false;
	}
}

// SWT-1017 (MJL)
// A simple type check, just so other code looks nicer
function isString(testValue)
{
        if(testValue && typeof testValue == "string")
        {
                return true;
        }
        else
        {
                return false;
        }
}

