SITE_URL = parent.top.SITE_URL;

/**

 *

 * @access public

 * @return void

 **/

function showCommentArea(commentArea,actn)

	{

		if(actn){

			$(commentArea).show();

		}else{

			$(commentArea).hide();

		}

	}





function city_from_country(country,field_id)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var post_param = "action=city&country="+country;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				document.getElementById(field_id).innerHTML=response;

			}

		});

}



function city_from_state(state,field_id)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var post_param = "action=city&state="+state;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				document.getElementById(field_id).innerHTML=response;

			}

		});

}



function state_from_country(country,field_id)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var post_param = "action=state&country="+country;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				document.getElementById(field_id).innerHTML=response;

			}

		});

}



function attachment(field_id, action_url, fieldname, txt_id, extra_param)

{

	if(txt_id!="")

	   var txt_comment = jQuery('#'+txt_id).val();

	else

	   var txt_comment = '';

	

	if(fieldname=="scibe_attach")

	{

		var mode = 'scibe';
		
		txt_comment = jQuery('#'+txt_id).val();

	}

	else

	{

		var  mode = 'other';

	}

	

	 new AjaxUpload('#'+field_id,{

	  action:   action_url, 

	  name:    fieldname, 

	  responseType:  'text/html',

	  onSubmit :   function(file , ext){

		this.setData({

			'action'      :'attachment',

			'mode'		  : mode, 

			'txt_comment' :txt_comment, 

			'extra_param' :extra_param 

			});

	  },

	  onComplete:  function(file, response)

	  {

			if(fieldname=="scibe_attach")

			{

				
				var user_count = response.split('@');

				if(user_count[0]=="Error")

				{

					jQuery("#selUpdates").html(user_count[1]);		

					setTimeout("show_walls('all&"+extra_param+"','editProfile.php','selUpdates','wall_all');",3000);

					return false;

				}

				else

				{
					jQuery("#selUpdates").html("Scrib posted successfully with attachment.");		
					
					jQuery("#scribe_count").fadeOut('fast');

					jQuery("#scribe_count").html(user_count[0]);	

					jQuery("#scribe_count").fadeIn('slow');

					

					jQuery("#pal_count").fadeOut('fast');

					jQuery("#pal_count").html(user_count[1]);	

					jQuery("#pal_count").fadeIn('slow');

					

					setTimeout("show_walls('all&"+extra_param+"','editProfile.php','selUpdates','wall_all');",3000);

				}

			}

			else

			{

				alert(response);

			}

		 }

	  });

}



function people_like(act_id,html_url)

{

	url = SITE_URL+'members/commonAjax.php';

	

	

	var post_param = "action=more_likes&activity_id="+act_id+"&html_url="+html_url;

	

	if(document.getElementById('more_comment'+act_id).style.display=='none')

	{

		var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					jQuery("#more_comment"+act_id).html(response);

					jQuery("#more_comment"+act_id).fadeIn('slow');

				}

			});

	}

	else

	{

		jQuery("#more_comment"+act_id).fadeOut('slow');

	}

}



function sure_delete(div_id)

{

	jQuery("#"+div_id).fadeIn('slow');

}



function DeleteLikeYes(id,prnt_div,child_div)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var post_param = "action=dlt_like_cmnt&activity_id="+id;

	

	var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					jQuery("#"+prnt_div).fadeOut('slow');

				}

			});

}



function DeleteLikeNo(div_id)

{

	jQuery("#"+div_id).fadeOut('slow');

}



function choice_item(friend_id, choice)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var post_param = "action=choice_post&friend_id="+friend_id+"&choice="+choice;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				alert("Your Choose Item Has Been Send Succesfully.");

			}

		});

}



function save_testomanial(frnd_id)

{

	url = SITE_URL+'members/commonAjax.php';

	var testomanial = document.getElementById('txt_testomanial_'+frnd_id).value;

	var post_param = "action=testomanial&testomanial="+testomanial+"&frnd_id="+frnd_id;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				document.getElementById('spn_testomanial_'+frnd_id).value="";

				document.getElementById('spn_testomanial_'+frnd_id).style.display="none";

			}

		});

	

}



function open_testimonial(typ)

{

	document.getElementById('selUpdates').innerHTML = 'Loading....';

	

	url = SITE_URL+'members/testimonials.php';

	

	var post_param = "action=testomanial&type="+typ;

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				var response = msg.responseText;

				document.getElementById('selUpdates').innerHTML = response;			

			}

		});

}



function remove_from_wall()

{

	var row_id = arguments[0];

	var parent = document.getElementById("table_selupdates");

	var tr = document.getElementById("updates_"+row_id);

	

	var post_param = "row_id="+row_id+"&action=dltwall";

	

	url = SITE_URL+'members/commonAjax.php';

	

	jQuery("#updates_"+row_id).fadeOut('slow');

	

	

	var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					jQuery("#scribe_count").fadeOut('slow');

					jQuery("#scribe_count").html(response);	

					jQuery("#scribe_count").fadeIn('fast');

				}

			});

	

	



}

/*******************For main page left block change **********/



function showcontent(ids,temp)

{

	if(temp==1)

	{

	var post_param = "id="+ids;

	document.getElementById('leftblockcontent').innerHTML = 'Loading...';

	url = 'frontblockcontain.php';

	var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					document.getElementById('leftblockcontent').innerHTML=response;

				}

			});

	}

	if(temp==2)

	{

	var post_param = "id="+ids;

	document.getElementById('leftblockcontent').innerHTML = 'Loading...';

	url = 'frontblockcontain.php';

	var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					document.getElementById('leftblockcontent').innerHTML=response;

				}

			});

	}

	

}

/**

 *

 * @access public

 * @return void

 **/

function showCommentAreaCancel(text_name)

	{

		text_name.value='';

		$(text_name).style.fontSize='12px';

		$(text_name).value='Write a comment...';

		new Effect.Highlight(text_name, { startcolor: '#FFCFCF',endcolor: '#ffffff' });

		autoTASizeOnBlur(text_name);

	}

	

/**

 *

 * @access public

 * @return void

 **/

