// JavaScript Document
function showForumLink() {
	var block 					= document.getElementById( "forumLink" );	
	var picture					= document.getElementById( "forumIcon" );			
	var offsets 				= cumulativeOffset( picture );
	block.style.top 			= offsets[1] - 64 + 'px';
	block.style.left 			= offsets[0] + 48 + 'px';
	dojo.lfx.html.fadeShow( block, 200 ).play();
}

function hideForumLink(){
	var block = document.getElementById( "forumLink" );
	dojo.fx.html.fadeHide( block, 200 ).play();
}

function cumulativeOffset(element) {
	var valueT = 0, valueL = 0;
	do {
		valueT += element.offsetTop || 0;
		valueL += element.offsetLeft || 0;
		element = element.offsetParent;
	} while (element);
	return [valueL, valueT];
} 

/**
 * Trigger function for token association
 */
function associateToken( ebay_accounts_id ){
	document.getElementById( 'resultfield' ).innerHTML = 
					'<img src="templates/images/indicator.gif">';
					
	dojo.io.bind({
		url: "ajaxproxy.php",
		content: {
			action: 'sendtoken',
			account: ebay_accounts_id
		},
		handler:function( type, data, evt ){
			document.getElementById( 'resultfield' ).innerHTML = data;					
		},
		mimetype: "text/plain",
		method: "POST"
	});		
}

function openWindow( page, width, height ){
	window.open( page, "Window", "width=" + width + ",height=" + height + ",top=150,left=150,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=no,location=no" );
}
