﻿// JScript File

//for forum page
var LoginLocation;
var NotAuthorisedLocation;

function SetLocation(login,notAuthorised)
    {
        LoginLocation=login;
        NotAuthorisedLocation=notAuthorised;
    }

function showAddTopicText(loggedUser,canPostTopic)
		{
		    if(loggedUser == 0)
		    {
		        window.location = LoginLocation;
		    }
		    else if(canPostTopic == 'True')
		    {
		      Effect.Appear($("divAddTopic"),{duration:1.5});
		    }
		    else
		    {
		        window.location =NotAuthorisedLocation;
		    }
		    
		    return false;
		}
		
function hideAddTopicText()
		{
            Effect.Fade($("divAddTopic"));
		    return false;
		}


function ValidateControls()
         {
            if(document.getElementById('ctl00_ContentPlaceHolder1_txtName').value=="")
            {
                alert("Please enter topic name");
                document.getElementById('ctl00_ContentPlaceHolder1_txtName').focus();
                return false;
            }
            if(document.getElementById('ctl00_ContentPlaceHolder1_txtPageText').value=="")
            {
                alert("Please enter topic page text");
                document.getElementById('ctl00_ContentPlaceHolder1_txtPageText').focus();
                return false;
            }
            return true;
         }  
         
         
         //for ForumDetail page
         
         function showPostReplyText(divReplyID,loggedUser,canPostReply)
		{
		    if(loggedUser == 0)
		    {
		         if(confirm("Please login to continue."))
                 { window.location =LoginLocation; }
                 else
                 { return false;}
            }
		    else if(canPostReply == 'True')
		    {


               Effect.Appear($("divReplyPost" + + divReplyID),{duration:1.5});
		    }
		    else
		    {
		        window.location = NotAuthorisedLocation;
		    }
		    return false;
		}
		
		function hidePostReplyText(divReplyID)
		{

            Effect.Fade($("divReplyPost" + divReplyID));
		    
		    return false;
		}
	   function ConfirmReplyPost(objTextbox)
         {
            objTextbox = objTextbox.replace("btnReplyPost", "txtReplyPost");
            var txtReplyPost = document.getElementById(objTextbox);
            var ReplyPost = txtReplyPost.value;
                             
            if(ReplyPost == "")
            {
                alert("Please enter reply comment");
                return false;   
            }
             
            return true; 
         }  
    