function showCommonCommentArea(divLink,divComment,textId,commentText,cancelText)

	{

		if($(divComment).style.display=='none')

			{

				$(divComment).show();

//				$(textId).innerHTML=cancelText;

				$(textId).hide();

				$(divComment).onblur = showLabel;

			}

		else

			{

				$(divComment).hide();

				$(textId).show();

				$(textId).innerHTML=commentText;

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function hideCommonCommentArea(divLink,divComment,textId,commentText,cancelText)

	{

		if($(divComment).style.display=='none')

			{

				return ;

			}

		else

			{

				$(divComment).hide();

				$(textId).innerHTML=commentText;

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function commentWhenOnFocus(textName,max,replaceId)

	{



		if( autoTASize($(textName)) )

			{

				countTextareaLength(textName,max,replaceId);

			}



 		if( $(textName).style.fontSize=='12px' )

 			{

 				$(textName).value='';

 				$(textName).style.fontSize='';

 				$(replaceId).innerHTML = parseInt(max)+' Characters remaining';

 			}



	}



function jstrim(stringToTrim) {

	return stringToTrim.replace(/^\s+|\s+$/g,"");

}





/**

 *

 * @access public

 * @return void

 **/

function commentWhenOnKeyUp(textName,max,replaceId)

	{

		if( autoTASize($(textName)) )

			{

				countTextareaLength(textName,max,replaceId);

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function commentWhenOnBlur(div_id,update_div,divLink,divComment,textId)

	{

		resizeCommentTextLength(div_id,update_div,divLink,divComment,textId,lable_comment,lable_cancel)

	}



/**

 *

 * @access public

 * @return void

 **/

function commentWhenClickCancel(textName,max,replaceId,divLink,divComment,textId)

	{

		showCommentAreaCancel($(textName));

		countTextareaLength(textName,max,replaceId);

		showCommonCommentArea(divLink,divComment,textId,lable_comment,lable_cancel);

	}



function likeWhenClickCancel(textName,max,replaceId,divLink,divComment,textId)

	{

		showCommentAreaCancel($(textName));

		countTextareaLength(textName,max,replaceId);

		showCommonCommentArea(divLink,divComment,textId,'Like',lable_cancel);

	}

	

/******* Start Trim Functions ************/

function Trim(TRIM_VALUE)

	{

		if(TRIM_VALUE.length < 1)

			{

				return "";

			}

		TRIM_VALUE = RTrim(TRIM_VALUE);

		TRIM_VALUE = LTrim(TRIM_VALUE);

		if(TRIM_VALUE=="")

			{

				return "";

			}

		else

			{

				return TRIM_VALUE;

			}

	}



function RTrim(VALUE)

	{

		var w_space = String.fromCharCode(32);

		var v_length = VALUE.length;

		var strTemp = "";

		if(v_length < 1)

			{

				return "";

			}

		var iTemp = v_length -1;

		while(iTemp > -1)

			{

				if(VALUE.charAt(iTemp) == w_space)

					{

					}

				else

					{

						strTemp = VALUE.substring(0,iTemp +1);

						break;

					}

				iTemp = iTemp-1;



			}

		return strTemp;

	}



function LTrim(VALUE)

	{

		var w_space = String.fromCharCode(32);

		if(v_length < 1)

			{

				return "";

			}

		var v_length = VALUE.length;

		var strTemp = "";



		var iTemp = 0;



		while(iTemp < v_length)

			{

				if(VALUE.charAt(iTemp) == w_space)

					{

					}

				else

					{

						strTemp = VALUE.substring(iTemp,v_length);

						break;

					}

				iTemp = iTemp + 1;

			}

		return strTemp;

	}

/***********End trim functions********/

var getHtmlDiv = '';

function getHTML(url, pars, divname, method_type)

{

	//displayLoadingStatus(divname);

	getHtmlDiv = divname;

	pars=pars+'&resultDiv='+divname;

	//alert(pars);

	var myAjax = new Ajax.Request(

					url,

					{

					method: method_type,

					parameters: pars +"&isAjax=true&items=" + Math.random(),

					onComplete: getHtmlResponse

					});

	return false;



}



function addkhar(event_id,user_id,mode)

{

	if(mode=='tot')

	{

		var temp=mode;

		var totkhr=document.getElementById("toteventkharcha").value;

		var amttype=document.getElementById("KHRamountIn").value;

		if (isNaN(totkhr))

	 	{

			alert("enter only Numeric value in Total Kharcha");

			return false;

	     }

	}

	var mykhr=document.getElementById("myeventkharcha").value;

	var khr_detail=document.getElementById("txtareadetail").value;

	var khr_myeve=document.getElementById("KHRmykhr").value;

	url = SITE_URL+'members/myevent_a.php';

	

	 if (isNaN(mykhr)) 

	 {

		alert("enter only Numeric value in My Kharcha");

		return false;

     }

	

	var post_param = "action1=addkhr&event_id="+event_id+"&user_id="+user_id+"&khr_myeve="+khr_myeve+"&mykhr="+mykhr+"&khr_detail="+khr_detail;

	if(mode=='tot')

	{

		post_param = "action1=addkhr&event_id="+event_id+"&amttype="+amttype+"&user_id="+user_id+"&totkhr="+totkhr+"&khr_myeve="+khr_myeve+"&mykhr="+mykhr+"&khr_detail="+khr_detail;

	}

	

	var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: post_param,

			onComplete: function(msg){

				if(temp=='tot')

				{

					document.getElementById("toteventkharcha").value="";

				}

				document.getElementById("myeventkharcha").value="";

				document.getElementById("txtareadetail").value="";

				//var response = msg.responseText;

				//alert(response);

			}

		});

}



function chkNAN()

{



    var field = document.getElementById(id);

  

             if (isNaN(field.value)) {

                 alert('not a number');

             }

}



function getHtmlResponse(originalRequest)

{

	if(getHtmlDiv=='photoalbums' || getHtmlDiv=='videoalbums')

	{

		getHtmlDiv='albums';

	}

	$(getHtmlDiv).innerHTML = originalRequest.responseText;

	data = originalRequest.responseText+' ';

	data.evalScripts();

}



/**

 *

 * @access public

 * @return void

 **/

function setLoadingStatus(loadingdiv)

{

	if( $(loadingdiv) )

		{

			$(loadingdiv).innerHTML='<p class="clsLodingUpdates"><img src="'+SITE_URL+'images/ajaxLoadingRed.gif" /> <br/><span style="color:#DD6C34">Loading..</span></p>';

		}

}



/**

 *

 * @access public

 * @return void

 **/

function pgLoadStatus(linkid)

{

	$(linkid).innerHTML='<img src="'+SITE_URL+'images/ajax_paging_loader.gif" />';



	var anotherId=linkid.split('pgselect_bottom');

	if(!anotherId[1])

	{

		var anotherId=linkid.split('pgselect');

		anotherId='pgselect_bottom'+anotherId[1];

		if($(anotherId))

		$(anotherId).innerHTML='<img src="'+SITE_URL+'images/ajax_paging_loader.gif" />';

	}else{

		anotherId='pgselect'+anotherId[1];

		if($(anotherId))

		$(anotherId).innerHTML='<img src="'+SITE_URL+'images/ajax_paging_loader.gif" />';

	}

}

function getAjaxContent()

	{	

		var url = arguments[0];

		var pars = arguments[1];

		var divname = arguments[2];

		var method_type = arguments[3];

		if( arguments.length >= 5 )

		{

			var fName = arguments[4];

		}

		else

		{

			var fName = 'getAjaxContentResponse';

		}



		var showingLoadingStatus = false;



		if( arguments.length > 5 )

			{

				showingLoadingStatus = arguments[6];

			}



		if( $(divname) && showingLoadingStatus)

			{

				setLoadingStatus(divname);

			}

			

		var myAjax = new Ajax.Request(

							url,

							{ 

							method: method_type,

							parameters: pars +"&isAjax=true&items=" + Math.random(),

							onComplete: function(){eval(fName)(arguments[0],divname)}

							});



		Ajax.Responders.register({

						  onCreate: showProcessing(divname)

						});



		return true;

	}



function getAjaxContentResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		if( divname )

			{

				parent.top.$(divname).innerHTML = data;

			}

		data.evalScripts();

		helpTipInitialize();

		helpTipMessageInitialize();



		if( $('selLoadingDiv') )

			{

				$('selLoadingDiv').style.display = 'none';

			}

		if(  $('selBigLoadingDiv') )

			{

				$('selBigLoadingDiv').innerHTML = '<img src="'+SITE_URL+'images/ajaxLoadingRed.gif" />&nbsp;Posting..';

				$('selBigLoadingDiv').style.display = 'none';

			}

	}

function showProcessing(divname)

	{

	  if(Ajax.activeRequestCount > 0)

		{

			if( $('selLoadingDiv') )

				{

					$('selLoadingDiv').style.display = 'inline';

				}

			else if(  $('selBigLoadingDiv') )

				{

					$('selBigLoadingDiv').innerHTML = '<img src="'+SITE_URL+'images/ajaxLoadingRed.gif" />&nbsp;Posting..';

					$('selBigLoadingDiv').style.display = 'inline';

				}

		}

	}

var enter_key_text = new Array();

enter_key_text['search_fr'] = 'search_fr_submit';

enter_key_text['relation_name'] = 'add_list';

enter_key_text['search_friends'] = 'search_friend_button';

enter_key_text['event_searchtext'] = 'eventsearch_btn';

enter_key_text['search_for_people'] = 'btn_search_for_people';

enter_key_text['search_for_email'] = 'btn_search_for_emil';

enter_key_text['mobile'] = 'add_mobile_button';

enter_key_text['other'] = 'add_other_button';

enter_key_text['search_text'] = 'search_btn';

enter_key_text['searchPeople'] = 'searchBtn';



function enterKeySubmit(key)

	{

		if( document.captureEvents )

			{

	    		if( Event.KEYUP )

					{

	        			document.captureEvents( Event.KEYUP );

	     			}

			}

		if(typeof(key) == 'object')

			{

				key.onkeydown = enterSubmitForm;

			}

  	}



function enterSubmitForm(e)

	{

		var id = this.id;

		var obj = $(id);

		var key_code = alertkey(e);

//		var text = Trim(obj.value);



		if(key_code==13)

			{

				$(enter_key_text[id]).click();

				return false;

			}

	}

function alertkey(e)

	{

	     if( !e )

		 	{

		         //if the browser did not pass the event information to the

		         //function, we will have to obtain it from the event register

		         if( window.event )

				 	{

		            	 //DOM

		            	 e = window.event;

		         	}

				else

					{

		            	 //TOTAL FAILURE, WE HAVE NO WAY OF REFERENCING THE EVENT

		            	 return;

	         		}

     		}

	     if( typeof( e.which ) == 'number' )

		 	{

	         	//NS 4, NS 6+, Mozilla 0.9+, Opera

	        	 e = e.which;

	     	}

		else if( typeof( e.keyCode ) == 'number'  )

			{

	        	 //IE, NS 6+, Mozilla 0.9+

	        	 e = e.keyCode;

	     	}

		else if( typeof( e.charCode ) == 'number'  )

			{

	         	//also NS 6+, Mozilla 0.9+

	         	e = e.charCode;

	     	}

		else

			{

	         //TOTAL FAILURE, WE HAVE NO WAY OF OBTAINING THE KEY CODE

	         return;

	     	}

	 	return e;

     //window.alert('The key pressed has keycode ' + e + ' and is key ' + String.fromCharCode( e ) );

 }



  /**

   *

   * @access public

   * @return void

   **/

function selectDisplayDiv(divName)

  {

		var disNewArry = new Array('Full','Left','Center','Right');

		for(i=0;i<4;i++)

			{

				if(disNewArry[i]==divName)

					{

						$('selDisplay'+divName).style.display = 'block';

					}

				else

					{

						$('selDisplay'+disNewArry[i]).style.display = 'none';

					}

			}

  }





//**************** confirmation box related functions Start *******************/

//Change position of the confirmation block

function getAbsoluteOffsetTopConfirmation(obj)

	{

	    var top = obj.offsetTop;

	    var parent = obj.offsetParent;

	    while (parent != document.body)

			{

		        top += parent.offsetTop;

		        parent = parent.offsetParent;

		    }

	    return top;

	}



function getAbsoluteOffsetLeftConfirmation(obj)

	{

	    var left = obj.offsetLeft;

	    var parent = obj.offsetParent;

	    while (parent != document.body)

			{

		        left += parent.offsetLeft;

		        parent = parent.offsetParent;

		    }

	    return left;

	}



//Hide all confirmation blocks

function hideAllBlocks()

	{

		var obj;

		if(obj = $('selAlertbox'))

			obj.style.display = 'none';

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

			{

				if(obj = $(block_arr[i]))

					{

						obj.style.display = 'none';

					}

			}

		if(obj = $('hideScreen'))

			{

				obj.style.display='none';

			}

		if(obj = $('selAjaxWindow'))

			{

				obj.style.display='none';

			}

		if(obj = $('selAjaxWindowInnerDiv'))

			{

				obj.innerHTML='';

			}

		return false;

	}



//**************** confirmation box related functions Start *******************/

//Change position of the confirmation block

//Get multible check box value with comma seperator

var multiCheckValue='';

var minimum_top = 20;

var minimum_left = 20;

var zIndexValue = 200;

// form_name, check_all_name, alert_value, place

var getMultiCheckBoxValue = function()

	{

		multiCheckValue = '';

		var form_name = arguments[0];

		var check_all_name = arguments[1];

		var alert_value = arguments[2];



		var frm = eval('document.'+form_name);

		var ids = '';

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

			{

				var e=frm.elements[i];

				if ((e.name != check_all_name) && (e.type=='checkbox') && e.checked)

					{

						ids += e.value+',';

					}

			}

		if(ids)

			{

				multiCheckValue =ids.substring(0,ids.length-1);

				return true;

			}

			alert_manual(alert_value);

		return false;



	}



var alert_manual = function()

	{

		var obj;

		var alert_value = arguments[0];

		if(obj = $('selAlertMessage'))

			{

				obj.innerHTML = alert_value;

			}

		if(fromObj = $('selAlertbox'))

			{

				changePosition(fromObj);

			}

		if(obj = $('selAlertOkButton'))

			{

				obj.focus();

			}

		return false;

	}

function changePosition(fromObj)

	{

		var obj = fromObj;

		obj.style.display = 'block';

		if (navigator.appName == "Microsoft Internet Explorer")

			{

				var scrolltop = document.body.scrollTop;

				var scrollleft = document.body.scrollLeft;

				var innerheight = document.body.offsetHeight;

				var innerwidth = document.body.offsetWidth;

				var divwidth = obj.offsetWidth;

				var divheight = obj.offsetHeight;

				/*if(innerwidth > 1024)

	 				innerwidth = 1024;

	 			if(innerHeight > 602)

	 				innerHeight = 602;*/

			}

		else

			{

				var scrolltop = window.pageYOffset;

				var scrollleft = window.pageXOffset;

				var innerheight = window.innerHeight;

				var innerwidth = window.innerWidth;

				var divwidth = obj.offsetWidth;

				var divheight = obj.offsetHeight;

			}

		//alert(innerwidth+'---'+innerheight);

		if(obj.style.position == 'fixed')

			{

				var movedivleft = (parseInt(innerwidth)/2)-(parseInt(divwidth)/2);

				var movedivtop = (parseInt(innerheight)/2)-(parseInt(divheight)/2);

			}

		else

			{

				var movedivleft = (parseInt(innerwidth)/2)+(parseInt(scrollleft))-(parseInt(divwidth)/2);

				var movedivtop = (parseInt(innerheight)/2)+(parseInt(scrolltop))-(parseInt(divheight)/2);

			}

		obj.style.top = movedivtop + 'px';

		obj.style.left = movedivleft + 'px';

		obj.style.zIndex = zIndexValue;

		$('selWrapper').className = 'clsWrapperHidden';

		if(obj = $('hideScreen'))

			{

				var ss = getPageSizeWithScroll();

				var ua = navigator.userAgent.toLowerCase();



				if(ua.indexOf("msie") != -1){

					obj.style.width=ss[0]+"px";

				}

				obj.style.height=ss[1]+"px";

				obj.style.display='block';

			}

		$('selWrapper').className = 'clsWrapper';

		//fade, slide, glide, wipe, unfurl, grow, shrink, highlight

//		$('fromObj.id').show();

//		Zapatec.Effects.show(fromObj.id, 5, '')

		return false;

	}



function showHideScreen(divElm)

	{

		var fromObj = $(divElm);

		fromObj.style.zIndex = zIndexValue;

		fromObj.style.display = 'block';

		if(obj = $('hideScreen'))

			{

				var ss = getPageSizeWithScroll();

				var ua = navigator.userAgent.toLowerCase();



				if(ua.indexOf("msie") != -1)

				{

					obj.style.width=ss[0]+"px";

				}

				obj.style.height=ss[1]+"px";

				obj.style.display='block';

				return false;

			}

	}

function makeQueryAsFormFieldValues(form_name)

	{

		var query = '';

		var frm = eval('document.'+form_name);

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

			{

				var e=frm.elements[i];

				if (e.type!='button' && e.type!='checkbox')

					{

						query += e.name+'='+e.value+'&';

					}

			}

		query =query.substring(0,query.length-1);

		return query;

	}



//Display confirmation Block

//place, block, form_name, id_array, value_array, property_array, add_top_position, add_left_position

//property_array, add_top_position, add_left_position --- optional

var ConfirmationUpdate = function()

	{

		var obj, inc, form_field;

		hideAllBlocks();

		var block = arguments[0];

		var form_name = arguments[1];

		var id_array = arguments[2];

		var value_array = arguments[3];

		var property_array = new Array();

		multiCheckValue ='';



		if(arguments.length>=5)

			{

				property_array = arguments[4];

			}



		for(inc=0; inc<value_array.length;inc++)

			{

				if(!property_array[inc])

					{

						property_array[inc] = 'value';

					}

				form_field = eval('document.'+form_name+'.'+id_array[inc]);

				if(form_field && form_field[property_array[inc]]!=null)

					{

						form_field[property_array[inc]] = value_array[inc];

					}

				else if(obj = $(id_array[inc]))

					{

						obj[property_array[inc]] = value_array[inc];

					}

			}



		if(fromObj = $(block))

			{

				changePosition(fromObj);

			}

		return false;

	}

function getPageSizeWithScroll()

	{

		if (window.innerHeight && window.scrollMaxY)

			{

				// Firefox

				yWithScroll = window.innerHeight + window.scrollMaxY;

				xWithScroll = window.innerWidth + window.scrollMaxX;

			}

		else if (document.body.scrollHeight > document.body.offsetHeight)

			{

				// all but Explorer Mac

				yWithScroll = document.body.scrollHeight;

				xWithScroll = document.body.scrollWidth;

			}

		else

			{

				// works in Explorer 6 Strict, Mozilla (not FF) and Safari

				yWithScroll = document.body.offsetHeight;

				xWithScroll = document.body.offsetWidth;

	  		}

		arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);

		//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );

		return arrayPageSizeWithScroll;

	}

//**************** confirmation box related functions End *******************/

//*****************comments function start from here ***********************/

/**

 *

 */

//PostComments function used for many module if any one chage this function please analyes it and changeit

function PostCommonComments()

	{

		var url = arguments[0];

		var parms = arguments[1];

		var textarea_id = arguments[2];

		var resultDiv = arguments[3];

		var action_to = arguments[4];

		var remainingStr = ' Characters remaining';



		if( arguments.length > 5 )

			{

				var replace_id = arguments[5];

			}

		if( arguments.length > 6 )

			{

				var max_length = arguments[6];

			}

		if(arguments.length > 7)

			{

				var selLodingPostingTest = arguments[7];

			}

		//if(IsBlank(textarea_id)){return false;}

		var postValue=jstrim($(textarea_id).value);



		if( postValue.length > max_length )

			{

				postValue = postValue.substring(0, max_length);

			}



		parms=action_to+'_post_comments=true&'+ parms +'&'+action_to+'_comment_content='+escape(postValue);

		if( postValue=='' || $(textarea_id).style.fontSize=='12px' )

			{

				$(textarea_id).style.fontSize='12px';

				$(textarea_id).value='Write a comment...';

				new Effect.Highlight(textarea_id, { startcolor: '#FFCFCF',endcolor: '#ffffff' });

				return;

			}





		if($(selLodingPostingTest))

			{

				$(selLodingPostingTest).innerHTML='<img src="../images/ajax-page_loader.gif" />&nbsp;Posting..';

			}

		else

			{

				$(resultDiv).innerHTML='<img src="../images/ajax-page_loader.gif" />&nbsp;Posting..';

			}



		new Ajax.Request(

					url,

					{

						method:'post',

						parameters:parms +"&isAjax=true&items=" + Math.random(),

						onCreate:function(req){

							//For later use

						},

						onComplete:function(resp)

						{

							//setting the text area value to  empty

							data = resp.responseText;

							tmpArr = data.split('|||');

							if($(selLodingPostingTest))

								{

									$(selLodingPostingTest).innerHTML='';

								}

							$(textarea_id).value='';

							$(resultDiv).innerHTML='';

							 resp.responseText.evalScripts();

							$(resultDiv).innerHTML=tmpArr['0'];

							//setSlideDownEffect(resultDiv);

							if(replace_id && max_length)

								{

									$(replace_id).innerHTML = max_length+' '+remainingStr;

								}

							if(tmpArr['1'])

								{

									setCommentLastID(tmpArr['1'])

								}

						}

					}

				);

				return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function processPhotoDeletion(url,parms,statusDiv,redirect_photo_url)

	{

		$(statusDiv).innerHTML='<img src="../images/ajax-page_loader.gif" />&nbsp;Deleting..';

		new Ajax.Request(

					url,

					{

						method:'post',

						parameters:parms +"&isAjax=true&items=" + Math.random(),

						onCreate:function(req){

							//For later use

						},

						onComplete:function(resp)

						{

							$(statusDiv).innerHTML='<img src="../images/deleted.gif" />&nbsp;Deleted..';

							redirctToPhotoList(redirect_photo_url);



						}

					}

				);

				return false;

	}



/**

	 *

	 * @access public

	 * @return void

	 **/

	function redirctToPhotoList(redirect_photo_url)

		{

			window.location = redirect_photo_url;

		}

	function redirct2Url(url)

		{

			window.location = url;

		}



/**

 *

 * @access public

 * @return void

 **/

function AlbumDeletion(url,parms,tohide,statusDiv)

	{

		var album_ids = $('record_ids').value;

		var new_params = parms+'&record_ids='+album_ids;

		processCommonDeletion(url,new_params,tohide,statusDiv)

	}

/**

 *

 * @access public

 * @return void

 **/

function processCommonDeletion(url,parms,tohide,statusDiv)

{	

	new Ajax.Request(

				url,

				{

					method:'post',

					parameters:parms +"&isAjax=true&items=" + Math.random(),

					onCreate:function(req){

						//For later use

					},

					onComplete:function(resp)

					{

						Zapatec.Effects.hide(tohide, 5, 'fade')



						var data = resp.responseText+' ';



						var tmpArr = data.split('|||');



						if( tmpArr.length >= 3 )

							{

								if( tmpArr[1] == 0 )

									{

										var length = tmpArr.length;

										var argStr = '';



										if( tmpArr[2] == 'showVideoList' )

											{

												showVideoList(SITE_URL+'members/videoList.php','myvideos','delVideoSuccess');

											}

										else if( tmpArr[2] == 'showNoteList' )

											{

												showNoteList(SITE_URL+'members/ajaxNotes.php','?view=all&type=full&dis=my','selUserNotes');

											}

										else if( tmpArr[2] == 'showAlbumList' )

											{

												showAlbumList(SITE_URL+'members/albumlistAjax.php','?pg=myalbum','selMyAlbumsDisplay');

											}

									}

							}

					}

				}

			);

			return false;



}



/**

 *

 * @access public

 * @return void

 **/

function showAlbumList(url,pars,resultDiv)

	{

		getAjaxContent(url,pars,resultDiv,'post');

	}



/**

 *

 * @access public

 * @return void

 **/

function setIncreaseOpacity(effectdiv)

	{

		new Effect.Opacity(effectdiv, { from: 0, to: 1 })

	}



/**

 *

 * @access public

 * @return void

 **/

function setSlideDownEffect(effectdiv)

	{

		Effect.SlideDown(effectdiv); return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function showDropoutEffect(effectdiv)

	{

		Effect.DropOut(effectdiv);

	}



/**

 *

 * @access public

 * @return void

 **/

function showHighlightEffect(effectdiv)

	{

		new Effect.Highlight(effectdiv, { startcolor: '#ffff99',endcolor: '#ffffff'});

	}

/**

 *

 * @access public

 * @return void

 **/

function ShowEffect(element)

	{

		Effect.toggle(element, 'appear');

		Effect.toggle(element, 'slide', { delay: 0.5 });

		Effect.toggle(element, 'blind', { duration: 2.0 });

	}

//******************* comments function end from here ****************************/

/**

 *

 * @access public

 * @return void

 **/

function countTextareaLength(id,max,replaceId)

	{

		var remainingStr = ' Characters remaining';

		var beginStr = '';

		if( $(id).value.length > max )

			{

				$(id).value = $(id).value.substring(0, max);

				return false;

			}

		var string = $(id).value;

		if( parseInt(max) > parseInt(string.length) )

			{

				if( $(replaceId) )

					{

						$(replaceId).innerHTML = beginStr;

						$(replaceId).innerHTML += parseInt(max) - parseInt(string.length);

						$(replaceId).innerHTML += ' '+remainingStr;

					}

			}



		else

			{

				if( $(replaceId) )

					{

						$(replaceId).innerHTML = '0'+remainingStr;

					}

			}

	}



var encN = 3;

function decodeTxt(s)

	{

		var s1=unescape(s.substr(0,s.length-1));

		var t='';

		for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1));

		return unescape(t);

	}



// ENCODES, IN UNICODE FORMAT, ALL TEXT AND THEN ESCAPES THE OUTPUT

function encodeTxt(s)

	{

		s=escape(s);

		var ta=new Array();

		for(i=0;i<s.length;i++)ta[i]=s.charCodeAt(i)+encN;

		return ""+escape(eval("String.fromCharCode("+ta+")"))+encN;

	}



var Redirect2URL = function()

	{

		if(arguments[0])

			location.replace(arguments[0]);

		else

			window.back();

		return false;

	}



function windowOpen(obj)

	{

		var href1 = obj;

		if(obj.href)

			{

				href1 = obj.href;

			}

		window.open(href1,'mywindow','toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no, resizable=no');

		return false;

	}

function tempjs(eid)

{

	var evntid="eventId="+eid;

	document.getElementById('tempdiv').innerHTML = 'Loading...';

	url = 'myEvent_a1.php';

	var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: evntid,

				onComplete: function(msg){

					var response = msg.responseText;

					document.getElementById('tempdiv').innerHTML=response;

				}

			});

}



