	// JavaScript Document
 	var xmlHttp
	var xmlHttp2
	var SUBCATID2
	var STATEID
	//display subcategory .................................
	function showsubcategory(val,subcat)
	{		
		//alert(subcat)
		SUBCATID2=subcat
		
		xmlHttp2=GetXmlHttpObject2()
		if (xmlHttp2==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getSubcategory.php?catId="+val;				
		xmlHttp2.onreadystatechange=statechangedCat
		xmlHttp2.open("GET",url,true)
		xmlHttp2.send(null)
	}	
	
	
	function statechangedCat() 
	{    //alert(SUBCATID2)
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
		{			
			results = xmlHttp2.responseText.split("<br>");    							
			
			document.form.subCategory.options.length =0 ;
			document.form.subCategory.options[document.form.subCategory.options.length]= new Option("Select All","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.form.subCategory.options[document.form.subCategory.options.length]= new Option(optionsval[1],optionsval[0]);
			
			    if(optionsval[0]==SUBCATID2){
			     document.form.subCategory.selectedIndex=parseInt(i+1);
			     }
			
			}    
		} 
	}
	//-------------- end here --------------------
	
	
	//display Search  subcategory .................................
	var SUBCATEGORY
	function showCastsubcategory(val,name)
	{		
		SUBCATEGORY=name;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getJobSubcategory.php?catId="+val;				
		xmlHttp.onreadystatechange=stateCastchange
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
	
	
	function stateCastchange() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");  				
			
			document.getElementById(SUBCATEGORY).options.length =0;
			document.getElementById(SUBCATEGORY).options[document.getElementById(SUBCATEGORY).options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.getElementById(SUBCATEGORY).options[document.getElementById(SUBCATEGORY).options.length]= new Option(optionsval[1],optionsval[0]);
			}  
		} 
	}
	//--------------end here --------------------
	
	function showAge(cid)
	{
		//alert(cid)
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getAge.php?cId="+cid;				
		xmlHttp.onreadystatechange=endage
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)	
	}
	
	function endage() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			
		//	alert(results)
			document.form.endAge.options.length =0 ;
			document.form.endAge.options[document.form.endAge.options.length]= new Option("End","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.form.endAge.options[document.form.endAge.options.length]= new Option(optionsval[0],optionsval[1]);
			}    
		} 
	}
	
	//-----------show country state ---------------------	
	
	function showCountryStates(cid, sid)
	{		
		//alert(cid)
		STATEID=sid;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getCountryStates.php?cId="+cid;				
		xmlHttp.onreadystatechange=countryStates
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}		
	function countryStates() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results2 = xmlHttp.responseText	;				
			results1 = 	results2.replace(/(^\s*)|(\s*$)/g, "");
			results = results1.split("<br>");  
			
			document.form.regionName.options.length =0 ;
			document.form.regionName.options[document.form.regionName.options.length]= new Option("Select All","");
			for(i=0;i < results.length-1;i++)
			{   
				optionsval = results[i].split(",");
				document.form.regionName.options[document.form.regionName.options.length]= new Option(optionsval[1],optionsval[0]);
			   
			   if(optionsval[0]==STATEID)
			   {
			    document.form.regionName.selectedIndex=parseInt(i+1);
			   }

			}    
		} 
	}
	
	function showCountryStates1(cid)
	{		
		//alert(cid)
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getCountryStates.php?cId="+cid;				
		xmlHttp.onreadystatechange=countryStates1
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}		
	function countryStates1() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			
			//alert(results)
			document.form.regionName.options.length =0 ;
			document.form.regionName.options[document.form.regionName.options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.form.regionName.options[document.form.regionName.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	function showCountryStates2(cid)
	{		
		//alert(cid)
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getCountryStates2.php?cId="+cid;				
		xmlHttp.onreadystatechange=countryStates2
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}		
	function countryStates2() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			
			//alert(results)
			document.form.regionName2.options.length =0 ;
			document.form.regionName2.options[document.form.regionName2.options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.form.regionName2.options[document.form.regionName2.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	
	function showCountryStates3(cid)
	{		
		//alert(cid)
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="getCountryStates2.php?cId="+cid;				
		xmlHttp.onreadystatechange=countryStates3
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}		
	function countryStates3() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			
			//alert(results)
			document.form.regionName2.options.length =0 ;
			document.form.regionName2.options[document.form.regionName2.options.length]= new Option("Select All","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.form.regionName2.options[document.form.regionName2.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	///////------------end here ----------------
	
	
	function showsubterritory(id)
	{		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="subterritory.php?id="+id;				
		xmlHttp.onreadystatechange=displaystates
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function displaystates() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			document.frmvideo.regionName.options.length =0 ;
			document.frmvideo.regionName.options[document.frmvideo.regionName.options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.frmvideo.regionName.options[document.frmvideo.regionName.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	
	
	function showsubter(val)
	{		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="subterritory.php?id="+val;				
		xmlHttp.onreadystatechange=statesubter
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function statesubter() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			document.frmwish.sub_territory.options.length =0 ;
			document.frmwish.sub_territory.options[document.frmwish.sub_territory.options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.frmwish.sub_territory.options[document.frmwish.sub_territory.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	
	
	function showvideo(val)
	{			
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="showvideo.php?id="+val;		
		xmlHttp.onreadystatechange=videochanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
	
	function videochanged() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("<br>");    							
			document.frmdeal.video.options.length =0 ;			
			document.frmdeal.video.options[document.frmdeal.video.options.length]= new Option("Select","");
			for(i=0;i < results.length-1;i++)
			{
				optionsval = results[i].split(",");
				document.frmdeal.video.options[document.frmdeal.video.options.length]= new Option(optionsval[1],optionsval[0]);
			}    
		} 
	}
	
	function showplat_ter(val)
	{		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}				
		var url="showplat_terr.php?id="+val;		
		xmlHttp.onreadystatechange=plat_ter
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
	
	function plat_ter() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText.split("DIFF");			
			if(results[0]==null || results[1]==null)
			{
				document.frmdeal.platform.options.length =0 ;						
				document.frmdeal.territory.options.length =0 ;						
				document.frmdeal.SUB_territory.options.length =0 ;						
			}
			else
			{
				results1 = results[0].split("<br>");    							
				results2 = results[1].split("<br>");
				results3 = results[2].split("<br>");
				document.frmdeal.platform.options.length =0 ;						
				for(i=0;i < results1.length-1;i++)
				{
					optionsval = results1[i].split(",");
					document.frmdeal.platform.options[document.frmdeal.platform.options.length]= new Option(optionsval[1],optionsval[0]);
				}
				document.frmdeal.territory.options.length =0 ;						
				for(i=0;i < results2.length-1;i++)
				{
					optionsval = results2[i].split(",");
					document.frmdeal.territory.options[document.frmdeal.territory.options.length]= new Option(optionsval[1],optionsval[0]);
				}
				document.frmdeal.sub_territory.options.length =0 ;						
				for(i=0;i < results3.length-1;i++)
				{
					optionsval = results3[i].split(",");
					document.frmdeal.sub_territory.options[document.frmdeal.sub_territory.options.length]= new Option(optionsval[1],optionsval[0]);
				}
			}
		} 
	}
	
	
	function showrunvideo(val)
	{		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="runningvideo.php?id="+val;				
		xmlHttp.onreadystatechange=staterunvideo
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function staterunvideo() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			document.getElementById('runningvideo').innerHTML= xmlHttp.responseText;			   
		} 
	}
	
	
	function showindexinformation(val)
	{		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="index_"+val+".php";				
		xmlHttp.onreadystatechange=stateindexinformation
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function stateindexinformation() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			document.getElementById('indexinformation').innerHTML= xmlHttp.responseText;			   
		} 
	}
	
	function reportAbuse(catId,mid)
	{
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="report_abuse.php&catId="+catId+"&mid="+mid;				
		xmlHttp.onreadystatechange=stateindexinformation
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
	var type;
	function checkexists(obj)
	{				
		val=obj.value;
		type=obj.id;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		if(val=="")
		{
			alert("Please enter the information");
			document.getElementById(type).focus();
			return true;
		}
		var url="checkexists.php?val="+val;				
		xmlHttp.onreadystatechange=statecheckexists
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function statecheckexists() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			if(xmlHttp.responseText!="")
			{				
				document.getElementById(type).className='RedBut';
				document.getElementById('checkavailable').innerHTML= xmlHttp.responseText;
				document.getElementById(type).focus();				
			}
			else
			{
				document.getElementById(type).className='But1';
				document.getElementById('checkavailable').innerHTML="";				
			}
		} 
	}
	
	function GetXmlHttpObject()
	{ 
		var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
	}
	
	


 var SPUID;
 var pgname;
 
 function add2hotlist_snddig(id,loginstatus,memberId,action,receiverId)
	{     
		SPUID=id;
		login=loginstatus;
		mid=memberId;
		action=action;
		receiverId=receiverId;
		
	    xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url="popUpPage.php?login="+login+"&mid="+mid+"&action="+action+"&receiverId="+receiverId;
		//alert(url)
		xmlHttp.onreadystatechange=stageadd2hotlist
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
	}
	
	
	function stageadd2hotlist() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{   
		    m=xmlHttp.responseText;
			alert(m);
			
		}
	}
	
	
	var profileRate=0
	function submitRating(id,loginstatus,ratingNumber,rateBy,rateTo)
	{     
		SPUID=id;
		login=loginstatus;
		ratingNumber=ratingNumber;
		rateBy=rateBy;
		rateTo=rateTo;
		action='rating';
		
		
	    xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		if(rateBy==rateTo)
		{
		   document.getElementById('ratestatus1').innerHTML="Can't rate yourself.";
		}else{
		if(profileRate==0)
		{
			var url="popUpPage.php?login="+login+"&ratingNumber="+ratingNumber+"&rateBy="+rateBy+"&action="+action+"&rateTo="+rateTo;
			xmlHttp.onreadystatechange=stategetpopup
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		
		}
		}
	}	
	function stategetpopup() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{   
		    m=xmlHttp.responseText;
			document.getElementById('ratestatus1').innerHTML="<b>Thanks for Rating!</b>";
			profileRate=1
			//alert(m);
			SetAverage(m)
			//document.getElementById(SPUID).innerHTML=m;	
			scrollleft=document.all?document.documentElement.scrollLeft:window.pageXOffset;
		    scrolltop=document.all?document.documentElement.scrollTop:window.pageYOffset;	
			//document.getElementById(SPUID).style.left=((parseInt(document.body.clientWidth)+parseInt(scrollleft))/2-parseInt(document.getElementById(SPUID).style.width)/2)+"px";
		    //document.getElementById(SPUID).style.top=(((parseInt(document.body.clientHeight)+parseInt(scrolltop))/2-parseInt(document.getElementById(SPUID).style.width)/2))+"px";
			document.getElementById(SPUID).style.left=((parseInt(document.body.clientWidth)+parseInt(scrollleft))/2-parseInt(document.getElementById(SPUID).style.width)/2)+100+"px";
		    document.getElementById(SPUID).style.top=(scrolltop+150)+"px";
			
			if(pgname=='privacy')
			{
			  document.getElementById(SPUID).style.width='700px';	
			}
			if(pgname=='notification')
			{
			  document.getElementById(SPUID).style.width='700px';	
			}
			if(pgname=='vote')
			{
			  document.getElementById(SPUID).style.width='700px';	
			}
			if(pgname=='invite')
			{
			  document.getElementById(SPUID).style.width='700px';	
			}
			
		}
	}
	
	//##################################### [ Slide Images ] #################################################
	
	function SlideImages(mid,pageindex,totalRecord,action)
	{	
	    xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="silde_image.php?mid="+mid+"&pageindex="+pageindex+"&totalRecord="+totalRecord+"&action="+action;		
		xmlHttp.onreadystatechange=stateslideimage
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
		
		
	function stateslideimage() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{			
			results = xmlHttp.responseText;
			//alert(results);
			document.getElementById('previewPane').innerHTML=results;
			
			srcImg=document.getElementById('lboximg').src;
			enlargeIMG=srcImg.replace('enlarge','thumb_500_500');
			document.getElementById('firstImage').href=enlargeIMG;
		} 
	}
	//#########################################################################################################
	
	//########################################## [ COUNTRY SESSION ] ########################################
	var returnUrl
	function createCountrySession(val,page)
	{		
		//alert(val+" | "+page);
		returnUrl=page;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="session.php?country="+val;				
		xmlHttp.onreadystatechange=stateCreateSession
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
	
	function stateCreateSession()
	{
	   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	   { 
		//alert(xmlHttp.responseText)
		 window.location.href=returnUrl;
	   }
	}
	//########################################################################################################
	
	//######################################### [ SUBMIT VIDEO RATING ] #########################################
	var rateComplete=0 
	function submitVideoRating(vid,rateBy,ratingNumber)
	{     
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		if(rateComplete==0){
			var url="submitVideoRating.php?vid="+vid+"&rateBy="+rateBy+"&ratingNumber="+ratingNumber;
			xmlHttp.onreadystatechange=statesubmitvidorating
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		
	}	
	function statesubmitvidorating() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{   
		    m=xmlHttp.responseText;
			//alert(m);
			SetDefault(m)
			//window.location.reload()
			document.getElementById('ratestatus').innerHTML="<b>Thanks for Rating!</b>";
			rateComplete=1
		}
	}
	//###########################################################################################################
	
	function GoToLogin()
	{
	   var con=confirm("You must be Signed In. Do you wish to Sign In now?")	 
	   if(con)
	   {
		  window.location.href="sign-in.php";   
	   }
	}
 	
	
	//######################################### [ OPEN MESSANGER ] #########################################
	var chatMid1
	var chatMid2
	var chatMemName
	function OpenMessanger(mid,chatid,memName)
	{     
	    chatMid1=mid
		chatMid2=chatid
		chatMemName=memName
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		if(rateComplete==0){
			var url="isOnline.php?mid="+mid+"&chatid="+chatid+"&memName="+memName;
			xmlHttp.onreadystatechange=stateOpenMessanger
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		
	}	
	function stateOpenMessanger() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{   
		    m=xmlHttp.responseText;
			//if(m==1)
			//{
				
			//	MPage="messanger/message.php?mid="+chatMid1+"&chatid="+chatMid2;
			//window.open(MPage,'Modelsite','height=120px,width=500,top=350px,left=270px,resizable=no,scrollbars=no');
			if(m==100)
			{
				 // alert("You are blocked by "+chatMemName+". You can not request private chat.");
				  alert(chatMemName+" appears to be away from computer.");
			
			}
			else{
			 window.open('messanger/pchat.php?mid='+chatMid1+'&chatid='+chatMid2,'Modelsite','height=590px,width=730,top=150px,left=50px,resizable=no,scrollbars=yes');
			}
			//}
			//else{
			// alert(chatMemName +" is not available for Chat.");	
			//}
		}
	}
	//###########################################################################################################
	
	
//################################## [ CHECK IM MESSAGES ] ######################################
var imuser;
var impass;
var im_mid;
var interval;
var newn=0;

function Get_IM_Message(user,pass,mid)
	{  //alert(user+"|"+pass+"|"+mid)
		newn=newn+1;
		imuser=user;
		impass=pass;
		im_mid=mid;
	    xmlHttp2=GetXmlHttpObject2()
		if (xmlHttp2==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="get_im_message.php?user="+user+"&mid="+mid;//window.status=newn;
		xmlHttp2.onreadystatechange=statechangeimmessage
		xmlHttp2.open("GET",url,true)
		xmlHttp2.send(null)
	}	
		
	function statechangeimmessage() 
	{ 
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
		{	
		 var page;
		 var immsg;
		 m= xmlHttp2.responseText;
		
		if(m>0){
			//imcomplete=1;
//		    document.getElementById('Layer1').innerHTML=m;	
//		    scrollleft=document.all?document.documentElement.scrollLeft:window.pageXOffset;
//		    scrolltop=document.all?document.documentElement.scrollTop:window.pageYOffset;	
//		    document.getElementById('Layer1').style.left=((parseInt(document.body.clientWidth)+parseInt(scrollleft))/2-parseInt(document.getElementById('Layer1').style.width)/2)+"px";
//		    document.getElementById('Layer1').style.top=(parseInt(scrolltop)+150)+"px";
            //start_timer(imuser,impass,im_mid,'stop'); 
			
			
			
			MPage="messanger/message.php?mid="+im_mid+"&chatid="+m;
			window.open(MPage,'IM_Request','height=120px,width=500,top=350px,left=270px,resizable=no,scrollbars=no');
			
			page="messanger/pchat.php?mid="+im_mid+"&chatid="+m;
			
			//window.open(page,'Modelsite','height=590px,width=730,top=150px,left=10px,resizable=no,scrollbars=yes');
			//window.clearTimeout(interval);
			//showWindow(page);
			
			 interval=setTimeout("Get_IM_Message('"+imuser+"','"+impass+"','"+im_mid+"')",30000);
			 setTimeout("Get_Hotlist('"+im_mid+"')",5000);
			
		 }
		 else{
			
			if(m<0)
			{
				
				//MPage="messanger/cancel.php?mid="+im_mid+"&chatid="+m;
			  //  window.open(MPage,'Cancel_Request','height=120px,width=500,top=350px,left=270px,resizable=no,scrollbars=no');
				//alert("The member you are trying to contact is currently busy or away from their computer. Please try again later."); 
			}
			//Get_IM_Message(imuser,impass,im_mid)
			
			interval=setTimeout("Get_IM_Message('"+imuser+"','"+impass+"','"+im_mid+"')",15000);
			setTimeout("Get_Hotlist('"+im_mid+"')",5000);
		 }
		
		 }
	}

//###################################################################################################

//################################## [ CHECK IM MESSAGES ] ######################################
var xmlHttp4
var hotlist_mid
function Get_Hotlist(mid)
	{
		
		hotlist_mid=mid;
	    xmlHttp4=GetXmlHttpObject2()
		if (xmlHttp4==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="get_hotlist.php?mid="+hotlist_mid;//alert(url)
		xmlHttp4.onreadystatechange=statechangehotlist
		xmlHttp4.open("GET",url,true)
		xmlHttp4.send(null)
		
	}	
		
	function statechangehotlist() 
	{ 
		if (xmlHttp4.readyState==4 || xmlHttp4.readyState=="complete")
		{	
		 m123= xmlHttp4.responseText;//alert(m123)
		if(m123!=''){
		   if(document.getElementById('hotmemlist')){	
		   document.getElementById('hotmemlist').innerHTML=m123;
		   }
		}
		 else{
			setTimeout("Get_Hotlist('"+hotlist_mid+"')",5000);
		 }
		}
	}

//###################################################################################################

var stime;
function Check_IM_Message(user,pass,mid,val)
  {
       Get_IM_Message(user,pass,mid);
 }
 
function Check_Hotlist(mid)
  {
       Get_Hotlist(mid);
 }
 
function start_timer(user,pass,mid,val)
 { 
    Check_IM_Message(user,pass,mid,val);
	
	Check_Hotlist(mid);
	
 } 
 

//########## [ for xmlHttp ] #######################
	function GetXmlHttpObject2()
	{ 
	var objXMLHttp2=null
	if (window.XMLHttpRequest)
	{
	objXMLHttp2=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
	objXMLHttp2=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp2
	}
	
	
	function GetXmlHttpObject4()
	{ 
	var objXMLHttp4=null
	if (window.XMLHttpRequest)
	{
	objXMLHttp4=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
	objXMLHttp4=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp4
	}
//#################################################################################################




//################################## [ CHECK IM MESSAGES ] ######################################
var imuser2
var impass2
var im_mid2
var xmlHttp4
var interval2
function Get_IM_Message2(user,pass,mid)
	{  //alert(user+"|"+pass+"|"+mid)
		
		imuser2=user;
		impass2=pass;
		im_mid2=mid;
	    xmlHttp4=GetXmlHttpObject4()
		if (xmlHttp4==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}		
		var url="../get_im_message.php?user="+user+"&mid="+mid;//window.status=newn;
		xmlHttp4.onreadystatechange=statechangeimmessage2
		xmlHttp4.open("GET",url,true)
		xmlHttp4.send(null)
	}	
		
	function statechangeimmessage2() 
	{ 
		if (xmlHttp4.readyState==4 || xmlHttp4.readyState=="complete")
		{	
		
		 m= xmlHttp4.responseText;
		if(m<0){
			 clearTimeout(interval2);
			 MPage="cancel.php?mid="+im_mid2+"&chatid="+m;
			 window.open(MPage,'Cancel_Request','height=120px,width=500,top=350px,left=270px,resizable=no,scrollbars=no');
			 window.close();
		}
		interval2=setTimeout("Get_IM_Message2('"+imuser2+"','"+impass2+"','"+im_mid2+"')",1000);
		}
		
	}

//###################################################################################################