I'm trying to center an IFrame I'm creating via Javascript, without having to rely on css defined outside of the script (if it's possible to define it inside of the script it's fine), and without having to re-write the whole document.

I googled the matter and saw either HTML tags which are of no use to me in my situation (correct me if I'm wrong), or an attempt to do it by creating a div and appending the iframe to it, but it wasn't really center.

Here's my code (just creating / removing an iframe):

var iframe;

window.onload = function()
	openOffers(123, 'royi', 'ohdfg345dsf');

function openOffers(id, username, session)
	iframe = document.createElement('iframe');
	iframe.src = 'https://www.trialpay.com/social/offers/?vic=1b931e374ab4e3347d67e142916131c9&type=payment_overlay&sid=' + id + '&id=' + id + '&username=' + username + '&session=' + session;
	iframe.width = 585;
	iframe.height = 600;
	iframe.scrolling = 'no';
	iframe.frameBorder = 0;

function closeOffers()
	iframe = null;