/* Commonly used function among pages */

/* prevent conflict with scriptaculous, prototype */
jQuery.noConflict();

/* run this config at start */
jQuery(document).ready(function()
{
	common.alignment();
	jQuery(window).bind("resize", common.alignment);
});

/* class: */
var common =
{
	/* function: Align screen loader, align subheader */
	alignment		:	function()
	{
		jQuery(".subtitle").css("marginLeft", (jQuery(".content").position().left + 10) + "px");
	},
	/* end function */

	/* function: Align content panel */
	alignContent	:	function()
	{
		jQuery("div.content").css("left", ((jQuery("#background").width() - jQuery("div.content").width()) / 2) + "px");
		jQuery(".subtitle").css("marginLeft", "10px");
	},
	/* end function */

	/* function: Align Loading Screen */
	alignLoader		:	function()
	{
		jQuery("#loading").stop(false, true).fadeIn("normal");
		
		var winsize = {	h : jQuery("#loading").height(),	w : jQuery("#loading").width() };	// browser size
		var size	= { h : jQuery("#loader").height(),		w : jQuery("#loader").width() };	// loader size
		
		jQuery("#loader").css({ left : ((winsize.w - size.w) / 2) + "px", top : ((winsize.h - size.h) / 2) + "px"});
	},
	/* end function */

	/* support xml for IE */
	processXML		:	function(data)
	{
		var xml = data;
		
		if(typeof data == "string") // IE uses "text" as content type, firefox uses "text/xml"
		{
			xml = new ActiveXObject("Microsoft.XMLDOM");
			xml.async = false;
			xml.loadXML(data);
		}
		return xml;
	}
	/* end function */
};
/* end class */