function showBox(){

/*var title_name="chandigarhwallahs";

window.open('editprofileproximity',title_name,'height=600,width=485,top=100,left=500,right=500,resizable=yes,scrollbars=no,toolbar=no,status=no');

*/

window.location="editprofileproximity";

}

function GetXmlHttpObject()

{

   var xmlHttp=null;

	var versions = ["Msxml2.XMLHTTP.7.0","Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];



   for(var i=0; i<= versions.length; i++)

   {

		try

		{

			xmlHttp=new XMLHttpRequest();

			return xmlHttp;

		}

		catch(e)

		{

			try

			{

				xmlHttp = new ActiveXObject(versions[i]);

				

				return xmlHttp;

			}

			catch(e)

			{

				continue;

			}

		}

	}

}



function pro_sort_pro(did,url, eventhandler)

{ 

	xmlHttp=GetXmlHttpObject();	

	var url=url;

	xmlHttp.onreadystatechange=Changed;

	xmlHttp.open("GET", url, true);

	xmlHttp.send(null);

	function Changed(){

	if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200))

	{	

		document.getElementById(did).innerHTML = xmlHttp.responseText;

		try

		{	if( typeof eventhandler != 'undefiend' )

			{ 	var f=eval(eventhandler);

				if( typeof f=='function')

				{  

					var fun =eventhandler+"()";	eval(fun); }

			}

			

		}

		catch(e){ alert(e.message);}

		

	}

	else 

	document.getElementById(did).innerHTML = '<div  align="center">Loading Content.......</div>';

		

	}

}



function pro_sort_pro_quicksearch(did,url,to,message,csid){

   if(confirm("Sure want to send message?")) {

	url=url+'?friendId='+to+'&message='+message;

	pro_sort_pro(did,url);

	document.getElementById("msg"+csid).style.display="none";

	document.getElementById("promsg").innerHTML="Message sent successfully";

	document.getElementById('promessage'+csid).value = "";

	return false;

  }else

  return false;

}

function pro_sort_pro_sendmessage(did,url,to,message){



	url=url+'?friendId='+to+'&message='+message;

	pro_sort_pro(did,url);

}

function test_sort_sendmessage(did,url,to,message){ 



	url=url+'?iFriendID='+to+'&sTestimony='+message;	

	pro_sort_pro(did,url);

 

	}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



function acceptInvitation(id){

	var table_row_id = "table_id_"+id;

	var url = "acceptinvitation?id="+id;

	var row = document.getElementById(table_row_id);

	row.style.display = 'none';

	xmlHttp=GetXmlHttpObject();		

	xmlHttp.onreadystatechange=Changed;

	xmlHttp.open("GET", url, true);

	xmlHttp.send(null);    

	function Changed(){		

		if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

			document.getElementById('output').innerHTML=xmlHttp.responseText;

			window.location.reload(true);

			return false;

		}

	}



}



	function denyInvitation(id){

		var table_row_id = "table_id_"+id;

		var url = "denyinvitation?id="+id;

		var row = document.getElementById(table_row_id);

		row.style.display = 'none';

		xmlHttp=GetXmlHttpObject();		

		xmlHttp.onreadystatechange=Changed;

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);    

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				document.getElementById('output').innerHTML=xmlHttp.responseText;			

				return false;

			}

		}

}



//Delete Message



function yesDeleteMessage(msgId) {

	//alert(msgId);

	var altBox = confirm("Are you sure you want to Delete this recommendation?");

    if(altBox == true){

		

		var url = "deletemessage?msgId="+msgId;

		//document.getElementById('light').style.display = 'none';

		//document.getElementById('fade').style.display = 'none';

		

		xmlHttp=GetXmlHttpObject();	

		

		xmlHttp.onreadystatechange=function (){

		if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

			//alert(xmlHttp.responseText);

			document.getElementById("test").innerHTML =xmlHttp.responseText;

			

			window.location.reload(); 

			}

		

		

		};

		

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);

	}

		

	

}



