/*
	$Id: base.js 3469 2008-10-30 11:18:23Z andrei $
	
	Base JavaScript Library
*/

function GlobToogleInputValue ( sID )
{
	var oInput = $( '#' + sID );
	var sValue = oInput[0].value;
	
	oInput.bind( 'focus', function () {
		if ( $(this)[0].value == sValue ) $(this)[0].value = '';
	} );
	oInput.bind( 'blur', function () {
		if ( $(this)[0].value == '' ) $(this)[0].value = sValue;
	} );
	
	return true;
}

function GlobCopyToClipBoard ( oWhere, sPath )
{
	var sText = ( typeof oWhere != 'string' ) ? oWhere.value : oWhere;
	
	if ( window.clipboardData && clipboardData.setData ) {
		clipboardData.setData( 'Text', sText );
	} else {
		var tempSWFDiv = document.getElementById( 'ClipBoardSWFDivID' );
		if ( tempSWFDiv == null ) {
			tempSWFDiv = document.createElement( 'div' );
			tempSWFDiv.setAttribute( 'id', 'ClipBoardSWFDivID' );
			document.body.appendChild( tempSWFDiv );
		}
		tempSWFDiv.innerHTML = '<embed src="'+sPath+'/clipboard.swf" FlashVars="clipboard='+encodeURIComponent(sText)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	}
	
	if ( typeof oWhere != 'string' ) {
		oWhere.focus();
		oWhere.select();
	}
	
	return true;
}
