// JavaScript Document
// Focus Login Popup Methods

function openFocusLoginPopup() {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 		if (ieversion<7){
  			window.location.href= "/login.jspa";
			return false;
		}
	}

	$('focus-login-popup-shader').appear({ duration: .25, from:0, to: .8 });
	$('focus-login-popup-container').appear({ duration: .5, from: 0, to: 1 });
	if ($('focus-vimeo-video') != null) {
		$('focus-vimeo-video').fade({ duration: .25, from: 1, to: 0 });
	}
	windowSize = {
		x:((document.body.clientWidth>window.innerWidth) ? document.body.clientWidth : window.innerWidth) ,
		y:((document.body.clientHeight<window.innerHeight) ? document.body.clientHeight : window.innerHeight)
	}
	
	var posX = Math.round(0 - $('focus-login-popup-container').getWidth() / 2);
	var posY = Math.round(0 - $('focus-login-popup-container').getHeight() / 2);
	
	
	//$('focus-login-popup-container').setStyle({top:posY + 'px', left: '50%', position:'absolute', marginLeft:posX + 'px'});
	$('focus-login-popup-container').style.marginLeft = posX + 'px';
	$('focus-login-popup-container').style.marginTop = posY + 'px';
	$('login-username').activate();
	
	
	if(location.hostname == 'www.focusonlinecommunities.com') {
		document.loginform.action= "https://" + location.hostname + "/cs_login";
	} else {
		document.loginform.action= "http://" + location.hostname + "/cs_login";
	}
	
	return false;
}

function closeFocusLoginPopup() {
	$('focus-login-popup-shader').fade({ duration: .25, from: .8, to: 0 });
	$('focus-login-popup-container').fade({ duration: .25, from: 1, to: 0 });
	if ($('focus-vimeo-video') != null) {
		$('focus-vimeo-video').appear({ duration: .25, from: 0, to: 1 });
	}
}