
//Web Developer: Jaypee de Real
// JavaScript Document



function urlencode (str) {

    str = (str+'').toString();
    
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}




function MM_preloadImages() {
   var d = document;
   if(d.images) {
      if(!d.MM_p)
         d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
      for(i = 0; i < a.length; i++)
         if (a[i].indexOf("#")!=0) {
            d.MM_p[j] = new Image;
            d.MM_p[j++].src=a[i];
         }
   }
}



function changeImage(btnname,image)
 {
 
	 document[btnname].src = image;

 }
 
 

//TRIM FUNCTION 

String.prototype.trim = function() {

a = this.replace(/^\s+/, '');

return a.replace(/\s+$/, '');

};



//VALIDATE EMAIL

function validate_email(get_pass_id,email) {

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

   var address = document.forms[get_pass_id].elements[email].value;

   if(reg.test(address) == false) 

    {

      alert('Invalid Email Address');

      return false;

    }

   else

    {

		return

	}

}







//SUBMITTING FORM

function Order(){

	obj=document.myform;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

  	var address = document.getElementById('Email').value.trim();

		

	var error=""; 

	

	if (obj.lname.value.trim()==""){

		

		error = error + "* Enter family name \n";

	

	}

	

	if (obj.fname.value.trim()==""){

		

		error = error + "* Enter first name. \n";

		

	}

	

	if (obj.email.value.trim()==""){

		

		error = error + "* Enter email address. \n";

		

	}

	

	else if(reg.test(address) == false) {

		

		error = error + "* Enter a valid Email Address \n";

		

	}

	

	if (obj.noplanners.value.trim()==""){

	

		error = error + "* Enter no. of planners. \n";

	

	}

	

	if (obj.deladd.value.trim()==""){

	

		error = error + "* Enter delivery address. \n";

	

	}

	

	var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    }
  catch (e)
    {    // Internet Explorer    
	try
      {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        alert("Your browser does not support AJAX!");        
	return false;        }      }    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
  		document.getElementById('submitDiv').style.display="block";
		document.getElementById('loaderDiv').style.display="none";

		xmlresponse = xmlHttp.responseText;
		
		if (xmlresponse.search(/math/) > -1)
		{
		error = error + "* Please check your answer to the math question. \n";
		} 

		if(error)

	 		{

		 

		alert(error);	 

		

	 		}

			else {

			

			document.myform.submit();


		

		}
		
	 }
	else
	{
		
		document.getElementById('submitDiv').style.display="none";
		document.getElementById('loaderDiv').style.display="block";
		
	}
      }

	if (document.getElementById('secure').value == '') {document.getElementById('secure').value = 0;}

    xmlHttp.open("GET","check_uniqueemail.php?email=" + obj.email.value + "&math=" + document.getElementById('secure').value + "&rand="+Date(),true);
    xmlHttp.send(null);  

	



}







function claimCheck()

{

	



	document.getElementById("LName2").value = document.getElementById("LName").value;

  	document.getElementById("FName2").value = document.getElementById("FName").value;

  	document.getElementById("Email2").value = document.getElementById("Email").value;

  	document.getElementById("Mobile2").value = document.getElementById("Mobile").value;

	



	

	var box = document.getElementById("Claim_box").value;

	

	 if(box=="")

	  {

		 

		  document.getElementById("claim").style.display = "none"; 

		  document.getElementById("Claim_box").value = "Y";

		  

	  }

	 else

	  {

		

		document.getElementById("claim").style.display = "block"; 

		document.getElementById("Claim_box").value = "";

		

	  }

	  

		



}




function RememberCheck()

{


	var box = document.getElementById("RememberMe").value;

	

	 if(box=="")

	  {

		  document.getElementById("RememberMe").value = "Y";

	  }

	 else

	  {
		
		document.getElementById("RememberMe").value = "";


	  }

	

}




//SUBMITTING Reg

function Register(){

	

	obj=document.myform;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

  	var address = document.getElementById('Email').value.trim();

		

	var error=""; 

	

	if (obj.lname.value.trim()==""){

		

		error = error + "* Enter family name \n";

	

	}

	

	if (obj.fname.value.trim()==""){

		

		error = error + "* Enter first name. \n";

		

	}

	

	if (obj.email.value.trim()==""){

		

		error = error + "* Enter email address. \n";

		

	}

	

	else if(reg.test(address) == false) {

		

		error = error + "* Enter a valid Email Address \n";

		

	}

	if ((obj.password.value.trim()=="") || (obj.password.value != obj.cpassword.value)){

		

		error = error + "* Please check the passwords you entered. \n";

		

	}

	if (obj.compsch.value.trim()==""){

		

		error = error + "* Enter company or school. \n";

		

	}

	if ((obj.month.value.trim()=="") || (obj.day.value.trim()=="") || (obj.year.value.trim()=="")){

		

		error = error + "* Enter your birthdate. \n";

		

	}

	if (obj.country.options[obj.country.selectedIndex].value == ''){

		

		error = error + "* Select your country. \n";

		

	}

	if (obj.income.value.trim()==""){

		

		error = error + "* Select your monthly income. \n";

		

	}

	
	 if(document.myform["priphoto"].value != "")
	  {
		  
		  //alert('upload photo');
		  
		 if((document.myform["priphoto"].value.lastIndexOf(".jpg")==-1)) 
			{
				
			  
			  error = error + "* Image should be jpeg. \n";
			   
			}

	 
	  }
	

var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    }
  catch (e)
    {    // Internet Explorer    
	try
      {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        alert("Your browser does not support AJAX!");        
	return false;        }      }    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
  		document.getElementById('submitDiv').style.display="block";
		document.getElementById('loaderDiv').style.display="none";

		xmlresponse = xmlHttp.responseText;
		
		if (xmlresponse.search(/found/) > -1)
		{
		error = error + "* The email you entered is already registered. \n";
		} 

		if (xmlresponse.search(/math/) > -1)
		{
		error = error + "* Please check your answer to the math question. \n";
		} 

		if(error)

	 		{

		 

		alert(error);	 

		

	 		}

			else {

			

			document.myform.submit();

		

		}
		
	 }
	else
	{
		document.getElementById('submitDiv').style.display="none";
		document.getElementById('loaderDiv').style.display="block";
	}
      }

	if (document.getElementById('secure').value == '') {document.getElementById('secure').value = 0;}

    xmlHttp.open("GET","check_uniqueemail.php?email=" + obj.email.value + "&math=" + document.getElementById('secure').value + "&rand="+Date(),true);
    xmlHttp.send(null);  

}



function reloadCaptcha()
	{
		document.getElementById('captcha').src = document.getElementById('captcha').src+ '?' +new Date();
	}
	
	
	
	
	
function checkLogin()
 {
	 
	
	 
	 obj=document.login_form;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

  	var address = document.getElementById('Email').value.trim();
		 
	if(obj.email.value.trim() == "")
	 {
		 
		 
		 alert("Enter your email address. ");
		  return false
		  
		 
	 }

	else if(reg.test(address) == false) {

		

		alert(" Enter a valid Email Address. ");
		 return false
		 
	
	}
	
	if(obj.password.value.trim() == "")
	 {
		 
		 
		 alert("Enter your password. ");
		 return false
		 
		 
	 }

	else
	 {
		 
		 
		//obj.submit(); 
		MemberLogin();
		
		
	 }


 }
 
 
 
function EnterPressed(e)
 {
// Code adapted from Jennifer Madden
// http://jennifermadden.com/162/examples/stringEnterKeyDetector.html

  var characterCode
  if(e && e.which){           // NN4 specific code
    e = e
    characterCode = e.which
  }
  else {
    e = event
    characterCode = e.keyCode // IE specific code
  }
  if (characterCode == 13) return true   // Enter key is 13
  else return false
}




function updateProfile(){

	

	obj=document.profile_form;


	var error=""; 

	

	if (obj.lname.value.trim()==""){

		

		error = error + "* Enter family name \n";

	

	}

	

	if (obj.fname.value.trim()==""){

		

		error = error + "* Enter first name. \n";

		

	}

	

	if (obj.compsch.value.trim()==""){

		

		error = error + "* Enter company or school. \n";

		

	}

	if ((obj.month.value.trim()=="") || (obj.day.value.trim()=="") || (obj.year.value.trim()=="")){

		

		error = error + "* Enter your birthdate. \n";

		

	}

	if (obj.country.options[obj.country.selectedIndex].value == ''){

		

		error = error + "* Select your country. \n";

		

	}

/*
	if (obj.income.value.trim()==""){

		

		error = error + "* Select your monthly income. \n";

		

	}
*/
	
	if(error)
	 {
		
		alert(error);
		 
	 }
	 
	else
	 {
		 
		obj.submit(); 	 
		 
	 }



}



