var swatchcard;
var NewWindow;
function closeSwatchcard(){
	if (swatchcard) swatchcard.close();
}
function ShowPopup(FileURL, ImgHeight, ImgWidth) {
var WinHeight=Math.floor(screen.height);
   if (WinHeight >= 600) {
	var WinLeft=Math.floor((screen.width-ImgWidth)/2);
	var WinTop=Math.floor((screen.height-ImgHeight)/2);
	var WinAppearence = 'scrollbars=yes,width='+(ImgWidth)+',height='+(ImgHeight)+',top='+WinTop+',left='+WinLeft;
   } else {
	ImgHeight=WinHeight-100;
	var WinLeft=Math.floor((screen.width-ImgWidth)/2);
	var WinTop=Math.floor((screen.height-ImgHeight)/2);
	var WinAppearence = 'scrollbars=yes,width='+(ImgWidth)+',height='+(ImgHeight)+',top='+WinTop+',left='+WinLeft;
   }
   NewWindow=window.open( FileURL,'',WinAppearence);
   swatchcard = NewWindow;
   NewWindow.focus();
}
function setInputValue(id, tag){
	var val;
	var srcobj = document.getElementById(id + tag);
	var trgobj = document.getElementById('input' + tag);
	if (srcobj){ val=unescape(srcobj.innerHTML); }
	if (trgobj){ trgobj.value = val; }
}
function setInputCheck(id, tag){
	var val;
	var srcobj = document.getElementById(id + tag);
	var trgobj = document.getElementById('input' + tag);
	if (srcobj){ val=unescape(srcobj.innerHTML); }
	if (trgobj){ 
			if (val == 'Y')
				trgobj.checked = 1; 
			else 	
				trgobj.checked = 0; 
	}
}

function showPanel( id, act )
	{
	var c = document.getElementById(id);
	c.style.visibility = 'VISIBLE';
		if( act != null && act != '' )
		{
		var es = c.getElementsByTagName('input');
			for( var i = 0 ; i < es.length ; i++ )
				if( es[i].name == 'action' )
				{
				es[i].value = act;
				break;
				}
		}
	}

function hidePanel(id){
	document.getElementById(id).style.visibility='HIDDEN';
}