function submitFormBasedCheckBox( )

	{

		var formName = arguments[0];

		var fieldName = arguments[1];

		ajaxPage = false;

		if(arguments[2])

			ajaxPage = true;

		found = false;

		var field = eval('document.'+formName+'.'+fieldName);

		if(ajaxPage)

				{

					var pars = '';

					if(formName == 'frmWallPhotoUpload')

						{

							pars = $('frmWallPhotoUpload').serialize();

						}

					else if(formName == 'frmCapturedPhotoUpload')

						{

							pars = $('frmCapturedPhotoUpload').serialize();

						}

					getAjaxContent(SITE_URL+'members/editProfile.php',pars,'selUpdates','post');

					$('wallToWall_2').hide();

					$('wallToWalllPhoto').hide();

					$('wallToWallClose2').hide();

				}

			else

				{

					var frm = eval('document.'+formName);

					frm.submit();

				}

	}

	

	function submitFormBasedCheckBox_1()

	{

		var formName = arguments[0];

		var fieldName = arguments[1];

		ajaxPage = false;

		if(arguments[2])

			ajaxPage = true;

		found = false;

		var field = eval('document.'+formName+'.'+fieldName);

		if(ajaxPage)

		{

			var pars = '';

			if(formName == 'frmWallPhotoUpload')

				{

					pars = $('frmWallPhotoUpload').serialize();

				}

			else if(formName == 'frmCapturedPhotoUpload')

				{

					pars = $('frmCapturedPhotoUpload').serialize();

				}

			

			pars+='&wall_upload1=yes1'; 	

			getAjaxContent(SITE_URL+'members/editProfile.php',pars,'selUpdates','post');

			$('wallToWalllPhoto').hide();

		}

		else

		{

			var frm = eval('document.'+formName);

			frm.submit();

		}

	}

	

	

	function getEditphoto()

	{

		var formName = arguments[0];

		var fieldName = arguments[1];

		//alert(formName+'<=>'+fieldName);

		var frm = eval('document.'+formName);

		/*var url = arguments[0];

		var pars = arguments[1];

		var divname = arguments[2];

		var method_type = arguments[3];*/

		//var pars=frm.action.split('?');

		var frm = eval('document.'+formName);

		frm.submit();

		//getAjaxContent(pars[0],pars[1],'selUpdates','post');

		//$event->getFormField('action') == 'editPhotos'

	}



 /**

  *

  * @access public

  * @return void

  **/

 function cancelUploaded(source){

 	alert(source);

 	 iframe_uploader.document.location=source;

 	$('upload_photo_submit').style.display='none';

 	$('showSelectImage').style.display='none';

 	$('selThumbNails').innerHTML='';

 }



//share functionality function start from here

/**

 *

 * @access public

 * @return void

 **/



function getShareDiv(div_name,params,url)

	{

		if( $('selShareThisVideo')	)

			{

				highLightDivs('selShareThisVideo');

			}

		setLoadingStatus(div_name);

		//alert(url+" "+params+" "+div_name);

		

		getAjaxContent(url,params,div_name,'get','getShareDivResponse');

		return false;

	}

function getShareDivResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		if( divname )

			{

				$(divname).innerHTML = data;

				data.evalScripts();

			}

		openModal_Window(divname,true);

	}

function setPrivacyFields(frmName)

	{

		var frm = eval('document.'+frmName);

		var everyOne = frm.chk_every_one.checked;

		$('friends_select_name').value='';

		$('friends_filter').value='';



		var length = frm.users_view_status.length;



		for( i = 0; i < length ; i++ ){

			frm.users_view_status[i].disabled = everyOne;

		}



		frm.friend_name.disabled = everyOne;

	}

