//
// ACE Rent A Car Members Web Site Common Script
//
function FindForm()
{
    var theForm;
    if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1) {
        theForm = document.Form1;
    } else {
        theForm = document.forms['Form1'];
    }
    return theForm;
}

function FindParentForm()
{
    var theForm;
    if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1) {
        theForm = window.opener.document.Form1;
    } else {
        theForm = window.opener.document.forms['Form1'];
    }
    return theForm;
}

function ShowModal(url, name, height, width)
{
    var theForm = FindForm();
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
        theForm[name] = window.open(url, name,
		    	  	     	        'height=' + height +
			      		            ',width=' + width +
				    		    	',top=' + ((screen.height - height) / 2) +
					    		    ',left=' + ((screen.width - width) / 2));
    } else {
        theForm[name] = window.open(url, name,
		                            'dependent=yes,modal=yes,dialog=yes,minimizable=no' +
				    		        ',height=' + height +
					    		    ',width=' + width +
						    	    ',top=' + (window.screenY + ((window.outerHeight - height) / 2)) +
							        ',left=' + (window.screenX + ((window.outerWidth - width) / 2)));
    }
    theForm[name].focus();
    return false;
}

function ShowCalendar(field)
{
    return ShowModal('/calendar.aspx?target=' + field + '&&value=' +
                      document.getElementById(field).value, field + "_Calendar", 210, 230);
}

function CloseChild(name)
{
    var Field = document.getElementById(name);
    if (typeof (Field) != "undefined") {
        try { Field.close(); } catch (dummy) { }
    }
}

var Editing = false;
