//##########################################################################//
// Image functions
//##########################################################################//
var menutimer = null;
var messageTimerId;
if (window!=top){top.location.href=location.href;}
function Init()
{}
function rowhilite(obj)
{
if (_activeobj != null) _activeobj.className = "calendar";
	obj.className = "calendarMD";
	_activeobj = obj;

}
function rowunhilite(obj)
{
if (_activeobj != null) _activeobj.className = "calendarMD";
	obj.className = "calendar";
	_activeobj = obj;

}
function reportrowhilite(obj)
{
 if (_activeobj != null) _activeobj.className = "reportresulttrstyle2";
 obj.className = "reportresulttrstyle1";
 _activeobj = obj;
}
function reportrowunhilite(obj)
{
  if (_activeobj != null) _activeobj.className = "reportresulttrstyle2";
 obj.className = "reportresulttrstyle1";
 _activeobj = obj;
}
function Logout()
{
  $("#NCSFLogout").val("Y");
  $("#logmeout").submit();
}
function OpenItem(url) {
 var productwindow = window.open(url,'NCSFItem','toolbar=no,status=yes,scrollbars=yes,location=no,menubar=no,directories=no,width=700,height=830')
 if (window.focus)
   productwindow.focus(); 
 
}
function emailaddress(str)
{
 var username = str;  
 if (username.indexOf("@") == -1 || username.lastIndexOf(".") == -1 || (username.lastIndexOf(".") < username.lastIndexOf("@"))) 
     return false;
 else 
     return true;    
} 
function validphone(str) 
{
	var validchars = "1234567890-+ ";
	for (var ii=0; ii<str.length; ii++) {
		if (validchars.indexOf(str.toLowerCase().charAt(ii)) == -1) 
			return false;
	}
	return true;
}
function html_entity_decode(str) {
    var ta = document.createElement("textarea");
    ta.innerHTML = str.replace(/</g, "<").replace(/>/g, ">");
    return ta.value;
}
function OpenBlogComments(loginstate) {
    $("#blogcommentcontainer").css("position", "absolute");
    $("#blogcommentcontainer").css("left", "37px");
    $("#blogcommentcontainer").show();
    $("#BlogCommentAjaxContent").html("<div class='blogcommentclose'><a href='javascript:CloseBlogCommentInput()' onclick='CloseBlogCommentInput()' title='Close' ><img src='/media/images/misc/closediv.png' width='39' height='14' border='0' alt='Close'/></a></div><div class='clearboth'>&nbsp;</div><div class=\"spacerpx30\">&nbsp;</div><div class=\"centered\"><img src=\"/media/images/misc/ajax-loaderwhite.gif\" width=\"32\" height=\"32\" />&nbsp;&nbsp;&nbsp;<span class=\"redspan\">Loading ...</span></div>");
    // ajax call to load blog comment
    $.ajax({
        type: "GET",
        cache: false,
        data: "id=" + $("#bid").val() + "&state=" + loginstate,
        url: "/trainerblog/ajax/comment.input.aspx",
        success: function(html) {
            $("#BlogCommentAjaxContent").html(html);
            //$("#datacorner").attr("class", "bottomright");
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }
    });
    if ($("#InputMessageCtrl").length)
        $("#InputMessageCtrl").focus();
    else if ($("#NCSFUserNameCtrl").length)
        $("#NCSFUserNameCtrl").focus();
}
function CloseBlogCommentInput() {
    if ($("#blogcommentcontainer:visible").length == 1);
    $("#blogcommentcontainer").css("display", "none");
} 


