
//************************************************************************
//THIS WILL CONTAIN COMMON FUNCTIONS
//************************************************************************

function confirmKeepLogin(element) {
    var confirmText = "If you tick this box then you will no longer need to log in\n" +
		                "when visiting this site from this computer.\n\n" +
		                "You can disable this feature at any time by logging out.\n\n" +
		                "Don't use this option unless you are the only person\nwho has access to this computer.";

    if (element.checked)
        if (!confirm(confirmText))
        element.checked = false;
}


function jsShowModalWindow(url,destinationControl, dialogWidth, dialogHeight)
{
	//open the popup screen
	var retval = window.showModalDialog(url, null,'dialogWidth:' + dialogWidth +'px;dialogHeight:'+ dialogHeight +'px;resizable=1;');

	//check if not null
	if(retval == 0 || (retval !="" && retval !=null))
	{
		document.getElementById(destinationControl).value = retval;
	}
		
}
function jsOpenWindow(url,windowName,settings) {
	var newwindow = window.open(url,windowName,settings);
	newwindow.focus()
}

function JSOpenWindow(url)
{
	window.open(url);
}

function jsEmail(Mail, SiteName)
{
	location.href ="mailto:?subject="+SiteName+"&body="+Mail;
}
var CBModalWindow
function showCBModalWindow(url,destinationControl, dialogWidth, dialogHeight) {
	//open the popup screen
	var CBModalWindow = window.open(url, null,'dialogWidth:' + dialogWidth +'px;dialogHeight:'+ dialogHeight +'px;resizable=1;');

	//check if not null
	if(CBModalWindow == 0 || (CBModalWindow !="" && CBModalWindow !=null))
	{
		document.getElementById(destinationControl).value = CBModalWindow;
	}
}
function checkForModal() {
	if (CBModalWindow!='undefined' && CBModalWindow.closed == false) {
		CBModalWindow.focus();
	}
}

var popupLoginForm = function(formWrapperId) {

    var form = prototypeJs(formWrapperId);
    Modalbox.show(form, { width: 500, title: 'Login', aspnet: true, slideDownDuration: 0.1, slideUpDuration: 0.1 });

}

function InLineTextBoxFocus(textbox, inlineTextbox) {
    var element = prototypeJs(textbox);
    var inlineElement = prototypeJs(inlineTextbox);
    if (element != null && inlineElement != null) {
        if (inlineElement.hasClassName('inLinePlaceHolder')) {
            inlineElement.removeClassName('inLinePlaceHolder');
            element.show();
            element.focus();
            inlineElement.hide();
        }
    }
}

function InLineTextBoxBlur(textbox, inlineTextbox) {
    var element = prototypeJs(textbox);
    var inlineElement = prototypeJs(inlineTextbox);
    if (element != null && inlineElement != null) {
        if (element.value === '') {
            inlineElement.addClassName('inLinePlaceHolder');
            inlineElement.show();
            element.hide();
        }
    }
}