var urlChkUserName = '';

function showFriendsAndList(key,url,urlChkUserName)

	{

		urlChkUserName = urlChkUserName;

		if( document.captureEvents )

			{

			    if( Event.KEYUP )

					{

			        	document.captureEvents( Event.KEYUP );

			     	}

			}



		if(typeof(key) == 'object')

			{

				key.onkeydown = function(e)

							{

								var key_code = alertkey(e);

								if(key_code==188 || key_code==13){

									chkUserName(key.value,urlChkUserName);

									key.value = '';

									return false;

								}

							};

				getFriendsSuggestion('username','selFriendsSuggestionList', 'selSuggestionList',url,'selNoFriends','selSuggestionFocus','','selMailList','mail_select_name','friendList');

			}

	}



function chkUserName(txtVal,url)

	{

		var pars = 'enter_user_name='+txtVal;

		pars += '&action=chkUserName';

		getAjaxContent(url,pars,'','post','chkUserNameResponse');

	}



function chkUserNameResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		var dataArr = data.split('|||');



		if( dataArr[0] == 'success' )

			{

				dataArr[1] = 'user_'+dataArr[1];

				if( addFriendsId(dataArr[1],'mail_select_name') )

					{

						createFriendListDiv(dataArr[1],dataArr[2],'selMailList','mail_select_name');

					}

			}

		else

			{

				$('selFriendsSuggestionList').style.display = 'none';

				$('selSuggestionFocus').style.display = 'none';

				$('selNoFriends').style.display = 'block';

			}

		return false;

	}

function getFriendsSuggestion()

	{

	    var fieldName = arguments[0];

	    var divs = arguments[1];

	    var divs1 = arguments[2];

	    var url = arguments[3];

		var divNoRecords = arguments[4];

		var divSuggestion = arguments[5];



		if( arguments[6] )

			{

				var fName = arguments[6];

			}

		else

			{

				var fName = 'addToFriendsList';

			}



		divForList = '';

		divForFieldId = '';

		if( arguments.length > 7 )

			{

				var divForList = arguments[7];

				var divForFieldId = arguments[8];

			}

		var extArg = '&userdet=1';



		if( arguments.length >= 10 )

			{

				if( arguments[9] == 'friendList')

					{

						extArg = '&show=friendAndList&userdet=1';

					}

				else

					{

						extArg = '';

					}

			}

		if( arguments.length > 10 )

			{

				if( arguments[10] == 'loginnedUser')

					{

						extArg += '&show_logined_user=true&userdet=1';

					}

			}



		var options_xml = {

			script: function (input) { return url+'?suggest='+input+extArg; },

			varname:"suggest",

			div_ids:divs,

			div_ids1:divs1,

			div_no_records:divNoRecords,

			div_focus:divSuggestion,

			callback: function (obj){ eval(fName)(obj.id,obj.value,divForList,divForFieldId,fieldName)  }

		};

		var as_xml = new bsn.AutoSuggest(fieldName, options_xml);

	}



function addToFriendsList(id,uName,divName,fieldName,mainFieldName)

	{

		if( divName && fieldName && addFriendsId(id,fieldName) )

			{

				if(divName)

					{

						createFriendListDiv(id,uName,divName,fieldName);

						$(mainFieldName).value = '';

					}

	//			updateFriendListDiv();

			}

		else

			{

				$(mainFieldName).value = '';

			}

	}

function createFriendListDiv(id,userName,divName,fieldName)

	{

		var newdiv = document.createElement('div');

		newdiv.setAttribute('id',id);

		newdiv.className = 'clsSuggestionMain clsClearFix';



		var idTemp = parseInt(id);



		if( id != idTemp && id.substring(0,4) == 'list' )

			{

				var listId = id.replace('list','');



				var field = document.createElement("INPUT");

				field.setAttribute("type","text");

				field.setAttribute("id","removed_list_users_"+listId);

				field.setAttribute("name","removed_list_users["+listId+"]");

				document.selFormCompose.appendChild(field);



				newdiv.innerHTML += "<div class='clsSuggestRight'><div class='clsSuggestLeft'><div class='clsSuggestMiddle'><p class='clsFriedsListMail'><span class='clsFriendName'><a id='lnlOpen' href='#' onclick='return showMemberInList("+listId+");'>"+userName+"</a></span><span onclick=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode.parentNode.parentNode);deleteFriendListDiv('"+id+"','"+fieldName+"');><a class='clsMailCloseBtn'></a></span></p></div></div></div>";

				newdiv.innerHTML += "<div id='selConfirmFriendList"+listId+"' style='display:none;position:absolute;z-index:10000' class='clsFriendListMembers'></div>";

	//			id="selConfirmDeleteFriend" class="clsPopupConfirmation" style="display:none;position:absolute;;"

			}

		else

			{

				newdiv.innerHTML += "<div class='clsSuggestRight'><div class='clsSuggestLeft'><div class='clsSuggestMiddle'><p class='clsFriedsListMail'><span class='clsFriendName'>"+userName+"</span><span onclick=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode.parentNode.parentNode);deleteFriendListDiv('"+id+"','"+fieldName+"');><a class='clsMailCloseBtn'></a></span></p></div></div></div>";

			}

	//	newdiv.innerHTML += '</div></div>';

		$(divName).appendChild(newdiv);

	}

function showMemberInList(listId)

	{

		var allDivs = document.getElementsByClassName('clsPopupConfirmation');

		for( i = 0 ; i < allDivs.length; i++)

			{

				var divId = allDivs[i].id;



				if( divId.search('selConfirmFriendList/') )

					{

						$(divId).style.display = 'none';

					}

			}



		var divId = 'selConfirmFriendList'+listId;

		var pars = '?friend_list_id='+listId;



		pars += '&action=showUsersInList';



		if( $('removed_list_users_'+listId).value != '' )

			{

				pars += '&removed_users='+$('removed_list_users_'+listId).value;

			}



		var url = SITE_URL+'members/friendsList.php';

		getAjaxContent(url,pars,divId,'post','showMemberInListResponse');



	}

function showMemberInListResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';

		$(divname).innerHTML = data;

		$(divname).style.display = 'block';

//		openModal_Window(divname,false);

    }

function removeFromMessageList( objChkBox , userId , friendListId , totalUsers )

	{

		var fieldName = 'removed_list_users_'+friendListId;



		if( objChkBox = '' || !objChkBox.checked )

			{

				if( $(fieldName).value )

					{

						$(fieldName).value += ','+userId;

					}

				else

					{

						$(fieldName).value = userId;

					}



				var allFname = $(fieldName).value;

				var tmpArr = allFname.split(',');



				var length = tmpArr.length;



				if( ( length - 1 ) ==  totalUsers )

					{

						var objRemove = $('list'+friendListId)

						objRemove.parentNode.removeChild(objRemove);

						deleteFriendListDiv('list'+userId,'mail_select_name');

					}



			}

		else

			{

				var allFname = $(fieldName).value;

				var tmpArr = allFname.split(',');



				var length = tmpArr.length;

				var str = '';

				for( i = 0; i < length ; i++ ){

					if( tmpArr[i] != userId )

						{

							if( str )

								{

									str += ','+tmpArr[i];

								}

							else

								{

									str += tmpArr[i];

								}

						}

				}

				$(fieldName).value = str;



			}



//		alert(userId);

//		alert(friendListId);

	}

function addFriendsId(id,fieldName)

	{

		var allFname = $(fieldName).value;



		var tmpArr = allFname.split(',');



		var length = tmpArr.length;

		for( i = 0; i < length ; i++ )

			{

				if( tmpArr[i] == id )

					{

						return false;

					}

			}

		if( $(fieldName).value )

			{

				$(fieldName).value += ','+id;

			}

		else

			{

				$(fieldName).value = id;

			}

		return true;

	}

function updateFriendListDiv(fieldName)

	{

		$(fieldName).value='';

		$(fieldName).focus();

	}



function chkfrnd()

{

	$('frnd').style.display = 'block';

	$('grp').style.display = 'none';

	document.getElementById("grptype").selectedIndex=-1;

}



function chkgrp()

{

	

	$('grp').style.display = 'block';

	$('frnd').style.display = 'none';

	document.getElementById("frndtype").selectedIndex=-1;

}



function chkall()

{

	$('frnd').style.display = 'none';

	$('grp').style.display = 'none';

	document.getElementById("frndtype").selectedIndex=-1;

	document.getElementById("grptype").selectedIndex=-1;

}







function deleteFriendListDiv(id,fieldName)

	{

		var allFname = $(fieldName).value;

		var tmpArr = allFname.split(',');



		var length = tmpArr.length;



		allFname = '';



		for( i = 0; i < length ; i++ )

			{

				if( tmpArr[i] != id )

					{

						if( allFname )

							{

								allFname += ','+tmpArr[i];

							}

						else

							{

								allFname = tmpArr[i];

							}

					}

			}



		$(fieldName).value = allFname;

	}

function unCheckEveryOne(chkBox)

	{

		if( $("chk_every_one") )

			{

				$("chk_every_one").checked = false;

			}

		if( chkBox.value == 'SomeFriends')

			{

				$('selOnlyMyFriends').style.display = 'block';

			}

		else

			{

				$('selOnlyMyFriends').style.display = 'none';

			}

		if(chkBox.value == 'OnlyMe')

			{

				$('friends_filter').value = '';

				$('friends_select_name').value = '';

				$('selFriendNameAdded1').innerHTML = '';

				$('selFriendNameAdded').innerHTML = '';

				$('friend_name').disabled = true;

			}

		else{

				$('friend_name').disabled = false;

			}

		if( $('customize_status') )

			{

				$('customize_status').value = chkBox.value;

			}

	}

function showChangePictureLink()

	{

		if( $('selChangePicture').style.display == 'none' )

			{

				$('selLinkEditProfile').show();

			}

		return false;

	}

function hideAvatarDiv()

	{

		$('selChangePicture').style.display = 'none';

		$('selLinkEditProfile').show();

	}

function showAvatarDiv()

	{

		mainDivName = arguments[0];

		divId = arguments[1];

		url = arguments[2];



		if( arguments.length == 4 )

			{

				var fName = arguments[3];

			}

		else

			{

				var fName = 'getAvatarContentResponse';

			}



		closeModal_Window_Cancel(mainDivName);

		if( divId )

			{

	//			setLoadingStatus(divId);

	//			openModal_Window(divId,true);

			}

		pars = '?profile_page='+$('profile_page').value;

		getAjaxContent(url,pars,divId,'post',fName);

	}



function getAvatarContentResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		if( divname )

			{

				$(divname).innerHTML = data;

			}

		data.evalScripts();

		helpTipInitialize();

		helpTipMessageInitialize();

		if( divname )

			{

//				$('selLinkEditProfile').hide();

				openModal_Window(divname,true);

			}

	}



function showAlbumPhotos()

	{

		var divId = arguments[0];

		url = arguments[1];



		if( arguments.length == 3 )

			{

				var albumId	= arguments[2];

			}

		else

			{

				var albumId	= $('selected_album_id').value;

			}

		pars = 'selected_album_id='+albumId;

		getAjaxContent(url,pars,divId,'post');

		return false;

	}

function changeAvatar(url)

	{

		if( document.frmSelectAlbum.photo_id.value )

			{

				pars = '?photo_id='+document.frmSelectAlbum.photo_id.value;

				pars += '&profile_page='+document.frmSelectAlbum.profile_page.value;

				getAjaxContent(url,pars,'','post','changeAvatarResponse');

				return false;

			}

	}



function selecteAvatarPhoto(photoId)

	{

		var photoIds = document.frmSelectAlbum.photo_ids.value.split(',');

		var length = photoIds.length;



		var strPhotoId = '';

		for( i = 0; i < length; i++ ){

			strPhotoId = 'selPhotoToMove_'+photoIds[i];

			$(strPhotoId).style.border = '0px';

		}



		strPhotoId = 'selPhotoToMove_'+photoId;

		$(strPhotoId).style.border = '2px solid red';

		document.frmSelectAlbum.photo_id.value = photoId;

	//	openModal_Window('selConfirmSelectPhoto',false);

	//	alert(photoId);

	}



function changeAvatarResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		tmpArr = data.split('|||');



		if( tmpArr[0] == 'SUCCESS')

			{

				closeModal_Window_Cancel('selUploadAvatar');

				document.getElementById('selAvatarImage').innerHTML = tmpArr[1];

				data.evalScripts();

			}

	}

function editThumbNail()

	{

		var url = arguments[0];

		if (navigator.appName == "Microsoft Internet Explorer")

			{

				var frmElements = iframeEditThumbnail.document.frmEditThumbnail;

				var frmElementsLength = iframeEditThumbnail.document.frmEditThumbnail.elements.length;



				var pars = '';

				for( i = 0; i < frmElementsLength; i++){

					if( i == 0 )

						{

							pars += frmElements[i].id+'='+escape(frmElements[i].value);

						}

					else

						{

							pars += '&'+frmElements[i].id+'='+escape(frmElements[i].value);

						}

				}

			}

		else

			{

				var pars = iframeEditThumbnail.document.frmEditThumbnail.serialize();

			}



		if( arguments.length == 2 )

			{

				pars += '&change_original_version=true';

			}

		getAjaxContent(url,pars,'','post','editThumbNailResponse');

	}



function refreshThumbnailIframe()

	{

		// just refersh the iframe

//		Math.random()

//		src = parent.top.iframeEditThumbnail.document.location;

		var srcIframe = parent.top.SITE_URL+'members/uploadAvatar.php?pg=editThumbnail&cache='+Math.random();

		if( $('profile_page').value )

			{

				srcIframe += '&profile_page='+$('profile_page').value;

			}

		parent.top.iframeEditThumbnail.document.location = srcIframe;

	}



function editThumbNailResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		tmpArr = data.split('|||');

		if( tmpArr[0] == 'SUCCESS')

			{

				closeModal_Window_Cancel('selAvatarEditThumbnail');

				document.getElementById('selAvatarImage').innerHTML = tmpArr[1];

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function setAlbumCover(album_id,url)

{

	album_cover = $('album_cover').value;

	if(album_cover)

		{

			pars='action=setAlbumCover&album_id='+album_id+'&album_cover='+album_cover;

			getAjaxContent(url,pars,'selMyAlbumCover'+album_id,'post');

		}

	closeModal_Window_Cancel('selAlbumCoverDetails_'+album_id);

}



/**

 *

 * @access public

 * @return void

 **/

function setAlbumCoverValue(albumValue)

	{

		if(albumValue!='')

			{

				$('album_cover').value=albumValue;

				var album_ids = $('album_cover_id').value;

				var splitted=album_ids.split(',');

				for(i=0;i<splitted.length;i++)

					{

						if(splitted[i])

							{

								$('selImageBorderSelected'+splitted[i]).hide();

								$('selPlainImageBorder'+splitted[i]).show();

							}

					}

				$('selPlainImageBorder'+albumValue).hide();

				$('selImageBorderSelected'+albumValue).show();

			}

	}



function getAlbumCoverDive(div_name,params,url)

	{

		getAjaxContent(url,params,div_name,'post','getAlbumResponse');

	}



/**

 *

 * @access public

 * @return void

 **/

function getAlbumResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';

		if( divname )

			{

				$(divname).innerHTML = data;

			}

		openModal_Window(divname,true);

	}



/**

 *

 * @access public

 * @return void

 **/

function removePeopleYouMayKnow(url,params,hide_divname,method)

	{

		Zapatec.Effects.hide(hide_divname, 5, 'fade');

		people_may_know_limit_count = parseInt(people_may_know_limit_count)+1;

		setTimeout(function()

			{

        		getAjaxContent(url,params+people_may_know_limit_count,hide_divname,method,'getFriendsdiveBodyShow');

      		}, 1000);

	}



/**

 *

 * @access public

 * @return void

 **/

function removePeopleYouMayKnowHomeTap(url,params,div_name,method)

	{

		Zapatec.Effects.hide(div_name, 5, 'fade');

		people_may_know_index_limit_count = parseInt(people_may_know_index_limit_count)+1;



		setTimeout(function()

			{

        		getAjaxContent(url,params+people_may_know_index_limit_count+'&home_tap=true',div_name,method,'getFriendsdiveBodyShow');

      		}, 2000);

	}





/**

 *

 * @access public

 * @return void

 **/

function getFriendsdiveBodyShow(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';

		if( divname )

			{

				if( Trim(data) )

					{

						$(divname).innerHTML = data;

						data.evalScripts();

						helpTipInitialize();

						helpTipMessageInitialize();

						Zapatec.Effects.show(divname, 5, 'fade');

					}

				else

					{

						var tmpArr = document.getElementsByClassName('clsPeopleRoundedSections');

						var length = tmpArr.length;

						var foundPeopleKnow = false;



						var found = false;

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

							{

								if( $(tmpArr[i].id).style.display != 'none')

									{

										found = true;

										break;

									}

							}

						if( !found )

							{

								var url = SITE_URL+'members/index.php';

								var params = '?action=showNoPeopleBlock';

								var update_div = '';

								if($('selListPeopleMayKnow'))

									{

										update_div = 'selListPeopleMayKnow';

									}

								else

									{

										update_div = 'peopleYouKnowMain';

									}

								getAjaxContent(url,params,update_div,'post');

							}

					}

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function CheckandOpenFrndReq()

	{

		var user_id = arguments[0];

		var post_value = user_id;

		if(arguments[1])

			var post_value = post_value+arguments[1];

		var pars='actn=checkfriendrequest&requestuser_id='+post_value;

		var url = SITE_URL+'members/inviteListAjax.php';

		//alert(pars);

		var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: pars,

				//onComplete:confirmRSVP

				//onComplete: function(){confirmRSVP(rsvp);}

				onComplete:function(resp)

				{

					if(resp.responseText=='')

					{

						openModal_Window('addasfrnd_'+user_id);

						return;

					}else if(resp.responseText!='')

					{

						$('addasfrndmsg_'+user_id).innerHTML = resp.responseText;

						showRequestStatus('addasfrndmsg_'+user_id);

						return;

					}

				}

			});

			return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function getSearchPeopel(url,div_name)

	{

		if(IsBlank('search_for_people')){return false;}

		var search_value = $('search_for_people').value;

		params='isAjax=true&action=search_all&search_value='+escape(search_value);

		getAjaxContent(url,params,div_name,'post');

	}



/**

 *

 * @access public

 * @return void

 **/

function getSearchEmail(url,div_name)

	{

		if(IsBlank('search_for_people')){return false;}

		var search_value = $('search_for_email').value;

		params='isAjax=true&action=search_email&search_value='+escape(search_value)+'&search_for_email='+escape(search_value);

		getAjaxContent(url,params,div_name,'post');

	}



/**

 *

 * @access public

 * @return void

 **/

function sendMessageToEmail(user_id,user_email,url,dive_name)

	{

		subject = $('sendmail_subject'+user_id).value;

		message=$('sendmail_message'+user_id).value;

		params='isAjax=true&action=send_mail&email='+user_email+'&user_id='+user_id+'&subject='+subject+'&message='+message;

		getAjaxContent(url,params,dive_name,'post');

	}



/**

 *

 * @access public

 * @return void

 **/

function getSendMessageBody(url,params,dive_name)

	{

		getAjaxContent(url,params,dive_name,'post','getSendMessageBodyResponse');

	}

function getSendMessageBodyResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';

		if( divname )

			{

				$(divname).innerHTML = data;

			}

		data.evalScripts();

		helpTipInitialize();

		helpTipMessageInitialize();

		openModal_Window(divname,false);

	}

/**

 *

 * @access public

 * @return void

 **/

function showRequestStatus(id)

	{

		$(id).show();

		setTimeout(function() {

				        showDropoutEffect(id);

				      }, 1500);

	}



/**

 *

 * @access public

 * @return void

 **/

function viewFriendsImage(divShow,divHide)

	{

		$(divShow).show();

		$(divHide).hide();

	}



/**

 *

 * @access public

 * @return void

 **/

function sendFriendRequest(user_id)

	{

	var pars='actn=friendrequest&requestuser_id='+user_id+'&txtmsg='+$F('txtmsg_'+user_id);

			var url = SITE_URL+'members/inviteListAjax.php';

			//alert(pars);

			var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: pars,

				//onComplete:confirmRSVP

				//onComplete: function(){confirmRSVP(rsvp);}

				onComplete:function(resp)

				{



					if($('addasfrnd_'+user_id))

					{

						$('addasfrnd_'+user_id).style.display='none';

					}

					//$('addasfrndmsg_'+user_id).style.display='';

					var result=resp.responseText.split('|');



					if($('memberslistmsg_'+user_id))

					{

						$('memberslistmsg_'+user_id).hide();

					}



					if($('addasfrndmsg_'+user_id))

					{

						$('addasfrndmsg_'+user_id).innerHTML=result[0];

					}

					if($('friendRqstMsg_'+user_id))

					{

						$('friendRqstMsg_'+user_id).innerHTML=result[0];

					}





					/*

					setTimeout(function() {

				        showDropoutEffect('addasfrndmsg_'+user_id);

				      }, 1500);

				      */

				}

			});

	}



function showFaceMarker(id,dragArea)

	{

		$(dragArea).style.display = 'block';

		$(id).style.display = 'block';

	}

function hideFaceMarker(id,dragArea)

	{

		$(dragArea).style.display = 'none';

		$(id).style.display = 'none';

	}



/**

 *

 * @access public

 * @return void

 **/

function PostWallcontent(url,params,updateDiv,method,max_length)

	{

		var comment_value = escape($('wall_others_message').value);

		var remainingStr = ' Characters remaining';

		if( comment_value.length > max_length )

			{

				comment_value = comment_value.substring(0, max_length);

			}

		params = params+comment_value;

		if(comment_value)

			{

				getAjaxContent(url,params,updateDiv,'post');

				/*$('wall_others_message').value ='';*/

			}

		$('wall_others_message_0').innerHTML = max_length+' '+remainingStr;

		

	}





 function selectfriend()

   {

    var radioname="";

	var frndid=jQuery('#frndtype').val();

	var grpid=jQuery('#grptype').val();

	var uname=jQuery('#hdfield').val();

	var allid=jQuery('#allhidden').val();

	if(jQuery('#selFrnd').is(':checked'))

		{

			radioname="frnd";

		}

		if(jQuery('#selGrup').is(':checked'))

		{

			radioname="grp";

		}

		if(jQuery('#selAll').is(':checked'))

		{

			radioname="all";

		}

	if(radioname=="frnd")

	{

		var myString = new String(frndid);

		var myArray = myString.split(','); 

		for (i=0;i<myArray.length;i++)

		{

			var h=PostWallcontent("profile_updates.php","user_id="+myArray[i]+" &username="+uname+"&isAjax=true&wall_comment=true&wall_comment_value=","selUpdates","post","200");

			if(i==(myArray.length-1))

			{

				$('wall_others_message').value ='';	

			}

		}

	}

	if(radioname=="grp")

	{

		var grpid=jQuery('#grptype').val();

		var myString = new String(grpid);

		var myArray = myString.split(','); 

		var tt="";

		for (i=0;i<myArray.length;i++)

		{

			

			for (i=0;i<myArray.length;i++)

			{

			for(j=i+1;j<myArray.length;j++)

			{

				if(myArray[i] == myArray[j])

				{

				myArray[i]=" ";

				}

			}

			tt+=myArray[i]+",";

			}

			var myString1 = new String(tt);

			var myArray1 = myString1.split(','); 

			for (i=0;i<myArray1.length;i++)

			{

				if(myArray1[i] != "")

				{		

				var h=PostWallcontent("profile_updates.php","user_id="+myArray1[i]+" &username="+uname+"&isAjax=true&wall_comment=true&wall_comment_value=","selUpdates","post","200");

				}

				if(i==(myArray1.length-1))

				{

					$('wall_others_message').value ='';	

				}

			}

		}

	}

	

	

	if(radioname=="all")

	{

		var tt="";

		var myString = new String(allid);

		var myArray = myString.split(','); 

		for (i=0;i<myArray.length;i++)

		{

			for(j=i+1;j<myArray.length;j++)

			{

				if(myArray[i] == myArray[j])

				{

				myArray[i]=" ";

				}

			}

			tt+=myArray[i]+",";

		}

		var myString1 = new String(tt);

		var myArray1 = myString1.split(','); 

		for (i=0;i<myArray1.length;i++)

		{

			if(myArray1[i]=="")

			{		

			}

			else

			{ 

			var h=PostWallcontent("profile_updates.php","user_id="+myArray1[i]+" &username="+uname+"&isAjax=true&wall_comment=true&wall_comment_value=","selUpdates","post","200");

			}

			if(i==(myArray1.length-1))

			{

				$('wall_others_message').value ='';	

			}

		}

		

	}

}

   

