// JavaScript Document
function getURL(){
	return document.URL;
}
 
var regVisitor = mag_user.user_name;
var regVisitorname = mag_user.first_name;
var regfirstname = mag_user.first_name;
var currPos = getURL();

function cutString(str,num){
  if((!!str) &&(str.length > num)){
     var newStr = str.substr(0,num);
     newStr += "...";
     str = newStr;
   return(str);
   } else if (!!str){
  return(str)
} else {
  return " ";
}
}
if (!!regfirstname) {
 regVisitorname = cutString(regfirstname,12);}
else {
 regVisitorname = cutString(regVisitor,12);}

function headerLogin_new() {
	if (mag_user.logged_in) {
		document.write('<span><strong>Hi <a href="/registration/">'+regVisitorname+'</a></strong>&nbsp;|&nbsp;');
		document.write('<a href="/registration/logout?next_url=');
		document.write(currPos);
		document.write('">sign out</a></span>');
	}
	else {
		document.write('<span><a href="/login/">sign in</a>&nbsp;|&nbsp;<a href="/registration/">join free</a></span>');
	}
}

function commentsLogin() {
	document.write('<input type="hidden" value="')
	document.write(currPos);
	document.write('" name="next_url" />');
}

function commentsLoginUsername() {
	if (regVisitor == null) {
	}
	else {
		document.write(regVisitor);
	}
}

var loggedInNow = null;

if (mag_user.logged_in) {
	loggedInNow = true;
} else {
	loggedInNow = false;	
}