﻿//**********************************************************
function vCopyStringToClipboard( strStringToCopyIn )
{
// 2008-09-04: ASC:
//	IE6 and IE7 both allow clipboard access from Javascript.
//	IE7 asks the user's permission with a dialog the first 
//	time.  It does NOT ask for permission after that first 
//	time.
// 
//	But to increase security Firefox does not have a way to access
//	the clipboard from Javascript.
//	Mozilla recommends you install a plug-in to allow that:
//	http://support.mozilla.com/en-US/kb/Granting+JavaScript+access+to+the+clipboard
//
//  Another possible work-around is to use a small helper 
//	Flash SWF file, since Flash does allow clipboard access.
//	See: http://www.jeff.wilcox.name/2008/05/21/clipboard-access/
//	See my notes about that:
//	M:\__Silverlight\Samples\_SL2\ClipboardAccess\Workaround-UsingLittleFlashSwf\_Alan's notes about clipboard access in SL.txt
//

	if( window.clipboardData != null )
	{
		// Get here for IE6, IE7:
		
		window.clipboardData.clearData();

		bRes = window.clipboardData.setData( "Text", strStringToCopyIn );
	}
	else
	{	
		// Get here for Firefox (also Safari too probably?)

		alert(
			"@.20 - Video Transcript Viewer:\n\n" +
			" Clipboard operations are currently only\n" +
			" supported on Internet Explorer."
			);
	}


}	// end function

//**********************************************************
function vJunkTest1()
{
	alert( "@.31 in vJunkTest1()" );
}

//vJunkTest1();

//**********************************************************
function vMoveHtmlElement(
	strElementId_In,

	dNewLeftInPixels_In,
	dNewTopInPixels_In,
	dNewRightInPixels_In,
	dNewBottomInPixels_In
	)
{
//	debugger;

//	var o1 = document.all[ 0 ];
//	var o3 = document.all[ 1 ];
//	var o4 = document.childNodes.length;
//	var o5 = document.getElementsByTagName( 'div' );
//	var o6 = document.getElementsByName( 'errorLocation' );

//	alert( "abc" );		// Doesn't like this for some reason.
						// I get a beep from browser, but not message box.
						//	Is context of the call (from SL2) bad for this?

    var oHostDiv = document.getElementById( "div_SilverlightControlHost" );

    var oHtmlElement = document.getElementById( strElementId_In );
	if( oHtmlElement != null )
	{
		var dNewLeft = oHostDiv.offsetLeft + dNewLeftInPixels_In;
		var dNewTop	 = oHostDiv.offsetTop + dNewTopInPixels_In;

		oHtmlElement.style.left = dNewLeft+"px";
		oHtmlElement.style.top = dNewTop+"px";


		var dNewWidth	= dNewRightInPixels_In - dNewLeftInPixels_In;

// 2008-04-22: ASC: Unclear why these don't return anything:
//		var i1 = oHtmlElement.style.borderLeftWidth;
//		var i2 = oHtmlElement.style.paddingLeft;

// 2008-04-22: ASC:
//	Doesn't appear to be a way to get right border or padding 
//	of any kind from oHtmlElement.  So we multiply by 2.
//	Also we make sure the padding was fixed at 0, so we don't have 
//	to include it.
		var iLeftAndRightBorders = (oHtmlElement.clientLeft * 2);
		var iTopAndBottomBorders = (oHtmlElement.clientTop * 2);

//		dNewWidth -=
//			(oHtmlElement.style.borderLeftWidth + 
//				oHtmlElement.style.paddingLeft + 
//				oHtmlElement.style.paddingRight +
//					oHtmlElement.style.borderRightWidth);

// CSS box model doesn't count the borders or padding as part of 
//	the width:
		dNewWidth -= iLeftAndRightBorders;
		dNewWidth -= 2;		// Test.

		oHtmlElement.style.width = dNewWidth+"px";


		var dNewHeight	= dNewBottomInPixels_In - dNewTopInPixels_In;

		dNewHeight -= iTopAndBottomBorders;
		dNewHeight -= 2;	// Test.

//		dNewHeight -=
//			(oHtmlElement.style.borderTopWidth + 
//				oHtmlElement.style.paddingTop + 
//				oHtmlElement.style.paddingBottom +
//					oHtmlElement.style.borderBottomWidth);

		oHtmlElement.style.height = dNewHeight+"px";
	}
	else
	{
		var ii = 0;
		ii = ii + 1;
	}
// HtmlElement.style.left = x+"px";

/*
    var HtmlElement = document.getElementById( strElementId_In );
    HtmlElement.style.top = iYPixels_In+"px";
// HtmlElement.style.left = x+"px";

	alert( "@.27 in vMoveHtmlElement( iYPixels_In:" + iYPixels_In );
*/
}	// end function


//**********************************************************
function vSetWidthOfHtmlElement(
	strElementId_In,

	dNewWidthInPixels_In
	)
{
//	debugger;

    var oHostDiv = document.getElementById( "div_SilverlightControlHost" );

    var oHtmlElement = document.getElementById( strElementId_In );
	if( oHtmlElement != null )
	{
		oHtmlElement.style.width = dNewWidthInPixels_In+"px";
	}
	else
	{
		var ii = 0;
		ii = ii + 1;
	}

}	// end function
