var objLogRequest;
var userIdVal;
var topLogRequest;
var userIdValue;
function chekWVUserId()
	    {
		 try
			{
       	   		if(document.getElementById("userId").value=="")
				{
					alert(" Before Adding New Web Video Comment, Please enter your Username & Password. ");
					return 0;
				}
				if(document.getElementById("userPass").value=="")
				{
					alert("You have not entered Password.");
					return 0;
				}
				
				var userId = document.getElementById("userId").value;
				var userPass = document.getElementById("userPass").value;
				
				userIdVal = userId;
				//alert("userId:->"+userId);
				//alert("userPass:->"+userPass);
				//alert(userId);
    	    var serUrl ='/servlet/WVideoUserLogin?userID='+userId+'&userPass='+userPass+'&randomNum='+Math.random()*Math.random();
       			//alert("serUrl:->"+serUrl);
				
				
        		if(window.ActiveXObject)
	        	{
    	        	objLogRequest = new ActiveXObject('Microsoft.XMLHTTP');
        	    	//alert("Windos Browser");
        		}
	        	else
    	    	{
        	    	objLogRequest = new XMLHttpRequest();
            		
	        	}
    	    	if(objLogRequest)
        		{
            		//alert("objAddRequest 1");
            		objLogRequest.onreadystatechange = sendWVLogInfo;
	            	//alert("objAddRequest 2");
    	        	objLogRequest.open('Get',serUrl);
        	    	//alert("objAddRequest 3");
					if(window.ActiveXObject)
	        		{
            			objLogRequest.send();
					}
					else
    	    		{
        	    		objLogRequest.send('');
            		
	        		}
	            	
    	    	}			
			}// end try
		   catch(e)
		   {
		   		alert("Exception in chekUserId function "+e);
		   }
	   
	    }
    	function sendWVLogInfo()
	    {   
			var Pwidth = 'width=400,height=350,left=300,top=300,screenX=0,screenY=0,scrollbars=no,resizable=no';
			var space = '';
			var url = '/WVJsp/WebUpload.html';
    		try
			{
        		//alert('object state :-> '+objLogRequest.readyState)
	        	if(objLogRequest.readyState==4)
    	    	{
        	    	if(objLogRequest.status==200)
            		{
						var responseLogin = objLogRequest.responseText.split("~");
						
						var response = responseLogin[0];
						//alert(response);
						var UserName = responseLogin[1];
						//alert('UserName :-> '+UserName)
						//alert(response);
						if(response =='notLogin')
        	    		{
							//document.getElementById("errorpass").innerHTML ="Username and password do not match.";
							if(document.getElementById("hidden").value=='loginDiv'){
								alert("Username & Password do not match! Please check.");
								document.getElementById("userPass").value="";
								
							}else{
								//window.location.assign('/servlet/ProDispatchAddInfo');
								alert("Username or password do not match.");
								document.getElementById("userPass").value="";
							}
						}
						if(response =='login')
        	    		{		
							//alert(response);
							if(document.getElementById("hidden").value=='loginDiv')
							{
								//alert('U R Succes');
								DisplayTextArea();
								var loginTop = document.getElementById('loginTop');
                           loginTop.innerHTML= ' ';
                           loginTop.innerHTML= '<table width="665" height="22" border="0" cellpadding="0" cellspacing="0">'+
	  '<tr align="left" valign="middle">'+
          '<td width="76" height="10" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
		  '<td width="262" colspan="-9" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
        '</tr>'+
        '<tr align="left" valign="middle">'+
		  '<td height="29" align="left" valign="middle" class="Welcome">&nbsp;Welcome!</td>'+
		  '<td height="29" align="left" valign="middle" class="UserName">&nbsp;&nbsp;'+UserName+'</td>'+
		  '<td width="177" height="29" align="left" valign="middle" class="Welcome"><div align="left"><a href="javascript:void(0)" onClick="SessionOut();"><img src="/image/WVImage/Home/Logout.gif" width="79" height="21" border="0" align="middle" /></a></div></td>'+
		  '<td width="150" height="29" align="left" valign="middle" ><a href="javascript:void(0)" onclick="window.open(\''+url+'\',\''+space+'\',\''+Pwidth+'\')"><div align="right"><img src="/image/WVImage/Home/UploadButton.gif" width="122" height="25" border="0" align="middle"/></div></a></td>'+
		'</tr>'+
     '</table>';
	    var loginLeft = document.getElementById('commTextArea');
							loginLeft.innerHTML = ' ';
							loginLeft.innerHTML = '<table>'+
						    '<tr>'+
							'<td width="170" height="15" align="left" valign="middle" class="redlinktext"><a href="javascript:void(0)" onclick="DisplayTextArea();">Give your feedback for this Video : </a></td>'+
							  '<td width="0" height="20"></td>'+
							  '<td height="5" align="left" valign="middle" class="redlinktext"><a href="javascript:void(0)" onClick="ShowComments(1)">Show Comments</a></td>'+
							  //'<td height="15" align="left" valign="middle" class="redlinktext" id="LiveComment">Comments: </td>'+
						    '</tr>'+
						  '</table>';
	  
	   
								//window.location.replace('/servlet/GetCategory');
							}
							else
							{  
								if(document.getElementById("hidden").value!='loginDiv'){
									//.window.location.assign('/servlet/GetCategory');
								}
							}					
						}
					}
				}
			}
			catch(ex)
   			{
				alert("Exception in sendInfo function "+ex);
   			}
	    }
		
