var newWin=null;
var onscreen=false;

function NewWin( url, w, h ) {
	newWin=window.open(url, 'abc', 'location=0,resizable=0,status=0,titlebar=0,directories=0,toolbar=0,menubar=0,scrollbars=0,status=0,screenX=100,screenY=100,width='+w+',height='+h);
	newWin.focus();
	onscreen=true; 
}

function transferView( image, roseName, width, height ) {
	if ( width == 0 ) cond1=" " ;
		 else cond1 = "width="+ ( width + 0 ) + "" ;
	if ( height == 0 ) cond2=" " ;
		 else cond2 = "height="+ ( height + 0 ) + "" ;
	var dim = cond1 + "," + cond2 + "," ;
	  
	var s0 = "<html><head>";
	var s1 = "<title>" + roseName + "</title>" ;
	var s2 = "<style type='text/css'>";
	var s3 = "body {margin:0px;}";
	var s4 = "</style></head>";
	 
	var b1 = "<body>" ;
	var b2 = "<img src='" + image + "' border=0>" ;
	var b3 = "<CENTER>";
	var b4 = "<FORM><INPUT TYPE='BUTTON' VALUE='Close Window'"+ " onClick='self.close()'>";
	var b5 = "</FORM>";
	var b6 = "</CENTER>";
	var b7 = "</body></html>" ;
	  
	ImageWindow=window.open("about:blank","newwin", dim + "toolbar=no,scrollbars="+scroll+",menubar=no");
	ImageWindow.document.write( s0 + s1 + s2 + s3 + s4 + b1 + b2 + b7 );
	ImageWindow.document.close();
	ImageWindow.focus();
}

function newWinPDF( formular, cmdID, width, height ) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	cond1 = "width=" + ( width + 0 ) + "";
	cond2 = "height=" + ( height + 0 ) + "";
	var dim = cond1 + "," + cond2 + ",";

	fromPage = "pdf" + formular + ".php" + "?cmdID=" + cmdID;

	newWin = window.open(fromPage, "_blank", dim + "toolbar=no,scrollbars=no,resizable=0,menubar=no,status=no,left="+leftVal+",top="+topVal+"");

	newWin.document.close();
	newWin.focus();
}

function modifyComanda( cmdID, width, height ) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	cond1 = "width=" + ( width + 0 ) + "";
	cond2 = "height=" + ( height + 0 ) + "";
	var dim = cond1 + "," + cond2 + ",";

	fromPage = "modifyComanda/welcome.php" + "?cmdID=" + cmdID;

	newWin = window.open(fromPage, "_blank", dim + "toolbar=no,scrollbars=yes,resizable=0,menubar=no,status=no,left="+leftVal+",top="+topVal+"");

	newWin.document.close();
	newWin.focus();
}

function listComanda( cmdID, width, height ) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	cond1 = "width=" + ( width + 0 ) + "";
	cond2 = "height=" + ( height + 0 ) + "";
	var dim = cond1 + "," + cond2 + ",";

	fromPage = "htmlListCmd.php" + "?cmdID=" + cmdID;

	newWin = window.open(fromPage, "_blank", dim + "toolbar=no,scrollbars=yes,resizable=0,menubar=no,status=no,left="+leftVal+",top="+topVal+"");

	newWin.document.close();
	newWin.focus();
}

function listFactura( fctID, width, height ) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	cond1 = "width=" + ( width + 0 ) + "";
	cond2 = "height=" + ( height + 0 ) + "";
	var dim = cond1 + "," + cond2 + ",";

	fromPage = "htmlListFct.php" + "?fctID=" + fctID;

	newWin = window.open(fromPage, "_blank", dim + "toolbar=no,scrollbars=yes,resizable=0,menubar=no,status=no,left="+leftVal+",top="+topVal+"");

	newWin.document.close();
	newWin.focus();
}

function transferReg( fromPage, width, height ) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	cond1 = "width=" + ( width + 0 ) + "";
	cond2 = "height=" + ( height + 0 ) + "";
	var dim = cond1 + "," + cond2 + ",";

	ImageWindow = window.open(fromPage, "regView", dim + "toolbar=no,scrollbars=1,resizable=0,menubar=no,status=no,left="+leftVal+",top="+topVal+"");

	ImageWindow.document.close();
	ImageWindow.focus();
}