function showProfile(obj,profileId,divname)

	{

		var pars = 'actn=checkfriendrequest&requestuser_id='+profileId;



		var url = SITE_URL+'members/inviteListAjax.php';



		var myAjax = new Ajax.Request(

									url,

									{

										method: 'post',

										parameters: pars,

										//onComplete:confirmRSVP

										//onComplete: function(){confirmRSVP(rsvp);}

										onComplete:function(resp)

										{

											if( resp.responseText == ''  )

												{

													openModal_Window(divname+'_'+profileId);

//													showRequestStatus(divname+'_'+profileId);

													return false;

												}

											else if( resp.responseText == 'Already requested' )

												{

													$(divname+'_'+profileId).innerHTML = resp.responseText;

													showRequestStatus(divname+'_'+profileId);

//													openModal_Window(divname+'_'+profileId);

												}

											else

												{

													document.location.href = obj;

													return false;

												}

										}

									});

		return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function IsBlank(divId)

	{

		blankFlag = 0;

		itemVal = trim($(divId).value);

		for(i=0;i<itemVal.length;i++)

			{

				if(itemVal.charAt(i)==' ')

		   			{

 		 				blankFlag++;

	    			}

			}



		if(blankFlag==i)

			{

				$(divId).value='';

		    	$(divId).focus();

		    	return 1;

			}

    }



/**

 *

 * @access public

 * @return void

 **/

function trim(str)

	{

		s = str.replace(/^(\s)*/, '');

		s = s.replace(/(\s)*$/, '');

		return s;

	}



function showCutomizedTag()

	{

		var markerId = arguments[0];

		var contentId = arguments[1];

		var display_name = 'Add Name';

		var display_tag  = 'Add Tag';

		if( arguments.length > 2 )

			{

				var isEventPage = arguments[2];

			}

		if( arguments.length > 3 )

			{

				display_name = arguments[3];

				display_tag = 'Edit Tag';

				if(display_name=='Add Name')

					{

						display_tag = 'Add Tag';

					}

			}



		var field = document.createElement("INPUT");

		field.setAttribute("type","text");

		field.setAttribute("id","customize_tag"+markerId);

		field.setAttribute("name","customize_tag");



		var div_name = 'selFaceMarkerTag'+markerId;



		$(div_name).innerHTML = '';

		//$(div_name).appendChild(field);



		var divRounded = document.createElement("DIV");

		divRounded.className = 'clsDeleteConfirm';



		var divRoundedMiddle = document.createElement("DIV");

		divRoundedMiddle.className = 'clsDeleteConfirmMiddle';





		var divRoundedLeft = document.createElement("DIV");

		divRoundedLeft.className = 'clsDeleteConfirmLeft';



		var divRoundedRight = document.createElement("DIV");

		divRoundedRight.className = 'clsDeleteConfirmRight';



		var heading = document.createElement("H2");

		heading.innerHTML = display_name;

		divRoundedRight.appendChild(heading);



		divRoundedLeft.appendChild(divRoundedRight);



		var pLeft = document.createElement("div");

		pLeft.className = 'clsEmptyspace';

		pLeft.appendChild(field);

		divRoundedLeft.appendChild(pLeft);

		divRoundedMiddle.appendChild(divRoundedLeft);

		divRounded.appendChild(divRoundedMiddle);

		divRoundedRight.appendChild(pLeft);

	    $(div_name).appendChild(divRounded);



		var divForButtonMain = document.createElement("DIV");

		divForButtonMain.className = 'clsPaddingEmptySpace';

		var divForButton = document.createElement("DIV");

		divForButton.className = 'clsSubmitButtonRight';



		var divForLeftButton = document.createElement("DIV");

		divForLeftButton.className = 'clsSubmitButtonLeft';





		var field = document.createElement("INPUT");

		field.setAttribute("type","button");

		field.className = "clsSubmitButton";

		field.setAttribute("id","add_tag");

		field.setAttribute("name","add_tag");

		field.setAttribute("value",display_tag);

		field.setAttribute("onclick","return addCutomizedTag("+markerId+","+contentId+","+isEventPage+")");



		$(divForLeftButton).appendChild(field);

		$(divForButton).appendChild(divForLeftButton);;

		$(divForButtonMain).appendChild(divForButton);

		$(divRoundedRight).appendChild(divForButtonMain);



		var divForButton = document.createElement("DIV");

		divForButton.className = 'clsCancelButtonRight';



		var divForLeftButton = document.createElement("DIV");

		divForLeftButton.className = 'clsCancelButtonLeft';





		var cancelButton = document.createElement("INPUT");

		cancelButton.setAttribute("type","button");

		cancelButton.setAttribute("id","add_tag_calcel");

		cancelButton.setAttribute("name","add_tag_calcel");

		cancelButton.setAttribute("value","Cancel");

		cancelButton.setAttribute("onclick","closeModal_Window_Cancel('"+div_name+"')");



		$(divForLeftButton).appendChild(cancelButton);

		$(divForButton).appendChild(divForLeftButton);;

		$(divForButtonMain).appendChild(divForButton);

		$(divRoundedRight).appendChild(divForButtonMain);





		var divId = 'selFaceMarkerMain'+markerId;

		if( $(divId) )

			{

				var objDiv = $(divId);

				var divLeft = objDiv.offsetLeft;



				if (navigator.appName == "Microsoft Internet Explorer")

					{

						$(div_name).style.left = parseInt(divLeft)+280+'px';

					}

				else

					{

						$(div_name).style.left = parseInt(divLeft)+350+'px';

					}

			}

		openModal_Window(div_name,false);

		return false;

	}

function addCutomizedTag()

	{

		var markerId = arguments[0];

		var contentId = arguments[1];



		if( arguments.length > 2 )

			{

				var isEventPage = arguments[2];

			}



		var pars = '?face_marker_id='+markerId;

		pars += '&tagval='+escape($('customize_tag'+markerId).value);

		pars += '&action=addTag';



		if( isEventPage )

			{

				pars += '&event_id='+contentId;

				var url = SITE_URL+'members/viewEvent.php';

			}

		else

			{

				pars += '&photo_id='+contentId;

				var url = SITE_URL+'members/viewPhoto.php';

			}



		if( ($('customize_tag'+markerId).value) )

			{

				getAjaxContent(url,pars,'selFaceMarkerTag'+markerId,'post','addCutomizedTagResponse');

			}

	}

function addCutomizedTagResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';



		if( divname )

			{

				var tagId = divname.replace('selFaceMarkerTag','');

				$('selFaceMarker'+tagId).innerHTML = data;

			}

		closeModal_Window_Cancel(divname);

	}

function chkAccessType()

	{

		var obj = arguments[0];

		var divName = 'selMsgCustomize';



		if( arguments.length > 1 )

			{

				if( arguments[1] )

					{

						divName = arguments[1];

					}

			}

		if( arguments.length > 2 )

			{

				var cus_div_name = arguments[2];

				if( obj.value == 'Customize' )

					{

						$(cus_div_name).style.display = 'block';

					}

				else

					{

						$(cus_div_name).style.display = 'none';

					}

			}

		if( obj.value == 'Customize' )

			{

				if( $(divName).style.display == 'none' )

					{

						return openModal_Window(divName,true);

					}

			}

	}



/**

 *

 * @access public

 * @return void

 **/

function onClickChkAccessType()

	{

		var divName = 'selMsgCustomize';

		var file_name = arguments[0];

		if($(file_name))

			{

				$(file_name).value = 'Customize';

			}

		if( arguments.length > 1 )

			{

				if(arguments[1])

					{

						divName = arguments[1];

					}

			}

		if( arguments.length > 2 )

			{

				if(arguments[2])

					{

						var cus_div_name = arguments[2];

						$(cus_div_name).style.display = 'block';

					}

			}

		if( $(divName).style.display == 'none' )

			{

				return openModal_Window(divName,true);

			}



	}

	

//-----Common Search Functions Start-----//

	/**

 *

 * @access public

 * @return void

 **/

function setRSVP(rsvp,event_id){

if(event_id==''){event_id=$F('event_id');}

var pg=$F('pg');

var pars='rsvp='+rsvp+'&event_id='+event_id;



$('indicator_'+rsvp+'_'+event_id).show();

		var url = SITE_URL+'members/addEventAjax.php';

		//alert(pars);

		var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: pars,

			//onComplete:confirmRSVP

			//onComplete: function(){confirmRSVP(rsvp);}

			onComplete:function(resp)

			{

				if(pg=='list'){$('rsvp_'+event_id).style.display='none';}

				$('rsvpmsg_'+event_id).style.display='';

				var result=resp.responseText.split('|');

				$('rsvpmsg_'+event_id).innerHTML=result[0];

				if(pg=='list'){$('rsltrsvp_'+event_id).innerHTML=result[1];$('rsltrsvp_'+event_id).style.fontWeight='bold';}

				if(pg=='list'){$('rsvpRow_'+event_id).show();}



				if($('rsvpSelected_A_'+event_id))

				$('rsvpSelected_A_'+event_id).style.fontWeight='';



				if($('rsvpSelected_MA_'+event_id))

				$('rsvpSelected_MA_'+event_id).style.fontWeight='';



				if($('rsvpSelected_NA_'+event_id))

				$('rsvpSelected_NA_'+event_id).style.fontWeight='';



				if($('rsvpSelected_'+result[2]+'_'+event_id))

				$('rsvpSelected_'+result[2]+'_'+event_id).style.fontWeight='bold';







				if($('rsvpSelected_bx_A_'+event_id))

				$('rsvpSelected_bx_A_'+event_id).className='';



				if($('rsvpSelected_bx_MA_'+event_id))

				$('rsvpSelected_bx_MA_'+event_id).className='';



				if($('rsvpSelected_bx_NA_'+event_id))

				$('rsvpSelected_bx_NA_'+event_id).className='';



				if($('rsvpSelected_bx_'+result[2]+'_'+event_id))

				$('rsvpSelected_bx_'+result[2]+'_'+event_id).className='clsSelectedRsvp';



				$('indicator_'+rsvp+'_'+event_id).hide();







				setTimeout(function() {

			        //showDropoutEffect('rsvpmsg_'+event_id);

			        $('rsvpmsg_'+event_id).hide();



			      }, 1500);





			}

		});

}



function setRSVP1(rsvp,event_id){ 

if(event_id==''){event_id=$F('event_id');}

var pg=$F('pg');

var pars='rsvp='+rsvp+'&event_id='+event_id;



$('indicator_'+rsvp+'_'+event_id).show();

		var url = SITE_URL+'members/addEventAjax.php';

		//alert(pars);

		var myAjax = new Ajax.Request(

		url,

		{

			method: 'post',

			parameters: pars,

			//onComplete:confirmRSVP

			//onComplete: function(){confirmRSVP(rsvp);}

			onComplete:function(resp)

			{

				//if(pg=='list'){$('rsvp_'+event_id).style.display='none';}

				//$('rsvpmsg_'+event_id).style.display='';

				var result=resp.responseText.split('|');

				$('rsvpmsg_'+event_id).innerHTML=result[0];

				if(pg=='list'){$('rsltrsvp_'+event_id).innerHTML=result[1];$('rsltrsvp_'+event_id).style.fontWeight='bold';}

				if(pg=='list'){$('rsvpRow_'+event_id).show();}

				

				if($('rsvpSelected_bx_A_'+event_id))

				$('rsvpSelected_bx_A_'+event_id).className='';



				if($('rsvpSelected_bx_MA_'+event_id))

				$('rsvpSelected_bx_MA_'+event_id).className='';



				if($('rsvpSelected_bx_NA_'+event_id))

				$('rsvpSelected_bx_NA_'+event_id).className='';



				if($('rsvpSelected_bx_'+result[2]+'_'+event_id))

				$('rsvpSelected_bx_'+result[2]+'_'+event_id).className='clsSelectedRsvp';

				

				$('indicator_A_'+event_id).hide();

				$('indicator_MA_'+event_id).hide();

				$('indicator_NA_'+event_id).hide();

				

				setTimeout(function() {

			        //showDropoutEffect('rsvpmsg_'+event_id);

			        $('rsvpmsg_'+event_id).hide();



			      }, 1500);





			}

		});

}





