function communityLoginIntercept(redirectUrl) {
	
	var transparentDiv;
	var loginDiv;
	
	if(document.getElementById('community_login') == null) {		
		transparentDiv = document.createElement("DIV");
		transparentDiv.id = "community_login";
		transparentDiv.style.display = "none";
		document.body.appendChild(transparentDiv);
	}
	else {		
		transparentDiv = document.getElementById('community_login');
	}
	
	if(document.getElementById('community_login_intercept') == null) {
		loginDiv = document.createElement("DIV");
		loginDiv.id = "community_login_intercept";
		loginDiv.style.display = "none";
		document.body.appendChild(loginDiv);
	}
	else {
		loginDiv = document.getElementById('community_login_intercept');
	}
	
	if(transparentDiv.style.display == "none") {		
		transparentDiv.style.display = "";
		loginDiv.style.display = "";
		transparentDiv.innerHTML = "";
		loginDiv.innerHTML = getLoginBoxHtml(redirectUrl);

	}else {		
		transparentDiv.style.display = "none";
		transparentDiv.innerHTML = '';
		loginDiv.style.display = "none";
		loginDiv.innerHtml = ''; 
	}
	
	/** Reset DIVs layout by help of what ever browser is redering it */
	var dims = coreweb.common.ComponentUtils.getBrowserSize();
	var center = (dims.width-600)/2; // 600 px is set in communityIntercept.style file 
	if(loginDiv.style.visibility!="hidden"){
	   loginDiv.style.top="40px";
	   loginDiv.style.left=center+"px";
	   loginDiv.style.visibility="visible";
	   
	   if ( coreweb.common.Browser.isBrowser( 'firefox' ) && 
			questia.Dictionary.reader &&			 
			questia.Dictionary.reader.docId ) {
		   dims.width += 16; // scroll bar issues.
	   }
	   
	   transparentDiv.style.width=dims.width+"px";
	   //transparentDiv.style.height=window.innerHeight;
	}	
	
	return false;
}

function getLoginBoxHtml(redirectUrl)
{
	var html = '<table width="100%" height="100%">' +
	'<tr>' +
	'<td align="center" valign="middle" width="100%" height="100%">' +
		'<div id="community_login_loginMessage">You must be a Questia member to write a review.</div>' +
		'<div id="community_login_exit"><a style="cursor:hand" onclick="communityLoginIntercept();"><img src="/community/login/images/x.gif" border="0"/></a></div>' +
 	    '<br class="cc_CLR" />' +
	    '<div id="community_login_loginBox" style="float:left;">' +
	    '<div class="cc_pleaseLogin"><strong>Please login</strong></div>' +
	    '<div class="cc_basicLogin">' +    
		'<form onsubmit="questia.Dictionary.loginSubmitted=true; return true;" action="/LoginMediator.qst?action=loginUser" method="POST" target="_top">' +
		   '<input value="'+redirectUrl+'" name="previousURL" type="hidden" id="previousURL"></input>' +
			'<div class="userNameDiv">' +
				'<div class="cc_userNameLabel">Username</div>' +
				'<div class="cc_userNameField">' +
				'<input type="text" class="primaryTextField" name="userName" id="userName"></input>' +
				'</div>' +
				'<div class="cc_CLR"></div>' +
			'</div>' +
			'<div class="cc_passwordDiv">' +
				'<div class="cc_passwordLabel">Password</div>' +
				'<div class="cc_passwordField">' +
				'<input type="password" class="primaryTextField" name="password" id="password"></input>' +
				'</div>' +
				'<div class="cc_CLR"></div>' +
			'</div>' +
			'<button type="Submit" class="cc_loginButton"></button>' +
	        '<br class="cc_CLR" />' +
			'<div class="cc_forgotLogin2">' +
				'<a target="_top" href="/login/ForgotLogin.jsp">Forgot Your Username or Password?</a>' +
			'</div>' +
			'<div class="cc_CLR"></div>' +
		'</form>' +
	'</div>' +
	'</div>' +
	'<div id="community_login_adMessage"><ul>' +
	'<li>24/7 access to a trusted online research service.</li><br/>' +
	'<li>Over 74,000 full-text books and millions of journal, magazine and newspaper articles that can not be found anywhere else on the Internet.</li><br />' +
	'<li>A powerful set of research tool renabling you to quote and cite quality books and articles, highlight text, store notes for future reference, automatically creat bibliographies, and more!</li>' +
	'</ul></div>' +
	'<br class="cc_CLR" />' +
	'<div id="community_login_actionButtons">' +
	'<div class="cc_subscribeButton"><a href="/subscribe"><img src="/community/login/images/subscribe.gif" border="0" /></a></div>' +
	'<div class="cc_freeTrialButton"><a href="/subscribe?planId=183"><img src="/community/login/images/free_trial.gif" border="0" /></a></div>' +
	'</div>' +
	'<br class="cc_CLR" />' +
	'<div align="center" id="community_login_footerText"><a href="/subscribe">Subscribe</a> or <a href="/subscribe?planId=183">register</a> for a free trial to become a Questia member and write a review now!</div>' +
	'</td>' +
	'</tr>' +
	'</table>';
	return html;		
}

