function preview( elem )
{
	if( elem.type == "html" )
	{
		if( NewWindow != null ) NewWindow.close();
		NewWindow=window.open( elem.loc, "preview" );
	}
	else if( elem.type == "swf" || elem.type == "jpg" || elem.type == "gif" || elem.type == "png" )
	{
		assetPopup( elem.cid, parseInt( elem.width ),  parseInt(elem.height) );
	} 
}

var NewWindow = null;
function popup( file, w, h, scrolling )
{
	if( NewWindow != null ) NewWindow.close();
	var sc = scrolling == null ? "No" : "Yes";
	NewWindow=window.open( file,'newWin', 'width=' + w + ',height=' + h +',left=0,top=0,toolbar=No,location=No,scrollbars=' + sc + ',status=No,resizable=Yes,fullscreen=No');
	NewWindow.focus();
}

function assetPopup(id, w, h )
{
	var nHeight = h + 75;
	var nWidth = w + 40 < 400 ? 400 : w + 40;
	popup( document.appPrefix + "/" + document.urlPrefix + "/" + document.viewId + "/popup.htm?cid=" + id, nWidth, nHeight );
}