function submitForm(frmName)

	{

		$(frmName).submit();

	}

function showVideoActiveClass(id,status)

	{

		if( status == 'active' )

			{

				$(id).className = 'clsActive';

			}

		else if( status == 'inactive' )

			{

				$(id).className = 'clsInActive';

			}

	}

//-----Common Search Functions End-----//

/**

 *

 * @access public

 * @return void

 **/

function autoTASize(t)

	{

		if( trim(t.value) == '' && t.rows > 10 )

			return false;

		a = t.value.split('\n');

		b=1;

		b+= a.length;

		if (b > t.rows) t.rows = b;

		if(t.value=='')

			t.rows=2;

		return true;

	}



/**

 *

 * @access public

 * @return void

 **/

function autoTASizeOnBlur(t)

	{

		if(t.value=='') t.rows =1;

	}



/**

 *

 * @access public

 * @return void

 **/

function changeTextAreaPosition(t)

	{

		 t.rows =1

	}



/**

 *

 * @access public

 * @return void

 **/

function resizeCommentTextLength(div_id,update_div,divLink,divComment,textId,commentText,cancelText)

	{

		if($(div_id).value=='')

			{

				$(update_div).innerHTML='';

				autoTASizeOnBlur($(div_id));

				showCommonCommentArea(divLink,divComment,textId,commentText,cancelText);

			}

	}

function closeOtherModalWindows()

	{

		var elements = document.getElementsByClassName('clsPopupConfirmation');



		for( i = 0; i < elements.length; i++){

			objElement = elements[i].id;

			$(objElement).style.display = 'none';

		}



	}

function showTakePicture()

	{

		closeModal_Window_Cancel('selChangePicture');

		var str = SITE_URL+'members/uploadAvatar.php?pg=capturePhoto&profile_page='+$('profile_page').value;

		parent.top.iframeCapturePhoto.document.location = SITE_URL+'members/uploadAvatar.php?pg=capturePhoto&profile_page='+$('profile_page').value;

		openModal_Window('selAvatarCapture',true,true,'100');

	}



function showOnlineStatusDiv()

	{

		var chatBoxArr = document.getElementsByClassName('clsChatWindow');

		var length = chatBoxArr.length;



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

			{

				if( chatBoxArr[i].id )

					{

						$(chatBoxArr[i].id).style.display = 'none';

					}

			}



		if( $('selOnlineStatus').style.display == 'none' )

			{

				$('selRightFooter').className = 'clsChatFooterRgtbg clsChatFooterRgtbgActive';

				$('selOnlineStatus').style.display = 'block';

				$('selFooterBuzzLinks').className = 'clsChatFooterBuzzLinks';

				$('selFooterBuzzContent').className = 'clsChatBoxContent';

				$('selFooterBuzzContentLeft').className = 'clsChatBoxContentLeft';

				$('selBuddyList').style.display = 'none';

			}

		else if( $('selOnlineStatus').style.display == 'block' )

			{

				$('selRightFooter').className = 'clsChatFooterRgtbg';

				$('selFooterBuzzLinks').className = '';

				$('selFooterBuzzContent').className = '';

				$('selFooterBuzzContentLeft').className = '';

				$('selOnlineStatus').style.display = 'none';

			}



		return false;

	}

function showOnlineUsers()

	{

		if( $('selBuddyList').style.display == 'none' )

			{

				var chatBoxArr = document.getElementsByClassName('clsChatWindow');

				var length = chatBoxArr.length;



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

					{

						if( chatBoxArr[i].id )

							{

								$(chatBoxArr[i].id).style.display = 'none';

							}

					}

				$('selRightFooter').className = 'clsChatFooterRgtbg clsChatFooterRgtbgActive';

				$('selOnlineStatus').style.display = 'none';

				$('selFooterBuzzLinks').className = 'clsChatFooterBuzzLinks';

				$('selFooterBuzzContent').className = 'clsChatBoxContent';

				$('selFooterBuzzContentLeft').className = 'clsChatBoxContentLeft';

				$('selBuddyList').style.display = 'block';

			}

		else

			{

				$('selRightFooter').className = 'clsChatFooterRgtbg';

				$('selFooterBuzzLinks').className = '';

				$('selFooterBuzzContent').className = '';

				$('selFooterBuzzContentLeft').className = '';

				$('selBuddyList').style.display = 'none';

			}



		return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function updateUserStatusLeft(divname,change_update,hide_text)

	{

		if($(divname).style.display=='none')

			{



				$('selChangeUpdatesForStatus').innerHTML='';

				$('selChangeUpdatesForStatus').innerHTML=hide_text;

				$(divname).show();

			}

		else

			{

				$('selChangeUpdatesForStatus').innerHTML='';

				$('selChangeUpdatesForStatus').innerHTML=change_update;

				$(divname).hide();

			}



	}

function showApplicationLinks()

	{

			if( $('selFooterApplications').style.display == 'block' || $('selFooterApplications').style.display == '')

				{

					$('selLeftFooter').className = 'clsChatFooterLftbg';

					setCookieMyItems('ChatApps','Hide');

					$('selFooterApplications').hide();

				}

			else if( $('selFooterApplications').style.display == 'none' )

				{

					$('selLeftFooter').className = 'clsChatFooterLftbg clsChatFooterLftbgActive';

					setCookieMyItems('ChatApps','Show');

					$('selFooterApplications').show();



				}



			return false;

	}

function showFooterHelpTip(content)

	{

			return overlib("<div class='toolTopMain'>"+content+"</div>",ABOVE);

	}



//show Photo

/**

 *

 * @access public

 * @return void

 **/

function getViewPhotoPopup(url,div_name,params)

	{

		if( $(div_name)	)

			{

				highLightDivs(div_name);

			}

		setLoadingStatus(div_name);

		getAjaxContent(url,params,div_name,'get','getViewPhotoDivResponse');

		return false;

	}



/**

 *

 * @access public

 * @return void

 **/

function getViewPhotoDivResponse(originalRequest,divname)

	{

		data = originalRequest.responseText+' ';

		if( divname )

			{

				$(divname).innerHTML = data;

			}

		openModal_Window(divname,true);

	}

function restrictChatTextArea(id){

	var max = 50;



	if( $(id).value.length > max )

		{

			$(id).value = $(id).value.substring(0, max);

			return false;

		}

}





///Methods  for cookie unctiolality

var today = new Date();

var zero_date = new Date(0,0,0);

today.setTime(today.getTime() - zero_date.getTime());

var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));



function Set_Cookie(name,value,expires,path,domain,secure) {

    var cookieString = name + "=" +escape(value) +

       ( (expires) ? ";expires=" + expires.toGMTString() : "") +

       ( (path) ? ";path=" + path : "") +

       ( (domain) ? ";domain=" + domain : "") +

       ( (secure) ? ";secure" : "");

    document.cookie = cookieString;

}



function getCookie(name) {

   var start = document.cookie.indexOf(name+"=");

   var len = start+name.length+1;

   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;

   if (start == -1) return null;

   var end = document.cookie.indexOf(";",len);

   if (end == -1) end = document.cookie.length;

   return unescape(document.cookie.substring(len,end));

}





function setCookieMyItems(cookieName,cookieVal)

{

	Set_Cookie(cookieName,cookieVal,cookie_expire_date);

	return;



}



/**

 *

 * @access public

 * @return void

 **/

function setCommentLastID(div_id)

	{

		if($(div_id))

			new Effect.Highlight(div_id, { startcolor: '#DBFFAF',endcolor: '#ffffff' });

	}

function changeAvatarPopupPosition()

	{

			if( $('selChangePicture').style.display == 'block' )

				{

					closeModal_Window_Cancel('selChangePicture');

					return false;

				}

			var imageTop = $('selAvatarImageMain').offsetTop;

			var imageLeft = $('selAvatarImageMain').offsetLeft;

			var imageWidth = $('selAvatarImageMain').offsetWidth;

			var objDiv = $('selChangePicture');

			var divTop = objDiv.offsetTop;

			var divLeft = objDiv.offsetLeft;

			objDiv.style.top = parseInt(imageTop) - 2 + 'px';

			objDiv.style.left = parseInt(imageLeft) - 30 + parseInt(imageWidth) +'px';

			$('selChangePicture').style.display = 'none';

			$('selLinkEditProfile').hide();

			openModal_Window('selChangePicture',false);

			setTimeout('hideAvatarDiv()',30000);

	}

function videoPopup(url,ttl,wdth,hght)

	{

		window.open(url,ttl,'toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no, resizable=no, width='+wdth+', height='+hght);

	}

function getFlashUploader()

	{

		var uploadUrl = arguments[0];

		var postName = arguments[1];

		var fileTypes = arguments[2];

		var maxSize = arguments[3]+" MB";

		var postParams = arguments[4];



		swfu = new SWFUpload({

			// Backend settings

			upload_url: uploadUrl,

			file_post_name: postName,

			post_params: postParams,



			// Flash file settings

			file_size_limit : maxSize,

			file_types : fileTypes,			// or you could use something like: "*.doc;*.wpd;*.pdf",

			file_types_description : "All Files",

			file_upload_limit : "0",

			file_queue_limit : "1",



			// Event handler settings

			swfupload_loaded_handler : swfUploadLoaded,



			file_dialog_start_handler: fileDialogStart,

			file_queued_handler : fileQueued,

			file_queue_error_handler : fileQueueError,

			file_dialog_complete_handler : fileDialogComplete,



			//upload_start_handler : uploadStart,	// I could do some client/JavaScript validation here, but I don't need to.

			upload_progress_handler : uploadProgress,

			upload_error_handler : uploadError,

			upload_success_handler : uploadSuccess,

			upload_complete_handler : uploadComplete,



			// Button Settings

			button_image_url : SITE_URL+"images/swfUploadButton.png",

			button_placeholder_id : "spanButtonPlaceholder",

			button_width: 61,

			button_height: 22,



			// Flash Settings

			flash_url : SITE_URL+"swfupload.swf",



			custom_settings : {

				progress_target : "fsUploadProgress",

				upload_successful : false

			},



			// Debug settings

			debug: false

		});

	}



/**

 *

 * @access public

 * @return void

 **/

function viewWallToWallPhoto( divname ){

	if( $(divname) )

		{

			openModal_Window(divname,true);

		}

}

function changeBottomClassName(){

	var divName = arguments[0];



	if( arguments.length == 2 )

		{

			$(divName).className = 'clsPopupConfirmation';

		}

	else

		{

			$(divName).className = 'clsPopupConfirmation clsPopupConfirmationChange';

		}

}



/**

 *

 * @access public

 * @return void

 **/

function facebookSessionUnSetLogout()

	{

		facebook_logout.document.location = SITE_URL+'members/facebookLogout.php';

		return false;

	}



function showdiv()

{

	$('wallToWalllPhoto').show();

	$('wallToWallClose2').show();

	$('selWallNormalUpload').hide();

	$('selWallFlashUploader').hide();

	$('wallToWallClose3').hide();

	setTimeout("setEditHight();",1000);

}



function showdiv_1()

{

	$('wallToWalllPhoto').show();

	$('selWallNormalUpload').hide();

	$('selWallFlashUploader').hide();

	$('evnt').hide();

	$('wallToWallClose3').hide();

	setTimeout("setEditHight();",1000);

}





function showeventdiv()

{

	$('evnt').show();

	$('wallToWalllPhoto').hide();

	$('selWallNormalUpload').hide();

	$('selWallFlashUploader').hide();

	setTimeout("setEditHight();",1000);

}





function showvideodiv()

{

	$('selWallNormalUpload').show();

	$('evnt').hide();

	$('wallToWallClose3').show();

	$('wallToWalllPhoto').hide();

	$('wallToWallClose2').hide();	

	setTimeout("setEditHight();",1000);

}

function draftselfdiv()

{

	$('draftfrnd').hide();

}



function draftdiv()

