﻿
/* ------------------------------------------------------------------------------
Sample: 
<a href="javascript:OpenWin('http://myCompany.com',600,600,1 ,1 ,1 ,1 ,1 ,1 ,10 ,10);">Link text here</a> 

str_url	- The URL of the page to open. 
int_w	- The width of the window in pixels. 
int_h	- The height of the window in pixels (doesn't include menubars). 
int_tb	- Toolbar visible?		1 = yes, 0 = no. 
int_stb	- Status bar visible?	1 = yes, 0 = no. 
int_l	- Linkbar visible?		1 = yes, 0 = no. 
int_mb	- Menubar visible?		1 = yes, 0 = no. 
int_sb	- Scrollbars visible?	1 = yes, 0 = no. 
int_rs	- Resizable window?		1 = yes, 0 = no. 
int_x	- The horizontal position of the window from the left of the screen. 
int_y	- The vertical position of the window from the top of the screen.
*/
function OpenWin(
	 str_url
	,int_w
	,int_h
	,int_tb
	,int_stb
	,int_l
	,int_mb
	,int_sb
	,int_rs
	,int_x
	,int_y)
{
	var str_tb, str_stb, str_l, str_mb, str_sb, str_rs, temp, win

	try
	{
		str_tb  = (int_tb)  ? 'yes' : 'no';
		str_stb = (int_stb) ? 'yes' : 'no'; 
		str_l   = (int_l)   ? 'yes' : 'no'; 
		str_mb  = (int_mb)  ? 'yes' : 'no'; 
		str_sb  = (int_sb)  ? 'yes' : 'no';
		str_rs  = (int_rs)  ? 'yes' : 'no';
		
		// Check for firefox
		temp = (document.layers) ? ',screenX=' + int_x + ',screenY=' + int_y : ',left=' + int_x + ',top=' + int_y;
		
		win = window.open(
			   str_url, 
			  'win'          + new Date().getTime(),
			  'width='       + int_w + 
			  ',height='     + int_h + 
			  ',toolbar='    + str_tb + 
			  ',status='     + str_stb +
			  ',links='		 + str_l + 
			  ',menubar='    + str_mb + 
			  ',scrollbars=' + str_sb + 
			  ',resizable='  + str_rs + temp);
		
		win.focus();
	}
	catch(error)
	{
		// do nothing
	}
}

function OpenWinModal(
	 str_url
	,int_w
	,int_h
	,int_tb
	,int_stb
	,int_l
	,int_mb
	,int_sb
	,int_rs
	,int_x
	,int_y)
{
	var returnValue = null;

	if(window.showModalDialog)
	{
		try
		{
			returnValue = window.showModalDialog(
				   str_url, 
				  '',
				  'dialogWidth:'   + int_w + 'px' + 
				  ';dialogHeight:' + int_h + 'px' +
				  ';center:'       + 'yes' + 
				  ';dialogHide:'   + 'no' +
				  ';edge:'		   + 'raised' + 
				  ';status:'       + 'yes' + 
				  ';scroll:'       + 'yes' + 
				  ';resizable:'    + 'yes');
				  
			return returnValue;
		}
		catch(error)
		{
			// do nothing
		}
	} 
	else 
	{
		OpenWin(
			 str_url
			,int_w
			,int_h
			,int_tb
			,int_stb
			,int_l
			,int_mb
			,int_sb
			,int_rs
			,int_x
			,int_y);
	}
} 

function OpenLink(str_link)
{
	OpenWin(str_link,600,550,0 ,1 ,1 ,0 ,1 ,1 ,10 ,10); 
}



	
