function getxmlhttpobject()
{
	var xmlhttp;
	try {
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (oc) {
			xmlhttp=null;
		}
	}
	if(!xmlhttp && typeof XMLHttpRequest != "undefined")
		xmlhttp = new XMLHttpRequest();

	return xmlhttp;

/*
	var xmlhttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlhttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlhttp;
*/	
}
//find friends from yahoo, google, msn, rediff........
function fetchfrnd(frm,type)
{
	xmlhttp=getxmlhttpobject();
	var email_1=document.getElementById("uremail").value;
	var email_2=document.getElementById("mailadd").value;
	var email=email_1+"@"+email_2;
	var fname=document.getElementById("name").value;
	//Send the proper header information along with the request
	
	var query="email="+email+"&pass="+document.getElementById("urpass").value+"&type="+type+"&name="+fname;
	document.getElementById("urpass").value="";
	document.getElementById("frndlist").innerHTML='<span class="alertmsg" style="padding-left:10px;">Loading...</span><img src=images/icon_loading.gif />';
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{   
		    check = xmlhttp.responseText;
			document.getElementById("frndlist").innerHTML=xmlhttp.responseText;
			if(check == '<span class="alertmsg" style="padding-left:20px;">Bad user name or password</span>')
			{
			 alert('Bad user name or password');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Server error</span>')
			{
			 alert('Server error');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Unsupported webmail</span>')
			{
			 alert('Unsupported webmail');
			}
		}
	}
	//alert("pass.php?action=findFriend&"+query);
	xmlhttp.open("POST","getfreemeditation.php?action=findFriend",true);
	xmlhttp.setRequestHeader("Method", "POST " + "getfreemeditation.php  HTTP/1.1");
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(query);
	return false;
}

function fetchfrndEmail(frm,type)
{
	xmlhttp=getxmlhttpobject();
	var email_1=document.getElementById("uremail").value;
	var email_2=document.getElementById("mailadd").value;
	var email=email_1+"@"+email_2;
	//Send the proper header information along with the request
	
	var query="email="+email+"&pass="+document.getElementById("urpass").value+"&type="+type;
	document.getElementById("urpass").value="";
	document.getElementById("frndlist").innerHTML='<span class="alertmsg" style="padding-left:10px;">Loading...</span><img src=images/loading.gif />';
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{   
		    check = xmlhttp.responseText;
			document.getElementById("frndlist").innerHTML=xmlhttp.responseText;
			if(check == '<span class="alertmsg" style="padding-left:20px;">Bad user name or password</span>')
			{
			 alert('Bad user name or password');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Server error</span>')
			{
			 alert('Server error');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Unsupported webmail</span>')
			{
			 alert('Unsupported webmail');
			}
		}
	}
	//alert("pass.php?action=findFriend&"+query);
	xmlhttp.open("POST","findfriend.php?action=findFriend",true);
	xmlhttp.setRequestHeader("Method", "POST " + "findfriend.php  HTTP/1.1");
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(query);
	return false;
}



function sendInvite(frm,type)
{
	xmlhttp=getxmlhttpobject();
	for (var ctr=0; ctr < frm.length; ctr++)
	{
		field_name = frm.elements[ctr].name;
		if (field_name.indexOf("chk") != -1)
		{
			var data=frm.elements[ctr].value;
			/*
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState==4)
				{
					document.getElementById("frndlist").innerHTML=xmlhttp.responseText;
					//parent.frames['content'].location.reload(true);
				}
			}
			*/
			alert("pass.php?action=sendInvite&data"+data);
			//xmlhttp.open("GET","pass.php?action=sendInvite&data"+data,true);
			//xmlhttp.setRequestHeader("Method", "GET " + "pass.php?action=sendInvite&data"+data + " HTTP/1.1");
			//xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			//xmlhttp.send(null);
			//return false;
		}
	}
}




function toggleAll(cb) {
    var val = cb.checked;
	var frm = document.form_findfrnd;
	var len = frm.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (frm.elements[i].name=='uids[]') {
			frm.elements[i].checked=val;
		}
	}
}

function saveReview(type)
{
 id = document.frm.id.value;	
 var con = document.frm.comment.value;
 con = con.replace(/&/g, '[AMP]');
	if(con == '')
	{
	 alert('Please enter your comments');
	 document.frm.comment.focus();
	 return false;
	}
	else {
	xmlhttp7 = getxmlhttpobject()
	var query = "type="+type+"&id="+id+"&comment="+con
	document.getElementById("review").innerHTML='<img src=images/icon_loading.gif />';
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	 { 
	   document.getElementById("review").innerHTML = xmlhttp7.responseText;	 
	 }
	}
	xmlhttp7.open("GET","submitRating.php?action=reviews&"+query,true)
	xmlhttp7.send(null);
	}
}

function saveCDReview(id)
{
 var con = document.getElementById("comment_"+id).value;
 con = con.replace(/&/g, '[AMP]');
	if(con == '')
	{
	 alert('Please enter your comments');
	 document.frm.comment.focus();
	 return false;
	}
	else {
	xmlhttp7 = getxmlhttpobject()
	var query = "type=cd&id="+id+"&comment="+con
	document.getElementById("review_"+id).innerHTML='<img src=images/icon_loading.gif />';
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	 { 
	   document.getElementById("review_"+id).innerHTML = xmlhttp7.responseText;	 
	 }
	}
	 xmlhttp7.open("GET","submitRating.php?action=reviews&"+query,true)
	 xmlhttp7.send(null);
	}
}
function saveTestimonial()
{
 var testimonial = document.frm1.testimonial.value;
  testimonial = testimonial.replace(/&/g, '[AMP]');

	if(testimonial == '')
	{
	 alert('Please enter your testimonial');
	 document.frm1.testimonial.focus();
	 return false;
	}
	else {
	xmlhttp7 = getxmlhttpobject()
	var query = "testimonial="+testimonial
	document.getElementById("testimonials").innerHTML='<img src=images/icon_loading.gif />';
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	 { 
	  document.getElementById("testimonials").innerHTML = xmlhttp7.responseText;	 
	 }
	}
	 xmlhttp7.open("GET","submitRating.php?action=testimonial&"+query,true)
	 xmlhttp7.send(null);
	}
}
function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
}
function fetchfrndsemail(frm,id)
{
	xmlhttp=getxmlhttpobject();
	var email_1=document.getElementById("uremail").value;
	var email_2=document.getElementById("mailadd").value;
	var email=email_1+"@"+email_2;
	//Send the proper header information along with the request
	
	var query="email="+email+"&pass="+document.getElementById("urpass").value+"&mediaid="+id;
	document.getElementById("urpass").value="";
	document.getElementById("frndlist").innerHTML='<span class="alertmsg" style="padding-left:10px;">Loading...</span><img src=images/icon_loading.gif />';
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{   
		    check = xmlhttp.responseText;
			document.getElementById("frndlist").innerHTML=xmlhttp.responseText;
			if(check == '<span class="alertmsg" style="padding-left:20px;">Bad user name or password</span>')
			{
			 alert('Bad user name or password');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Server error</span>')
			{
			 alert('Server error');
			}
		    if(check == '<span class="alertmsg" style="padding-left:20px;">Unsupported webmail</span>')
			{
			 alert('Unsupported webmail');
			}
		}
	}
	//alert("pass.php?action=findFriend&"+query);
	xmlhttp.open("POST","sharemeditation.php?action=findFriend",true);
	xmlhttp.setRequestHeader("Method", "POST " + "sharemeditation.php  HTTP/1.1");
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(query);
	return false;
}


// pre made 

