
function GetLeftPointForCenter(width)
{
    return (screen.availWidth - width) / 2;
}

function GetTopPointForCenter(height)
{
    return (screen.availHeight - height - 100) / 2;
}

function windowOpenCenter(url, width, height, options)
{
    var leftPoint = GetLeftPointForCenter(width);
    var topPoint = GetTopPointForCenter(height);
	if (options)
	{
	    windowprops = "height=" + height + ",width=" + width + "," + options + ",left=" + leftPoint + ",top=" + topPoint;
	}
	else
	{
	    windowprops = "height=" + height + ",width=" + width + ",location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,left=" + leftPoint + ",top=" + topPoint;
	}
	OpenWindowAndFocus(url, "center", windowprops);
}

function windowOpenDRV(url)
{
	windowprops = "height=600,width=800,location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenFAA(url)
{
	windowprops = "height=500,width=534,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenP3P(url)
{
	windowprops = "height=500,width=534,location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenServiceCenters(url)
{
	windowprops = "height=700,width=530,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenFAAPrint(url)
{
	windowprops = "height=500,width=549,location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenFAAEmail(url)
{
    var width = 550;
    var height = 625;
    var leftPoint = GetLeftPointForCenter(width);
    var topPoint = GetTopPointForCenter(height);

	windowprops = "height=" + height + ",width=" + width + ",location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,left=" + leftPoint + ",top=" + topPoint;
	OpenWindowAndFocus(url, "Email", windowprops);
}

function windowOpenFAAInfo(url)
{
    var width = 550;
    var height = 625;
    var leftPoint = GetLeftPointForCenter(width);
    var topPoint = GetTopPointForCenter(height);
	windowprops = "height=" + height + ",width=" + width + ",location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,left=" + leftPoint + ",top=" + topPoint;
	OpenWindowAndFocus(url, "Info", windowprops);
}

function windowOpenVeriSign(url)
{
	windowprops = "height=542,width=554,location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=yes,left=90,top=10";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenCQAR(url)
{
	var w = "792";
	var h = 528;
	
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var args = 'status=yes, resizable=yes, scrollbars=yes,height='+h+',width='+w+',top='+wint+',left='+winl	
	OpenWindowAndFocus( url, 0, args );
}

function windowOpenMap(url)
{
	var height = 800;
	var width = 774;
	var availHeight = screen.availHeight;
	var availWidth = screen.availWidth;
	if (height > availHeight)
	{
		height = availHeight;
	}
	if (width > availWidth)
	{
		width = availWidth;
	}
	
	var x = (availWidth - width) / 2;
	var y = (availHeight - height - 100) / 2;
	
	if (y < 0)
	{
		y = 0;
	}
	
	var properties = "left=" + x + ", top=" + y + ", height=" + height + ", width=" + width + ", menubar=yes, statusbar=no, toolbar=yes, resizable=yes, scrollbars=yes";
	OpenWindowAndFocus(url, "Map", properties);
}

function windowOpenWindshield(url)
{
	windowprops = "height=245,width=237,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=yes,left=90,top=90";
	OpenWindowAndFocus(url, "Popup", windowprops);
}

function windowOpenLinkToPage(url)
{
	windowprops = "height=542,width=554,scrollbars=yes,menubar=no,toolbar=no,resizable=no";
	OpenWindowAndFocus(url, "LinkToPage", windowprops);
}

function windowOpenEmailAFriend(url)
{
	windowprops = "height=542,width=554,scrollbars=no,menubar=no,toolbar=no,resizable=no";
	OpenWindowAndFocus(url, "EmailAFriend", windowprops);
}

function OpenWindowAndFocus(url, name, properties)
{
	var win = window.open(url, name, properties);
	if (win)
	{
		win.focus();
	}
}

function ProcessCloseWindow()
{
	window.opener.focus();
	self.close();
}

function SendParentWindowToUrl(goToUrl)
{
	if(window.opener && window.opener.opener)
	{
		window.opener.opener.location = goToUrl;
		window.opener.opener.focus();
		self.close();
		return;
	}
	else if(window.opener)
	{
		window.opener.location = goToUrl;
		window.opener.focus();	
	}
	else
	{
		window.open(goToUrl);
	}
	self.close();
}

function windowOpenRssBlog(url, width, height)
{
	windowprops = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width="+width+",height="+height+",left = 385,top = 182";
	OpenWindowAndFocus(url, "", windowprops);
}