{

	$('draftfrnd').show();

	

}





/**

  *

  * @access public

  * @return void

  **/

function chkPrivacySettings()

	{

 		var divname = arguments[0];

 		closeModal_Window_Cancel(divname);

	}

	function showdivphoto()

	{

		$('photodiv').show();

		$('videodiv').hide();

	}

	

	function videodiv(ids)

	{

		$('videodiv').show();

		$('photodiv').hide();

		var post_param = "id="+ids+"&mode=eventajax";

		document.getElementById('videodiv').innerHTML = 'Loading...';

		//url = '../members/myeventvideo.php';

		url = 'eventVideo.php';		

		var myAjax = new Ajax.Request(

	 		url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					document.getElementById('videodiv').innerHTML=response;

				}

			});

	}

	

	

	

function get_pages(page_title)

{

	url = SITE_URL+'staticPage.php?';



	var post_param = "pg="+page_title;

	

	var myAjax = new Ajax.Request(

									url,

										{

											method: 'post',

											parameters: post_param,

											onComplete: function(msg){

											var response = msg.responseText;

											document.getElementById('pages_content').innerHTML=response;

										}

									});

}



function showhide_element(chk, id)

{

	if(chk)

	{

		document.getElementById(id).style.display='block';

	}

	else

	{

		document.getElementById(id).style.display='none';

	}

}



function txtChange_removelist(tag_display)

{

	var chk_tag = '';

	if(tag_display=="1")

	{

		var j=0;

		var tags = document.frm_rtag.Rtag;

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

		{

			if(tags[i].checked)

			{

				if(j==0)

				chk_tag += tags[i].value;

				else

				chk_tag += ','+tags[i].value;

				

				j++;

			}

		}

	}

	

	jQuery("#txt_remove_list").autocomplete("suggestListAjax.php?mode=remove_list&rtag="+chk_tag, {

			minChars: 0,

			matchContains: "word",

			multiple: true,

			mustMatch: false,

			autoFill: false,

			formatItem: formatItem_new,

			formatResult: formatResult_new

		});

}



function txtChange_addlist(tag_display)

{

	var chk_tag = '';

	

	if(tag_display=="1")

	{

		var j=0;

		var tags = document.frm_rtag.Rtag;

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

		{

			if(tags[i].checked)

			{

				if(j==0)

				chk_tag += tags[i].value;

				else

				chk_tag += ','+tags[i].value;

				

				j++;

			}

		}

	}

	

	jQuery("#txt_add_list").autocomplete("suggestListAjax.php?mode=add_list&rtag="+chk_tag, {

			minChars: 0,

			matchContains: "word",

			multiple: true,

			mustMatch: false,

			autoFill: false,

			formatItem: formatItem_new,

			formatResult: formatResult_new

		});

}



function txtChange_addlist_prof(field_name,tag_display)

{

	 var chk_tag = '';

	

	if(tag_display=="1")

	{

		var tags = document.getElementById('frm_rtag_'+field_name).Rtag;

		var j=0;

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

		{

			if(tags[i].checked)

			{

				if(j==0)

				chk_tag += tags[i].value;

				else

				chk_tag += ','+tags[i].value;

				

				j++;

			}

		}

	}

	

	jQuery("#txt_add_list_"+field_name).autocomplete("suggestListAjax.php?mode=add_list&rtag="+chk_tag, {

			minChars: 0,

			matchContains: "word",

			multiple: true,

			mustMatch: false,

			autoFill: false,

			formatItem: formatItem_new,

			formatResult: formatResult_new

		});

	

}



function txtChange_removelist_prof(field_name,tag_display)

{

	var chk_tag = '';

	

	if(tag_display=="1")

	{

		var tags = document.getElementById('frm_rtag_'+field_name).Rtag;	

		var j=0;

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

		{

			if(tags[i].checked)

			{

				if(j==0)

				chk_tag += tags[i].value;

				else

				chk_tag += ','+tags[i].value;

				

				j++;

			}

		}

	}

	

	jQuery("#txt_remove_list_"+field_name).autocomplete("suggestListAjax.php?mode=remove_list&rtag="+chk_tag, {

			minChars: 0,

			matchContains: "word",

			multiple: true,

			mustMatch: false,

			autoFill: false,

			formatItem: formatItem_new,

			formatResult: formatResult_new

		});

}





function apply_my_privacy(tag_display)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var act = document.getElementById('activity').value;

	

	var param = '';

	

	if(act == 'Scrib' || act == 'Events' || act == 'Groups' || act == 'Tasks' || act == 'Kharcha')

	{

		var chk_tag = '';

		

		if(tag_display=="1")

		{

			var j=0;	

			var tags = document.frm_rtag.Rtag;

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

			{

				if(tags[i].checked)

				{

					if(j==0)

					chk_tag += tags[i].value;

					else

					chk_tag += ','+tags[i].value;

					

					j++;

				}

			}

		}

		

		param += getPrivacyParam(act);

		param += "&act_ids="+getActivityParam(act);

		param += "&rtag="+chk_tag;

		

		var post_param = "action=save_privacy_organization&"+param;

		

		var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					alert(response);

				}

			});

		

	}

	else

	{

		alert("You can not set privacy for this activity");	

		return false;			

	}

}



function apply_scrib_privacy(tag_display,field_name)

{

	url = SITE_URL+'members/commonAjax.php';

	

	var param = 'field_name='+field_name;

		

		if(document.getElementById('only_me_'+field_name).checked)

		param += "&me=1";

		else

		param += "&me=0";

		

		if(document.getElementById('everyone_'+field_name).checked)

		param += "&pub=1";

		else

		param += "&pub=0";

		

		if(document.getElementById('friend_'+field_name).checked)

		param += "&frn=1";

		else

		param += "&frn=0";

		

		if(document.getElementById('foaf_'+field_name).checked)

		param += "&foaf=1";

		else

		param += "&foaf=0";

		

		if(document.getElementById('add_list_'+field_name).checked)

		{

			param += "&add=1";

			param += "&add_list="+document.getElementById('txt_add_list_'+field_name).value;

		}

		else

		{

			param += "&add=0";

		}



		if(document.getElementById('remove_list_'+field_name).checked)

		{

			param += "&remove=1";

			param += "&remove_list="+document.getElementById('txt_remove_list_'+field_name).value;

		}

		else

		{

			param += "&remove=0";

		}

		

		if(document.getElementById('def_setting_'+field_name).checked)

		param += "&def=1";

		else

		param += "&def=0";

		

		var chk_tag = '';

		

		if(tag_display=="1")

		{

			var tags = document.getElementById('frm_rtag_'+field_name).Rtag;

		

			if('undefined' != typeof(tags.length))

			{

				var j=0;

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

				{

					if(tags[i].checked)

					{

						alert("chked="+tags[i].value);

						

						if(j==0)

						chk_tag += tags[i].value;

						else

						chk_tag += ','+tags[i].value;

						

						j++;

					}

				}

			}

			else

			{

				if(typeof(tags)=="object")

				{

					if(tags.checked)

					{	

						chk_tag += tags.value;

					}

				}

			}

		}

	

	param += "&activity=Scrib";

	param += "&act_ids="+field_name;

	param += "&rtag="+chk_tag;

	

	var post_param = "action=save_privacy_organization&"+param;

		

		var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					alert(response);

					document.getElementById('scribid_'+field_name+'_privacy').style.display='none';

				}

			});

}



function getPrivacyParam(act)

{

	var param = 'activity='+act;

		

	if(act == 'Scrib' || act == 'Events' || act == 'Groups' || act == 'Tasks' || act == 'Kharcha')

	{

		if(document.getElementById('only_me').checked)

		param += "&me=1";

		else

		param += "&me=0";

		

		if(document.getElementById('everyone').checked)

		param += "&pub=1";

		else

		param += "&pub=0";

		

		if(document.getElementById('friend').checked)

		param += "&frn=1";

		else

		param += "&frn=0";

		

		if(document.getElementById('foaf').checked)

		param += "&foaf=1";

		else

		param += "&foaf=0";

		

		if(document.getElementById('add_list').checked)

		{

			param += "&add=1";

			param += "&add_list="+document.getElementById('txt_add_list').value;

		}

		else

		{

			param += "&add=0";

		}

		

		if(document.getElementById('remove_list').checked)

		{

			param += "&remove=1";

			param += "&remove_list="+document.getElementById('txt_remove_list').value;

		}

		else

		{

			param += "&remove=0";

		}

		

		if(document.getElementById('def_setting').checked)

		param += "&def=1";

		else

		param += "&def=0";

		

	}

	else

	{

		return param;

	}

	

	return param;

}



function getActivityParam(act)

{

	

	var chk_act='';

	

	if(act == 'Scrib' || act == 'Events' || act == 'Groups' || act == 'Tasks' || act == 'Kharcha')

	{

		if(act=='Scrib')

		var chk = document.activity.Scrib;

		else if(act=='Events')

		var chk = document.activity.Events;

		else if(act=='Groups')

		var chk = document.activity.Groups;

		else if(act=='Tasks')

		var chk = document.activity.Tasks;

		else if(act=='Kharcha')

		var chk = document.activity.Kharcha;

		

		var j=0;



		if('undefined' != typeof(chk.length))

		{

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

			{

				if(chk[i].checked)

				{

					if(j==0)

					chk_act += chk[i].value;

					else

					chk_act += ','+chk[i].value;

					

					j++;

				}

			}

		}

		else

		{

			if(typeof(chk)=="object")

			{

				if(chk.checked)

				{

					chk_act += chk.value;

				}

			}

		}

		

		return chk_act;

	}

	else

	{

		return '';

	}

}



function apply_profile_privacy(field_name,tag_display)

{

		url = SITE_URL+'members/commonAjax.php';

		

		var param = 'field_name='+field_name;

		

		if(document.getElementById('only_me_'+field_name).checked)

		param += "&me=1";

		else

		param += "&me=0";

		

		if(document.getElementById('everyone_'+field_name).checked)

		param += "&pub=1";

		else

		param += "&pub=0";

		

		if(document.getElementById('friend_'+field_name).checked)

		param += "&frn=1";

		else

		param += "&frn=0";

		

		if(document.getElementById('foaf_'+field_name).checked)

		param += "&foaf=1";

		else

		param += "&foaf=0";

		

		if(document.getElementById('add_list_'+field_name).checked)

		{

			param += "&add=1";

			param += "&add_list="+document.getElementById('txt_add_list_'+field_name).value;

		}

		else

		{

			param += "&add=0";

		}



		if(document.getElementById('remove_list_'+field_name).checked)

		{

			param += "&remove=1";

			param += "&remove_list="+document.getElementById('txt_remove_list_'+field_name).value;

		}

		else

		{

			param += "&remove=0";

		}

		

		var chk_tag = '';

		

		

		if(tag_display=="1")

		{

			var tags = document.getElementById('frm_rtag_'+field_name).Rtag;

		

			var j=0;

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

			{

				if(tags[i].checked)

				{

					if(j==0)

					chk_tag += tags[i].value;

					else

					chk_tag += ','+tags[i].value;

					

					j++;

				}

			}

		}

		

		var post_param = "action=save_privacy_profile&"+param;

		

		var myAjax = new Ajax.Request(

			url,

			{

				method: 'post',

				parameters: post_param,

				onComplete: function(msg){

					var response = msg.responseText;

					alert(response);

				}

			});

}

function report_abuse(div_id,txt_id,myid,userid,itemid,foritem)
{
	url = SITE_URL+'members/commonAjax.php';
	
	var param = "";
	
	param += "&byuser="+myid;
	param += "&foruser="+userid;
	param += "&item_id="+itemid;
	param += "&foritem="+foritem;
	param += "&comment="+document.getElementById(txt_id).value;
	
	var post_param = "action=report_abuse&"+param;
	
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: post_param,
			onComplete: function(msg){
				var response = msg.responseText;
				alert(response);
				document.getElementById(div_id).style.display='none';
			}
		});
}


/**
 * It will give slide in-out effect to html container
 * @access public
 * @return void
 * Creadted by Patel Alice: 
 * Creadted Date : 29-09-2009
 * Last Updated by Patel Alice:
 * Last Updated Date : 29-09-2009
 **/
 
function html_slider(div_id)
{
	jQuery("#"+div_id).slideToggle("slow");
}
