﻿// JScript File

//to change the image of FVlogo on mouse over event
function MouseOverFVLogo()
{
document.getElementById("imgLogo").src="/dogtalent/images/FVLogoRollOver.jpg" ;
}
//to change the image of FVlogo on mouse out event
function MouseOutFVLogo()
{
document.getElementById("imgLogo").src="/dogtalent/images/FVLogo.jpg" ;
}
//To close the window
function closeWindow()
{    
    self.close();
}

/*clear the share video text buttons*/
function ClearShareVideosText(strLoginstatus)
{    
    if( strLoginstatus != null && strLoginstatus == "0")
    {
    document.getElementById("PlayVideoControl1_txtYourName").innerText = "";
    document.getElementById("PlayVideoControl1_txtYourName").textContent = "";
    
    document.getElementById("PlayVideoControl1_txtYourEmail").innerText = "";
    document.getElementById("PlayVideoControl1_txtYourEmail").textContent = "";
    }
    
    document.getElementById("PlayVideoControl1_txtFriendsName").innerText = "";
    document.getElementById("PlayVideoControl1_txtFriendsName").textContent = "";
    
    document.getElementById("PlayVideoControl1_txtFriendsEmail").innerText = "";
    document.getElementById("PlayVideoControl1_txtFriendsEmail").textContent = "";
    
    document.getElementById("PlayVideoControl1_txtMessage").innerText = "";
    document.getElementById("PlayVideoControl1_txtMessage").textContent = "";
}
/*Individual Video Screen*/
function ShowAddComment(UserStatus,strMessage)
{
    if (UserStatus == 'n')
    {        
        document.getElementById("PlayVideoControl1_divCommentsLogginError").style.display = 'block';                    
    }
    else if (UserStatus == 'r')
    {        
        document.getElementById("PlayVideoControl1_tblAddComments").style.display= 'block';
        document.getElementById("PlayVideoControl1_tblDescription").style.display = 'none';                    
        document.getElementById("PlayVideoControl1_lblVideoMessages").textContent = ""; //for Mozilla
        document.getElementById("PlayVideoControl1_lblVideoMessages").innerText = ""; //for IE              
    }
    else if (UserStatus == 'm')
    {
        document.getElementById("PlayVideoControl1_tblAddComments").style.display = 'block';
        document.getElementById("PlayVideoControl1_tblDescription").style.display= 'none';
    }
}
function openShareVideo()
{
 document.getElementById("PlayVideoControl1_tblShareVideo").style.display = 'block';  
 document.getElementById("PlayVideoControl1_tblDescription").style.display= 'none';
 document.getElementById("PlayVideoControl1_tblDisplayComments").style.display = 'none';  
}
/*function openApproveShareVideo()
{
 document.getElementById("ApproveVideoControl1_tblDescription").style.display = 'none';   
}*/
/*Individual Video Screen*/


//The script dealing with the drop down in the upload page - Start

var gSelectedValueUpLoad;
  function fnShowHideDropDownUpLoad()
		{
			var objDropDown = document.getElementById("divDropDownUpLoad");
			var objTextBox = document.getElementById("lblSelectedValueUpLoad");			
			
			if(objDropDown.style.display == "none")
			{
			    objDropDown.style.display = "block";
			    objTextBox.innerText = "";				
		        objTextBox.textContent = ""; //For firefox
			}
			else
			{			    
			    objDropDown.style.display = "none";
			    objTextBox.innerText = gSelectedValueUpLoad;
		        objTextBox.textContent = gSelectedValueUpLoad; //For firefox
			}			  
		}

function fnUpLoadSetValue(strValue)
{
    var objTextBox = document.getElementById("lblSelectedValueUpLoad");
	var objSelectedDiv = document.getElementById(strValue);
	//objSelectedDiv = strValue;
    
    if(objSelectedDiv.textContent != null)
        gSelectedValueUpLoad = objSelectedDiv.textContent; //For firefox
    else
        gSelectedValueUpLoad = objSelectedDiv.innerText; //For IE
        
    //Check for the "select" option
    if(objSelectedDiv.getAttribute("valuetoshow") != null)
        gSelectedValueUpLoad = objSelectedDiv.getAttribute("valuetoshow");
	
	fnShowHideDropDownUpLoad();
			
	var objDropDiv = document.getElementById('divDropDownUpLoad');
	var objAll = objDropDiv.getElementsByTagName('li');
	for(var i=0;i<objAll.length;i++)			
	{			
		objAll[i].className = "";		
	}
	//alert(objSelectedDiv.className);
	objSelectedDiv.className = "Selected";	
	//alert(objSelectedDiv.className);
	
	var objHiddenField = document.getElementsByTagName("input")
	for(var loop = 0;loop < objHiddenField.length;loop++)
	{
	    if(objHiddenField[loop].getAttribute("info") != null && objHiddenField[loop].getAttribute("info") == "catId")
	    {
	        if(objSelectedDiv.getAttribute("value") != "0")
	            objHiddenField[loop].value = objSelectedDiv.getAttribute("value");
	        break;
	    }
	}
}