function yes_delete_recommendation(msgId) {

	//alert(msgId);

	var altBox = confirm("Are you sure you want to Delete this recommendation?");

    if(altBox == true){

		

		var url = "deleterecomm?irecommendid="+msgId;

		//document.getElementById('light').style.display = 'none';

		//document.getElementById('fade').style.display = 'none';

		

		xmlHttp=GetXmlHttpObject();	

		

		xmlHttp.onreadystatechange=Changed;

		

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);

	}

		function Changed(){



			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

			document.getElementById("recom_id").innerHTML =xmlHttp.responseText;

			window.location.reload(); 

			}

		}

	

}



function communityJoin(respondurl,id,status){

		//var table_row_id = "div"+id;

		var url = "join?id="+id+"&status="+status;

		

		//var row = document.getElementById(table_row_id);

		//row.style.display = 'none';

		xmlHttp=GetXmlHttpObject();		

		xmlHttp.onreadystatechange=Changed;

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);    

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				//var url1="thankstojoin?response="+xmlHttp.responseText;

				//alert(xmlHttp.responseText);

				//MM_openBrWindow(url1,'','width=400,height=135');	

				document.getElementById('successMsg1').style.display="block";

				document.getElementById('successMsg').innerHTML=xmlHttp.responseText;		

				return false;

			}

		}

	

	}

	

	/*

	*	Perform action to unjoin request of Community in community listing page

	*

	*/

	function communityUnjoin(respondurl,communityid,status){

		var url = "unjoin?communityid="+communityid+"&status="+status;



		xmlHttp=GetXmlHttpObject();	

		

		/*	This is used for alert mes before unjoin	*/

		var msg;

		msg= "Are you sure?";

		var agree=confirm(msg);

		if (agree){

			xmlHttp.onreadystatechange=Changed;

			xmlHttp.open("GET", url, true);

			xmlHttp.send(null);

		}else{

			return false ;

		}

		

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				//var url1="thankstounjoin?communityid="+communityid;

				

				//MM_openBrWindow(url1,'','width=400,height=135');

				//alert(xmlHttp.responseText);

				document.getElementById('tabb2').innerHTML=xmlHttp.responseText;			

				return false;

			}

		}

	

	}

	

	/*

	*	Perform action to accept/deny request to join Community

	*

	*/

	function communityJoinStatus(iCommunityRequestid,iCommunityID,iRequestUser,status){

		var url = "communityjoinstatus?iCommunityRequestid="+iCommunityRequestid+"&iCommunityID="+iCommunityID+"&iRequestUser="+iRequestUser+"&status="+status;

		xmlHttp=GetXmlHttpObject();		

		xmlHttp.onreadystatechange=Changed;

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);    

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				var url1="joinrequestmsg?iRequestUser="+iRequestUser+"&status="+status;

				MM_openBrWindow(url1,'','width=400,height=135');

				document.getElementById('tabb6').innerHTML=xmlHttp.responseText;			

				return false;

			}else{

					document.getElementById('tabb6').innerHTML="Loading...";

				}

		}

	

	}

	

	

	/*

	*	Perform action to accept/deny request to join Community

	*

	*/

	function communityJoinRequest(iCommunityRequestid,iCommunityID,iRequestUser,status){

		var url = "communityjoinrequest?iCommunityRequestid="+iCommunityRequestid+"&iCommunityID="+iCommunityID+"&iRequestUser="+iRequestUser+"&status="+status;

		xmlHttp=GetXmlHttpObject();		

		xmlHttp.onreadystatechange=Changed;

		xmlHttp.open("GET", url, true);

		xmlHttp.send(null);    

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				if(xmlHttp.responseText=="fail"){

					alert("Your session has been expired. Please Login..");

					document.location.href = 'newlogin';

					return false;

					}else{

						document.getElementById('output1').innerHTML=xmlHttp.responseText;		

					}

				return false;

			}else{

					document.getElementById('output1').innerHTML="Loading...";

				}

		}

	

	}

	

	/*

	*	Perform action to delete comments on topic of Community in topic details page

	*

	*/

	function deleteTopicComment(topicid,iTopicAnsid){

		var url = "deletetopiccomment?iTopicAnsid="+iTopicAnsid+"&topicid="+topicid;

	

		xmlHttp=GetXmlHttpObject();	

		

		/*	This is used for alert mes before unjoin	*/

		var msg;

		msg= "Are you sure?";

		var agree=confirm(msg);

		if (agree){

			xmlHttp.onreadystatechange=Changed;

			xmlHttp.open("GET", url, true);

			xmlHttp.send(null);

		}else{

			return false ;

		}

		

		function Changed(){		

			if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

				

				document.getElementById('successMsg').style.display="block";

				document.getElementById('output').innerHTML=xmlHttp.responseText;

				return false;

			}

		}

	

	}

	

	

	function changeText(div2show,text ) {

    // Detect Browser

    var IE = (document.all) ? 1 : 0;

    var DOM = 0; 

    if (parseInt(navigator.appVersion) >=5) {DOM=1};



    // Grab the content from the requested "div" and show it in the "container"

    if (DOM) {

        var viewer = document.getElementById(div2show);



        viewer.innerHTML = text;

    }  else if(IE) {

        document.all[div2show].innerHTML = text;

    }

}



	

	function rating(did,url,eventhandler){	



	xmlHttp=GetXmlHttpObject();	

	var url=url;

	var flag=true;

	if(did=='unit_ul01'){	

	if(document.getElementById('iSchoolid').value!=0){

	url =  url+'&iSchoolid='+document.getElementById('iSchoolid').value;

	

	}else{			

	flag=false;

	}}

	if(did=='unit_ul02'){	

	if(document.getElementById("iCollegeid").value!=0){

	url =  url+'&iCollegeid='+document.getElementById("iCollegeid").value;

	}else{

	flag=false;	}}	

	if(did=='unit_ul03'){	

	if(document.getElementById('iHangoutid').value!=0){

	url =  url+'&iHangoutid='+document.getElementById('iHangoutid').value;

	}else{

	flag=false;

	}}	

	if(did=='unit_ul04'){	

	if(document.getElementById('iHotelid').value!=0){

	url =  url+'&iHotelid='+document.getElementById('iHotelid').value;

	}else{

	flag=false;

	}}	

	if(did=='unit_ul05'){	

	if(document.getElementById('iPersonalityid').value!=0){

	url =  url+'&iPersonalityid='+document.getElementById('iPersonalityid').value;

	}else{

	flag=false;

	}}	

	if(did=='unit_ul06'){	

	if(document.getElementById('iRestaurantid').value!=0){

	url =  url+'&iRestaurantid='+document.getElementById('iRestaurantid').value;

	}else{

	flag=false;

	}}	

	if(did=='unit_ul07'){	

	if(document.getElementById('iShoppingMallid').value!=0){

	url =  url+'&iShoppingMallid='+document.getElementById('iShoppingMallid').value;

	}else{

	flag=false;

	}}	

	if(flag==true){		

	

	xmlHttp.onreadystatechange=Changed;

	xmlHttp.open("GET", url, true);

	xmlHttp.send(null);	

	

	}

	function Changed(){		

	if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){

	var response = xmlHttp.responseText;

	var update = new Array();

	

	if(response.indexOf('|') != -1) {

	update = response.split('|');	

	changeText(update[0], update[1]);

	

	}

	}	  	

	}

	

	}

	function showdiv(val){

			var catname = document.getElementById('sExcitedTxt-'+val).value;

			var catid = val;			

			var url = "updateexcitedcat?catname="+catname+"&catid="+catid;			

			xmlHttp=GetXmlHttpObject();		

			//xmlHttp.onreadystatechange=function 

			xmlHttp.onreadystatechange=function (){			  

			//function Changed(){		

				if((xmlHttp.readyState == 4 || xmlHttp.readyState == "completed" || xmlHttp.readyState == 200)){					

					//if(xmlHttp.responseText!=""){

						document.getElementById('tabb5').innerHTML=xmlHttp.responseText;

						if(document.getElementById('sExcitedTxt-'+val).value!=""){	

							document.getElementById('ratingcontain'+val).style.display='block';

							document.getElementById('defaultrating'+val).style.display='none';

						}else{

							document.getElementById('ratingcontain'+val).style.display='none';

							document.getElementById('defaultrating'+val).style.display='block';

						}

					//}

				 }

			};

			xmlHttp.open("GET", url, true);			

			xmlHttp.send(null);  		

}