function MemberLogin()
{
	
	var remember = document.getElementById("RememberMe").value;
	
	var xmlHttp;
  	try
     {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
    {    // Internet Explorer    
	try
      {      
	  
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
   			 
	 xmlHttp.onreadystatechange=function()
      {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var islog = xmlHttp.responseText;
			
				//alert(islog);
				if(islog == '1')
				 {
					 
					 //document.location.href='member.php' ;
					 //document.getElementById('login_loading').innerHTML = "Match. ";
					 //goto another page..... PROFILE
					 //alert(base + "myrecipes/");
					 //document.location.href = base + 'myrecipes.php';
					 window.location = "bdj/profile.php";
					 
					 
					 
				 }
				else
				 {
					
					 alert("Username and Password did not Match. "); 
					 document.getElementById('LoginLoader').style.display = 'none';
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById('LoginLoader').style.display = 'block';
				
			}
		
		
			
 	 }

	
 
   var username = urlencode(document.getElementById('Email').value.trim());
   var password = urlencode(document.getElementById('Password').value);
   //alert("xxx" + username + "xxx" + password + "xxx") 
   var param = 'action=login&rand=' + Math.random() + '&username='+ username + '&password='+ password + '&remember='+ remember;
   
    xmlHttp.open('POST', 'member_login.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param);


}




//SUBMIT TODAY I FEEL
function submitToday()
 {
	 
	 
	var today =  document.getElementById('Txt_Today').value.trim();
	
	/*
 	if(today == "")
	 {
		 
		alert("Please enter what you feel today. ");	 
		 
	 }
	else
	 {
	*/	 
	 	var xmlHttp;
		
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result == '1' || result == '2' )
					 {
						 
						 document.getElementById('TodayLoader').style.display = 'none';
						 document.getElementById('ClearTodayBtn').focus();
						 
					 }
					else
					 {
						
						 alert("Not Save. Error "); 
						 document.getElementById('TodayLoader').style.display = 'none';
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById('TodayLoader').style.display = 'block';
					
				}
			
			
				//UpdateToday
				
		 }
	
		
	   
	   var param = 'action=post&rand=' + Math.random() + '&today='+ today;
	   
		xmlHttp.open('POST', 'feeling_today.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param);

	 
	// }
	
 
 }
 
 
 
 
//SUBMIT THIS YEAR I WILL.
function submitYear()
 {
	 
	 
	var goal =  document.getElementById('Txt_Year').value.trim();
	
	var goal = goal.replace("|","'");
	
	var goal_id = document.getElementById('GoalID').value.trim();
	
	
		 
 	if(goal == "")
	 {
		 
		alert("Please enter your goal. ");	 
		 
	 }
	else
	 {
		 
		document.getElementById('YearLoader').style.display = 'block'; 
		 
	 	var xmlHttp;
		
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result == 1 || result == 2 )
					 {
						 
						 document.getElementById('YearLoader').style.display = 'none';
						
						 
					 }
					else
					 {
						
						 alert("Not Save. Error "); 
						 document.getElementById('YearLoader').style.display = 'none';
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById('YearLoader').style.display = 'block';
					
				}
			
			
				//UpdateToday
				
		 }
	
		
	   
	   var param = 'action=update_content&rand=' + Math.random() + '&goal='+ goal + '&goal_id='+ goal_id;
	   
		xmlHttp.open('POST', 'insert_goal.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param);

	 
	 }
	
 
 }





//SUBMIT INSPIRATION..
function submitInspiration()
 {
	 
	 
	var inspiration =  document.getElementById('Txt_Inspiration').value.trim();
	var tags =  document.getElementById('Txt_Tags').value.trim();
	//tinyMCE.get('text').getContent or tinyMCE.activeEditor.getContent or tinyMCE.activeEditor.save(); + document.getElementById('TEXT').value
	var content = tinyMCE.activeEditor.save();
	

	if((content.trim()) == "")
	 {
		 
		 alert("Please enter content. ");
		 
	 }
 	else if(inspiration == "" || inspiration == "write inspiration here" )
	 {
		 
		alert("Please enter inspiration title. ");	 
		 
	 }
	else
	 {
		 
		 
	
	
	 	var xmlHttp;
		
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result == 1)
					 {
						 
						 //getFavInspiration();
						 document.getElementById('Txt_Inspiration').value = '';
						 document.getElementById('Txt_Tags').value = '';
						 document.getElementById('Txt_Content').value = '';
						 
						 //document.getElementById('MyInspirations').innerHTML = result; 
						 tinyMCE.get('Txt_Content').setContent('');
						 
						 document.getElementById('InspirationLoader').style.display = 'none';
						 
					 }
					else
					 {
						
						 alert("Not Save. Error ");
						 document.getElementById('Txt_Inspiration').value = '';
						 document.getElementById('Txt_Tags').value = '';

						 document.getElementById('InspirationLoader').style.display = 'none';
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById('InspirationLoader').style.display = 'block';
					
				}
			
			
				//UpdateToday
				
		 }
	
		
	   
	   var param = 'action=post&rand=' + Math.random() + '&inspiration='+ inspiration+ '&tags='+ tags+ '&content='+ content;
	   
		xmlHttp.open('POST', 'insert_inspiration.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset:UTF-8");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    


		xmlHttp.send(param);
	
		
		
	 
	 }
	
 
 }



//SUBMIT INSPIRATION..
function submitInspirationPost()
 {
	 
	 
	var inspiration =  document.getElementById('Txt_Inspiration').value.trim();
	var tags =  document.getElementById('Txt_Tags').value.trim();
	//tinyMCE.get('text').getContent or tinyMCE.activeEditor.getContent or tinyMCE.activeEditor.save(); + document.getElementById('TEXT').value
	var content = tinyMCE.activeEditor.save();
	
	var frm = document.form_post_inspiration;
	
	if((content.trim()) == "")
	 {
		 
		 alert("Please enter content. ");
		 
	 }
 	else if(inspiration == "" || inspiration == "write inspiration here" )
	 {
		 
		alert("Please enter inspiration title. ");	 
		 
	 }
	else
	 {
		 
		 
		frm.submit();
		
	 
	 }
	
 
 }







//COMMENT POST
function enterPost(id, textid)
 {
	 
	 document.getElementById(id).style.display = 'block';
	 document.getElementById(textid).value = '';
	 document.getElementById(textid).style.backgroundColor = '#ffffff';
	 document.getElementById(textid).rows = (document.getElementById(textid).value.split("\n").length||1);
	 
 }
 



function hidePost(id)
 {
	 
	 document.getElementById(id).style.display = 'none';
	 
 }




function submitPost(insid, commentid, divid, loaderid, commentupdate)
 {
	 
	
	 var comment = document.getElementById(commentid).value.trim();
	 
	 if(comment == "")
	  {
		  
		  document.getElementById(commentid).style.backgroundColor = "#fcecec";
		  
	  }
	 else
	  {
		  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 //getFavInspiration();
							 document.getElementById(commentupdate).innerHTML = 'view comments(' + result + ')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';
							 document.getElementById(loaderid).style.display = 'none';
							 document.getElementById(divid).style.display = 'none';
							 document.getElementById('ViewComment'+insid).style.display = 'none';
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(loaderid).style.display = 'none';
							  document.getElementById(divid).style.display = 'none';
							  document.getElementById('ViewComment'+insid).style.display = 'none';
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loaderid).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&insid='+ insid;
		   
			xmlHttp.open('POST', 'submit_comment.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 }



function viewComments(div_id, ins_id, loader_id, access)
 {
	 
	 document.getElementById(div_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 //getFavInspiration();
					 document.getElementById(div_id).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById(div_id).style.display = 'none';
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			//UpdateToday
			
	 }

	
   
   var param = 'action=view&rand=' + Math.random() + '&ins_id='+ ins_id + '&access='+ access;
   
	xmlHttp.open('POST', 'view_comments.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 
 

function hideComments(id)
 {
	 
	 document.getElementById(id).style.display = 'none';
	 
 }





function deleteComment(cid, ins_id, update_divid, loader_id, access)
 {
	

	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					
					 document.getElementById(update_divid).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 CountComment(ins_id);
					 
					 
				 }
				else
				 {
					
					  document.getElementById(update_divid).style.display = 'none';
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById("CommentUpdate"+ins_id).innerHTML = '';
					 
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&cid='+ cid + '&ins_id='+ ins_id + '&access='+ access;
   
	xmlHttp.open('POST', 'delete_comment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 
 
 
 function CountComment(ins_id)
 {
	
	
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					
					 
					 //document.getElementById('CommentUpdate'+ins_id).innerHTML = 'view comments('+result+')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';	
				
					 document.getElementById('CommentUpdate'+ins_id).innerHTML = result; 
			
				
				 }
				else
				 {
					 
					 document.getElementById('ViewComment'+ins_id).innerHTML = 'none';	
					 //document.getElementById('CommentUpdate'+ins_id).style.display = 'none';	 
					 
				 }
				
				
				
			}
		
		  else
			{
				
				
				
			}
		
		
			
	 }

	
   
   var param = 'action=update_commentcount&rand=' + Math.random() + '&ins_id='+ ins_id;
   
	xmlHttp.open('POST', 'submit_comment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 }

 
 
 
 
 
 
 
 function showremoveDiv(ins_id, divid, loader_id)
 {
	
	
	 document.getElementById(divid).style.display = 'block';
	
	
 }
 
 
 function hideremoveDiv(divid)
 {
	
	
	 document.getElementById(divid).style.display = 'none';
	
	
 }
 
 
 
 function removeDiv(ins_id, divid, loader_id)
 {
	
	 
	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById(loader_id).style.display = 'none';
					 document.getElementById('MyInspirations').innerHTML = result;	
					 
					 //window.location = 'myinspiration.php' 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&ins_id='+ ins_id;
   
	xmlHttp.open('POST', 'delete_inspiration.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 }



function addFavInspiration(ins_id, divid, loader_id)
 {
	

	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 1)
				 {
					 
					 document.getElementById("ILike").style.display = 'none'; 	
					 document.getElementById(loader_id).style.display = 'none';
					 
					 RollIt.hidePopup(divid);
					 
					 
				 }
				else
				 {
					
					
					 document.getElementById(loader_id).style.display = 'none';
					 
					 //document.getElementById(divid).style.display = 'none';
					 RollIt.hidePopup(divid);
					
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=add&rand=' + Math.random() + '&ins_id='+ ins_id;
   
	xmlHttp.open('POST', 'addfav_inspiration.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 }





function submitGoal()
 {
	
	 var goal_id = document.getElementById("ActionW").value.trim();
	 
	 var goal = document.getElementById("Txt_Goal").value.trim();
	 var target_date = document.getElementById("CalInput").value.trim();
	 var category =  document.getElementById("Category").value.trim();
	 var priority =  document.getElementById("Priority").value.trim();
	 
	 
	
	 var sortby = document.getElementById("SortBy").value.trim();
	 
	 if(goal_id == "")
	  {
		  
		  action = "add";
		  
	  }
	 else
	  {
		  
			
		 action = "update";
		  
	  }
	 

	

	if(goal == "" || goal == "<type here>")
	 {
		 
		 alert("Please enter your goal. ");
		 
	 }
	
	else if(category == "")
	 {
		 
		 alert("Please select category. ");
		 
	 }
	else if(priority == "")
	 {
		 
		 alert("Please select priority. ");
		 
	 }
	else if(target_date == "")
	 {
		 
		 alert("Please enter the target date. ");
		 
	 } 
	else
	 {
		 
		 
		var xmlHttp;
			
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result)
					 {
						 
						 document.getElementById("GoalLoader").style.display = 'none';
						 document.getElementById("Txt_Goal").value = "";
	 					 document.getElementById("CalInput").value = "";
						 document.getElementById("MyGoals").innerHTML = result;
						 //window.location = 'mygoals.php';
						 
						 
						 var goals = document.demoForm.goal_list.value;
						 var progress = document.demoForm.progress_list.value;
						 
						 var goal_list = goals.split(";");
						 var progress_list = progress.split(";");
						 
						 for (var i = 0; i < goal_list.length; i += 1) {
							 scroll_bar(goal_list[i], progress_list[i]);
						 }
						 
						
						 //window.location = 'mygoals.php?sortby=' + sortby;
						 
					 }
					else
					 {
						
						
						 document.getElementById("GoalLoader").style.display = 'none';
						
						
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById("GoalLoader").style.display = 'block';
					
				}
			
			
				
		 }
	
		
	   
	   var param = 'action=' + action + '&rand=' + Math.random() + '&goal_id='+ goal_id + '&goal='+ goal + '&target_date='+ target_date + '&category=' + category + '&priority=' + priority + '&sortby=' + sortby;

		xmlHttp.open('POST', 'insert_goal.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param); 
		
		
	 }
	
	
		
	
 }




function viewGoalComments(goal_id, div_id, loader_id, memid)
 {
	 
	 
	 document.getElementById(div_id).style.display = 'block';
	 
	 listGoalComments(goal_id, div_id, loader_id, memid);
	 
 }


function listGoalComments(goal_id, div_id, loader_id, memid)
 {
	 
	 document.getElementById(div_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 //getFavInspiration();
					 document.getElementById(div_id).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById(div_id).style.display = 'none';
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
			
	 }

	
   
   var param = 'action=view&rand=' + Math.random() + '&goal_id='+ goal_id + '&memid='+ memid;
   
	xmlHttp.open('POST', 'view_goalcomments.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }




function deleteGoalComment(cid, goal_id, update_divid, loader_id, memid)
 {
	
	
	 
	 document.getElementById(loader_id).style.display = 'block';
	
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result != 0)
				 {
					 
					
					 document.getElementById(update_divid).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 CountGoalComment(goal_id);
					 
					 
				 }
				else
				 {
					
					  document.getElementById(update_divid).style.display = 'none';
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById("CommentUpdate"+goal_id).innerHTML = '';
					 
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&cid='+ cid + '&goal_id='+ goal_id + '&memid='+ memid;
   
	xmlHttp.open('POST', 'delete_goalcomment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }





 function CountGoalComment(goal_id)
 {
	
	
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
			
				if(result)
				 {
					
					 
					 document.getElementById('CommentUpdate'+goal_id).innerHTML = 'view comments('+result+')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';	
					 
				
				 }
				else
				 {
					 
					 //document.getElementById('CommentUpdate'+ins_id).innerHTML = '';	
					 document.getElementById('CommentUpdate'+goal_id).style.display = 'none';	 
					 
				 }
				
				
				
			}
		
		  else
			{
				
				
				
			}
		
		
			
	 }

	
   
   var param = 'action=update_commentcount&rand=' + Math.random() + '&goal_id='+ goal_id;
   
	xmlHttp.open('POST', 'submit_goalcomment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 }

 
function submitGoalPost(goal_id, commentid, divid, loaderid, commentupdate)
 {
	 

	 
	 var comment = document.getElementById(commentid).value.trim();
	 
	 if(comment == "")
	  {
		  
		  document.getElementById(commentid).style.backgroundColor = "#fcecec";
		  
	  }
	 else
	  {
		  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 //getFavInspiration();
							 document.getElementById(commentupdate).innerHTML = 'view comments(' + result + ')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';
							 document.getElementById(loaderid).style.display = 'none';
							 document.getElementById(divid).style.display = 'none';
							 document.getElementById('ViewComment'+goal_id).style.display = 'none';
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(loaderid).style.display = 'none';
							  document.getElementById(divid).style.display = 'none';
							  document.getElementById('ViewComment'+goal_id).style.display = 'none';
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loaderid).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&goal_id='+ goal_id;
		   
			xmlHttp.open('POST', 'submit_goalcomment.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 } 
 
 
 function removeGoalDiv(goal_id, divid, loader_id)
 {
	
	 
	 var sortby = document.getElementById("SortBy").value.trim();
	 
	 document.getElementById(loader_id).style.display = 'block';
	 
	
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById(loader_id).style.display = 'none';
					 document.getElementById('MyGoals').innerHTML = result;	
					 
					 var goals = document.demoForm.goal_list.value;
						 var progress = document.demoForm.progress_list.value;
						 
						 var goal_list = goals.split(";");
						 var progress_list = progress.split(";");
						 
						 for (var i = 0; i < goal_list.length; i += 1) {
							 scroll_bar(goal_list[i], progress_list[i]);
						 }
					 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&goal_id='+ goal_id + '&sortby='+ sortby;
   
	xmlHttp.open('POST', 'delete_goal.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
	
 }




 
function updateProgress(goal_id)
 {
	
	 
	 document.getElementById("Loader5"+goal_id).style.display = 'block';
	 
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 2)
				 {
					 
					 //document.getElementById('EditProgress'+goal_id).style.display= 'none';	
					 document.getElementById('Loader5'+goal_id).style.display = 'none';
					
					 
				 }
				else
				 {
					
					  alert("Error while updating.");	
					  document.getElementById('Loader5'+goal_id).style.display = 'none';
					
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById('Loader5'+goal_id).style.display = 'block';
				
			}
		
		
			
	 }
	 

   //var progress	= document.getElementById("pos3"+goal_id).value.trim();
   var progress	= document.getElementById("sliderValue"+goal_id).value.trim();
	  
   var param = 'action=update_progress&rand=' + Math.random() + '&goal_id='+ goal_id + '&progress='+ progress;
   
	xmlHttp.open('POST', 'insert_goal.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 }



// for opacity
function lightup(imageobject, opacity){
    if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
    imageobject.style.MozOpacity=opacity/100
    else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
    imageobject.filters.alpha.opacity=opacity


}



function changeFeat(mem_id)
 {
	 
	 document.getElementById('BigLoader').style.display = 'block';
	 
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('BigFImg').innerHTML = result; 
					 document.getElementById('BigLoader').style.display = 'none';
					
					 
				 }
				else
				 {
					
					  alert("Error.");	
					  document.getElementById('BigLoader').style.display = 'none';
					
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById('BigLoader').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=change&rand=' + Math.random() + '&mem_id='+ mem_id;
   
	xmlHttp.open('POST', 'change_featmem.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
	 
 }
 
 
 
function changeDyna(dfrom_id, dtitle, dfilename, dlink, ddescription, dlanding, timg)
 {
	 
	
	 
	 document.getElementById('BigLoader').style.display = 'block';
	 
	 //document.getElementById('DynamicLink').innerHTML = dlink;
	 document.getElementById('DynamicLink').innerHTML = "<div >" + "<img src='" + timg + "'/>" + "</div>";
	 document.getElementById('DynamicTitle').innerHTML = "<a href='" + dlanding + "'>" + dtitle + "</a>"; 
	 document.getElementById('DynamicDesc').innerHTML = ddescription;
	 document.getElementById('DynamicRead').innerHTML = "<a href='" + dlanding + "'>" + "Read more..." + "</a>";
	 
	 if(dlink == "BDJ Giveaways")
	  {
		  
		   document.getElementById('DynamicRead').style.display = "none";
		   document.getElementById('BigImgHolder').innerHTML = "<img src='resize_image.php?width=354&height=280&file=" + dfilename + "' style='border: 0px; ' >";

	  }
	  else
	  {
		  
		   document.getElementById('DynamicRead').style.display = "block";
		   document.getElementById('BigImgHolder').innerHTML = "<a href='" + dlanding + "'>" + "<img src='resize_image.php?width=354&height=280&file=" + dfilename + "' style='border: 0px; ' >" + "</a>"

	  }
	  
	 
	 //document['BigDynaImg'].src = "resize_image.php?width=354&height=280&file=" + dfilename; 
	 //document.getElementById('BigImgHolder').innerHTML = "<a href='" + dlanding + "'>" + "<img src='resize_image.php?width=354&height=280&file='" + dfilename + " style='border: 0px; ' >" + "</a>";
	 
	; 
	 
	  
	 document.getElementById('BigLoader').style.display = 'none';
	  
 } 
 
 
 
function addCircle(memid_f)
 {
	 
	 document.getElementById('LoaderConfirmAdd').style.display = 'block';
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 1)
				 {
					 
					 document.getElementById('AddToCircle').innerHTML = ''; 
					  document.getElementById('AddToCircle').style.border = '0px'; 
					 document.getElementById('LoaderConfirmAdd').style.display = 'none';
					 document.getElementById('ConfirmAdd').style.display = 'none';
					 
					 //alert(result);
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderConfirmAdd').style.display = 'none';
					 document.getElementById('ErrorConfirm').innerHTML = 'Error while sending request.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderConfirmAdd').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=insert&rand=' + Math.random() + '&memid_f='+ memid_f;
   
	xmlHttp.open('POST', 'add_circle.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
 }
 
 
 
function showDiv(id)
 {
	 
	 
	 document.getElementById(id).style.display = 'block';
	 
 }
 
function hideDiv(id)
 {
	 
	 
	 document.getElementById(id).style.display = 'none';
	 
 }


function viewRemoveCircle(member_id, relation_id, memid_f, fname, lname, imgpath)
 {
	 
	 
	 var fname_fr = fname.replace("|","'");
	 var lname_fr = lname.replace("|","'");
	 
	 document.getElementById('FullNameFr').innerHTML = fname_fr + " " + lname_fr;
	 document.getElementById('FnameFr').innerHTML = fname_fr;
	 
	 document.getElementById('ConfirmRemoveCircle').style.display = 'block';
	 document.getElementById('ImgFr').innerHTML = "<img src='resize_image.php?width=105&height=120&file=members_img/" + imgpath + "'  style='border: 1px solid #fbd6f0;' />";
	 
	 document.getElementById('HiddenIDM').value = member_id;
	 document.getElementById('HiddenIDR').value = relation_id;
	 

	 
 }
 
 
 
function deleteCircle()
 {
	 
	var relation_id = document.getElementById('HiddenIDR').value.trim();
	var member_id = document.getElementById('HiddenIDM').value.trim();
	
	
	document.getElementById('LoaderConfirmDelete').style.display = 'block';


	
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('LoaderConfirmDelete').style.display = 'none';
					
					 document.getElementById('WholeCircles').innerHTML = result;
					 
					 
					 document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderConfirmDelete').style.display = 'none';
					 document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderConfirmDelete').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=delete&rand=' + Math.random() + '&relation_id='+ relation_id + '&member_id='+ member_id;
   
	xmlHttp.open('POST', 'add_circle.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
}





function circlePagination(member_id, page)
 {
	 
	 var prev_page = document.getElementById('HiddenPage').value.trim();

	 var span_id = "Ctr" + page;

	
	 if(prev_page != 0)
	  {
		  
	 	document.getElementById("Ctr"+prev_page).innerHTML = "<a href=" + "javascript:circlePagination('" + member_id + "','" + prev_page + "')> " + prev_page + "&nbsp;" + "</a>" + "<input type='hidden' id='HiddenPage'" + "value=" + prev_page + "/>";
												
															 		
	  }
	  
	  
	 document.getElementById(span_id).innerHTML =  page + "&nbsp; ";
	
	 document.getElementById('HiddenPage').value = page; 
	 
	 
	 nextCirclePage(member_id, page);
	 
	
	 
 }
 
 
function nextCirclePage(member_id, page)
 {
	
	
	document.getElementById('LoaderNextPage').style.display = 'block';
	


	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('LoaderNextPage').style.display = 'none';
					
					 document.getElementById('DisplayCircles').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderNextPage').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderNextPage').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=paginate&rand=' + Math.random() + '&member_id='+ member_id + '&page='+ page;
   
	xmlHttp.open('POST', 'add_circle.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
	 
	  
}



function Search(txtsearch)
 {
	 
	var keyword = document.getElementById(txtsearch).value.trim();
	 
	if(keyword != "")
	 {
		 
		 window.location = 'search_results.php?keyword=' + keyword;
		 
	 }
	 
 }
 
 
 
 
function viewAddToCircle(member_ids, memid_f, fname, lname, imgpath)
 {
	 
	 
	 var fname_fr = fname.replace("|","'");
	 var lname_fr = lname.replace("|","'");
	 
	 document.getElementById('FullNameFr').innerHTML = fname_fr + " " + lname_fr;
	 document.getElementById('FnameFr').innerHTML = fname_fr;
	 
	 document.getElementById('ConfirmAdd').style.top = document.documentElement.scrollTop + 30 +'px';
		document.getElementById('ConfirmAdd').style.display = 'block';	
	 document.getElementById('ImgFr').innerHTML = "<img src='resize_image.php?width=105&height=120&file=members_img/" + imgpath + "'  style='border: 1px solid #fbd6f0;' />";
	 
	 document.getElementById('HiddenIDL').value = member_ids;
	 document.getElementById('HiddenIDM').value = memid_f;
	 

	 
 } 
 

function addCircleSearch()
 {
	 
	 var member_ids = document.getElementById('HiddenIDL').value.trim();
	 var memid_f = document.getElementById('HiddenIDM').value.trim();
	 
	 document.getElementById('LoaderConfirmAdd').style.display = 'block';
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 1)
				 {
					 
					 document.getElementById('AddToCircle'+memid_f).innerHTML = ''; 
					 
					 document.getElementById('LoaderConfirmAdd').style.display = 'none';
					 document.getElementById('ConfirmAdd').style.display = 'none';
					 
					 //alert(result);
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderConfirmAdd').style.display = 'none';
					 document.getElementById('ErrorConfirm').innerHTML = 'Error while sending request.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderConfirmAdd').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=insertsearch&rand=' + Math.random() + '&member_ids='+ member_ids + '&memid_f='+ memid_f;
   
	xmlHttp.open('POST', 'add_circle.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
 }
 
 
 
function searchPagination(keyword, page)
 {
	 
	 var prev_page = document.getElementById('HiddenPage').value.trim();

	 var span_id = "Ctr" + page;

	
	 if(prev_page != 0)
	  {
		  
	 	document.getElementById("Ctr"+prev_page).innerHTML = "<a href=" + "javascript:searchPagination('" + keyword + "','" + prev_page + "')> " + prev_page + "&nbsp;" + "</a>" + "<input type='hidden' id='HiddenPage'" + "value=" + prev_page + "/>";
												
															 		
	  }
	  
	  
	 document.getElementById(span_id).innerHTML =  page + "&nbsp; ";
	
	 document.getElementById('HiddenPage').value = page; 
	 
	 
	 nextSearchPage(keyword, page);
	 
	
	 
 }
 
 
 
function nextSearchPage(keyword, page)
 {

	document.getElementById('LoaderNextPage').style.display = 'block';
	


	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('LoaderNextPage').style.display = 'none';
					
					 document.getElementById('SearchResults').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderNextPage').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderNextPage').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=paginate&rand=' + Math.random() + '&keyword='+ keyword + '&page='+ page;
   
	xmlHttp.open('POST', 'search_ajax.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
	 
	  
}



function Vote(question_id)
 {
	 
	 
	 
	 var ans = 0;
	 
	 for( i = 0; i < document.vote_form.poll_ans.length; i++ )
		{
			
			if( document.vote_form.poll_ans[i].checked == true )
			ans = document.vote_form.poll_ans[i].value;
		}
	
	if(ans != 0)
	 {
		 
		submitVote(question_id, ans);
	
	
	 }
	 
 }
 
 
 
 
function submitVote(question_id, ans)
 {
	 
	 
	 document.getElementById('LoaderVote').style.display = 'block';
	 
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 
					 document.getElementById('LoaderVote').style.display = 'none';
					 viewVoteResults(question_id)
					 //insert here view results...s
					 //document.getElementById('SearchResults').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderVote').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderVote').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=vote&rand=' + Math.random() + '&question_id='+ question_id + '&ans='+ ans;
   
	xmlHttp.open('POST', 'vote_poll.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
	 
 }
 
 
function viewVoteResults(question_id)
 {
	 
	 
	 document.getElementById('LoaderVote').style.display = 'block';
	 
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result != 'error')
				 {
					 
					 document.getElementById('LoaderVote').style.display = 'none';
					
					 //insert here view results...s
					 document.getElementById('PollQDisp').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderVote').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderVote').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=result&rand=' + Math.random() + '&question_id='+ question_id;
   
	xmlHttp.open('POST', 'vote_poll.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
 }


function viewVoteQuestion(question_id)
 {
	 
	 
	 document.getElementById('LoaderVote').style.display = 'block';
	 
	 
	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result != 'error')
				 {
					 
					 document.getElementById('LoaderVote').style.display = 'none';
					
					 //insert here view results...s
					 document.getElementById('PollQDisp').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderVote').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderVote').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=question&rand=' + Math.random() + '&question_id='+ question_id;
   
	xmlHttp.open('POST', 'vote_poll.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
 }


function confirmFriendReq(request_id,action)
 {
	
	 
	 document.getElementById('LoaderFR'+request_id).style.display = 'block';


	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('LoaderFR'+request_id).style.display = 'none';
					
					 //insert here view results...s
					 document.getElementById('WholeRequest').innerHTML = result;
					 
					 //document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderFR'+request_id).style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderFR'+request_id).style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action='+ action +'&rand='+ Math.random() + '&request_id='+ request_id;
   
	xmlHttp.open('POST', 'request_confirmation.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 



 }
 
 
 
function viewAddLookbook(product_id, product_name, source)
 {

	 
	 document.getElementById('ConfirmAddLookbookContent').style.position = 'fixed'; 
	 document.getElementById('ConfirmAddLookbookContent').style.top = '50%';
	 document.getElementById('ConfirmAddLookbookContent').style.left = '43%';	
	 
	 document.getElementById('LookName').innerHTML = "Add "+ product_name + " in your Lookbook?";
	 document.getElementById('BtnAddLook').innerHTML = "<div  style='margin: 0px; padding: 0px; text-align: center; ' >" + "<input class='btn_click' type='button' value='yes' style='font-weight: bold;' onclick=\"addLookbook('" + product_id + "','" + source + "')\">" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input class='btn_click' type='button' value='no' style='font-weight: bold;' onclick='hideAddLookbookBox()' >" + "</div>";
	 
	 //document.getElementById('ConfirmAddLookbookContent').style.display = 'block'; 
	 
	 document.getElementById('ConfirmAddLookbook').innerHTML = document.getElementById('ConfirmAddLookbookContent').innerHTML;  
	 
	
	 document.getElementById('ConfirmAddLookbook').style.display = 'block'; 

 }
 
 
function hideAddLookbookBox()
 {
	 
	 
	 document.getElementById('ConfirmAddLookbook').style.display = 'none'; 
	 
 }
 
 
function addLookbook(product_id, source)
 {
	 
	 
	 
	  //var source = source; 
	
	
	  document.getElementById('AddLookLoader').style.display = 'block';
	 

	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 1)
				 {
					 
					 document.getElementById('AddLookLoader').style.display = 'none';
					
					 //insert here view results...
					 
					 document.getElementById('ILike'+product_id).innerHTML = '';
					 document.getElementById('ILike'+product_id).style.display = 'none';
					 
				 }
				else
				 {
					
					 document.getElementById('AddLookLoader').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('AddLookLoader').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=add' +'&rand='+ Math.random() + '&product_id='+ product_id + '&source='+ source;
   
	xmlHttp.open('POST', 'lookbook_ajax.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	 
 }


 function viewAddLookbook2(product_id, product_name, source)
 {
	 
	 
	 document.getElementById('ConfirmAddLookbook').style.zIndex = '99999';
	 
	 document.getElementById('ConfirmAddLookbook').style.position = 'fixed'; 
	 document.getElementById('ConfirmAddLookbook').style.top = '50%';
	 document.getElementById('ConfirmAddLookbook').style.left = '34%';	
	 
	 document.getElementById('LookName').innerHTML = "Add "+ product_name + " in your Lookbook?";
	 document.getElementById('BtnAddLook').innerHTML = "<div  style='margin: 0px; padding: 0px; text-align: center; ' >" + "<input class='btn_click' type='button' value='yes' style='font-weight: bold;' onclick=\"addLookbook2('" + product_id + "','" + source + "')\">" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input class='btn_click' type='button' value='no' style='font-weight: bold;' onclick='hideAddLookbookBox2()' >" + "</div>";
	
	//document.getElementById('ConfirmAddLookbookContent').style.display = 'block'; 
	 
	 document.getElementById('ConfirmAddLookbook').innerHTML = document.getElementById('ConfirmAddLookbookContent').innerHTML;  
	 
	 
	 document.getElementById('ConfirmAddLookbook').style.display = 'block'; 
	 
	 //document.getElementById('ConfirmAddLookbookContent').style.zIndex = '99999';
	 
 }
 
 
function hideAddLookbookBox2()
 {
	 
	 
	 document.getElementById('ConfirmAddLookbook').style.display = 'none'; 
	 
 }
 

function addLookbook2(product_id, source)
 {
	 
	
	  document.getElementById('AddLookLoader').style.display = 'block';
	 
	  var from = "ep";

	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == 1)
				 {
					 
					 document.getElementById('AddLookLoader').style.display = 'none';
					
					 //insert here view results...
					 
					 document.getElementById('ILike'+product_id).innerHTML = '';
					 document.getElementById('ILike'+product_id).style.display = 'none';
					 hideAddLookbookBox2();
					 
				 }
				else
				 {
					
					 document.getElementById('AddLookLoader').style.display = 'none';
					 //document.getElementById('ErrorConfirm').innerHTML = 'Error while removing friend.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('AddLookLoader').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=add' +'&rand='+ Math.random() + '&product_id='+ product_id + '&source='+ source;
   
	xmlHttp.open('POST', 'lookbook_ajax.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	

	 
 }





function viewRemoveLookbook(look_id, name, imgpath)
 {
	 
	 
	 var name_fr = name.replace("|","'");
	 //var lname_fr = lname.replace("|","'");
	 
	 document.getElementById('FullNameFr').innerHTML = name_fr;
	 document.getElementById('FnameFr').innerHTML = name_fr;
	 
	 document.getElementById('ConfirmRemoveCircle').style.zIndex = '200';
	 
	 
	 document.getElementById('ImgFr').innerHTML = "<img src='resize_image.php?width=105&height=120&file=products/" + imgpath + "'  style='border: 1px solid #fbd6f0;' />";
	 //document.getElementById('ConfirmRemoveCircle').style.position = 'fixed';
	 //document.getElementById('ConfirmRemoveCircle').style.top = '50%';
	 //document.getElementById('ConfirmRemoveCircle').style.left = '40%';
	 
	 document.getElementById('ConfirmRemoveCircle').style.display = 'block';
	 
	 document.getElementById('HiddenIDM').value = look_id;
	 //document.getElementById('HiddenIDR').value = relation_id;
	 

	 
 }




function deleteLookbook()
 {
	 
	
	var look_id = document.getElementById('HiddenIDM').value.trim();

	
	document.getElementById('LoaderConfirmDelete').style.display = 'block';



	  var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 document.getElementById('LoaderConfirmDelete').style.display = 'none';
					 
					 document.getElementById('WholeMyLookbook').innerHTML = result;
					 
					 Slimbox.scanPage();
					 
					 document.getElementById('ConfirmRemoveCircle').style.display = 'none';
					 
					
					 
				 }
				else
				 {
					
					 document.getElementById('LoaderConfirmDelete').style.display = 'none';
					 document.getElementById('ErrorConfirm').innerHTML = 'Error while removing lookbook.'; 
					
					
				 }
				
			}
		
		  else
			{
				
				 document.getElementById('LoaderConfirmDelete').style.display = 'block';
				
			}
		
		
			
	 }


	  
   var param = 'action=delete&rand=' + Math.random() + '&look_id='+ look_id;
   
	xmlHttp.open('POST', 'lookbook_ajax.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
}


function viewCommentsRead(div_id, ins_id, loader_id, access)
 {
	 
	 document.getElementById(div_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 //getFavInspiration();
					 document.getElementById(div_id).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById(div_id).style.display = 'none';
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'none';
				
			}
		
		
			//UpdateToday
			
	 }

	
   
   var param = 'action=view&rand=' + Math.random() + '&ins_id='+ ins_id + '&access='+ access;
   
	xmlHttp.open('POST', 'view_comments_read.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }



function deleteCommentRead(cid, ins_id, update_divid, loader_id, access)
 {
	

	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result != 0)
				 {
					 
					 
					  
					 document.getElementById(update_divid).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					
					 
					 CountCommentRead(ins_id);
					 
					 
				 }
				else
				 {
					
					  document.getElementById(update_divid).style.display = 'none';
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById("CommentUpdate"+ins_id).innerHTML = '';
					 
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&cid='+ cid + '&ins_id='+ ins_id + '&access='+ access;
   
	xmlHttp.open('POST', 'delete_comment_read.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 
 
function CountCommentRead(ins_id)
 {
	
	
	 
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					
					 
					 document.getElementById('CommentUpdate'+ins_id).innerHTML = 'comments('+result+')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';	
					 
				
				 }
				else
				 {
					 
					 //document.getElementById('CommentUpdate'+ins_id).innerHTML = '';	
					 document.getElementById('CommentUpdate'+ins_id).style.display = 'none';	 
					 
				 }
				
				
				
			}
		
		  else
			{
				
				
				
			}
		
		
			
	 }

	
   
   var param = 'action=update_commentcount&rand=' + Math.random() + '&ins_id='+ ins_id;
   
	xmlHttp.open('POST', 'submit_comment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 
	
 } 


function submitPostRead(insid, commentid, divid, loaderid, commentupdate)
 {
	 
	
	 
	 var comment = document.getElementById(commentid).value.trim();
	 
	 if(comment == "")
	  {
		  
		  document.getElementById(commentid).style.backgroundColor = "#fcecec";
		  
	  }
	 else
	  {
		  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 //getFavInspiration();
							 document.getElementById(commentupdate).innerHTML = 'comments(' + result + ')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp';
							 document.getElementById(loaderid).style.display = 'none';
							 document.getElementById(commentid).value = "";
							 viewCommentsRead('ViewComment'+insid, insid, 'PostLoader2'+insid, '1')
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(loaderid).style.display = 'none';
							  
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loaderid).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&insid='+ insid;
		   
			xmlHttp.open('POST', 'submit_comment.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 }



function setPrimaryPhoto(filename)
 {
	 
	
	 	document.getElementById('MessageLoaderPri').style.display = 'block';
  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result == 1)
						 {
							 
							 //getFavInspiration();
							 
							 document.getElementById('MessageLoaderPri').style.display = 'none';
							 document.getElementById('MessageBoxPri').style.display = 'none';
							 
							 
						 }
						else
						 {
							
							  alert("Not change. "); 
							 document.getElementById('MessageLoaderPri').style.display = 'none';
							  
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById('MessageLoaderPri').style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=change&rand=' + Math.random() + '&filename='+ filename;
		   
			xmlHttp.open('POST', 'photo_members.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
	
	 
 }




// UPDATE PHOTO CAPTION... 
function updateCaption(file_id)
 {
	 
	var caption = document.getElementById('Caption').value.trim();
	
	
	if(caption == "")
	 {
		 
		document.getElementById('Caption').style.backgroundColor = "#fcecec";  
		 
	 }
	else 
	 { 
		 
		 var caption = caption.replace("|","'");
		 
		 caption =caption.replace('|','"');
		 
		 document.getElementById('CaptionLoader').style.display = 'block';
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result == 1)
						 {
							 
							 //getFavInspiration();
							 
							 document.getElementById('CaptionLoader').style.display = 'none';
							 document.getElementById('EditCaption').style.display = 'none';
							  document.getElementById('CaptionUp').innerHTML = document.getElementById('Caption').value.trim(); 
							 
							 
						 }
						else
						 {
							
							 alert("Not save. "); 
							 document.getElementById('CaptionLoader').style.display = 'none';
							  
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById('CaptionLoader').style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=update_caption&rand=' + Math.random() + '&file_id='+ file_id + '&caption='+ caption;
		   
			xmlHttp.open('POST', 'photo_members.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param);  
		
	 }
	 
 }
 
 
 
 function deletePhoto(file_id, filename, member_id)
 {
	 
		
	 	document.getElementById('MessageLoaderDel').style.display = 'block';
  
		 
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result == 1)
						 {
							 
							 //getFavInspiration();
							 
							 document.getElementById('MessageLoaderDel').style.display = 'none';
							 document.getElementById('MessageBoxDel').style.display = 'none';
							 window.location ='view_photos.php?id='+member_id;
							 
							 
						 }
						else
						 {
							
							  alert("Not change. "); 
							 document.getElementById('MessageLoaderDel').style.display = 'none';
							  
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById('MessageLoaderDel').style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=delete&rand=' + Math.random() + '&file_id='+ file_id + '&filename='+ filename;
		   
			xmlHttp.open('POST', 'photo_members.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  

	 
 }
 
 
 
 
 
 
 
 
 
 function priorControl(prior_id, control_id)
  {
	  
	  
	  if(document.getElementById(prior_id).style.display == "none")
	  	{
			
			document.getElementById(prior_id).style.display = "block";
			
			document.getElementById(control_id).innerHTML = "<a href=\"javascript:priorControl('" + prior_id + "','" + control_id + "')\" >[hide]</a>";
			
		}
	  else
	   {
		   
		    document.getElementById(prior_id).style.display = "none";
			
		 	document.getElementById(control_id).innerHTML = "<a href=\"javascript:priorControl('" + prior_id + "','" + control_id + "')\" >[show]</a>";
		   
	   }
	  
	  
	  
  }
 
 
 
 
 function setPriGoal(goal_id, set, messagebox, loader)
 {
		
		var sortby = document.getElementById('SortBy').value;
		
		
	
		var next_m;
		
		if(set == "no")
		 {
			 
			 next_m = "Set as primary goal"
			 
		 }
		else
		 {
			 
			next_m = "Remove as primary goal";	 
			 
		 }
		 
		 
	 	document.getElementById(loader).style.display = 'block';
  
		
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 //getFavInspiration();
							 
							 document.getElementById(loader).style.display = 'none';
							 document.getElementById(messagebox).style.display = 'none';
							 
							 document.getElementById('MyGoals').innerHTML = result; 
							 
							 //window.location = "mygoals.php?sortby="+sortby;
							 
							 
							 var goals = document.demoForm.goal_list.value;
							 var progress = document.demoForm.progress_list.value;
							 
							 var goal_list = goals.split(";");
							 var progress_list = progress.split(";");
							 
							 for (var i = 0; i < goal_list.length; i += 1) {
								 scroll_bar(goal_list[i], progress_list[i]);
							 }
							 
							 
						 }
						else
						 {
							
							  //alert("Not change. "); 
							 document.getElementById(loader).style.display = 'none';
							  
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loader).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=feature&rand=' + Math.random() + '&goal_id='+ goal_id + '&set='+ set + '&sortby='+ sortby;
		   
			xmlHttp.open('POST', 'setprigoal.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
	
	 
 }
 
 
 
 
 

 
 
 
function changeSortGoal(sortby)
 {
	 
	 window.location = "mygoals.php?sortby=" + sortby;
	 
 }
  
  
 
 
function editGoal(goal_id, category, priority, date_target, goal)
 {
	 
	 var sortby = document.getElementById("SortBy").value.trim();
	 
	 window.scrollBy(0,1000); // horizontal and vertical scroll increments
	 
	 document.getElementById("ActionW").value = goal_id;
	 
	 

	 document.getElementById("Txt_Goal").value = goal;
	 document.getElementById("Priority").value = priority;
	 document.getElementById("Category").value = category;
	 document.getElementById("CalInput").value = date_target;	 
	 
	 
	 
 }
 
 
 
 
function updateGoal()
 {
	 
	 var goal_id = document.getElementById("ActionW").value.trim();
	 
	 var goal = document.getElementById("Txt_Goal").value.trim();
	 var target_date = document.getElementById("CalInput").value.trim();
	 var category =  document.getElementById("Category").value.trim();
	 var priority =  document.getElementById("Priority").value.trim();
	 
	 
	 goal = goal.replace("'","`");
	 goal = goal.replace('"','`');
	 
	
	var sortby = document.getElementById("SortBy").value.trim();
	

	if(goal == "" || goal == "<type here>")
	 {
		 
		 alert("Please enter your goal. ");
		 
	 }
	
	else if(category == "")
	 {
		 
		 alert("Please select category. ");
		 
	 }
	else if(priority == "")
	 {
		 
		 alert("Please select priority. ");
		 
	 }
	else if(target_date == "")
	 {
		 
		 alert("Please enter the target date. ");
		 
	 } 
	else
	 {
		 
		 
		var xmlHttp;
			
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result)
					 {
						 
						 document.getElementById("GoalLoader").style.display = 'none';
						 document.getElementById("Txt_Goal").value = "";
	 					 document.getElementById("CalInput").value = "";
						 document.getElementById("MyGoals").innerHTML = result;
						 document.getElementById("ActionW").value = '';
						 //window.location = 'mygoals.php';
						 
						 
						 var goals = document.demoForm.goal_list.value;
						 var progress = document.demoForm.progress_list.value;
						 
						 var goal_list = goals.split(";");
						 var progress_list = progress.split(";");
						 
						 for (var i = 0; i < goal_list.length; i += 1) {
							 scroll_bar(goal_list[i], progress_list[i]);
						 }
						 
						
						 //window.location = 'mygoals.php?sortby=' + sortby;
						 
						 window.scrollBy(0,0);
						 
					 }
					else
					 {
						
						
						 document.getElementById("GoalLoader").style.display = 'none';
						
						
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById("GoalLoader").style.display = 'block';
					
				}
			
			
				
		 }
	
		
	   
	   var param = 'action=update&rand=' + Math.random() + '&goal_id='+ goal_id + '&goal='+ goal + '&target_date='+ target_date + '&category=' + category + '&priority=' + priority + '&sortby=' + sortby;

		xmlHttp.open('POST', 'insert_goal.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param); 
		
		
	 }
	

 }
 
 
 
 
 
 
 // SHOW AND HIDE SUBMENU...
var RollIt = {
    timeout : null,
    showPopup : function(divid){
        clearTimeout(this.timeout);
        if($(divid).style.display == 'none'){
            this.timeout = setTimeout(function(){new Effect.BlindDown(divid, {duration:.3, fps:40})},200);
        }
    },
	
    hidePopup : function(divid){
        if($(divid).style.display == 'none'){
            clearTimeout(this.timeout);
        }else{
            this.timeout = setTimeout(function(){new Effect.BlindUp(divid, {duration:.3, fps:40})},100);
        }
    }    
}
 
 
 


function CompareGoal()
 {
	 
	
	
	var goal = document.getElementById("GoalInput").value.trim();
	

	if(goal == "" || goal == "<type here>")
	 {
		 
		 return false;
		 
	 }
	
	
	else
	 {
		 
		 
		var xmlHttp;
			
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					if(result)
					 {
						 document.getElementById("DILoader").style.display = "block";
						 /*
						 document.getElementById("GoalLoader").style.display = 'none';
						 document.getElementById("Txt_Goal").value = "";
	 					 document.getElementById("CalInput").value = "";
						 document.getElementById("MyGoals").innerHTML = result;
						 document.getElementById("ActionW").value = '';
						 //window.location = 'mygoals.php';
						 
						 
						 var goals = document.demoForm.goal_list.value;
						 var progress = document.demoForm.progress_list.value;
						 
						 var goal_list = goals.split(";");
						 var progress_list = progress.split(";");
						 
						 for (var i = 0; i < goal_list.length; i += 1) {
							 scroll_bar(goal_list[i], progress_list[i]);
						 }
						 
						
						 //window.location = 'mygoals.php?sortby=' + sortby;
						 
						 window.scrollBy(0,0);
						 */
						 
						 document.getElementById("DILoader").style.display = "none";
						 document.getElementById("InputtedGoal").innerHTML += result; 
						 document.getElementById("GoalInput").value = "";
						 
					 }
					else
					 {
						
						
						 document.getElementById("DILoader").style.display = "none";
						
						
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById("DILoader").style.display = "block";
					
				}
			
			
				
		 }
	
		
	   
	   var param = 'action=check&rand=' + Math.random() + '&goal='+ goal;

		xmlHttp.open('POST', 'goal_check.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param); 
		
		
	 }		
	//document.getElementById("InputtedGoal").innerHTML += "<div class='cm_gray' style='font-size: 12pt; border-bottom: 1px dashed #c12c62; padding: 4px; font-family: arial;  '>" + document.getElementById("GoalInput").value + "</div>";
	
	 
	 
 }
 
 
 
 


function removeWho(id) {

	
    document.getElementById("DILoader").style.display = "block";
   
   
   	var xmlHttp;
			
		try
		 {    // Firefox, Opera 8.0+, Safari    
			
			xmlHttp=new XMLHttpRequest();  
			
		 }
		 
	   catch (e)
		{    // Internet Explorer    
		try
		  {      
		  
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  
		  }
		  
			catch (e)
			  {   
			  try
				{        
				 
				 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				 
				}
			  catch (e)
				{        
					alert("Your browser does not support AJAX!");        
					return false;        
					
				}      
			  }    
		  
		  }
				 
		 xmlHttp.onreadystatechange=function()
		  {
			  
			  if(xmlHttp.readyState==4)
				{
				
					var result = xmlHttp.responseText;
				
					
					
					if(result)
					 {
						 
						//alert(result);
						
						
						
			
						for(i=id; i<=result; i++)
						 {
							
							//alert(i + " -- " + result);
							
							if(((parseInt(i))+1) < result )
							 {
								 
								var x = parseInt(i) + 1; 
							
							    //var divid1 = ("GI" + i).toString();
							    //var divid2 = ("GI" + x).toString();
							  
							  	document.getElementById("GI" + i).innerHTML = document.getElementById("GI" + x).innerHTML;
								document.getElementById("CloseBtn" + (parseInt(i) + 1)).innerHTML = "<img src='imgs/idelete.gif' style='margin: 3px 0px 0px 5px; cursor: pointer; ' onclick='removeWho(" + i + ")'  title='" + i + "'  />";
								document.getElementById("Ign" + (parseInt(i) + 1)).innerHTML = i + ".";
								
							    
								/*
								if(x < result)
								 {
									var divid3 = ("Ign" + x).toString(); //number in the list id.
							 		var divid4 = ("CloseBtn" + x).toString(); //close btn id.
								
									document.getElementById(divid3).innerHTML = i + "."; 
									document.getElementById(divid4).innerHTML = "<img src='imgs/idelete.gif' style='margin: 3px 0px 0px 5px; cursor: pointer; ' onclick='removeWho(" + i + ")'  title='" + i + "' />";
								
								 }
								*/
							
							
							  }
				
							   
						  }
				
						
						
						   
						 who = "GI" + result;  
						   
						 if(typeof who== 'string') who=document.getElementById(who);
						 if(who && who.parentNode)who.parentNode.removeChild(who);
								   
						 document.getElementById("DILoader").style.display = "none";
						 //document.getElementById("InputtedGoal").innerHTML += result; 
						 document.getElementById("GoalInput").value = "";
						 
					 }
					else
					 {
						
						
						 document.getElementById("DILoader").style.display = "none";
						
						
						
					 }
					
				}
			
			  else
				{
					
					document.getElementById("DILoader").style.display = "block";
					
				}
			
			
				
		 }
	
		
	   
	   var param = 'action=delete&rand=' + Math.random() + '&id='+ id;

		xmlHttp.open('POST', 'goal_check.php', true);    
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		xmlHttp.setRequestHeader("Content-length", param.length);    
		xmlHttp.setRequestHeader("Connection", "close");    
		xmlHttp.send(param); 
   
   
}




function submitInsPost(insid, commentid, divid, loaderid)
 {
	 
	
	 var comment = document.getElementById(commentid).value.trim();
	 
	 if(comment == "")
	  {
		  
		  document.getElementById(commentid).style.backgroundColor = "#fcecec";
		  
	  }
	 else
	  {
		  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 
							 document.getElementById(loaderid).style.display = 'none';
							 document.getElementById(divid).innerHTML += result;
							 document.getElementById(commentid).value = "";
							 document.getElementById(commentid).rows =(document.getElementById(commentid).value.split("\n").length||1);

							
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(loaderid).style.display = 'none';
							
							
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loaderid).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&insid='+ insid;
		   
			xmlHttp.open('POST', 'submit_comment.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 }





function deleteInsComment(cid, ins_id, update_divid, loader_id, access)
 {
	

	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == '1')
				 {
					 
					
					 //document.getElementById(update_divid).style.display = 'none';
					 
					 document.getElementById(loader_id).style.display = 'none';
					 
					 RollIt.hidePopup(update_divid);
					 
					 
					 
				 }
				else
				 {
					
					  alert('Error while deleting comment. ');
					  document.getElementById(loader_id).style.display = 'none';
				
					 
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&cid='+ cid + '&ins_id='+ ins_id + '&access='+ access;
   
	xmlHttp.open('POST', 'submit_comment.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 




function submitGivPost(givid, commentid, divid, loaderid)
 {
	 
	
	 var comment = document.getElementById(commentid).value.trim();
	 
	 if(comment == "")
	  {
		  
		  document.getElementById(commentid).style.backgroundColor = "#fcecec";
		  
	  }
	 else
	  {
		  
		  
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 
							 
							 document.getElementById(loaderid).style.display = 'none';
							 document.getElementById(commentid).value = '';
							 /*
							 document.getElementById(divid).innerHTML += result;
							 
							 document.getElementById(commentid).value = "";
							*/
							document.getElementById(commentid).rows =(document.getElementById(commentid).value.split("\n").length||1);
							
							viewGivComments(divid, givid, loaderid); 
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(loaderid).style.display = 'none';
							
							
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(loaderid).style.display = 'block';
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&givid='+ givid;
		   
			xmlHttp.open('POST', 'ajax_giveaways.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 }
 
 
 
 
function viewGivComments(div_id, givid, loader_id, access)
 {
	
	 
	 document.getElementById(div_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result)
				 {
					 
					 //getFavInspiration();
					 document.getElementById(div_id).innerHTML = result;
					 document.getElementById(loader_id).style.display = 'none';
					 
					 
				 }
				else
				 {
					
					
					  document.getElementById(loader_id).style.display = 'none';
					  document.getElementById(div_id).style.display = 'none';
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			//UpdateToday
			
	 }

	
   
   var param = 'action=view&rand=' + Math.random() + '&givid='+ givid + '&access='+ access;
   
	xmlHttp.open('POST', 'ajax_giveaways.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 
 

function deleteGivComment(cid, givid, update_divid, loader_id, access)
 {
	

	 document.getElementById(loader_id).style.display = 'block';
	 
	 
	
	 var xmlHttp;
		
	try
	 {    // Firefox, Opera 8.0+, Safari    
		
		xmlHttp=new XMLHttpRequest();  
		
	 }
	 
   catch (e)
	{    // Internet Explorer    
	try
	  {      
	  
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  
	  }
	  
		catch (e)
		  {   
		  try
			{        
			 
			 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			 
			}
		  catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
				
			}      
		  }    
	  
	  }
			 
	 xmlHttp.onreadystatechange=function()
	  {
		  
		  if(xmlHttp.readyState==4)
			{
			
				var result = xmlHttp.responseText;
			
				
				if(result == '1')
				 {
					 
					
					 //document.getElementById(update_divid).style.display = 'none';
					 RollIt.hidePopup(update_divid);

					 document.getElementById(loader_id).style.display = 'none';
					 
					 
					 
				 }
				else
				 {
					
					  alert('Error while deleting comment. ');
					  document.getElementById(loader_id).style.display = 'none';
				
					 
					
				 }
				
			}
		
		  else
			{
				
				document.getElementById(loader_id).style.display = 'block';
				
			}
		
		
			
	 }

	
   
   var param = 'action=delete&rand=' + Math.random() + '&cid='+ cid + '&givid='+ givid + '&access='+ access;
   
	xmlHttp.open('POST', 'ajax_giveaways.php', true);    
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
	xmlHttp.setRequestHeader("Content-length", param.length);    
	xmlHttp.setRequestHeader("Connection", "close");    
	xmlHttp.send(param); 

 }
 
 
 
function submitWallMessage(memid, commentid, updatediv)
 {
	 

	 var comment = document.getElementById(commentid).value.trim();
	 
	 document.getElementById(commentid).style.backgroundColor = "#fcecec";
	 

	  if(comment != "")
	  {
		  
		 
		 
		 var xmlHttp;
		
			try
			 {    // Firefox, Opera 8.0+, Safari    
				
				xmlHttp=new XMLHttpRequest();  
				
			 }
			 
		   catch (e)
			{    // Internet Explorer    
			try
			  {      
			  
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			  
			  }
			  
				catch (e)
				  {   
				  try
					{        
					 
					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
					 
					}
				  catch (e)
					{        
						alert("Your browser does not support AJAX!");        
						return false;        
						
					}      
				  }    
			  
			  }
					 
			 xmlHttp.onreadystatechange=function()
			  {
				  
				  if(xmlHttp.readyState==4)
					{
					
						var result = xmlHttp.responseText;
					
						
						if(result)
						 {
							 
							 
							 
							
							 document.getElementById(commentid).value = '';
							 /*
							 document.getElementById(divid).innerHTML += result;
							 
							 document.getElementById(commentid).value = "";
							*/
							document.getElementById(commentid).rows =(document.getElementById(commentid).value.split("\n").length||1);
							document.getElementById(commentid).style.backgroundColor = "#ffffff";
							
							
							//document.getElementById(updatediv).innerHTML = "<div class='cm_gray' id='Wall" + result + "' style='display:block; padding-bottom: 20px; ' >" + comment + "</div>" + document.getElementById(updatediv).innerHTML; 
							
							document.getElementById(updatediv).innerHTML = result + document.getElementById(updatediv).innerHTML; 
							
							RollIt.showPopup(updatediv);
							//viewGivComments(divid, givid, loaderid); 
							 
							 
						 }
						else
						 {
							
							  alert("Not Save. Error "); 
							  document.getElementById(commentid).style.backgroundColor = "#ffffff";
							
							
							
						 }
						
					}
				
				  else
					{
						
						document.getElementById(commentid).style.backgroundColor = "#fcecec";
						
					}
				
				
					//UpdateToday
					
			 }
		
			
		   
		   var param = 'action=post&rand=' + Math.random() + '&comment='+ comment + '&memid='+ memid;
		   
			xmlHttp.open('POST', 'ajax_messagewall.php', true);    
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
			xmlHttp.setRequestHeader("Content-length", param.length);    
			xmlHttp.setRequestHeader("Connection", "close");    
			xmlHttp.send(param); 
		  
		  
	  }
	 
	 
 }
  