function changeLiUpLoad(LIid)
{    
   // alert(document.getElementById(LIid).innerText);
   // alert(gSelectedValueUpLoad);
//    if(document.getElementById(LIid).innerText != gSelectedValueUpLoad && document.getElementById(LIid).textContent != gSelectedValueUpLoad)
//    {        
//        document.getElementById(LIid).className = "changeli";            
//    }  
    
      if(document.getElementById(LIid).className != "Selected" )
        {        
            document.getElementById(LIid).className = "changeli";            
        }
}

function restoreLiUpLoad(LIid)
{    
    if(document.getElementById(LIid).className != "Selected")
    {
      document.getElementById(LIid).className = "";
    }      
}

function getLastSelectedValueUpLoad()
{    
    var strLastSelectedText = " ";
    try
    {       
        var objDivContent = document.getElementById("divDropDownUpLoad").getElementsByTagName("div")[0];
        var strLastValue = objDivContent.getAttribute("lastSelectedValue");
        
        //get the text of the corresponding last selected value
        var objLiContent = document.getElementById("divDropDownUpLoad").getElementsByTagName("li");
        for(var nLoop=0;nLoop < objLiContent.length;nLoop++)
        {        
            if(objLiContent[nLoop].getAttribute("value") == strLastValue)
            {
                objLiContent[nLoop].className = "Selected";
                
                 if(navigator.appName=='Microsoft Internet Explorer')    
                 {
                    if(nLoop != 0)
                    {
                        strLastSelectedText = objLiContent[nLoop].innerText;
                    }
                    else
                    {
                        strLastSelectedText = objLiContent[nLoop].getAttribute("valuetoshow");
                    }
                    break;
                 }
                 else
                 {
                    if(nLoop != 0)
                    {
                        strLastSelectedText = objLiContent[nLoop].textContent;
                    }
                    else
                    {
                        strLastSelectedText = objLiContent[nLoop].getAttribute("valuetoshow");
                    }
                    break;
                 }
            }
        }
    }
    catch(e)
    {
        return null;
    }
    return strLastSelectedText
}

//The script dealing with the drop down in the upload page - end

//The script dealing with the drop down on left - Starts

