/* 
	Functions.js: contains javascript and ajax methods that apply to all modules
*/

function popup(elementId)
{
	$('pageblur').className = 'blur_on';
	$(elementId).className = 'modal-popup';
	
}

function close_popup(elementId)
{
	$('pageblur').className = 'nodisplay';
	$(elementId).className = 'nodisplay';
}


/* Functions for finding the x and y coordinates of an xhtml element */

function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
	    while(1) 
	    {
	      curleft += obj.offsetLeft;
	      if(!obj.offsetParent)
		    break;
	      obj = obj.offsetParent;
	    }
    else if(obj.x)
	    curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
	{
	    while(1)
	    {
	        curtop += obj.offsetTop;
	        if(!obj.offsetParent)
		        break;
	        obj = obj.offsetParent;
	    }
    }
    else if (obj.y)
    {
        curtop += obj.y;
    }
    
    return curtop;
}

function MM_openBrWindow(theURL,winName,features)
{
  window.open(theURL,winName,features);
}