/*	
--------------------------------------------------------------------------------
Name:		openWindow.js
Revision:	
2000-10-04	Henrik Engqvist		Created
2005-05-17  Daniel Joelsson     Updated - included strEqpPickedPrice in function OpenSummary
2009-08-26  Magnus Svensson     Updated - changed the window.open-attribute resizable from no to yes in function 
                                          openWindow	
--------------------------------------------------------------------------------
FUNCTIONS

openWindow(url, name, width, height)

Purpose:	Function used to open a new browser window in the center of the
			screen

Arguments:	url				location of page displayed in new window
			name			name of new window
			winWidth		new window width
			winHeight		new window height
--------------------------------------------------------------------------------					
*/


function openWindow(url, name, winWidth, winHeight) {
	var scrWidth = screen.availWidth;
	var scrHeight = screen.availHeight;

	var xpos = Math.ceil((scrWidth-winWidth)/2);
	var ypos = Math.ceil(30*(scrHeight-winHeight)/100);

	if (xpos < 0) xpos = 0;
	if (ypos < 0) ypos = 0;

	var attr = "toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no,width=" + winWidth + ",height=" + winHeight + ",left=" + xpos + ",top=" + ypos;

	var newWindow = window.open (url, name, attr);
	newWindow.focus();
}

function OpenSummary(intConfigID, intModelID, intPaintID, intUpholsteryID, strEquipmentID, strEquipmentTypeID, strEqpPickedPrice) {
  	var intLeft = (window.screen.width / 2)  - 325;

	switch (window.screen.height) {
		case 480 : var intHeight = 360; break;
		case 600 : var intHeight = 480; break;
		case 768 : var intHeight = 640; break;
		default : var intHeight = 640; break;
	}

	if (intConfigID<0) intConfigID = 0;
	if (intModelID<0) intModelID = 0
	if (intPaintID<0) intPaintID = 0
	if (intUpholsteryID<0) intUpholsteryID = 0

	var url = '../summary/summary.asp?configid=' + intConfigID + '&modelid=' + intModelID + '&paintid=' + intPaintID + '&upholsteryid=' + intUpholsteryID + '&equipid=' + strEquipmentID + '&equiptype=' + strEquipmentTypeID + '&equipprice=' + strEqpPickedPrice;
	var name = 'winSummary';
	var attr = 'toolbar=no,menubar=yes,scrollbars=yes,resizable=no,location=no,directories=no,status=no,width=667,height=500,left=' + intLeft + ',top=10';

	var objSummary = window.open(url, name, attr);
}

function OpenSummaryAF(intConfigID, intModelID, intPaintID, intUpholsteryID, strEquipmentID, strEquipmentCatID, strEquipmentTypeID) {
  	var intLeft = (window.screen.width / 2)  - 325;

	switch (window.screen.height) {
		case 480 : var intHeight = 360; break;
		case 600 : var intHeight = 480; break;
		case 768 : var intHeight = 640; break;
		default : var intHeight = 640; break;
	}

	if (intConfigID<0) intConfigID = 0
	if (intModelID<0) intModelID = 0
	if (intPaintID<0) intPaintID = 0
	if (intUpholsteryID<0) intUpholsteryID = 0

	var url = '../../../summary/summary.asp?configid=' + intConfigID + '&modelid=' + intModelID + '&paintid=' + intPaintID + '&upholsteryid=' + intUpholsteryID + '&equipid=' + strEquipmentID + '&equipcat=' + strEquipmentCatID + '&equiptype=' + strEquipmentTypeID;
	var name = 'winSummary';
	var attr = 'toolbar=no,menubar=yes,scrollbars=yes,resizable=no,location=no,directories=no,status=no,width=667,height=500,left=' + intLeft + ',top=10';

	var objSummary = window.open(url, name, attr);
}

function OpenPriceList(intConfigID, intModelID, intPaintID, intUpholsteryID, strEquipmentID, strEquipmentCatID, strEquipmentTypeID) {
  	var intLeft = (window.screen.width / 2)  - 325;

	switch (window.screen.height) {
		case 480 : var intHeight = 360; break;
		case 600 : var intHeight = 480; break;
		case 768 : var intHeight = 640; break;
		default : var intHeight = 640; break;
	}

	if (intConfigID<0) intConfigID = 0
	if (intModelID<0) intModelID = 0
	if (intPaintID<0) intPaintID = 0
	if (intUpholsteryID<0) intUpholsteryID = 0

	var url = '../PriceList/PriceListInfo.asp?configid=' + intConfigID + '&modelid=' + intModelID + '&paintid=' + intPaintID + '&upholsteryid=' + intUpholsteryID + '&equipid=' + strEquipmentID + '&equipcat=' + strEquipmentCatID + '&equiptype=' + strEquipmentTypeID;
	var name = 'winSummary';
	var attr = 'toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes,width=610,height=657,left=' + intLeft + ',top=10';

	var objSummary = window.open(url, name, attr);
}