var gSelectedValue;
  function fnShowHideDropDown()
		{
			var objDropDown = document.getElementById("divDropDown");
			var objTextBox = document.getElementById("lblSelectedValue");			
			
			if(objDropDown.style.display == "none")
			{
			    objDropDown.style.display = "block";
			    objTextBox.innerText = "";				
		        objTextBox.textContent = ""; //For firefox
			}
			else
			{			    
			    objDropDown.style.display = "none";
			    objTextBox.innerText = gSelectedValue;
		        objTextBox.textContent = gSelectedValue; //For firefox
			}			  
		}

		
	function fnSetValue(strValue)
	{
		var objTextBox = document.getElementById("lblSelectedValue");
		var objSelectedDiv = document.getElementById(strValue);
        
        if(objSelectedDiv.textContent != null)
            gSelectedValue = objSelectedDiv.textContent; //For firefox
        else
            gSelectedValue = objSelectedDiv.innerText; //For IE
            
        //Check for the "select" option
        if(objSelectedDiv.getAttribute("valuetoshow") != null)
        gSelectedValue = objSelectedDiv.getAttribute("valuetoshow");            
		
		fnShowHideDropDown();
				
		var objDropDiv = document.getElementById('divDropDown');
		var objAll = objDropDiv.getElementsByTagName('li');
		for(var i=0;i<objAll.length;i++)			
		{			
			objAll[i].className = '';		
		}
		objSelectedDiv.className = 'Selected';
		
		//call function for redirect if "select" option is not clicked
		if(objSelectedDiv.getAttribute("value") != "0")		
		    redirectTo(objSelectedDiv.getAttribute("value"));
	}  
  
  //For dropdown collapse on mouse click anywhere else 
  
  function hideDropMenu(e)
{
var targ;
if (!e)
  {
  var e = window.event;  
  }
if (e.target)
  {
  targ = e.target;
  }
else if (e.srcElement)
  {
  targ = e.srcElement;
  }
if (targ.nodeType == 3) // defeat Safari bug
  {
  targ = targ.parentNode;
  }
var tname;
var idname;
tname=targ.tagName;
idname = targ.id;

if(tname!='LI' && idname!='lblSelectedValue' && idname!='divSelectBoxDropDown'
    && idname!='lblSelectedValueUpLoad' && idname!='divSelectBoxDropDownUpLoad' || idname == '')	
	{
	    document.getElementById("divDropDown").style.display = 'none';	
	    var objTextBox = document.getElementById("lblSelectedValue");	
	    objTextBox.innerText = gSelectedValue;				
		objTextBox.textContent = gSelectedValue; //For firefox
		
		if(document.getElementById("lblSelectedValueUpLoad") != null)
        {
		    document.getElementById("divDropDownUpLoad").style.display = 'none';	
	        var objTextBox = document.getElementById("lblSelectedValueUpLoad");	
	        objTextBox.innerText = gSelectedValueUpLoad;				
		    objTextBox.textContent = gSelectedValueUpLoad; //For firefox
		}
	}
}

window.onload = function init()
{
    if(navigator.appName=='Microsoft Internet Explorer')    
    {        
        if(getLastSelectedValue() != null)
        {            
            document.getElementById("lblSelectedValue").innerText = getLastSelectedValue()
            gSelectedValue = getLastSelectedValue();
        }
        
        if(getLastSelectedValueUpLoad() != null)
        {    
            if(document.getElementById("lblSelectedValueUpLoad") != null)
            {
                document.getElementById("lblSelectedValueUpLoad").innerText = getLastSelectedValueUpLoad()
                gSelectedValueUpLoad = getLastSelectedValueUpLoad();
            }
        }
        document.onmousedown = hideDropMenu;
    }
    else
    {
        //For firefox
        document.getElementById("lblSelectedValue").textContent = getLastSelectedValue();
        gSelectedValue = getLastSelectedValue();
        document.body.setAttribute("onmousedown","hideDropMenu(event)");
        
        //For firefox
        if(document.getElementById("lblSelectedValueUpLoad") != null)
        {
            document.getElementById("lblSelectedValueUpLoad").textContent = getLastSelectedValueUpLoad();
            gSelectedValueUpLoad = getLastSelectedValueUpLoad();
            document.body.setAttribute("onmousedown","hideDropMenu(event)");
        }
    }
    
    //Initializing the rating elements
    if(document.getElementById("divMainRate") != null)
    {
        objDivRate = document.getElementById("divMainRate").getElementsByTagName("div")[1];            
        objPrevDivRate = document.getElementById("divMainRate").getElementsByTagName("div")[0];            
        strAvgRate = objDivRate.getAttribute("rate");
        strRateNum = objDivRate.getAttribute("ratenumber");
        
        objPrevDivRate.id = "rate"+strAvgRate;    
        
        var objPlayVServerMsgs = null;
        var objApproVServerMsgs = null;
        
        if(document.getElementById("PlayVideoControl1_hdnMessages") != null && document.getElementById("PlayVideoControl1_hdnMessages").value)
        {
           objPlayVServerMsgs = document.getElementById("PlayVideoControl1_hdnMessages").value;
        }
        
        if(document.getElementById("ApproveVideoControl1_hdnMessages") != null && document.getElementById("ApproveVideoControl1_hdnMessages").value)
        {
           objApproVServerMsgs = document.getElementById("ApproveVideoControl1_hdnMessages").value;
        }
        
        if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
        {
            document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = strRateNum+' Evaluations';
        }
        if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
        {
            document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = strRateNum+' Evaluations';
        }             
        
        if(objPlayVServerMsgs != null)
        {
           document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML =objPlayVServerMsgs;
        }   
        
        if(objApproVServerMsgs  != null)
        {
          document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML =objApproVServerMsgs;
        }
    }
}

