if (typeof(jpositioning_js_loaded)=="undefined")
{

$jpos = jQuery.noConflict();	// Make sure our implementation doesn't conflict with anyone elses


var positioning_js_loaded = true;


/*
//**************
// Scroll top functions
//**************
	function get_scroll()
	{
		var x,y;
		if (self.pageYOffset) // all except Explorer
		{
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		return y;
	}

	// Based on code from quirksmode.org
	function scroll_y()
	{
		var y;
		if (self.pageYOffset) // all except Explorer
			y = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
			y = document.documentElement.scrollTop;
		else if (document.body) // all other Explorers
			y = document.body.scrollTop;
		return y;
	}

	// Based on quirksmode.org code
	function set_scroll(y)
	{
		if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
			document.documentElement.scrollTop = y;
		else if (document.body) // all other Explorers
			document.body.scrollTop = y;
	}

	// Based on quirksmode.org code
	function page_width()
	{
		var x;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
			x = document.body.scrollWidth;
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
			x = document.body.offsetWidth;
		return x;
	}

	// Based on quirksmode.org code
	function page_height()
	{
		var y;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
			y = document.body.scrollHeight;
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
			y = document.body.offsetHeight;
		return y;
	}
	
	function page_viewable_width()
	{
		var viewportwidth;
		
		// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		if (typeof window.innerWidth != 'undefined')
			viewportwidth = window.innerWidth;
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		else 
			viewportwidth = document.documentElement.clientWidth;
		return viewportwidth;
	}

	function page_viewable_height()
	{
		var viewportheight;
		
		// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		if (typeof window.innerWidth != 'undefined')
			viewportheight = window.innerHeight;		
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		else 
			viewportheight = document.documentElement.clientHeight;
		return viewportheight;
	}

//**************
// Scroll top functions
//**************
	function page_bottom()
	{
		return scroll_y()+page_viewable_height();
	}

	function screen_center()
	{

		if (window.innerWidth)
		{
			s_center = window.innerWidth/2;
		}
		else
		{
			s_center = document.documentElement.offsetWidth/2;
		}
		return s_center;
	}	

	function in_rect(x,y,x1,y1,x2,y2) 
	{
		if ( (x > x2) || (x < x1) || (y > y2) || (y < y1) )
			return false;
		return true;
	}

 	function select_vis(hide)
   	{
   	for_count = document.forms.length;
        for (i=0;(i<for_count) && (i<10);i++)	// The i < 10 is just a failsafe. that won't happen on this page
        {
        	for_count2 = document.forms[i].elements.length;
            for (j=0;j<for_count2;j++)
            {
                if (document.forms[i].elements[j].type.indexOf('select')>-1)
                    document.forms[i].elements[j].style.visibility=hide
            }
        }
   	}
*/   
	



//***************
// ATTACH
//***************

/**
 * Set the left position of an object
 */
	function jattach_left(id,id2)
	{
    		jset_left(id,jget_left(id2));
	}
    
/**
 * Set the top position of an object
 */
	function jattach_top(id,id2)
	{
    		jset_top(id,jget_top(id2));
	}
    
/**
 * Set the bottom position of an object
 */
	function jattach_bottom(id,id2)
	{
    		jset_bottom(id,jget_bottom(id2));
	}
    
/**
 * Set the right position of an object
 */
	function jattach_right(id,id2)
	{
    		jset_right(id,jget_right(id2));
	}


//***************
// SETS
//***************
	
/**
 * Set the left position of an object
 */
	function jset_left(id,left)
	{
    		$jpos("#"+id).css('left',left);
	}
    
/**
 * Set the top position of an object
 */
	function jset_top(id,top)
	{
    		$jpos("#"+id).css('top',top);
	}
    
/**
 * Set the bottom position of an object
 */
	function jset_bottom(id,bottom)
	{
    		jset_top(id,bottom-$jpos("#"+id).outerHeight());
	}
    
/**
 * Set the right position of an object
 */
	function jset_right(id,right)
	{
    		jset_left(id,right-$jpos("#"+id).outerWidth());
	}


//***************
// GETS
//***************

    
/**
 * Get the left position of an object
 */
	function jget_left(id)
	{
		temp = $jpos("#"+id).offset();
	    	return temp.left;
	}
    
/**
 * Get the top position of an object
 */
	function jget_top(id)
	{
		temp = $jpos("#"+id).offset();
	    	return temp.top;
	}
    
/**
 * Gets the right edge of an object
 */
    function jget_right(id)
    {
        return (jget_left(id) + $jpos("#"+id).outerWidth());    
    }

/**
 * Gets the bottom edge of an object
 */
    function jget_bottom(id)
    {
        return (jget_top(id) + $jpos("#"+id).outerHeight());
    }
    
 }
