/*Development Info

	lm 20060406 mga
	note: javascript used on all pages of Federauto

	HTML: MGA
	DESIGN: VIM
	PM: JLA
*/

/*CUSTOM FUNCTIONS*/
function showLogin(){
	//repositions and shows a box
	Repos();
	GetObj('loginBox').style.display='block';
}
function hideLogin(){
	GetObj('loginBox').style.display='none';
}
function Repos(){
	//repositions the login box
	GetObj('loginBox').style.top=GetPos(GetObj('memberAccess')).y+'px';
	GetObj('loginBox').style.left=GetPos(GetObj('memberAccess')).x+'px';
}

/*GENERIC FUNCTIONS*/
function GetPos(){
	//function GetPos by mga@emakina lm 20040707-15:00
	//returns an object containing x and y positions of Element in the page
	//usage : GetPos(GetObj('obj_id')).x || GetPos(GetObj('obj_id')).y
	arg=GetPos.arguments;t={x:0,y:0};o=arg[0];
	if(o.offsetParent){while(o.offsetParent){t={x:(t.x+=o.offsetLeft),y:(t.y+=o.offsetTop)};o=o.offsetParent;}}else if(o.x&&o.y){t={x:(t.x+=o.x),y:(t.y+=o.y)}};return t;
}
function GetObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=GetObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function addEvent(obj, evType, fn){
	//unobtrusive addevent
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}





/* INIT */
//onresize repos login layer)
addEvent(window, 'resize', Repos);