function changeLi(LIid)
{
    if(document.getElementById(LIid).className != "Selected" )
    {    document.getElementById(LIid).className = "changeli";             
    }
}

function restoreLi(LIid)
{
    if(document.getElementById(LIid).className != "Selected" )
        document.getElementById(LIid).className = '';
}

function getLastSelectedValue()
{    
    var strLastSelectedText = " ";
    var objDivContent = document.getElementById("divDropDown").getElementsByTagName("div")[0];
    var strLastValue = objDivContent.getAttribute("lastSelectedValue");
  
    
    //get the text of the corresponding last selected value
    var objLiContent = document.getElementById("divDropDown").getElementsByTagName("li");
    for(var nLoop=0;nLoop < objLiContent.length;nLoop++)
    {        
        if(objLiContent[nLoop].getAttribute("value") == strLastValue)
        {
          //alert(strLastValue);
          //alert(objLiContent[nLoop].className);
            objLiContent[nLoop].className = "Selected";
            
             if(navigator.appName=='Microsoft Internet Explorer')    
             {
                if(nLoop != 0)
                {
                    strLastSelectedText = objLiContent[nLoop].innerText;
                }
                else
                {
                    strLastSelectedText = objLiContent[nLoop].getAttribute("valuetoshow");
                }
                break;
             }
             else
             {
                if(nLoop != 0)
                {
                    strLastSelectedText = objLiContent[nLoop].textContent;
                }
                else
                {
                    strLastSelectedText = objLiContent[nLoop].getAttribute("valuetoshow");
                }
                break;
             }
        }
    }
    
    return strLastSelectedText
}

//Function handling the redirect
function redirectTo(catId)
{
    var objDivContent = document.getElementById("divDropDown").getElementsByTagName("div")[0];
    var strUrl = objDivContent.getAttribute("catSearchResult");
    
    
    location.href = strUrl + catId;
}

//The script dealing with the drop down on left - Ends

/*Start of KeyPress Function*/
function PortionLoginSubmit(e)
{
if(e.keyCode==13 ||e.which ==13)
	{
		if (navigator.appName.indexOf('Microsoft') != -1)
		{
			document.getElementById("LoginControl1_btnSubmit").focus();			
		}
		else
		{
			document.getElementById("LoginControl1_btnSubmit").click();			
		}
	}
}
function PortionUploadSubmit(e)
{
if(e.keyCode==13 ||e.which ==13)
	{
		if (navigator.appName.indexOf('Microsoft') != -1)
		{
			document.getElementById("UploadVideoControl1_btnSubmit").focus();			
		}
		else
		{
			document.getElementById("UploadVideoControl1_btnSubmit").click();			
		}
	}
}
/*end*/

/*Script dealing wiht rating - Start*/
var objDivRate;
var objPrevDivRate;
var strAvgRate;
var strRateNum;
var strShowOldRate = 1;
var strAlreadyRated = 0;
var strAllowClick = 1;
function overImage(msg,rate)
{
    //objDivRate.className = "rate"+rate;
    if(strShowOldRate != 0)
    {
        if(strAlreadyRated != 1)
        {
            objPrevDivRate.id= "rate"+rate;
            if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = msg;
            }
            if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = msg;
            }
        }
        else //Display rating allowed only once
        {
            if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("message");
            }
            if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("message");
            }
        }
    }
}

function getOldRate(rateId)
{        
       // document.getElementById(rateId).className = "rate"+strAvgRate;
        if(strShowOldRate != 0)
        {
            objPrevDivRate.id= "rate"+strAvgRate;
            if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = strRateNum+' Evaluations';
            }
            if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = strRateNum+' Evaluations';
            }
        }
}
function ratingNotAllowed()
{
    if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
    {
        document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("message");
    }
    if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
    {
        document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("message");
    }
}

//****************************************AJAX implementation to update rating***************************************

    //Global variable for AJAX use.
    var xmlHttp;     
    var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
    var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
    var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
    //netscape, safari, mozilla behave the same??? 
    var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0;
    
