/**
 * Global structure defining initialization behavior of dojo.
 * We just want it to parse our declarative dojo attributes on load.
 **/
djConfig = {
	parseOnLoad: true
};

var store=null;

function openEmbroideryDialog(e) {
	var d7=dijit.byId('dialog7');
	d7.attr('href','/Embroidery-Library');
	d7.show();
	e.preventDefault();
}

function getEmbroideryChoice() {
	return true;
}

/**
 * Callback which fires when the dojo libraries have been loaded.
 **/
function ondojoload() {
	store=new dojo.data.ItemFileReadStore({url:'/includes/embroideries.cfm'});

	dojo.query('a#embroiderylibrary').forEach(function(item) {
		var img=document.createElement('img');
		img.src='/user_images/embroidery_ad.jpg';
		img.width="300";
		img.height="150";
		img.alt="Free Embroidery Designs - Click to Preview";
		item.appendChild(img);
		dojo.connect(item,'onclick',openEmbroideryDialog);
	});
}

/**
 * Callback which fires when the Google libraries have been loaded.
 * @class
 * @name setOnLoadCallback
 **/
google.setOnLoadCallback(function() {
	dojo.require("dijit.layout.ContentPane");
	dojo.require("dijit.form.Button");
	dojo.require("dijit.form.TextBox");
	dojo.require("dijit.Dialog");
	dojo.require("dojo.currency");
	dojo.require("dojo.data.ItemFileReadStore");

	dojo.addOnLoad(ondojoload);
});

google.load("dojo", "1.3");