	var ArPopUpSub=new Array();
	var ArPopUpTyp=new Array();
	var ArPopUpWnd=new Array();
	var PopUpNos=0;
	var hubactivitytype='friends';
	var elementid;
	var width;
	var height;
	var search_text;
	var flag = false;
	if(!flag){
		dwr.engine.setActiveReverseAjax(true);
		flag = true;
	}
	function getvideocall(eid,urlId,w,h){
//		alert("urlid==============="+urlId);
		width=w;
		height=h;
		elementid=eid;
		fnGetRegHTML('GetVideo?id='+urlId,7);
	}
	/*
	function playeachpageaudio(id,music_file)
	{
	 var so = new SWFObject("mymp3player.swf", "mymovie", "75", "30", "7", "#FFFFFF");
     so.addVariable("autoPlay", "yes");
     so.addVariable("soundPath", "assets/audios/file/"+music_file);
     so.write("audioplayer");
	}
	*/
	 function showimage(imagename)
     {
     document.getElementById("whateveryonedoingpagelinkid").src="images/home/"+imagename+"";
      }
	function sethubtype(type){
		hubactivitytype=type;
		fnGetRegHTML('get-parser.jsp?params=317;'+hubactivitytype,3);
	}
	function sethubtypeforhubpage(type){
		hubactivitytype=type;
		fnGetRegHTML('get-parser.jsp?params=355;'+hubactivitytype,8);
	}
	
	function showhubactivity(){
	  	fnGetRegHTML('get-parser.jsp?params=317;'+hubactivitytype,3);
	}
	
	function startHubTimer(){
		if(document.getElementById("hubactivitydiv")!=null)
		{
		 // alert(hubactivitytype);
		  fnGetRegHTML('get-parser.jsp?params=317;'+hubactivitytype,3);
		}
	}
	function forgottenpassword()
	{
	  fnShowData('get-parser.jsp?params=322;xyz','header_reg',0,false);
	}
	function validateforgottenpassword()
	{
	  var frm=document.getElementById("frmforgottenpassword");
	  if((frm.email.value=="") || (frm.email.value==null))
	  {
	  	alert("Enter E-mail");
	  }
	  else
	  {
	    frm.action="MultipartHandler";
		frm.submit();
	  }
	}
	function showforgottenpasswordmessage(status)
	{
	  fnShowData('get-parser.jsp?params=323;'+status,'header_reg',0,false);
	
	}
	function changepassword()
	{
	   fnShowData('get-parser.jsp?params=320;xyz','header_reg',0,false);
	}
	function cancelchangepassword()
	{
	 document.getElementById("header_reg").innerHTML="";
	}
	function showchangepasswordmessage(status)
	{
	fnShowData('get-parser.jsp?params=321;'+status,'header_reg',0,false);
	}
	
	function validatechangepassword()
	{
		var frm=document.getElementById("frmchangepassword");
		
		if((frm.email.value=="") || (frm.email.value==null))
		{
		alert("Enter Email");
		
		}
		else if((frm.oldpassword.value=="") || (frm.oldpassword.value==null))
		{
		alert("Enter Old password");
		}
		else if((frm.newpassword.value=="") || (frm.newpassword.value==null))
		{
		alert("Enter New password");
		}
		else if((frm.confirmpassword.value=="") || (frm.confirmpassword.value==null))
		{
		alert("Enter Confirm password");
		}
		else if(!(frm.confirmpassword.value==frm.newpassword.value))
		{
		alert("New Password and Confirm password should be same.");
		}
		else
		{
		frm.action="MultipartHandler";
		frm.submit();
		}
	}
	function changechatcategory(){
		catid=document.getElementById("chatcategory").value;
		var targetId="chatdirectory";
		fnShowData('get-parser.jsp?params=183;'+catid+";"+targetId+";"+JSID+"'",targetId,0,false);
	}
	JavaChat.getTopChatRooms();
	function TopChatRooms(r1,r2){
		JSCR1 = r1;
		JSCR2 = r2;
		//alert('r1 '+JSCR1+' r2 '+JSCR2);
	}
	function get_Registration(status){
	  	//fnGetHTMLRegister('get-parser.jsp?params=135;xyz');
	  	//aConfirmBoxType=0;
	  	//alert('get_Registration '+status);
	  	fnShowData('get-parser.jsp?params=184;'+status,'header_reg',0,false);
	  	//aConfirmBox.askUser('<iframe frameborder="0" scrolling="no" height="400" width="300" name="ifrmRegistration" id="ifrmRegistration" src="registration.jsp"></iframe>',"Artistic Yoga Registration.");
 	}
 	
 	function get_Captcha(){
 		fnShowData('get-parser.jsp?params=345;','tr_captcha',0,false);
 	}
 	
 	function Success_Registration(status){
	  	//fnGetHTMLRegister('get-parser.jsp?params=135;xyz');
	  	//aConfirmBoxType=0;
	  	//alert('get_Registration '+status);
	  	fnShowData('get-parser.jsp?params=185;'+status,'header_reg',0,false);
	  	//aConfirmBox.askUser('<iframe frameborder="0" scrolling="no" height="400" width="300" name="ifrmRegistration" id="ifrmRegistration" src="registration.jsp"></iframe>',"Artistic Yoga Registration.");
 	}
 	function Cancel_Confirm(dv) {
		if(document.getElementById(dv).style.display == 'none')
			document.getElementById(dv).style.display = 'block';
		else
			document.getElementById(dv).style.display = 'none';
	}
	function ValidateRegResult(innerHtml,typ){	
//		alert('innerHtml '+innerHtml);
	    if(typ==0)// for registration
		 {	
	 		//alert('in type 0 '+innerHtml);
	 		if(innerHtml==0 || innerHtml.indexOf("0")>-1){
	 			fnExecHTML(JSURL,'dsd');
	 			window.location.reload();
	 		}else
	 		fnShowData('get-parser.jsp?params=136;'+innerHtml,'header_reg',0,false);
		 }
		 if(typ==1)
		 { 
		  // alert('jsid in header'+JSID);
			document.getElementById("showallusers").innerHTML=innerHtml;
			fnGetRegHTML('get-parser.jsp?params=292;'+JSID,2);
		 
		 }
		 if(typ==2)
		 {
			document.getElementById("totcu").innerHTML=innerHtml;
		 }
		 if(typ==3)
		 {
			document.getElementById("hubactivitydiv").innerHTML=innerHtml;
			init_Scroll('10');
			
			
			if(document.getElementById("leftsideteacherslist")!=null)
			{
			//alert("there is hub teacher and contributor in this page");
			fnGetRegHTML('get-parser.jsp?params=340;'+JSID,4);
			}
			else
			{
			// alert("there is no hub teacher and contributor in this page");
			}
		 }
		 if(typ==4)
		 {
		  document.getElementById("leftsideteacherslist").innerHTML=innerHtml;// refereshing left side teachers list.
		  fnGetRegHTML('get-parser.jsp?params=341;'+JSID,5);
		 }
	   if(typ==5)
		 {
			  document.getElementById("leftsidecontributorslist").innerHTML=innerHtml;// refereshing left side contributors list.
			  if(document.getElementById("leftsidefriendslist")!=null)
			  {
			   // alert("there is friend list here");
			    fnGetRegHTML('get-parser.jsp?params=342;'+JSID,6);
			  }
			  else
			  {
			  init_Scroll('6');
			  init_Scroll('7');
			 // alert("there is no friend list in this page.");
			  }
		 }
		  if(typ==6)
		 {
		  document.getElementById("leftsidefriendslist").innerHTML=innerHtml;// refereshing left side friends list.
		  init_Scroll('6');
		  init_Scroll('7');
		  init_Scroll('8');
		 }
		 if(typ==7)
		 {		
		var videoElement = document.createElement('video');
       videoElement.setAttribute('src', innerHtml+".mp4");
       videoElement.setAttribute('autoplay', 'true');
       videoElement.setAttribute('controls', 'true');
       videoElement.setAttribute('width', width);
       videoElement.setAttribute('height', height);
       videoElement.setAttribute('id', 'a');
       videoElement.setAttribute('type', "video/mp4; codecs= 'avc1.42E01E, mp4a.40.2'");
       videoElement.play();
       if(document.getElementById('a'))
       {
        document.getElementById(elementid).removeChild(document.getElementById('a'));
       }
         document.getElementById(elementid).appendChild(videoElement);
		 }
	 if(typ==8)
	 {
	  document.getElementById("pagehubactivitydiv").innerHTML=innerHtml;
	  }
		 
		 
	}
	//var pageno = 1;
	function search_validate(formObject,cat,pageno) {
		//alert('page no '+typeof(pageno));
		if(typeof(pageno) == "undefined")
			pageno = 1;
		if(typeof(cat) == "undefined")
			cat = 'text';
		var frm = document.getElementById(formObject);
		if((frm.all.value=="") || (frm.all.value==null)){
			alert("Enter Search Word");
			frm.all.focus();
		}
		else
		{	 
			//document.frmLogin.action = "SubscriberValidate.jsp?url="+url;
			//search_text=frm.all.value;
			window.location = "#!Search";
//			alert("after window location");
			setTimeout("search_validatedelay('"+formObject+"','"+cat+"','"+pageno+"')",1000);
			
//			search_validatedelay(formObject,cat,pageno);
			//frm.submit();
		}
		
	}
	function search_validatedelay(formObject,cat,pageno)
	{
			var frm = document.getElementById(formObject);
			frm.pageno.value="1";
			fnShowSearchData('facets.dw?type=facet&pageno='+pageno+'&all='+frm.all.value+'&solr.Limit='+frm.sLimit.value+'&category='+cat,'srch1',false);//
			//fnShowData('facets.dw?q=yoga&version=2.2&start=0&rows=10&indent=on');
			//var strSessionValue = '<%=Session("hiddenKeyWord").ToString();%>';
			//frm.all.value =search_text;
			var dvcat = 'sdiv_'+cat;
			search4(dvcat);
	
	}
	
		
	function validate_login(){
	}
 	function RemoveSubPopUp(idSub) {
		//alert('rem '+idSub);
		for(i=0;i<PopUpNos;i++){
			if(ArPopUpSub[i]==idSub){
				for(j=i;j<PopUpNos-1;j++){
					ArPopUpSub[j]=ArPopUpSub[j+1];
					ArPopUpTyp[j]=ArPopUpTyp[j+1];
					ArPopUpWnd[j]=ArPopUpWnd[j+1];
				}
				PopUpNos--;
				return true;
			}
			PopUpNos--;
			return true;
		}
	}
	
	function getMyFriends() {
		fnShowData('get-parser.jsp?params=180;'+JSID,'dvfriends',0,false);
		setTimeout("fnShowData('get-parser.jsp?params=181;"+JSID+"','dvteachers',0,false)",500);
	}
	function RemovePopUp() {
		var rIndx=0; var lowPriority=9;
		for(i=0;i<PopUpNos;i++){
			if(ArPopUpTyp[i]<lowPriority) {
				lowPriority=ArPopUpTyp[i];
				rIndx=i;
			}
		}
		
		for(i=0;i<PopUpNos;i++){
			if(ArPopUpSub[i]=idSub){
				for(j=i;j<PopUpNos-1;j++){
					ArPopUpSub[j]=ArPopUpSub[j+1];
					ArPopUpTyp[j]=ArPopUpTyp[j+1];
				}
				PopUpNos--;
			}
			return;
		}
	}
	function startup(sid) {
     //  alert("inside start application......"+sid);
 		//dwr.engine.setActiveReverseAjax(true);
//		JavaChat.StartApp(sid);
	}
	function handleGetData(){ 
		alert('in handledata');
    }

   	function ChatLogin(sid){  
//		alert("logged in...!!!your id :" + sid);
//		dwr.engine.setActiveReverseAjax(true);
//		alert("inside chat Login");
       	JavaChat.ChatLogin(sid);
//       	setTimeout('JavaChat.ChatLogin('+sid+')');
	}
	
	function ChatLogout(sid) {
 	     //dwr.engine.setActiveReverseAjax(true);
		//alert("logout id........................ "+sid);
//		setTimeout('JavaChat.ChatLogout('+sid+')');
		JavaChat.ChatLogout(sid);
	//alert("  The given id has logout........................ "+sid);
	}
	 
	function getChatMessage(from_id,from_name,to_id,thumb){
		//alert("from ID "+JSID+" to msg "+to_id);
 		if(JSID==to_id)
 			chatWith(from_id,from_name,thumb,'GSM')
 		//openmypage(to_id, from_id, from_name,'SM',thumb);
 	}
 	function addTeacher_Contributor(id,name,type,thumb){
//		alert("inside client side addTeacher_contributor");
// 		alert("JsID:"+ JSID+" >> id:"+id+" >>name: "+name+" >> type: "+type+" thumb :"+thumb)
 		if(JSID==id)
 			return;
 		//alert("teacher contri "+type);
	 	if(type == 1)
	 		addChatUserLI('chat_teachers', id, name, thumb,'ctli_')
	 	if(type == 2)
	 		addChatUserLI('chat_contributors', id, name, thumb,'ccli_')
 	}
 	function addFriends(to_id,id,name,thumb){
// 		alert("adding a friend in your chat window, id : " + to_id);
// 		alert("id : " + id + " >>name : " +name + " >>thumb : " + thumb);
 		if(to_id !=""){
 			if(to_id.indexOf("|") != -1){
		 		var friends_ids = to_id.split("|");
//		 		alert('friends Ids =>' + friends_ids + ' and JSID =>' +JSID);
		 		for(i=0;i<friends_ids.length;i++){
			 		if(JSID == friends_ids[i])
			 		{
			 	 		addChatUserLI('chat_friends', id, name, thumb,'cfli_')
			 	 		break;
			 	 	}
		 		}
 			} else {
 				if(JSID == to_id)
		 	 		addChatUserLI('chat_friends', id, name, thumb,'cfli_')
 			}
 		}
  	}
 	
 	function addChatUserLI(list_name, id, name, thumb,type) {
// 		alert("adding user with userId: " + id + " to your Chat Window");
		var list = document.getElementById(list_name);
		var li = document.createElement("li");
		li.id = type+id;
	//	alert("inside..addChatUserLI..li.id is........."+document.getElementById(li.id));
		if(list!=null && li!=null && document.getElementById("totcu")!=null){
			if(document.getElementById(li.id) == null)
			{
				li.innerHTML = '<a class="" href="javascript:void(0);" onClick="javascript:chatWith(\''+id+'\',\''+name+'\',\''+thumb+'\',\'FM\')"><img src="images/chat/chat-thumb.gif" alt=""> '+name+'</a>';
				list.appendChild(li);
				var tot = document.getElementById("totcu").innerHTML;
				if(list_name=='chat_friends') tot++;
				document.getElementById("totcu").innerHTML = tot;
			}
		}	
	}
	function removeTeacher_Contributor(id,type){
//		alert('removing teacher/contributor with id: ' + id);
		if(JSID==id)
 			return;
 		//alert('teacher contri '+type);
	 	if(type==1)
	 	removeChatUserLI('chat_teachers', id,'ctli_')
	 	if(type==2)
	 	removeChatUserLI('chat_contributors', id,'ccli_')
	}
	function removeFriends(to_id,id){
 		if(to_id != ""){
 			if(to_id.indexOf("|") != -1){
		 		var friends_ids = to_id.split("|");
	 			for(i=0;i<friends_ids.length;i++){
			 		if(JSID==friends_ids[i])	{
				 	 	removeChatUserLI('chat_friends', id, 'cfli_');
				 	 	break;
			  	    }
	 			}	
 			}else{
 				if(JSID==to_id){
				 	 	removeChatUserLI('chat_friends', id, 'cfli_');
			  	}
 			}
 		}
  	}
	function removeChatUserLI(list_name, id, type) {
		id = type+id;
		//alert('li............remove......... '+id)
		var list = document.getElementById(list_name);
		//alert(id);
		var li = document.getElementById(id);

		if(list!=null && li != null){
		//alert('inside  if.......'+li)
			list.removeChild(li);
			var tot = document.getElementById("totcu").innerHTML;
			if(list_name=='chat_friends') tot--;
			document.getElementById("totcu").innerHTML = tot;
		//alert('inside  if.....tot--..'+tot)
		}
	}
	function getOfflineMessage(from_id,from_name,to_id){
		//alert("offline"+to_id);
 		if(JSID==to_id)
 		fnGetChat('getchat.jsp?sid='+from_id+'&to='+to_id+'&MT=SM','SM',from_id)
 		//alert('Append Offline message'+name);
 		
 	}
 
	function ConfirmVCall(from_id,from_name,to_id,thumb,type){
		//alert('Confirm VCall'+to_id);
		if(JSID==to_id){
		//alert('confirm v call');
 		chatWith(from_id, from_name,thumb,'FM');
 		openvcall(from_id,from_name,type)
 		}
 		//
	}
	function openvcall(from_id,from_name,type) {
		var div_id = 'chatboxvideo'+from_id;
		document.getElementById(div_id).style.backgroundColor  = "white";
		if(type==1)
		 str = "Video";
		else if(type==2)
		 str = "Audio";
		 
		document.getElementById(div_id).innerHTML =from_name+"\'s "+str+" call..  "+
						"<input type='button' id='btnyvc' value='Accept' onclick=\"startvcall('"+from_id+"','"+from_name+"','"+type+"');\" ><input type='button' id='btnnvc' value='Reject' onclick=\"rejectvcall("+from_id+");\" > "; 
		
		document.getElementById(div_id).style.height = "30px";
	}
	function closevcall(to_id) {
		 
		var div_id = 'chatboxvideo'+to_id;
		//alert('div '+div_id);
		if(document.getElementById(div_id) !=null){
			document.getElementById(div_id).innerHTML ="";
			document.getElementById(div_id).style.height = "0px";
		}
 	}
	
	function rejectvcall(to_id) {
		//alert('rej '+to_id);
		closevcall(to_id);
		//alert('rej clear div');
		JavaChat.CancelVChat(JSID);
	}
	function cancelvcall(to_id) {
		closevcall(to_id);
		//alert('cancel clear div');
		JavaChat.CancelVChat(JSID);
		
	}
	function onEndVideoChat(obj){
	//alert(obj.secondPerson);
	closevcall(obj.secondPerson);
	//	alert('cancel clear div');
	JavaChat.CancelVChat(obj.firstPerson);
	JavaChat.CancelVChat(obj.secondPerson);
	
	//alert(obj.firstPerson);
	
	
	}
	function initvcall(to_id,to_name,type)
	{
		//JSCT=1;
	//	alert('in invitcall');
		var div_id = 'chatboxvideo'+to_id;
		document.getElementById(div_id).style.backgroundColor  = "white";
		document.getElementById(div_id).innerHTML = "<div  style='padding-top: 1px;float:left;'><img src='images/chat/call.gif'><a href='javascript:cancelvcall("+to_id+")'><img src='images/chat/no.png'></a></div>";
		document.getElementById(div_id).style.height = "30px";
		JavaChat.MakeVCall(JSID,to_id,JSNM,to_name,type);
	}
	 
	 
	function startvcall(to_id,to_name,type) {
	  // alert("start vcall");
		JavaChat.StartVCall(JSID,to_id,type);
	}
	function ConnectVCall(from_id,to_id,type,s1,s2) 
	{
		//alert("my id "+JSID+"Connected V Call id "+from_id+" id "+to_id);
		if(JSID == from_id){
		var div_id = 'chatboxvideo'+to_id;
		
		document.getElementById(div_id).innerHTML=  "";
		//document.getElementById(t3).style.width = "100%";
		//alert('div '+document.getElementById(t3).style.hieght);
		//document.getElementById(div_id).style.backgroundColor  = "black";
			//document.getElementById(t3).innerHTML = "SHowing SWF";
			if(type==1){
			document.getElementById(div_id).style.height = "161px";
			StartVideoChat(from_id,to_id,s1,s2,'v','100%','161px',div_id,true);
			}else if(type==2){
			document.getElementById(div_id).style.height = "50px";
			StartVideoChat(from_id,to_id,s1,s2,'a','100%','0px',div_id,true)
			document.getElementById(div_id).innerHTML = "<div  style='padding-top: 1px;float:left;'><img src='images/chat/call.gif'><input type='button' value=Video Call onclick=startvcall("+to_id+","+from_id+",'1') ></div>";
			}
			document.getElementById(div_id).style.display = "block";
			 			
		}	
	 	 
	}
	function connectvcall(from_id,to_id,stream1, stream2){
	document.getElementById(div_id).style.display = "block";
	//
	
	}
	function onSwitchToAudio(obj){
		//alert(obj.firstPerson);
		//alert(obj.secondPerson);
		JavaChat.StartVCall(JSID,obj.secondPerson,'2');
	}
	
	function onAuthFailure() {
		
	}
	var j ;
	function openmypage(from_id,to_id,to_name,type,thumb){ 
		 j = jQuery.noConflict(); 
 		//Define arbitrary function to run desired DHTML Window widget codes
		//alert('Open Append message'+to_id);
		var i = 0;
		var t2 ;
		var t1;
		
		for(i=0;i<PopUpNos;i++){
			if(ArPopUpSub[i]==to_id){
			if(type =='CVC'){
				//alert('confirm v call0');
				fnGetChat('getchat.jsp?sid='+from_id+'&to='+to_id+'&MT=SM','SM'+type,to_id) // call and attach msg
				//alert('confirm v call1');
			}
			else
				fnGetChat('getchat.jsp?sid='+from_id+'&to='+to_id+'&MT='+type,type,to_id) // call and attach msg
			 
				//alert('present');
				return;
			}
		}
		var ypos = (window.screen.width - 1024)/2;
		var xpos = window.innerHeight - 242;//(document.height - 200);
		//alert(window.innerHeight);
		
		ajaxwin=dhtmlwindow.open("chat"+to_id, "ajax", "getchat.jsp?sid="+from_id+"&to="+to_id+"&MT=FM", to_name,JSID,to_id,JSNM,to_name,'<img src=assets/subscriber/'+thumb+'>', "width=215px,height=350px,left="+(ypos+(PopUpNos*205))+"px,top="+xpos+"px,resize=0,scrolling=0", "recal")
		//Run custom code when window is about to be closed
		ajaxwin.onclose=function(){return RemoveSubPopUp(to_id)} 
		//alert('pop uped');
		if(type=='CVC'){
			//alert('in cvc111 '+to_id);
			t2 = 'dv_vc'+to_id;
			t1 = 'ajaxchat'+to_id;
			t3 = 'dv_vc'+from_id;
			//alert('div '+t2);
			//alert('disp '+document.getElementById(t1));
			//alert('disp2 '+document.getElementById(t2));
			//alert('ch div '+t1);
			 if(document.getElementById(t2).style.display == 'none'){
			 	//alert('1');
				 document.getElementById(t2).style.display = "block";
				//alert('2');
				i = document.getElementById(t1).style.height;
				//alert('3');
				 i=i.substring(0,i.length-2);
				 i=i-25;
				 document.getElementById(t1).style.height = i+"px";
				 document.getElementById(t2).innerHTML = "  calling..  "+
							"<input type='button' id='btnyvc' value=Accept onclick=startvcall('dv_vc"+to_id+"','ajaxchat"+to_id+"','frmchat"+to_id+"') ><input type='button' id='btnnvc' value=Reject onclick=rejectvcall("+to_id+") > "; 
				 //JavaChat.MakeVCall('6','5','Ravi','Queen');
			 }
			 //alert('vcv');
		}
		
		ArPopUpSub[PopUpNos]=to_id;
		ArPopUpWnd[PopUpNos]=ajaxwin;
		PopUpNos++;
//		alert("before calling to upload");
	 	setTimeout("upload"+to_id+"()",100);
	}
	
	function UpdateChat(Msg,type,to_id){
		//alert('Append '+Msg+' TO '+to_id+' type '+type);
		if(type=='SMCVC'){
			//alert('before open vcall');
			openvcall(to_id)
			type="SM";	
			//alert('div placed');
		}
		var chatdiv= "ajaxchat"+to_id;
 		if(type=="FM")
 		document.getElementById(chatdiv).innerHTML =Msg;
 		else
 		document.getElementById(chatdiv).innerHTML +=Msg;
 		var objDiv = document.getElementById(chatdiv);
		objDiv.scrollTop = objDiv.scrollHeight;
		
		JavaChat.ChangeMsgState(to_id,JSID);
		//alert('2');
	}
	
	function getprivatemessage(frm_param){ //Define arbitrary function to run desired DHTML Window widget codes
		var frm = document.getElementById(frm_param);
		var chatdiv  = "ajaxchat"+frm.txtto_id.value;
		if((frm.txtmsg.value!="") && (frm.txtmsg.value!=null)){
			JavaChat.addPrivateMessage(frm.txtfrom_id.value,frm.txtto_id.value,frm.txtfrom_name.value,frm.txtto_name.value,frm.txtmsg.value);
	 		document.getElementById(chatdiv).innerHTML +='<div id=top><div class=txt>'+
	 							'<span class=ft10>me: </span><br/><span class=ft11> '+frm.txtmsg.value+'</span></div>';
	 		frm.txtmsg.value = "";
	 		var d_id = "ajaxchat"+frm.txtto_id.value;
			var objDiv = document.getElementById(d_id);
			objDiv.scrollTop = objDiv.scrollHeight;
			frm.txtmsg.focus();
	 		//	fnShowData('get-parser.jsp?params=141;'+frm.txtfrom_id.value+';'+frm.txtto_id.value+';<span class=ft11>JSNM : </span> '+frm.txtmsg.value+'<br>','ajaxchat'+frm.txtto_id.value,0,false);
		}
	}
	function uploadfileforsendfile(to_id,to_name)
	{
	           //alert('in uploadfileforsendfile');
                var uploader = new qq.FileUploader({
                element: document.getElementById('dv_sf_btn_'+to_id),
                action:'ChatSendfile',
                params: {
					        status: 'sendfile',
					        caption:'Send File',
					        classname:'qq-upload-button'				       
					     },
                debug:false,
                onComplete: function(id, fileName, responseJSON)
                {
                 var url = responseJSON.url;
                 sendmyfile(fileName,to_id, to_name,url);
                }
               
            });           
	
	
	}
	function sendmyfile(fl, to_id,to_name,fileurl){ //Define arbitrary function to run desired DHTML Window widget codes
		populateChatMessage(to_id, 'SSM','Click here <a href='+fileurl+' target=_blank>'+fl+'</a> to download<br>');
		setTimeout('JavaChat.sendPrivateMessage('+JSID+','+to_id+')',1000);
		
		//JavaChat.addPrivateMessage(JSID,to_id,JSNM,to_name,'<span class=ft11>'+JSNM+' </span> send <a href='+fileurl+' target=_blank>'+fl+'</a> file to <span class=ft11>'+to_name+'</span><br>');
	}
	function getChatStatus(sid,name,thumbnail) {
		//	alert("Here"+sid);
		var myTable=document.getElementById("myFriends");
		for(i=1;i<myTable.rows.length;i++) {
			if(sid == myTable.rows[i].cells[0].innerHTML){
			//alert(myTable.rows[i].innerHTML);
			myTable.rows[i].innerHTML ="<td style='display:none;'>"+sid+"</td>" +
						 		"<td height='20' align='center' width='15%'><img src='images/ask/online-cir.png'/></td>" +
						 		"<td align='left' class='bgover' width='85%'><a href=javascript:openmypage(JSID,'"+sid+"','"+name+"','FM','"+thumbnail+"');>"+name+"</a></td>";
			//alert(myTable.rows[i].cells[0].innerHTML);
			}
		}
	}
	function removeChatStatus(sid,name,thumbnail) {
		//	alert("logged out "+sid);
		var myTable=document.getElementById("myFriends");
		for(i=1;i<myTable.rows.length;i++) {
			if(sid == myTable.rows[i].cells[0].innerHTML){
			//alert(myTable.rows[i].innerHTML);
			myTable.rows[i].innerHTML ="<td style='display:none;'>"+sid+"</td>" +
						 		"<td height='20' align='center' width='15%'><img src='images/ask/invisible-cir.png'/></td>" +
						 		"<td align='left' class='bgover' width='85%'>"+name+"</td>";
			//alert(myTable.rows[i].cells[0].innerHTML);
			}
		}
	}
 
	function privatemessage(from_id,to_id,to_name) {
		openmypage(from_id,to_id,to_name);
		//alert(from_id+" Says "+to_name);
	}
	
	function stopRKey(evt) {
		var evt = (evt) ? evt : ((event) ? event : null);
		var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		if ((evt.keyCode == 13) && (node.type=="text"))  {
		return false;}
	}
	/**
	 * @functions removeRoomUser & getroomuser
	 * addChatRoomUserList, removeChatRoomUserList moved from chatroom.js to here!!
	 */
	function removeroomuser(crid, id) {
//		alert("removeroomuser crid============="+crid);
//		alert("removeroomuser jscr=========="+JSCR);
//		alert("removeroomuser id============="+id);
		if(JSID!=null && JSID!=id){
			if(JSCR!=null && JSCR == crid){
		    	removeChatRoomUserLI('ChatRoomUsers', id);
		  	}
		}
		//getRoomUsers();
	}
	
	
	function checkenter(e,frm) {
		if (window.event) { // IE
		if (e.keyCode == 13) {
		//override default value so you know it was caused by input
			getprivatemessage(frm)
		}
		}
		else if(e.which == 13 && !e.shiftKey) { // Netscape/Firefox/Opera
			getprivatemessage(frm)
		}
	}
	function getRoomUsers(){
    	 JavaChat.getRoomUsers(document.location.pathname+window.location.hash,idChatRoom,JSID,JSNM);
	}
	function init_Scroll(id){
	    var wndo = new dw_scrollObj('wn'+id, 'lyr'+id);
	    wndo.setUpScrollbar("dragBar"+id, "track"+id, "v", 1, 1);
	    wndo.setUpScrollControls('scrollbar'+id);
	}
	//document.onkeypress = stopRKey; 
	
	