function submitValue(value)
{
    try
    {
        //Do not allow rating if already rated
        if(strAlreadyRated != 1 && strAllowClick != 0)
        {
            //Disable click so long the response do not come back
            strAllowClick = 0;
            
            //show please wait message while sending the request        
            if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("wait");
            }
            if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
            {
                document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("wait");
            }
            
            //Disable showing of old rate on mouse out
            strShowOldRate = 0;
            
            //Create the XMLHttpRequest object.
            xmlHttp = getXmlHttp();                
            
            //Call the function to process the response from the server
            //Follow the used syntax to pass any parameter to the onreadystatechange handlar.
            xmlHttp.onreadystatechange = stateChanged;
            
            //Send request to the server
            var requestURL = location.href+"&rate="+value;        
            xmlHttp.open('GET',requestURL,true);
            xmlHttp.send(null); 
        }              
    }
    catch(e)
    {
        //alert("Error : Sending request");        
    }
}

//Function to process the response received
function stateChanged()
{
    try
    {
        if (xmlHttp.readyState==4 ||xmlHttp.readyState=='complete')
        {        
              //TO READ RESPONSE IN XML DOCUMENT. NOTE DIFFERENT METHOD FOR IE.    
//            var xmlDoc;
//            //get the response in xml as according to the type of browser
//            if (is_ie)
//            {
//                xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
//                xmlDoc.loadXML(xmlHttp.responseText);
//            }
//            else
//            {
//                xmlDoc = xmlHttp.responseXML.documentElement;
//            }            
            
            
            //Read response from the server and parse
            var strResponse = xmlHttp.responseText;
            var chStartEnd = strResponse.charAt(0);
            var strBuilString = "";
            var strStatus = null;
            var strAverageRate = null;
            var strRatingNumber = null;
            var chTemp = "";
            var nCounter = 0;            
            
            for(var nLoop = 1;nLoop <= strResponse.length;nLoop++)
            {
            
                chTemp = strResponse.charAt(nLoop);                
                if(chTemp != chStartEnd)
                {
                    if(chTemp != ",")
                    {
                        strBuilString = strBuilString + chTemp;                                                 
                    }
                    else
                    {
                        nCounter++;
                        
                        switch(nCounter)
                        {
                            case 1:
                                strStatus = strBuilString;    
                                break;
                            case 2:
                                strAverageRate = strBuilString;    
                                break;    
                            default:
                                strRatingNumber = strBuilString;                                    
                        }
                        
                        strBuilString = "";                        
                    }
                }
                else
                {
                    break;
                }                 
            }
            //PARSING COMPLETE
            
            
            if(strStatus == "98")
            {
                if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
                {
                    document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("fail");
                }
                if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
                {
                    document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("fail");
                }
                //To allow the rating since the database did not update
                strAlreadyRated = 0;
            }
            else if(strStatus == "99")
            {
                if(document.getElementById("PlayVideoControl1_lblVideoMessages") != null)
                {
                    document.getElementById("PlayVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("success");
                }
                if(document.getElementById("ApproveVideoControl1_lblVideoMessages") != null)
                {
                    document.getElementById("ApproveVideoControl1_lblVideoMessages").innerHTML = objDivRate.getAttribute("success");
                }
                                
                strAvgRate = strAverageRate;
                strRateNum = strRatingNumber;
                
                //To disallow the rating more then once
                strAlreadyRated = 1;
            }
            //To allow showing of rate on mouse out
            strShowOldRate = 1; 
            
            //enable the click
            strAllowClick = 1;           
        }        
     }
     catch(e)
     {
        //alert("Error : Processing response");
     }
}

//Creates and returns the XMLHttpRequest object.
function getXmlHttp()
{
    var objXmlHttp = null;    //Holds the local xmlHTTP object instance 

        //Depending on the browser, try to create the xmlHttp object 
        if (is_ie){ 
            //The object to create depends on version of IE 
            //If it isn't ie5, then default to the Msxml2.XMLHTTP object 
            var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP';
            //alert("Detected the IE version : "+strObjName);
             
            //Attempt to create the object 
            try{ 
                objXmlHttp = new ActiveXObject(strObjName);                
            } 
            catch(e){ 
            //Object creation errored 
                alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
                return; 
            } 
        } 
        else if (is_opera){ 
            //Opera has some issues with xmlHttp object functionality 
            alert('Opera detected. The page may not behave as expected.'); 
            return; 
        } 
        else{ 
            // Mozilla | Netscape | Safari 
            //alert("Detected Mozilla | Netscape | Safari");
            objXmlHttp = new XMLHttpRequest(); 
        } 
         
        //Return the instantiated object 
        return objXmlHttp;
}
/*Script dealing wiht rating - End*/

/*Script dealing with category management - start*/
function ShowEditBox(CatId)
{
    var objEditBox = document.getElementById("divEditCategory").getElementsByTagName("input")[0];
    var objEditLink = document.getElementById(CatId);
    
    //Show the edit textbox and display the category name in it
    document.getElementById("divEditCategory").className = "divEditCategoryShow";    
    
    if(navigator.appName=='Microsoft Internet Explorer')    
    {
        objEditBox.innerText = objEditLink.getAttribute("catName"); //For IE
    }
    else
    {//alert(objEditBox.textContent);
        objEditBox.value = objEditLink.getAttribute("catName"); //For FF
        //alert(objEditBox.textContent);
    }
    
    //Put the selected category value in the hidden field
    var objHidden = document.getElementsByTagName("input");
    for(var nLoop=0;nLoop < objHidden.length;nLoop++)
    {
        if(objHidden[nLoop].getAttribute("catId") != null)
        {
            objHidden[nLoop].value = objEditLink.getAttribute("catId");
            break;
        }
    }
    //alert(objHidden[nLoop].value);  
    
    //Hide message
    document.getElementById("divCategoryMessage").className = "divEditCategoryHidden";
}
/*Script dealing with category management - end*/

function valUpload(titleErr,DescErr,uploadDDErr,fileErr,fileFormatErr,chekErr)
 {
    var bReturn = true;
    document.getElementById("UploadVideoControl1_clErr").innerHTML = "";
    //title Check
    //alert(document.getElementById("UploadVideoControl1_txtTitle").value);
    if(document.getElementById("UploadVideoControl1_txtTitle").value == null ||
       document.getElementById("UploadVideoControl1_txtTitle").value == '')
    {
       //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
       document.getElementById("UploadVideoControl1_clErr").innerHTML += titleErr + "<BR>";
       //alert(titleErr);
       bReturn = false;
    }
    //Description Check
    //alert("Description");
    if(document.getElementById("UploadVideoControl1_txtDescription").value == null ||
       document.getElementById("UploadVideoControl1_txtDescription").value == '')
    {
       //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
       document.getElementById("UploadVideoControl1_clErr").innerHTML += DescErr + "<BR>";
       bReturn = false;
    }
    //Category Check
    //alert("Category");
    if(document.getElementById("UploadVideoControl1_catId").value == null ||
       document.getElementById("UploadVideoControl1_catId").value == '')
    {
      // alert(document.getElementById("UploadVideoControl1_LabelUploadDropDown1").style.visibility);
       //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
       document.getElementById("UploadVideoControl1_clErr").innerHTML += uploadDDErr + "<BR>";
       bReturn = false;
    }
    //alert("ValidateRadUpload");
    //ValidateRadUpload    
    var fileInputCount = GetRadUpload('UploadVideoControl1_RadUpload1').GetFileInputs().length; 
    var fileInputs = GetRadUpload('UploadVideoControl1_RadUpload1').GetFileInputs();
    var blnValidateExtns = GetRadUpload('UploadVideoControl1_RadUpload1').ValidateExtensions();
    var i = 0;                      
    
    if(fileInputCount == 0)
    {
       //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
       document.getElementById("UploadVideoControl1_clErr").innerHTML += fileErr+ "<BR>";;  
       bReturn = false;
    }
    else if(fileInputCount == 1)
    {
      if(fileInputs[i].value == null || fileInputs[i].value == "" || fileInputs[i].value == '')
      {
        //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
        document.getElementById("UploadVideoControl1_clErr").innerHTML += fileErr+ "<BR>";;  
        bReturn = false;
      }
    }
    
    //Validate Extensions
    //alert("Validate Extensions");
    if(blnValidateExtns == false)
    {
        //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
        document.getElementById("UploadVideoControl1_clErr").innerHTML += fileFormatErr+ "<BR>";;  
        bReturn = false;      
    }
    
    //Check BOX
    //alert("Check BOX");
    if(document.getElementById("UploadVideoControl1_chkTerms").checked == false)
   {
      //document.getElementById("UploadVideoControl1_clErr").style.display = "block";
      document.getElementById("UploadVideoControl1_clErr").innerHTML +=chekErr;  
      bReturn = false;
   }
   //alert(bReturn);
   scroll(0,0);
    return bReturn;
 }
