		var get_form_data = function(){
			var base = document.getElementById('frmpage').getElementsByTagName('input');
			var postobj = {};
			var x = base.length;
			var value = '';
			var name = '';
			var radios=[];

			for(y=0; y<x; y++){
				if(base[y].type != 'button'){
					if(base[y].type == 'text' || base[y].type == 'hidden' || base[y].type == 'password' || base[y].type == 'select'){
							value =  base[y].value;
							name = base[y].name;
					}else if(base[y].type == 'checkbox' || base[y].type == 'radio'){
						if (base[y].checked) {
							value =  base[y].value;
							name = base[y].name;
						}
					}
					if(name && value){
						postobj[name] = value;
					}
					name = value= null;
				}
			}

			base = document.getElementById('frmpage').getElementsByTagName('textarea');
			x = base.length;

			for(y=0; y<x; y++){
				postobj[base[y].name]= base[y].value;
			}
			return postobj;
	};

	function do_comment_post(){
			var post_data = get_form_data();
			post_data['ajax'] = 1;
		
				jQuery.ajax({type: 'POST', url: jQuery('#ref').val(), data: post_data, success:function(r){jQuery('#comments').html(r); }, async:false });
	}

	function show_all_comments(id){
				jQuery.ajax({type: 'POST', url:  SITEURL +'ajax_show_all_comments.html', data: 'id='+id, success:function(r){jQuery('#comments').html(r); }, async:false });
	}
	function show_all_friends(id){
				jQuery.ajax({type: 'POST', url:  SITEURL +'ajax_show_all_friends.html', data: 'id='+id, success:function(r){jQuery('#friends').html(r); }, async:false });
	}

	function validate_login()
	{
		if(document.frm_login.user_email.value==null ||document.frm_login.user_email.value=="" )
		{
			alert("Please enter the valid email id");
			document.frm_login.user_email.focus()
			return false;			
		}
		if(document.frm_login.user_password.value==null ||document.frm_login.user_password.value=="" )
		{
			alert("Please enter the password");
			document.frm_login.user_password.focus()
			return false;			
		}		
	}


	function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_preloadImages() { //v3.0
	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 MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function submit_form()
	{ 
		if(document.searchfrm.keyword.value==null ||document.searchfrm.keyword.value=="" )
		{
		alert("Please enter keyword");
		document.searchfrm.keyword.focus()
		
		return false;
		}		
	}


function highlight(id)
{
	document.getElementById(id).style.backgroundColor ='#E3F7FE'
	return false;
}
function dehighlight(id)
{
	document.getElementById(id).style.backgroundColor ='#FFFFFF';
	return false;
}
function select_template(id)
{
	document.getElementById(id).checked = true;
	document.getElementById(id).style.fontWeight ='bolder';
	document.getElementById(id).style.fontColor ='#FFA432';
	return false;
}
function highlight_template(id)
{
	if(document.getElementById(id).style.backgroundColor == '#E3F7FF')
	{
		
	}
	else
	{
		document.getElementById(id).style.backgroundColor ='#E3F7FE'
	}
	return false;
}
function dehighlight_template(id)
{
	if(document.getElementById(id).style.backgroundColor == '#E3F7FF')
	{
		
	}
	else
	{
		document.getElementById(id).style.backgroundColor ='#FFFFFF';
	}
	return false;
}
function content_type()
{

		var isForm=document.frm_choose_content.content_type_id;
		nradio = 0;
		ok = false;
		for (n=0; n<isForm.length; n++)
		{
			if (isForm[n].type == 'radio')
			{
			nradio++
			}
		}
		for (i=0; i<nradio; i++)
		{
			if(isForm[i].checked == true)
			{
				ok = true
			}
		}
		if (ok == false)
		{
			alert('Please make a selection')
			return false;		
		};
		return true;		
	
}
function validate_type()
{

		var isForm=document.frm_choose_content.template_id;
		nradio = 0;
		ok = false;
		for (n=0; n<isForm.length; n++)
		{
			if (isForm[n].type == 'radio')
			{
			nradio++
			}
		}
		for (i=0; i<nradio; i++)
		{
			if(isForm[i].checked == true)
			{
				ok = true
			}
		}
		if (ok == false)
		{
			alert('Please make a selection')
			return false;		
		};
		return true;		
	
}
function validate_title()
{
	if(document.frm_content_detail.added_content_title.value==null || document.frm_content_detail.added_content_title.value=="")
	{
		alert("Please enter the title");
		document.frm_content_detail.added_content_title.focus();
		return false;
	}
	else
	{
		if(isNaN(document.frm_content_detail.added_content_title.value)==false)
		{
			alert("Please enter proper title");
			document.frm_content_detail.added_content_title.focus();
			return false;
		}
		
	}

	/*if(document.frm_content_detail.added_content_subtitle.value==null || document.frm_content_detail.added_content_subtitle.value=="")
	{
		alert("Please enter the subtitle");
		document.frm_content_detail.added_content_subtitle.focus();
		return false;
	}
	else
	{
		if(isNaN(document.frm_content_detail.added_content_subtitle.value)==false)
		{
			alert("Please enter proper subtitle");
			document.frm_content_detail.added_content_subtitle.focus();
			return false;
		}
		
	}*/
	
	if(document.frm_content_detail.added_content_address.value==null || document.frm_content_detail.added_content_address.value=="")
	{
		alert("Please enter the address");
		document.frm_content_detail.added_content_address.focus();
		return false;
	}
	else
	{
		if(isNaN(document.frm_content_detail.added_content_address.value)==false)
		{
			alert("Please enter proper address");
			document.frm_content_detail.added_content_address.focus();
			return false;
		}
		
	}
	
}
function validate_image()
{
	
	if(document.frm_upload_content_image.added_content_category_id.value== 0)
	{
		alert("Please Select Category");
		document.frm_upload_content_image.added_content_category_id.focus();
		return false;
	}
	
}
function validate_field(field,right,wrong)
{
	document.getElementById(right).style.display ="none";
	document.getElementById(wrong).style.display = "none";
	if(document.getElementById(field).value == null || document.getElementById(field).value == "")
	{
		return false;
	}
	else
	{
		if(isNaN(document.getElementById(field).value)==false)
		{
			document.getElementById(wrong).style.display = "";
			//document.getElementById(right).style.display ="none";
			return false;
		}
		else
		{
			document.getElementById(right).style.display = "";
			//document.getElementById(wrong).style.display = "none";
			return false;
		}
	}
}


function add_as_friend(id){
	if(id){
		jQuery.ajax({type: 'POST', url: SITEURL +'ajax_add_friend.html', data: 'id='+id, success:function(r){alert(r); }, async:false });
	}else{
		jQuery('#profile_update').html('You must log-in to do this!');
	}

}

function boost_rank(id){
	
		if(id){
			jQuery.ajax({type: 'POST', url: SITEURL +'ajax_boost_rank.html', data: 'id='+id, success:function(r){alert(r); }, async:false });
		}else{
			alert('You must log-in to do this!');
		}

}

function delete_comment(id){
	if(id){
		jQuery.ajax({type: 'POST', url: SITEURL +'ajax_delete_comment.html', data: 'id='+id, success:function(r){if(r==1){ jQuery('#comment-'+id).toggle('slow');jQuery('#comment-'+id).remove();}else{alert('Could not delete comment!');} }, async:false });
	}else{
		
	}

}

function hide_charity(){
		jQuery.ajax({type: 'POST', url: SITEURL +'ajax_hide_charity.html', data: '', success:function(r){if(r==1) jQuery('#charity_wrapper').toggle('slow'); }, async:false });
}