//////////////////WVTopLogin Activity////////////////////////////////

function topWVUserId()
	    {
		 try
			{
       	   		if(document.getElementById("topuserId").value=="")
				{
					alert(" Before Upload New Web Video ,  Please enter your Username & Password. ");
					return 0;
				}
				if(document.getElementById("topuserPass").value=="")
				{
					alert("You have not entered Password.");
					return 0;
				}
				
				var userId = document.getElementById("topuserId").value;
				var userPass = document.getElementById("topuserPass").value;
				
				userIdValue = userId;
				//alert("userId:->"+userId);
				//alert("userPass:->"+userPass);
				//alert(userId);
    	    var serUrl ='/servlet/WVideoUserLogin?userID='+userId+'&userPass='+userPass+'&randomNum='+Math.random()*Math.random();
       			//alert("serUrl:->"+serUrl);
				
				
        		if(window.ActiveXObject)
	        	{
    	        	topLogRequest = new ActiveXObject('Microsoft.XMLHTTP');
        	    	//alert("Windos Browser");
        		}
	        	else
    	    	{
        	    	topLogRequest = new XMLHttpRequest();
            		
	        	}
    	    	if(topLogRequest)
        		{
            		//alert("objAddRequest 1");
            		topLogRequest.onreadystatechange = sendTopWVLogInfo;
	            	//alert("objAddRequest 2");
    	        	topLogRequest.open('Get',serUrl);
        	    	//alert("objAddRequest 3");
					if(window.ActiveXObject)
	        		{
            			topLogRequest.send();
					}
					else
    	    		{
        	    		topLogRequest.send('');
            		
	        		}
	            	
    	    	}			
			}// end try
		   catch(e)
		   {
		   		alert("Exception in chekUserId function "+e);
		   }
	   
	    }
    	function sendTopWVLogInfo()
	    {   
			var Pwidth = 'width=400,height=350,left=300,top=300,screenX=0,screenY=0,scrollbars=no,resizable=no';
			var space = '';
			var url = '/WVJsp/WebUpload.html';
    		try
			{
        		//alert('object state :-> '+topLogRequest.readyState)
	        	if(topLogRequest.readyState==4)
    	    	{
        	    	if(topLogRequest.status==200)
            		{
						var responseLogin = topLogRequest.responseText.split("~");
						//alert('response :-> '+response)
						//alert(response);
						var response = responseLogin[0];
						var UserName = responseLogin[1];
						if(response =='notLogin')
        	    		{
							//document.getElementById("errorpass").innerHTML ="Username and password do not match.";
							if(document.getElementById("tophidden").value=='loginDiv'){
								alert("Username & Password do not match! Please check.");
								document.getElementById("topuserPass").value="";
								
							}else{
								//window.location.assign('/servlet/ProDispatchAddInfo');
								alert("Username or password do not match.");
								document.getElementById("topuserPass").value="";
							}
						}
						if(response =='login')
        	    		{		
							//alert(response);
							if(document.getElementById("tophidden").value=='loginDiv')
							{
								//alert('U R Succes');
								//DisplayTextArea();
								//document.getElementById('login').innerHTML=response;
						   var loginTop = document.getElementById('loginTop');
                           loginTop.innerHTML= ' ';
                           loginTop.innerHTML= '<table width="665" height="22" border="0" cellpadding="0" cellspacing="0">'+
	  '<tr align="left" valign="middle">'+
          '<td width="76" height="10" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
		  '<td width="262" colspan="-9" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
        '</tr>'+
        '<tr align="left" valign="middle">'+
		  '<td height="29" align="left" valign="middle" class="Welcome">&nbsp;Welcome!</td>'+
		  '<td height="29" align="left" valign="middle" class="UserName">&nbsp;&nbsp;'+UserName+'</td>'+
		  '<td width="177" height="29" align="left" valign="middle" class="Welcome"><div align="left"><a href="javascript:void(0)" onClick="SessionOut();"><img src="/image/WVImage/Home/Logout.gif" width="79" height="21" border="0" align="middle" /></a></div></td>'+
'<td width="150" height="29" align="left" valign="middle" ><a href="javascript:void(0)" onclick="window.open(\''+url+'\',\''+space+'\',\''+Pwidth+'\')"><div align="right"><img src="/image/WVImage/Home/UploadButton.gif" width="122" height="25" border="0" align="middle"/></div></a></td>'+
		'</tr>'+
     '</table>';
						   /*'<table width="676" height="22" border="0" cellpadding="0" cellspacing="0">'+
						   '<tr align="left" valign="middle">'+
          '<td height="10" colspan="11" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
		  '<td width="17" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
        '</tr>'+
                            '<tr align="left" valign="middle">'+
          '<td height="10" colspan="11" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
		  '<td width="17" valign="top" bgcolor="#FFFFFF" class="commontext"></td>'+
       	  '<td height="10" colspan="11" valign="top" bgcolor="#FFFFFF" class="commontext"><b>Welcome! '+UserName+'</b></td>'+
		  '<td height="10" colspan="11" valign="top" bgcolor="#FFFFFF" class="commontext"><b>UpLoad</b></td>'+
          '<td height="10" colspan="11" valign="top" bgcolor="#FFFFFF" class="commontext"><a href="/blogger/sessionOut.jsp">LogOut</a></td>'+
		'</tr>'+
       '</table>';*/
						  var loginLeft = document.getElementById('commTextArea');
							loginLeft.innerHTML = ' ';
							loginLeft.innerHTML = '<table>'+
						    '<tr>'+
							'<td width="170" height="15" align="left" valign="middle" class="redlinktext"><a href="javascript:void(0)" onclick="DisplayTextArea();">Give your feedback for this Video : </a></td>'+
							  '<td width="0" height="20"></td>'+
							  '<td height="5" align="left" valign="middle" class="redlinktext"><a href="javascript:void(0)" onClick="ShowComments(1)">Show Comments</a></td>'+
							  //'<td height="15" align="left" valign="middle" class="redlinktext" id="LiveComment">Comments: </td>'+
						    '</tr>'+
						  '</table>';
								
								//window.location.replace('/servlet/GetCategory');
							}
							else
							{  
								if(document.getElementById("tophidden").value!='loginDiv'){
									//.window.location.assign('/servlet/GetCategory');
								}
							}					
						}
					}
				}
			}
			catch(ex)
   			{
				alert("Exception in sendInfo function "+ex);
   			}
	    }
