// ------------------- EmailLink -------------------

function SendEmail( encodedEmail, subject, body )
{
	var email = DecodeEmail( encodedEmail );
	
	var url = 'mailto:' + email;
	if( subject.length > 0 )
	  url += '?Subject=' + subject;
	if( body.length > 0 )
	  url += '&Body=' + body;
	  
	location.href = url; 
}

function DecodeEmail( encodedEmail )
{
	var email = "";
	for( i = 0; i < encodedEmail.length ; )
	{
		var letter = "";
		letter = encodedEmail.charAt( i ) + encodedEmail.charAt( i+1 );
		email += String.fromCharCode( parseInt( letter, 16 ) );
		i += 2;
	}
	return email;
}


// ------------------- GoTextBox -------------------


function PushDefaultButton( controlID )
{
	if( document.all )
	{
		if( event.keyCode == 13 )
		{ 
			event.returnValue = false;
			event.cancel = true;
			document.all[ controlID ].click();
		} 
	} 	
}


// ------------------- PostProgressBar -------------------
// Idozitve elinditja az inputokat tilto metodust 
function PostProgressBarStartTimer()
{
	window.setTimeout( PostProgressBarDisableInputs, 1 );
}


function PostProgressBarDisableInputs()
{				
	//document.all[ "ProgressImage" ].style.visibility = "visible";
	var image = document.getElementById("ProgressImage");
	image.style.visibility="visible";
	PostProgressBarDisableControl( document.all.tags( 'input' ) );
	PostProgressBarDisableControl( document.all.tags( 'a' ) );
}


function PostProgressBarDisableControl( controls )
{
	var control;
	for( var i = 0; i < controls.length; i++ ) 
	{
		control = controls[i];
		control.disabled = true;
		if ( control.href )
			control.removeAttribute("href");
	}				
}

var _imageToApply = null;
// ------------------- DisableLinkButton -------------------
// Idozitve elinditja az inputokat tilto metodust 
function DisableLinkButtonStartTimer( imageToApply )
{
	_imageToApply = imageToApply;
	if ( Page_ClientValidate() )
		window.setTimeout( DisableLinkButtonDisableInputs, 1 );
}


function DisableLinkButtonDisableInputs()
{			
	//document.all[ "ProgressImage" ].style.visibility = "visible";
	//var image = document.getElementById( "imgP" );
	var image = _imageToApply;
	image.style.visibility="visible";
	PostProgressBarDisableControl( document.all.tags( 'input' ) );
	PostProgressBarDisableControl( document.all.tags( 'a' ) );
}