// The D-Word external API...

var dw_domain = 'http://www.d-word.com/api.php' // www.d-word.com

function dw_registerForm() {
	//dw_name = window.dw_name || newVal;
	url = '?url=/users/register&from=api'
	dw_writeFrame(url);
}

function dw_login() {
	url = '?url=/login&from=api'
	dw_writeFrame(url);
}

function dw_topicsList() {
	url = '?url=/topics/list&from=api'
	dw_writeFrame(url);
}

function dw_writeFrame(url) {
	if (window.dw_name)
		url += '&name=' + dw_name
	if (window.dw_email)
		url += '&email=' + dw_email
	if (window.dw_city)
		url += '&city=' + dw_city
	if (window.dw_state)
		url += '&state=' + dw_state
	if (window.dw_country)
		url += '&country=' + dw_country
	if (window.dw_how_heard)
		url += '&how_heard=' + dw_how_heard
	if (window.dw_site)
		document.write('<iframe src="'+dw_domain+url+'&site='+dw_site+'" width="'+dw_width+'" height="'+dw_height+'" name="dword_frame" id="dword_frame" frameborder="0" scrolling="auto" style="border: none; overflow: auto;"></iframe>')
	else
		alert("This site could not be verified for access to "+dw_domain+". Please check the API key.")
}