// JavaScript Library ShopCard.JS

/*
'***************************************************************************
' Source Code Function Library (SFL)
' Various Functions used in General Search
' Copyright(c) 2001, es promotion, Basel - Switzerland
'
' Revision:
' 01-12-17 viral	Initiale Version
'***************************************************************************
*/

var xleft=0;
var ytop=0;

	
	function OpenProduct(ProdId)
	{
		//This opens a new window displaying the information of the product clicked.
		//This passes product id in ProductsId as querystring.
		window.open("ShowProduct.aspx?ProductsId="+ProdId,'Product','width=500,height=500,resizable=yes,scrollbars=yes,top=5');
	}	

	function OpenInformation(InfoId)
	{
		//This opens a new window displaying the information of the product clicked.
		//This passes product id in ProductsId as querystring.
		window.open("ShowInformation.aspx?InfoId="+InfoId,'Information','width=500,height=500,resizable=yes,scrollbars=yes,top=5');
	}
	
	function OpenProject(ProId)
	{
		var w = 650;
		var h = 600;
		chkMiddleWin(w,h);
	    var PopupWindow=null;
		settings='width='+ w + ',height='+ h + ',top='+ ytop +',left='+ xleft +',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=auto,resizable=yes,dependent=no';
		PopupWindow=window.open("ShowProject.aspx?ProId="+ProId,'Project',settings);
		PopupWindow.focus();
	}

	function OpenMilestone(ProId)
	{
		//This opens a new window displaying the information of the product clicked.
		//This passes product id in ProductsId as querystring.
		window.open("ShowMilestone.aspx?ProId="+ProId,'Milestone','width=500,height=500,resizable=yes,scrollbars=yes,top=5');
	}

	function OpenProjecArchive(ProId)
	{
		//This opens a new window displaying the information of the product clicked.
		//This passes product id in ProductsId as querystring.
		window.open("ShowProjectArchive.aspx?ProId="+ProId,'Archive','width=500,height=500,resizable=yes,scrollbars=yes,top=5');
	}
	
	function OpenContact(ConId)
	{
		var w = 500;
		var h = 500;
		chkMiddleWin(w,h);
	    var PopupWindow=null;
		settings='width='+ w + ',height='+ h + ',top='+ ytop +',left='+ xleft +',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=auto,resizable=yes,dependent=no';
		PopupWindow=window.open("ShowContact.aspx?ContactID="+ConId,'Contact',settings);
		PopupWindow.focus();
	}	
	
	function OpenContactWS(ConId)
	{
		var w = 500;
		var h = 500;
		chkMiddleWin(w,h);
	    var PopupWindow=null;
		settings='width='+ w + ',height='+ h + ',top='+ ytop +',left='+ xleft +',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=auto,resizable=yes,dependent=no';
		PopupWindow=window.open("ShowContactWS.aspx?ContactID="+ConId,'Contact',settings);
		PopupWindow.focus();
	}	
	
	function OpenPicture(i)
	{
		var w = 650;
		var h = 600;
		chkMiddleWin(w,h);
	    var PopupWindow=null;
		settings='width='+ w + ',height='+ h + ',top='+ ytop +',left='+ xleft +',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes,dependent=no';
		PopupWindow=window.open("ShowPicture.aspx?i="+i+"&w="+w,'xsPicture',settings);
		PopupWindow.focus();
	}

	function OpenPrintContent()
	{
		var w = 650;
		var h = 600;
		chkMiddleWin(w,h);
	    var PopupWindow=null;
		settings='width='+ w + ',height='+ h + ',top='+ ytop +',left='+ xleft +',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes,dependent=no';
		PopupWindow=window.open("ShowPrint.aspx",'xsPrint',settings);
		PopupWindow.focus();
	}
	
	function ShowPrint(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.visibility = 'visible';
		}
	}
	
	
	function chkMiddleWin(xsize1,ysize1) {
    xwinsizem = 785;
    ywinsizem = 430;
    if (screen) {
		xwinsizem = screen.availWidth;
		ywinsizem = screen.availHeight;
		if (xwinsizem >= 2000 && ywinsizem <= 1200) xwinsizem = xwinsizem/2;
    }
	xleft = (xwinsizem/2)-(xsize1/2);
	ytop = (ywinsizem/2)-(ysize1/2);
	xleft = (xwinsizem >= 1024) ? xleft : '0';
	ytop = (ywinsizem >= 740) ? ytop : '0';
	}
