/* function make the MAIN DIV visibility as visible and display as show ***/
var SERVER_PATH,IMG_PATH;
var js_country_for_city = "";

var mouse_on_expint = false;
var arr_exp_int = new Array(); //Array of ids of which profile is expanded.
	
var ppg_loading = 0;
var frmob;
//Variables used in transition effect.
var prepage_inner_html = ""; //Stores loading icon div
var transition_delay = 500; // Delay for tranisiton handling
var firstdiv_ht = 0; //Stores default profile div height
var firstdiv_wd = 0; //Stores default profile div width
var seconddiv_ht = 0; //Stores mini profile div height

// Following function added to supplement for Array.indexOf in IE.
if(!Array.indexOf){
	Array.prototype.indexOf = function(obj){
	for(var i=0; i<this.length; i++)
	{
		if(this[i]==obj)
		{
			return i;
		}
	}
	return -1;
	}
}

function submit_cannedsearch_mul(flag_from,div_id_mul,valentine)
{
	var rad_val = "";
	for (var i=0; i < document.expressval.personilze.length; i++)
	{
	if (document.expressval.personilze[i].checked)
	  {
		rad_val = document.expressval.personilze[i].value;
	  }
   }

	if(rad_val == "")
	{
		if(document.getElementById("personalisedmessage1"))
		{
			rad_val  = document.getElementById("personalisedmessage1").value;
		}
	}
	else if(rad_val == "none")
	{
		rad_val  = "";
	}

	var valentine_url = '';
	if(valentine == 'true' )
	{
		var val = "";
		for (var i=0; i < document.expressval.giftoption1.length; i++)
		{
		if (document.expressval.giftoption1[i].checked)
		  {
			val = document.expressval.giftoption1[i].value;
		  }
	   }
		valentine_url = "&gift_option="+escape(val);
	}

	var extend_url = "";
	var exp_send_password = document.expressval.send_password;
	if(exp_send_password && exp_send_password.checked==true)
	{
		extend_url = "&send_password="+escape(exp_send_password.value);
	}


	var file_url = frmob.go.value+'&personalisedmessage='+escape(rad_val)+extend_url+valentine_url;
	submit_express_interest_multiple(div_id_mul,frmob,file_url,flag_from);

    $.tweenbox.tearDown();

    $("#" + div_id_mul).show();
}

function mediator_search_page_multiple(div_id_mul,frmobject,file_url,flag_from)
{
	profile_position = ''; // fixed by nivedita
	var len = document.frmExpressIntrest.chkexpressint.length;
	profileid = ''; 
	var arr_ids = new Array();
	var j =0;
	var arr_position = new Array(); // array to store profile position on search page
	if(len){
		for(var i=0; i < len; i++)
		{
			if(document.frmExpressIntrest.chkexpressint[i].checked)
			{
				arr_position.push(i+1); // store profile position on search page
				
				if(document.frmExpressIntrest.chkexpressint[i].disabled == false)
				{
					arr_ids[j] = document.frmExpressIntrest.chkexpressint[i].value;
					j++;
				}
			}
		}

		var w1  = implode(',',arr_ids );
 		profileid = w1;

		profile_position = implode(',',arr_position );
	}

	if(len == null)
	{
		if(document.frmExpressIntrest.chkexpressint.checked)
		{
			if(document.frmExpressIntrest.chkexpressint.disabled == false)
			{
				profileid = document.frmExpressIntrest.chkexpressint.value
			}
		}
	}
	frmobject.go.value = file_url;
	if(frmobject.per_msg.value == 1)
	{
		from_personalise_link = 'true';
	}
	else
	{
		from_personalise_link = 'false';
	}

	var extend_url = "";
	var ihid=frmobject.getElementsByTagName('input');
	for (inum=0;inum<ihid.length-1;inum++)
	{
		if(ihid[inum].name=="show_send_password")
		{	
			extend_url += "&show_send_password="+ihid[inum].value.toString();
		}
	}

	frmob=frmobject;
	var t = this.title || this.name || this.href || null;
	$("body").css("overflow", "hidden");

	var pos = function(){ $.tweenbox.position($('#tweenContent')[0]); };
	try{
	var setup=false;var url ="express.php?msg="+from_personalise_link.toString()+"&canned=true"+"&searchpage=yes"+"&multiple=yes"+"&flag_from="+flag_from+"&div_id_mul="+div_id_mul+extend_url+'&profileids='+profileid+'&profile_pos='+profile_position;
	}catch(e)
	{
	}

	try{
	$("body").tweenbox("express.php?msg="+from_personalise_link.toString()+"&canned=true"+"&searchpage=yes"+"&multiple=yes"+"&flag_from="+flag_from+"&div_id_mul="+div_id_mul+extend_url+'&profileids='+profileid+'&profile_pos='+profile_position);
		}catch(e)
		{
		}

	return false;
}


function mediator_search_page(frmobject,file_url,link_name,profileid,IMG_PATH, from_personalise_link,current_link_desc,sTextArea, sTextInput, iMaxLimit)
{
	frmob=frmobject;
	var extend_url = "";
	var ihid=frmobject.getElementsByTagName('input');
	for (inum=0;inum<ihid.length-1;inum++)
	{
		if(ihid[inum].name=="show_send_password")
		{	
			extend_url += "&show_send_password="+ihid[inum].value.toString();
		}
	}

	if(file_url == '/ssi/p-action/acceptdecline.php')
	{
		var check =	frmob.check.value;
		if(link_name == "Declined_Member")
		{
			accept_decline = 'false';
		}
		else if(link_name == "Accepted_Member")
		{
			accept_decline = 'true';
		}
		else
		{
			if(frmob.acceptdecline[0].checked)
			{
				accept_decline = 'true';
			}
			else
			{
				accept_decline = 'false';
			}
		}
		var t = this.title || this.name || this.href || null;
		$("body").css("overflow", "hidden");

		var pos = function(){ $.tweenbox.position($('#tweenContent')[0]); };
		try{
			
		var setup=false;var url ="interest-accept.php?msg="+from_personalise_link.toString()+"&canned=true"+"&profileid="+profileid+"&searchpage=yes"+"&filter="+link_name.toString()+"&img_http_url="+IMG_PATH.toString()+"&current_link_desc="+current_link_desc.toString()+"&check="+check.toString()+"&accept_decline="+accept_decline.toString()+extend_url;
		}catch(e)
		{
		}

		try{
		$("body").tweenbox("interest-accept.php?msg="+from_personalise_link.toString()+"&canned=true"+"&profileid="+profileid+"&searchpage=yes"+"&filter="+link_name.toString()+"&img_http_url="+IMG_PATH.toString()+"&current_link_desc="+current_link_desc.toString()+"&check="+check.toString()+"&accept_decline="+accept_decline.toString()+extend_url);
			}catch(e)
			{
			}

		return false;
	}
	else
	{
		var t = this.title || this.name || this.href || null;

		$("body").css("overflow", "hidden");

		var pos = function(){ $.tweenbox.position($('#tweenContent')[0]); };

		try{
		var setup=false;var url ="express.php?msg="+from_personalise_link.toString()+"&canned=true"+"&profileid="+profileid+"&searchpage=yes"+"&filter="+link_name.toString()+"&img_http_url="+IMG_PATH.toString()+"&current_link_desc="+current_link_desc.toString()+extend_url;
		}catch(e)
		{
		}

		try{
		$("body").tweenbox("express.php?msg="+from_personalise_link.toString()+"&canned=true"+"&profileid="+profileid+"&searchpage=yes"+"&filter="+link_name.toString()+"&img_http_url="+IMG_PATH.toString()+"&current_link_desc="+current_link_desc.toString()+extend_url);
			}catch(e)
			{
			}
		return false;
	}
}
function submit_canned_search_accept_decline(filter,profileid,img_http_url,current_link_desc,contact,valentine)
{
	var personalisedmessage = "";
	for (var i=0; i < document.acceptdeclineval.personilze.length; i++)
	{
	  if (document.acceptdeclineval.personilze[i].checked)
      {
		 var rad_val = document.acceptdeclineval.personilze[i].value;
      }
    }
	
	if(contact == 'Accepted' && rad_val == "I like your profile however please provide the following details")
	{
		var total="" ;
		if (typeof document.acceptdeclineval.checkselected.length != "undefined")
		{
		// multiple checkboxes with the same name
			for(var j=0; j < document.acceptdeclineval.checkselected.length; j++)
			{
				if(document.acceptdeclineval.checkselected[j].checked)
				{
					total +=document.acceptdeclineval.checkselected[j].value + "|";
				}
			}
		}
		else
		{
			// only one checkbox
			if(document.acceptdeclineval.checkselected.checked)
			{
				total +=document.acceptdeclineval.checkselected.value + "|";
			}
		}
		if(total == "")
		{
			document.getElementById("accept_error").style.display = "block";
			document.getElementById("radio_bg2").style.border = "solid 2px #CC0000";
			return false;
		}
		total= total.slice(0, -1);
		personalisedmessage = rad_val+": "+total;
		
	} 
	else
	{
		personalisedmessage = rad_val;
	}
	if(personalisedmessage == "")
	{
		if(document.getElementById("personalisedmessage1"))
		{
			personalisedmessage  = document.getElementById("personalisedmessage1").value;
		}
	}
	else if(personalisedmessage == "none")
	{
		personalisedmessage  = "";
	}

	if(contact == 'Accepted-from-layer')
	{
		personalisedmessage = "Accepted-from-layer";
		contact = 'Accepted';
	}
	try
	{
		frmob.acceptdecline.value = contact;
	}
	catch(e)
	{
	}

	
	var valentine_url="";
	if(valentine == 'true')
	{
		var valentine_val = "";
		for (var i=0; i < document.acceptdeclineval.giftoption1.length; i++)
		{
		if (document.acceptdeclineval.giftoption1[i].checked)
		  {
			valentine_val = document.acceptdeclineval.giftoption1[i].value;
		  }
	   }
		valentine_url = "&gift_option="+escape(valentine_val);
	}
	
	var extend_url = "";
	var exp_send_password = document.acceptdeclineval.send_password;
	if(exp_send_password && exp_send_password.checked==true)
	{
		extend_url = "&send_password="+escape(exp_send_password.value);
	}

	submit_express_interest(frmob,'/ssi/p-action/acceptdecline.php?personalisedmessage='+escape(personalisedmessage)+extend_url+valentine_url,filter,profileid,img_http_url, 'yes',current_link_desc,'personalisedmessage',personalisedmessage,1000);

    $.tweenbox.tearDown();

    $("#show_main_div").show();

	 return false;
}
function submit_cannedsearch(filter,profileid,img_http_url,current_link_desc,valentine)
{
	var rad_val = "";
	for (var i=0; i < document.expressval.personilze.length; i++)
	{
	if (document.expressval.personilze[i].checked)
	  {
		rad_val = document.expressval.personilze[i].value;
	  }
   }
 
	if(rad_val == "")
	{
		if(document.getElementById("personalisedmessage1"))
		{
			rad_val  = document.getElementById("personalisedmessage1").value;
		}
	}
	else if(rad_val == "none")
	{
		rad_val  = "";
	}
	
	var valentine_url = '';
	if(valentine == 'true' )
	{
		var val = "";
		for (var i=0; i < document.expressval.giftoption1.length; i++)
		{
		if (document.expressval.giftoption1[i].checked)
		  {
			val = document.expressval.giftoption1[i].value;
		  }
	   }
		valentine_url = "&gift_option="+escape(val);
	}
	
	var extend_url = "";
	var exp_send_password = document.expressval.send_password;
	if(exp_send_password && exp_send_password.checked==true)
	{
		extend_url = "&send_password="+escape(exp_send_password.value);
	}

	submit_express_interest(frmob,'/ssi/p-action/contact.php?personalisedmessage='+escape(rad_val)+extend_url+valentine_url,filter,profileid,img_http_url, 'yes',current_link_desc,'personalisedmessage',rad_val,1000);
    
    $.tweenbox.tearDown();

    $("#show_main_div").show();
    
}

function check_if_all_values_selected(chk_name, hidden_field)
{

	var all_castes_selected = true;

	for(i=0; i< chk_name.length; i++)
	{
		if(!chk_name[i].value) 
			continue;
		if(!chk_name[i].checked)
		{
			all_castes_selected = false;
			break;
		}
	}

	if(all_castes_selected == true)
	{
		for (counter = 0; counter < chk_name.length; counter++)
				chk_name[counter].checked=!chk_name[counter].value;

		if(hidden_field)
		{
			hidden_field.value = "";
		}
	}

	return true;
}

function show_hide_sort_drop_down(show_hide)
{
	try
	{
		if(fn_js_featuredmatch_yn=='Y')
		{
			return true;
		}
	}
	catch (err)
	{
	}

	if(document.getElementById('sort_drop_drown'))
		document.getElementById('sort_drop_drown').style.display=show_hide;
}

function check_uncheck_obj(current_field, all_objs, val)
	{
	if(current_field.checked)
	{			
			if(!val)
			{		
			for (counter = 0; counter < all_objs.length; counter++)
				if(all_objs[counter].value)
					all_objs[counter].checked=false;
			}
			else 
			{			
			all_objs[0].checked=false;
		} 
	} // EO if(current_field.checked)
} // EO function check_uncheck_obj(current_field, all_objs, val)



function data_updated(frm, current_field)
{
	var all_objs = new Array();
	eval("all_objs = frm." + current_field.name);

	if(!all_objs)
		return false;

	check_uncheck_obj(current_field, all_objs, current_field.value);
	return true;
}

function maximize_minimize(obj,div_id)
{
	var hideControls	= document.getElementById('show_refine_sub_div');
	var hideControls_1	= document.getElementById(div_id+'_1');
	var hideControls_2	= document.getElementById(div_id+'_2');
	if (obj.id == "minimize")
	{
		hideControls.style.display='none';
		hideControls_1.style.display='none';
		hideControls_2.style.display='none';
		obj.id = "maximize";
		obj.src = IMG_PATH + "/imgs/bullet/plus-symbol.jpg";
		document.cookie = "max_min=minimize;";

		if(document.getElementById('religion1'))
			hide_div("religion1");

		if(document.getElementById('mothertongue_div'))
			hide_div("mothertongue_div");
	}
	else
	{
		hideControls_1.style.display='block';
		hideControls_2.style.display='block';
		obj.id = "minimize";
		obj.src = IMG_PATH + "/imgs/bullet/minus-symbol.jpg";
		document.cookie = "max_min=maximize;";
	}

}//EO function maximize_minimize(obj,div_id)

function check_keyword_refine(obj)
{
	var _iMinLength = 4;

	myString = new String(obj.value);
	var keyword = myString.trim();

	if(keyword && keyword.length < _iMinLength)
	{
		alert('Please enter atleast '+_iMinLength+' characters.');
		return false;
	}

	return true;

} // EO function check_keyword()

function restrict_selection(source_obj_name)
{
	var max = source_obj_name.countryarray.length;
	var total = 0;
	for (counter = 0; counter < source_obj_name.countryarray.length; counter++)
	{
		if(source_obj_name.countryarray[counter].checked)
		{
			total += 1;
			//var hidden_val
		}
		if(total > 10)
		{
			alert("You can select Max 10 values.");
			return false;
		}
	}
}


function show_div(showControls, b)
{
   if(showControls)
  {
	var temp_b = b; // To position the favorite div popup position of Add to favorite/Favorite link.
	var link_substr = b.id.substr(0,8);
	var curleft = curtop = 0;

	var flag = false; // To position the favorite div popup position of Add to favorite/Favorite link.
	if (b.offsetParent) {
		do {
			curleft += b.offsetLeft;
			curtop += b.offsetTop;
			if(b.id == temp_b.id.substr(9)+'first_div' && in_array(temp_b.id.substr(9)+'first_div',arr_exp_int)) flag=true;// To position the favorite div popup position of Add to favorite/Favorite link.
		} while (b = b.offsetParent);
	}

	if(showControls.getAttribute("id") != "show-add-to-fav-msg")
	{
		showControls.style.top = curtop-125;
		showControls.style.left = curleft-165;
	}
	else
	{
		showControls.style.top = curtop+15;
		showControls.style.left = curleft;
		
		//PSL phase II bug fixes
		//To position the 'add to fav' box as per position of Add to favorite/Favorite link inside mini profile.
		var IE = document.all ? true : false;
		
		if(IE && (flag==true) && link_substr =="fav_link")
		{
			showControls.style.top = curtop+80;
			showControls.style.left = curleft+95;
		}
		else if(!temp_b.offsetParent && link_substr =="fav_link")
		{
			obj = document.getElementById(temp_b.id.substr(9));
			if (obj.offsetParent) {
				do {
					curleft += obj.offsetLeft;
					curtop += obj.offsetTop;
				} while (obj = obj.offsetParent);
			}
			showControls.style.top = curtop+145;
			showControls.style.left = curleft+2;
		}
		div_disp = false;
		setTimeout(function(){div_disp = true;},100);
 
	} // EO if(div_id != "show-add-to-fav-msg")
	if (link_substr == "featured")
	{
		c = document.getElementById("featured_members_div");
		cur_left = c.offsetLeft;
		if (c.offsetParent) {
				do {
					cur_left += c.offsetLeft;
				} while (c = c.offsetParent);
			}
		total_width = cur_left + 556;
		if (eval(curleft)+256 > total_width)
		{
			curleft = curleft - (118);
		}
		curtop += 13;
		showControls.style.left = curleft;
		showControls.style.top = curtop
	}
	else if(link_substr == "refinely")
	{
		showControls.style.top = curtop+26;
		showControls.style.left = curleft;
	}

	showControls.style.visibility='visible';
	showControls.style.display='block';

  }//EO if(showControls)

}//EO function show_div(div_id)



/* function make the send her/him personalised message DIV visibility as visible and display as show ***/

//PSL-EN 4 Function call for Hiding  Div//

function show_hidden_person_div(hidden_person_id)
{
	var showhidden_person = document.getElementById(hidden_person_id);

	if(showhidden_person)
	 {
		showhidden_person.style.visibility='visible';
		showhidden_person.style.display='block';
	}//EO if(hideControls)
}


/* function make the MAIN DIV visibility as hidden and display as hide ***/
function hide_div(div_id)
{
  var hideControls = document.getElementById(div_id);
  if(hideControls)
  {
	// Show "Sort Order By" drop down
	show_hide_sort_drop_down("block");

	hideControls.style.visibility='hidden';
	hideControls.style.display='none';
  }//EO if(hideControls)
}//EO function hide_div(div_id)



/* following function is used to handle response of express interest, accept interest,decline interest... and so on **/

var confirm_msg = false;

//PSL -PhaseII-bugfix
/*
*@author prajakta
*function to handle onclick event of submit express intrest
*/

function submit_express_interest_multiple(multi_exp_div,frmobject,file_url,flag_from)
{
	//PSL PHASE II Bugfixes (Changing the link names and makeing the checkboxes disabled --on multi express intrest without reloading the the page)
	if(flag_from == '1')
	{
		profileid_nt_filt_canl = frmobject.profileid_nt_filt_canl.value
		 if(profileid_nt_filt_canl != '')
		 {
			profileid_nt_filt_canl = profileid_nt_filt_canl.split(',');
			arr_profileid_nt_filt_canl = explodeArray(profileid_nt_filt_canl,',');
 			for(i=0;i<arr_profileid_nt_filt_canl.length;i++)
			{
				 ar = arr_profileid_nt_filt_canl[i];
				 lnk = "link_change_id_"+ar
				 //document.getElementById(lnk).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'>Send Reminder&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>"; 
				 document.getElementById(lnk).innerHTML = "";
				 lnk_expand = "link_change_id1_"+ar;
				 var lnk_expand_obj = document.getElementById(lnk_expand);
				 if(lnk_expand_obj)
				 {
 					lnk_expand_obj.innerHTML = "<span style='font:normal 11px verdana;'><b>You have already expressed interest in this member</b></span>";
				 }
				 chkexpressint_id=ar+"chkexpressint";
				 document.getElementById(chkexpressint_id).disabled=true;
				 document.getElementById(chkexpressint_id).checked=false;
				 div_top_bar = ar+'main_expdiv';
				 validate_multiple(div_top_bar,chkexpressint_id);
			}
		 }
	}
	else if(flag_from == '2')
	{
		if(frmobject.chk_filtered.checked)
		{
			profileid_filtered = frmobject.profileid_filtered.value
			
			if(profileid_filtered != '')
			{
				profileid_filtered = profileid_filtered.split(',')
				arr_profileid_filtered = explodeArray(profileid_filtered,',');
				for(i=0;i<arr_profileid_filtered.length;i++)
				{
					lnk = "link_change_id_"+arr_profileid_filtered[i];
					ar = arr_profileid_filtered[i]
					document.getElementById(lnk).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'>Filtered Member&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>";
					chkexpressint_id=ar+"chkexpressint";

					lnk_expand = "link_change_id1_"+arr_profileid_filtered[i];
				    var lnk_expand_obj = document.getElementById(lnk_expand);
				    if(lnk_expand_obj)
				    {
						document.getElementById(lnk_expand).innerHTML = "<span style=\"color: #FF0000;\"><b>You have been filtered by this member.</b></span>";
					}

					document.getElementById(chkexpressint_id).disabled=true;
					document.getElementById(chkexpressint_id).checked=false;
					div_top_bar = ar+'main_expdiv';
					validate_multiple(div_top_bar,chkexpressint_id);
			    }
		     }
		  }
	 }
	 else if(flag_from == '3')
	 {
		if(frmobject.chk_filtered.checked)
		{
			profileid_filtered = frmobject.profileid_filtered.value;
			
			if(profileid_filtered != '')
			{
				profileid_filtered = profileid_filtered.split(',')
				arr_profileid_filtered = explodeArray(profileid_filtered,',');
				for(i=0;i<arr_profileid_filtered.length;i++)
				{
					ar = arr_profileid_filtered[i];
					lnk = "link_change_id_"+arr_profileid_filtered[i];
					
					//document.getElementById(lnk).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'>Send Reminder&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>";
					document.getElementById(lnk).innerHTML = "";

					lnk_expand = "link_change_id1_"+arr_profileid_filtered[i];
					var lnk_expand_obj = document.getElementById(lnk_expand);
					if(lnk_expand_obj)
				    {
						document.getElementById(lnk_expand).innerHTML = "<span><b>You have already expressed interest in this member</b></span>";
					}
					chkexpressint_id=ar+"chkexpressint";
					document.getElementById(chkexpressint_id).disabled=true;
					document.getElementById(chkexpressint_id).checked=false;
					div_top_bar = ar+'main_expdiv'
					validate_multiple(div_top_bar,chkexpressint_id)				
				}
			 }
		 }

		 if(frmobject.chk_cancelled.checked)
		 {
			profileid_cancelled = frmobject.profileid_cancelled.value
			if(profileid_cancelled != '')
			{
				profileid_cancelled = profileid_cancelled.split(',')
				arr_profileid_cancelled = explodeArray(profileid_cancelled,',');
				for(i=0;i<arr_profileid_cancelled.length;i++)
				{
					ar = arr_profileid_cancelled[i];
					lnk = "link_change_id_"+arr_profileid_cancelled[i];
					
					//document.getElementById(lnk).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'>Send Reminder&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>";
					document.getElementById(lnk).innerHTML = "";

					lnk_expand = "link_change_id1_"+arr_profileid_cancelled[i];
				    var lnk_expand_obj = document.getElementById(lnk_expand);
				    if(lnk_expand_obj)
				    {
						document.getElementById(lnk_expand).innerHTML = "<span ><b>You have already expressed interest in this member</b></span>";
					}

					chkexpressint_id1=ar+"chkexpressint";
					document.getElementById(chkexpressint_id).checked=false;
					document.getElementById(chkexpressint_id).disabled=true;
					div_top_bar1 = ar+'main_expdiv';
	 				document.getElementById(div_top_bar1).style.backgroundImage="url("+IMG_PATH+"/imgs/background/search-header-bg-1.gif)";
				}
			 }
		  }
	 }
	 else if(flag_from == '4')
	{
		if(frmobject.chk_cancelled.checked)
		{
			profileid_cancelled = frmobject.profileid_cancelled.value
		
			if(profileid_cancelled != '')
			{
				profileid_cancelled = profileid_cancelled.split(',')
				arr_profileid_cancelled = explodeArray(profileid_cancelled,',');
				for(i=0;i<arr_profileid_cancelled.length;i++)
				{
					ar = arr_profileid_cancelled[i];
					lnk = "link_change_id_"+arr_profileid_cancelled[i];
					
					//document.getElementById(lnk).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'>Send Reminder&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>";
					document.getElementById(lnk).innerHTML = "";
					
					lnk_expand = "link_change_id1_"+arr_profileid_cancelled[i];
					var lnk_expand_obj = document.getElementById(lnk_expand);
				    if(lnk_expand_obj)
				    {
						document.getElementById(lnk_expand).innerHTML = "<span style='font:normal 11px verdana; color:#0066CC;'><b>You have already expressed interest in this member</b></span>";
					}

					chkexpressint_id=ar+"chkexpressint";
					document.getElementById(chkexpressint_id).disabled=true;
					document.getElementById(chkexpressint_id).checked=false;
					div_top_bar = ar+'main_expdiv';
 					document.getElementById(div_top_bar).style.backgroundImage="url("+IMG_PATH+"/imgs/background/search-header-bg-1.gif)";
				}
			 }
		 }
	 }
	var img = "<table border=\"0\" cellpadding=\"0\" width=\"100%\" cellspacing=\"0\" align=\"left\" style=\"height:120px;\" valign=\"top\"><tr><td class=\"top_left_png\" align=\"left\"></td><td class=\"top_middle_png\"></td><td class=\"top_right_png\"></td></tr><tr><td class=\"left_border_png\" align=\"left\" align=\"top\"></td><td bgcolor=\"#ffffff\" style=\" font: normal 11px verdana;\" valign=\"middle\" align=\"center\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax.gif\"></td><td class=\"right_border_png\"></td></tr><tr><td class=\"bottom_left_png\"></td><td class=\"bottom_middle_png\"></td><td class=\"bottom_right_png\"></td></tr></table>";
 	frmobject.action=file_url;
	var status = AjaxRequest.submit(frmobject,{
		'onLoading':function(req){
				document.getElementById(multi_exp_div).innerHTML= img;
				//PSL PHASE II Bugfixes
				// Code to fix sortby selection box display above popup in IE.

				if(document.all)
				{
					var ifr = document.createElement("iframe");
					var div_ref = document.getElementById(multi_exp_div);

					if(ifr !=null && div_ref !=null){
						ifr.style.setAttribute('position', 'absolute');
						ifr.frameBorder = 0;
						ifr.scrolling = 'no';
						ifr.style.top = '8px';
						ifr.style.left = '5px';
						ifr.style.width = get_element_width(div_ref) - 13 + 'px';
						ifr.style.height = get_element_height(div_ref) -22 + 'px';
						ifr.style.zIndex = - 1;
						ifr.style.display = "block";
						div_ref.appendChild(ifr);
					}
				}
			}
		,'onSuccess':function(req){
			 document.getElementById(multi_exp_div).innerHTML = req.responseText;

			//PSL PHASE II Bugfixes
			// Code to fix sortby selection box display above popup in IE.
			
			if(document.all)
			{
				var ifr = document.createElement("iframe");
				var div_ref = document.getElementById(multi_exp_div);

				if(ifr !=null && div_ref !=null && div_ref.innerHTML){
					ifr.style.setAttribute('position', 'absolute');
					ifr.frameBorder = 0;
					ifr.scrolling = 'no';
					ifr.style.top = '8px';
					ifr.style.left = '5px';
					ifr.style.width = get_element_width(div_ref) - 13 + 'px';
					ifr.style.height = get_element_height(div_ref) -22 + 'px';
					ifr.style.zIndex = - 1;
					ifr.style.display = "block";
					div_ref.appendChild(ifr);
				}
			}
		}
		,'timeout':30000
		,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
		,'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			}
		}
	)
} // EO function submit_express_interest_multiple()


function submit_express_interest(frmobject,file_url,link_name,profileid,IMG_PATH, from_personalise_link,current_link_desc,sTextArea, sTextInput, iMaxLimit)
{
	var img = "<span style=\"padding-left:75px;\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax.gif\"></span>";

		var member_express_interest = false;

		current_link_desc = typeof(current_link_desc) != 'undefined' ? current_link_desc : 'null';

		if(current_link_desc == 'member_express_interest')
		{
			if(frmobject.acceptdecline[0].checked == true)
			{
				member_express_interest = true;
				link_name = "Accepted Member";
			}

			if(frmobject.acceptdecline[1].checked == true)
			{
				member_express_interest = true;
				link_name = "Declined Member";
			}

			if(frmobject.acceptdecline[0].checked == false && frmobject.acceptdecline[1].checked == false)
			{
				member_express_interest = true;
				link_name = "Accepted Member";
			}
			if(sTextInput=='Accepted-from-layer')
			{
				member_express_interest = true;
				link_name = "Accepted Member";
			}
		}
	
		

	// to change the content inside the main div
	overwrite_sourceid = "show_inside_content_div_" + profileid;

	//to change the content from exress interest<-> send reminnder and so on
	td_id = "link_change_id_" + profileid;

	//PSL phase II to change the content from exress interest<-> send reminnder and so on in mini profile
	td_id_expand = "link_change_id1_" + profileid;

	//to hide and show the mail div id which was intially hide and show after click on link
	show_main_div_id = "show_main_div_" + profileid;

	if(confirm_msg == true)
	{

		   var answer = false;
		   answer = confirm("Are you sure you want to decline interest in this member?");

		   if(answer == false)
		   {
			   confirm_msg = false;
			   return false;
		   }
	}

	frmobject.action=file_url;
	var status = AjaxRequest.submit(frmobject,{
	'onLoading':function(req){
		document.getElementById("close_id").style.display="none";
		document.getElementById(overwrite_sourceid).innerHTML= img;
		if (window.ActiveXObject)
		{	var iframe_height = document.getElementById('show_main_div').offsetHeight - 30;
			if(document.getElementById('frame_id'))
			document.getElementById('frame_id').style.height= iframe_height+"px";
		}
		}
	,'onSuccess':function(req){

            //PSL PHASE II START(checkbox disable on single express intrest)
			chkexpressint_id=profileid+"chkexpressint";
			if (document.getElementById(chkexpressint_id))
			{
				document.getElementById(chkexpressint_id).checked=false;
				document.getElementById(chkexpressint_id).disabled=true;
				div_top_bar1 = profileid+'main_expdiv';
				document.getElementById(div_top_bar1).style.backgroundImage="url("+IMG_PATH+"/imgs/background/search-header-bg-1.gif)";
			}
			

        //PSL PHASE II END

        document.getElementById("close_id").style.display="block";
		if(link_name == "")
		{
			link_name_display = "Send Reminder";
		}
		else
		{
			link_name_display = link_name;
		}
		div_id_to_change = document.getElementById(td_id);
		if(div_id_to_change != null)
		{
			if(link_name_display != "Send Reminder")
			{
			document.getElementById(td_id).innerHTML = "<span class='smallbluelink'><img src='"+IMG_PATH+"/imgs/icons/icon-express-interest-default-panel.gif' align='absmiddle' hspace='5' border='0' vspace='1'  >"+link_name_display+"&nbsp;<img src='"+IMG_PATH+"/imgs/bullet/blue-arrow.gif' border='0' style='margin-bottom:-2px;'></span>";
			}
			else
			{
				document.getElementById(td_id).innerHTML = "";
			}
			//PSL phase II added to replace the send reminder in mini profile
			td_expand_express = document.getElementById(td_id_expand);			
			if(td_expand_express)
			{
     			td_expand_express.innerHTML = "<span><b>You have already expressed interest in this member</b></span>";
			}
			
		}
		div_id_to_change = document.getElementById("pos_featured_"+td_id);
		if(div_id_to_change != null)
		{
			div_id_to_change.innerHTML = "<span style='font:normal 11px verdana; color:#0066CC;'>"+link_name_display+"&nbsp;</span>";
		}

		if(link_name == 'Send Reminder')
		{
			if(current_link_desc == 'you_cancel_interest')
			{
				if(document.getElementById('cancel_#'+profileid) != null)
				{
					if(document.getElementById('cancel_#'+profileid).src)
					{
						document.getElementById('cancel_#'+profileid).src = IMG_PATH + "/imgs/icons/icon_open.gif";
						document.getElementById('cancel_#'+profileid).height = "14";
						document.getElementById('cancel_#'+profileid).vspace = "0";
						document.getElementById('cancel_#'+profileid).setAttribute("title", "Awaiting Response")
					}
				}
			}
			else
			{
				if(document.getElementById('trans-smile-'+profileid) != null)
				{
					document.getElementById('trans-smile-'+profileid).src = IMG_PATH + "/imgs/icons/icon_open.gif";
					document.getElementById('trans-smile-'+profileid).setAttribute("title", "Awaiting Response")
				}
			}
		}

		if(link_name == "Accepted Member" && member_express_interest == true)
		{
			if(document.getElementById('contact_#'+profileid) != null)
			{
				document.getElementById('contact_#'+profileid).src = IMG_PATH + "/imgs/icons/icon_accept.gif";
				document.getElementById('contact_#'+profileid).setAttribute("title", "Accepted")
			}
		}
		else if(link_name == "Declined Member" && member_express_interest == true)
		{
			if(document.getElementById('contact_#'+profileid) != null)
			{
				document.getElementById('contact_#'+profileid).src = IMG_PATH + "/imgs/icons/icon_decline.gif";
				document.getElementById('contact_#'+profileid).setAttribute("title", "Declined")
			}
		}
		else if(link_name == 'Declined Member')
		{
			if(document.getElementById('accept_#'+profileid) != null)
			{
				document.getElementById('accept_#'+profileid).src = IMG_PATH + "/imgs/icons/icon_decline.gif";
				document.getElementById('accept_#'+profileid).setAttribute("title", "Declined")
			}

		}else if(link_name == 'Accepted Member')
		{
			if(document.getElementById('decline_#'+profileid) != null)
			{
				document.getElementById('decline_#'+profileid).src = IMG_PATH + "/imgs/icons/icon_accept.gif";
				document.getElementById('decline_#'+profileid).setAttribute("title", "Accepted")
			}
		}
		else if(link_name == 'Cancel Interest')
		{
			if(document.getElementById('accept_#'+profileid) != null)
			{
				document.getElementById('accept_#'+profileid).src = IMG_PATH + "/imgs/icons/icon-heart-cancel.gif";
				document.getElementById('accept_#'+profileid).setAttribute("title", "Cancelled")
			}
		}
		
		document.getElementById(overwrite_sourceid).innerHTML = req.responseText;

		if (window.ActiveXObject)
		{	
			var iframe_height = document.getElementById('show_main_div').offsetHeight - 30;
			if(document.getElementById('frame_id'))
			document.getElementById('frame_id').style.height= iframe_height+"px";
		}

	}
	,'timeout':30000
	,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
	,'onError':function(req){
		alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
		}
	}
	)
	return status;
}


function send_password(file_url, overwrite_sourceid)
{
	var status = AjaxRequest.get(
	{
		'url':file_url
		,'onSuccess':function(req){
			show_hidden_person_div(overwrite_sourceid);
		}
		,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
	 }
	 );
}

/*
* @author prajakta
* this function implodes an array
*/
function implode( glue, pieces ) {

    return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces );
}
 

/*
*@author prajakta
*function for the dropdown (premium member case)-show
*/
function show_div_dropdown(div_dnd,div_exp,div_exp_over){
	if(!mouse_on_expint)
	{
		document.getElementById(div_dnd).style.display = 'block';
		document.getElementById(div_exp).style.display = 'none';
		document.getElementById(div_exp_over).style.display = 'block';
	}
}

/*
*@author prajakta
*function for the dropdown (premium member case)-hide
*/
function hide_div_dropdown(div_dnd,div_exp,div_exp_over){
	document.getElementById(div_dnd).style.display = 'none';
	document.getElementById(div_exp).style.display = 'block';
	document.getElementById(div_exp_over).style.display = 'none';
}

function show_content_layer(my_url, profileid, link_name, show_layer, featured,expand_image)
{
	hide_top_bottom_div();
	var img = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"left\" style=\"height:120px;\" valign=\"top\"><tr><td class=\"top_left_png\" align=\"left\"></td><td class=\"top_middle_png\"></td><td class=\"top_right_png\"></td></tr><tr><td class=\"left_border_png\" align=\"left\" align=\"top\"></td><td bgcolor=\"#ffffff\" style=\" font: normal 11px verdana;\" valign=\"middle\" align=\"center\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax.gif\"></td><td class=\"right_border_png\"></td></tr><tr><td class=\"bottom_left_png\"></td><td class=\"bottom_middle_png\"></td><td class=\"bottom_right_png\"></td></tr></table>";
	var img_fav = "<span style=\"padding-left:175px;\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax-small.gif\"></span>";

	var inside_inner_div;
	obj_div = document.getElementById(show_layer);


	if(link_name != "already_in_fav" && link_name != "add_to_fav")
	{
		if(expand_image)
		{	
			show_link_td_id = "link_change_id1_" + profileid;
		}
		else
		{
			show_link_td_id = "link_change_id_" + profileid;
		}

		if (featured == "Y")
		{
			show_link_td_id = "featured_link_change_id_" + profileid;
		}
		b = document.getElementById(show_link_td_id);

		inside_inner_div = obj_div;
	}
	else if(link_name == "already_in_fav" || link_name == "add_to_fav")
	{
		ob_inner_div = document.getElementById('display-message-add-to-fav');

		fav_link_change_id = "fav_link_" + profileid;
		b = document.getElementById(fav_link_change_id);

		inside_inner_div = ob_inner_div;


		}
	inside_inner_div.innerHTML = "";

	var status = AjaxRequest.get(
	{

		'url':my_url
		,'onLoading':function(req){

			if(link_name != "already_in_fav" && link_name != "add_to_fav"){
					inside_inner_div.innerHTML = img;
				}
			else{
					inside_inner_div.innerHTML = img_fav;
				}
			show_div(obj_div, b); }
		,'onSuccess':function(req){
			//obj_div.style.border = '0';


			var temp = new Array();
			var temp = req.responseText.split("||");

			if(link_name == "already_in_fav")
			{
				inside_inner_div.innerHTML = temp[0];
				b.innerHTML = "<img src='"+IMG_PATH+"/imgs/bullet/favorite.jpg' width='15' height='16' style='margin-bottom: 3px; margin-right: 5px;' border='0' vspace='0' align='absmiddle'><span style=\"font: normal normal 11px tahoma;\">Favorite&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>";
				
				//To change the text from "Add To Favorite" to "Favorite" inside expanded panel
				var fav_spans = document.getElementsByTagName("span"); 
				for (var i = 0; i < fav_spans.length; i++) { 
					if(fav_spans[i].id == fav_link_change_id) 
					{
						fav_spans[i].innerHTML  = "<img src='"+IMG_PATH+"/imgs/bullet/favorite.jpg' width='15' height='16' style='margin-bottom: 3px; margin-right: 7px;' border='0' vspace='0' align='absmiddle'><span style=\"font: normal normal 11px tahoma;\" class=\"smallbluelink\">Favorite&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>";
					}
				}
				
			}
			else if(link_name == "add_to_fav")
			{

				inside_inner_div.innerHTML = temp[0];
				b.innerHTML = "<img src='"+IMG_PATH+"/imgs/bullet/add-to-fav.gif' width='18' height='14' border='0' vspace='0' align='absmiddle' valign='bottom' style='margin-right: 3px;' hspace='3'>Add To Favorites";
				
				//To change the text from "Add To Favorite" to "Favorite" inside expanded panel
				var fav_spans = document.getElementsByTagName("span"); 
				for (var i = 0; i < fav_spans.length; i++) { 
					if(fav_spans[i].id == fav_link_change_id) 
					{
						fav_spans[i].innerHTML  = "<img src='"+IMG_PATH+"/imgs/bullet/add-to-fav.gif' width='18' height='14' border='0' vspace='0' align='absmiddle' valign='bottom' style='margin-right: 3px;' hspace='3'><span style=\"font: normal normal 11px tahoma;\">Add To Favorites</span>&nbsp;";						
					}
				}

			}
			else
			{
				inside_inner_div.innerHTML = temp[0];

				if (window.ActiveXObject)
				{
					var iframe_height = document.getElementById('show_main_div').offsetHeight - 30;
					if(document.getElementById('frame_id'))
					document.getElementById('frame_id').style.height= iframe_height+"px";
					
					// Code to fix sortby selection box display above popup in IE. PSL
					var ifr = document.createElement("iframe");
					var div_ref = document.getElementById('show_main_div');

					if(ifr !=null && div_ref !=null){
						ifr.style.setAttribute('position', 'absolute');
						ifr.frameBorder = 0;
						ifr.scrolling = 'no';
						ifr.style.top = '8px';
						ifr.style.left = '5px';
						ifr.style.width = get_element_width(div_ref) - 12 + 'px';
						ifr.style.height = get_element_height(div_ref) -42 + 'px';
						ifr.style.zIndex = - 1;
						ifr.style.display = "block";
						div_ref.appendChild(ifr);
					}
				}
			}
		}
		,'timeout':30000
		,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
		,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}

		}
	 );

	 return status;


  } // EO function_name()




//PSL-EN 4   Function call for multiple express Interest.Start//
// PSL- Phase II -bugfix
/*
* @author prajakta
* function to display the popup div on click of multiple express intrest button(it will make a ajax call)
*/

function show_content_layer_multiple(multi_exp_div,my_url ,show_layer)
{ 
 	hide_top_bottom_div();
	profile_position = ''; // fixed by nivedita
	var len = document.frmExpressIntrest.chkexpressint.length;
	profileid = ''; 
	var arr_ids = new Array();
	var j =0;
	var arr_position = new Array(); // array to store profile position on search page
	if(len){
		for(var i=0; i < len; i++)
		{
			if(document.frmExpressIntrest.chkexpressint[i].checked)
			{
				arr_position.push(i+1); // store profile position on search page
				
				if(document.frmExpressIntrest.chkexpressint[i].disabled == false)
				{
					arr_ids[j] = document.frmExpressIntrest.chkexpressint[i].value;
					j++;
				}
			}
		}

		var w1  = implode(',',arr_ids );
 		profileid = w1;

		profile_position = implode(',',arr_position );
	}
 	//PSL-PHASE II Bug fixes
	//if single checkbox is selected

	if(len == null)
	{
		if(document.frmExpressIntrest.chkexpressint.checked)
		{
			if(document.frmExpressIntrest.chkexpressint.disabled == false)
			{
				profileid = document.frmExpressIntrest.chkexpressint.value
			}
		}
	}

	my_url  = my_url+'&profileid='+profileid+'&profile_pos='+profile_position;
	
	var img = "<table border=\"0\" cellpadding=\"0\" width=\"100%\" cellspacing=\"0\" align=\"left\" style=\"height:120px; \" valign=\"top\"><tr><td class=\"top_left_png\" align=\"left\"></td><td class=\"top_middle_png\"></td><td class=\"top_right_png\"></td></tr><tr><td class=\"left_border_png\" align=\"left\" align=\"top\"></td><td bgcolor=\"#ffffff\" style=\" font: normal 11px verdana;\" valign=\"middle\" align=\"center\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax.gif\"></td><td class=\"right_border_png\"></td></tr><tr><td class=\"bottom_left_png\"></td><td class=\"bottom_middle_png\"></td><td class=\"bottom_right_png\"></td></tr></table>";
	var img_fav = "<span style=\"padding-left:175px;\"><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax-small.gif\"></span>";

	document.getElementById(multi_exp_div).innerHTML = "";
	document.getElementById(multi_exp_div).style.display = "";

	var status = AjaxRequest.get(
		{
			'url':my_url
			,'onLoading':function(req)
				{
					document.getElementById(multi_exp_div).innerHTML=img;
					//PSL PHASE II Bugfixes
					// Code to fix sortby selection box display above popup in IE.

					if(document.all)
					{
						var ifr = document.createElement("iframe");
						var div_ref = document.getElementById(multi_exp_div);

						if(ifr !=null && div_ref !=null){
							ifr.style.setAttribute('position', 'absolute');
							ifr.frameBorder = 0;
							ifr.scrolling = 'no';
							ifr.style.top = '8px';
							ifr.style.left = '5px';
							ifr.style.width = get_element_width(div_ref) - 13 + 'px';
							ifr.style.height = get_element_height(div_ref) -22 + 'px';
							ifr.style.zIndex = - 1;
							ifr.style.display = "block";
							div_ref.appendChild(ifr);
						}
					}
				}
			,'onSuccess':function(req){
				var temp = new Array();
				var temp = req.responseText.split("||");
				document.getElementById(multi_exp_div).innerHTML = temp[0];
				
				//PSL PHASE II Bugfixes
				// Code to fix sortby selection box display above popup in IE.
				if(document.all)
				{
					var ifr = document.createElement("iframe");
					var div_ref = document.getElementById(multi_exp_div);
					
					if(ifr !=null && div_ref !=null){
						ifr.style.setAttribute('position', 'absolute');
						ifr.frameBorder = 0;
						ifr.scrolling = 'no';
						ifr.style.top = '8px';
						ifr.style.left = '5px';
						ifr.style.width = get_element_width(div_ref) -13 + 'px';
						ifr.style.height = get_element_height(div_ref) -22 + 'px';
						ifr.style.zIndex = - 1;
						ifr.style.display = "block";
						div_ref.appendChild(ifr);
					}
				}

				//PSL PHASE II Bugfixes
			   }
				,'timeout':30000
				,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
				,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
			}
	);
	return status;
  } // EO function_name()

  //PSL-EN 4   Function call for multiple express Interest. END//

  function show_already_in_fav(profileid, memberlogin)
  {
	hide_top_bottom_div();
	fav_link_change_id = "fav_link_" + profileid;

	b = document.getElementById(fav_link_change_id);

	var msg = "To view all members in your favorites list, <a href=\""+SERVER_PATH+"/partner_search/matrimonial_search/favourites.php\" class=\"smallbluelink\">click here</a><br><br>To remove "+profileid+" from your favorites list, <a href='#' onclick=\"javascript:show_content_layer('/ssi/p-action/addremovefav-ajax.php?profileid="+profileid+"&memberlogin="+memberlogin+"&removefromfav=Y','"+profileid+"','add_to_fav', 'show-add-to-fav-msg'); return false;\" class=\"smallbluelink\">click here</a>";

	obj_div = document.getElementById("show-add-to-fav-msg");
	show_div(obj_div, b);

	document.getElementById("display-message-add-to-fav").innerHTML = msg;

   }

  function show_visitor_layer(visitor_div_id, profileid, search_result_id, featured)
  {
		hide_top_bottom_div();
		var link;
		show_link_td_id = "link_change_id_" + profileid;
		if (featured == "Y")
		{
			show_link_td_id = "featured_link_change_id_" + profileid;
		}
		b = document.getElementById(show_link_td_id);

		showControls_visitor = document.getElementById(visitor_div_id);

		show_div(showControls_visitor, b);

		document.getElementById('visitor_id').innerHTML = profileid;
		featured_link = "";
		if (featured == "Y")
		{
			featured_link = "&featured=Y";
		}

		link = escape('/partner_search/matrimonial_search/showprofile.php?profileid='+profileid+featured_link+'&set='+search_result_id+'&set_profiles=&set_profiles_back=#action&vcase=express_interest');

		document.getElementById('show_visitor_link').innerHTML = "<a  class='smallbluelink' href='/registration/user/login.php?go="+link+"' onclick=\"return mediator_login_page(this);\">Login now</a>";

  }

  function show_astro_search_help(astro_search_help_div,profileid)
  {
 		b = document.getElementById("astrology_score_" + profileid);
		var curleft = curtop = 0;
		showControlhelp = document.getElementById(astro_search_help_div);
		curleft += b.offsetLeft;
		curtop += b.offsetTop;
		showControlhelp.style.top = curtop+22;
		showControlhelp.style.left = curleft-200;
		showControlhelp.style.display='block';
  }

  function show_same_gender_layer(same_gender_div_id, profileid, featured)
  {
		hide_top_bottom_div();
		show_link_td_id = "link_change_id_" + profileid;
		if (featured == "Y")
		{
			show_link_td_id = "featured_link_change_id_" + profileid;
		}
		b = document.getElementById(show_link_td_id);

		showControls_same_gender = document.getElementById(same_gender_div_id);

		show_div(showControls_same_gender, b);

		document.getElementById('same_gender_id').innerHTML = profileid;


  }

  function trim(str, chars)
  {
	return ltrim(rtrim(str, chars), chars);
  }

  function ltrim(str, chars)
  {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
  }

  function rtrim(str, chars)
  {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
  }

function show_refine_sub_layer_new(type, label, div_id, gender)
{
	var selected_values = new String();
	var img = "<br><br><center><img src=\""+ IMG_PATH + "/imgs/profiles/loading-ajax.gif\" align=\"center\"></center><br><br>";

	if(type == "")
	{
		return false;
	}

	var top_txt = "";
	var show_preselection = "";


	if(label == "mothertongue")
	{
		top_txt = "Mother Tongue:";
	}
	else if(label == "caste")
	{
		top_txt = "Caste:";
	}


	if(type == "mothertongue")
	{
		
		selected_values = fn_js_mothertongue_selected;
		show_preselection = fn_js_cast_selected;
		

	}
	else if(type == "caste")
	{
		selected_values = fn_js_cast_selected;
		show_preselection = fn_js_mothertongue_selected;
		
	}
	else if(type == "show_state")
	{
		selected_values = document.getElementById('country-state-city').value;

		if(selected_values == "")
		{
			alert("Please select country.");
			return false;
		}

		show_preselection = js_stateofresidence;
		top_txt = "State:";
	}
	else if(type == "show_city")
	{
		var country_sel = document.getElementById('country-state-city').value;
	
		if(country_sel == "")
		{
			alert("Please select country.");
			return false;
		}

		if(country_sel.indexOf("|India|") >= 0
			|| country_sel.indexOf("| India|") >= 0
			|| country_sel.indexOf("| USA|") >= 0
			|| country_sel.indexOf("|USA|") >= 0
			)
		{

			selected_values = js_stateofresidence+"@" + country_sel;
		
		if(js_stateofresidence == "")
		{
			alert("Please select state.");
			return false;
		}

		}
		else
		{
			if(js_stateofresidence == "")
			{
				selected_values = "| @"+country_sel;
			}
			else
			{
				selected_values = js_stateofresidence+"@" + country_sel;
			}

		}


		show_preselection = js_nearestcity;
		top_txt = "City:";
	}


	if(label == "country")
	{
		selected_values = document.getElementById('country').value;
		top_txt = "Country:";
	}
	else if(label == "country-state-city")
	{
		selected_values = document.getElementById('country-state-city').value;
		top_txt = "Country:";
	}
	else if(label == "marital")
	{
		selected_values = document.getElementById('marital').value;
		top_txt = "Marital Status:";
	}
	else if(label == "profession")
	{
		selected_values = js_occupation;
		top_txt = "Profession:";
	}
	else if(label == "specialcase")
	{
		selected_values = document.getElementById('specialcase').value;
		top_txt = "Special Cases:";
	}

	if(type == "mothertongue" || type == "caste")
	{

		religion = document.getElementById('religion').value;
		mothertongue = document.getElementById('mothertongue').value;
		gender = document.getElementById('gender').value;
		selected_caste = document.getElementById('caste').value;

		if(!religion)
		{
			alert("Please select Religion");
			return false;
		}

		my_url = "/ssi/ajax-com-mt-caste.php?community=" + escape(religion) + "&mothertongue=" + escape(mothertongue)+ "&gender=" + escape(gender)+"&return_type=html&selected_caste="+escape(selected_caste);

	}
	else
	{
		my_url = "/ssi/p-action/modify-checkbox-html.php?type="+escape(type)+"&label="+escape(label)+"&selected_values="+escape(selected_values)+"&gender="+escape(gender)+"&pre_selection="+escape(show_preselection);
	}

	//alert(my_url); //return false;
	dest_id = document.getElementById("show_refine_sub_div");
	dest_inner_id = document.getElementById("show_refine_sub_div1");

	if(document.getElementById('religion1'))
		hide_div("religion1");

	if(document.getElementById('mothertongue_div'))
		hide_div("mothertongue_div");

	var status = AjaxRequest.get(
	{
		'url':my_url
		,'onLoading':function(req){
			document.getElementById("layer_top_txt").innerHTML = ""; 

			// Hide "Sort Order By" drop down
			show_hide_sort_drop_down("none");

			dest_inner_id.innerHTML = ""; 
			show_div(dest_id, div_id);
			dest_inner_id.innerHTML = img;

		}
		,'onSuccess':function(req)
		{
			document.getElementById("layer_top_txt").innerHTML = top_txt;
			
			dest_inner_id.innerHTML = req.responseText;

				if(dest_id.offsetHeight > '200')
					document.getElementById('frame_div_id').style.height = "160px";
					
				}
		,'timeout':30000
		,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
		,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
	}
	 );
}


function set_hidden_value(label, obj, type)
{
	if(label == "mothertongue")
	{
		chk_name = new Array();
		chk_name = obj.mothertonguearray;
	}
	else if(label == "religion")
	{
		chk_name = new Array();
		chk_name = obj.religionarray;
	}
	else if(label == "caste")
	{
		chk_name = new Array();
		chk_name = obj.castearray;
	}
	else if(label == "marital")
	{
		chk_name = new Array();
		chk_name = obj.maritalarray;
	}
	else if(label == "country" || label == "country-state-city")
	{
		chk_name = new Array();
		chk_name = obj.countryarray;
	}
	else if(label == "state")
	{
		chk_name = new Array();
		chk_name = obj.statearray;
	}
	else if(label == "city")
	{
		chk_name = new Array();
		chk_name = obj.cityarray;
		/*if(chk_name.constructor.toString().indexOf("Array") == -1)
		{
			alert('is not array');
		}
		else
		{
			alert('is array');
		}*/

	
	}
	else if(label == "profession")
	{
		chk_name = new Array();
		chk_name = obj.professionarray;
	}
	else if(label == "specialcase")
	{
		chk_name = new Array();
		chk_name = obj.specialcasearray;
	}
	
	

	var hidden_val = "|";
	var hidden_val_caste = "";
	var flag_check = false;
	var temp_religion_caste = "";
	var temp_caste = "";
	
	for (counter = 0; counter < chk_name.length; counter++)
	{
		if(chk_name[counter].checked)
		{
			if(chk_name[counter].value != "")
			{
				flag_check = true;
				//Space required here
				hidden_val = hidden_val + chk_name[counter].value + "|";
				temp_religion_caste = chk_name[counter].value.split(":");
				temp_caste = temp_religion_caste[1];
				if(!temp_caste)
					temp_caste = temp_religion_caste[0];

				hidden_val_caste = hidden_val_caste + ", " + temp_caste;
			}
		}

	}

	if(!chk_name.length){
		flag_check = true;
		hidden_val = hidden_val + chk_name.value + "|";
	}

	hidden_val += " ";

	if(flag_check == false)
	{
		hidden_val = "";
	}

	// If a Religion has been selected...
	if(flag_check == true && label == "religion")
	{
		// ...uncheck "Doesn't Matter"
		chk_name[0].checked = false;
	}

	//selected_mt_ct = check_multiple_entry_combobox("castearray[]","Y");
	//hidden_val = "|"+hidden_val+"|"

	document.getElementById(label).value = hidden_val;
	
	if(label == "mothertongue")
	{
		fn_js_mothertongue_selected = hidden_val;

		check_if_all_values_selected(chk_name, document.getElementById('mothertongue'), fn_js_mothertongue_selected);

		document.getElementById('mothertongue_selcted').innerHTML = short_string(hidden_val);

		if(type)
		{
			document.getElementById('caste_selected').innerHTML = "&nbsp;Doesn't Matter";
			document.getElementById('caste').value = "";
			fn_js_cast_selected = "";

			if(!hidden_val)
			{
				for (counter = 0; counter < chk_name.length; counter++)
				{
					if(!chk_name[counter].value)
					{
						chk_name[counter].checked=true;					
						break;
					}
				}				
			}

		}

	if(document.getElementById('mothertongue_div'))
		hide_div("mothertongue_div");

	}
	else if(label == "caste")
	{
		fn_js_cast_selected = hidden_val;
		
		if(!hidden_val_caste)
			hidden_val_caste = hidden_val;


		hidden_val_caste = hidden_val_caste.trim();

		if(hidden_val_caste)
		{
			hidden_val_caste = hidden_val_caste.replace(/,/g, "|");
			document.getElementById('caste_selected').innerHTML = short_string(hidden_val_caste+"  ");
		}
		else
		{
			document.getElementById('caste_selected').innerHTML = "&nbsp;Doesn't Matter";

			for (counter = 0; counter < chk_name.length; counter++)
			{
				if(!chk_name[counter].value)
				{
					chk_name[counter].checked=true;
					break;
				}
			}

		}

	}
	else if(label == "marital")
	{
		document.getElementById('marital_selected').innerHTML = short_string(hidden_val);

	}
	else if(label == "country")
	{
		document.getElementById('country_selected').innerHTML = short_string(hidden_val);
		check_if_all_values_selected(chk_name, "");
	}
	else if(label == "country-state-city")
	{
		document.getElementById('country_selected').innerHTML = short_string(hidden_val);


		document.getElementById('state_selected').innerHTML = "&nbsp;Doesn't Matter";

		document.getElementById('city_selected').innerHTML = "&nbsp;Doesn't Matter";

		js_stateofresidence = "";
		
		js_nearestcity = "";

		document.getElementById('state').value = "";

		document.getElementById('city').value = "";

	}
	else if(label == "state")
	{
		js_stateofresidence = hidden_val;
		document.getElementById('state_selected').innerHTML = short_string(hidden_val);

		document.getElementById('city_selected').innerHTML = "&nbsp;Doesn't Matter";

		js_nearestcity = "";

		document.getElementById('city').value = "";
	}
	else if(label == "city")
	{
		js_nearestcity = hidden_val;
		document.getElementById('city_selected').innerHTML = short_string(hidden_val);

	}
	else if(label == "profession")
	{
		js_occupation = hidden_val;
		document.getElementById('profession_selected').innerHTML = short_string(hidden_val);
	}
	else if(label == "specialcase")
	{
		document.getElementById('specialcase').value = hidden_val;
		document.getElementById('specialcase_selected').innerHTML = short_string(hidden_val);
	}

	if(label == "religion")
	{
		document.getElementById('religion').value = hidden_val;
		document.getElementById('religion_selected_value').innerHTML = short_string(hidden_val);

		if(type)
		{


			var religion_value        = document.getElementById('religion').value;
			var caste_value           = document.getElementById('caste').value;
			var caste_label           = document.getElementById('caste_selected').value;

			var arr_selected_religion = religion_value.split("|");
			var arr_selected_caste    = caste_value.split("|");
			var new_caste_value       = "";
			var religion_from_caste   = "";
			var caste                 = "";
			var only_caste            = "";
			var new_caste_label       = "";
			var selected_caste_length = arr_selected_caste.length;


			check_if_all_values_selected(chk_name, document.getElementById('religion'), "");

			for(i=0; i< selected_caste_length; i++)
			{
                caste = arr_selected_caste[i].trim();
                if(!caste) 
					continue;

					religion_from_caste = caste.split(":");
					only_caste = religion_from_caste[1];

					if(!only_caste)
						only_caste = religion_from_caste[0];

					religion_from_caste =  religion_from_caste[0];

					if(religion_value.search(religion_from_caste)>0)
					{
					   new_caste_value += "| " + caste;
					   new_caste_label += "| " + only_caste;
					}

			}

			if(new_caste_value)
				new_caste_value += "| ";

			if(new_caste_label)
				new_caste_label += "| ";

			document.getElementById('caste').value = new_caste_value;
			document.getElementById('caste_selected').innerHTML = short_string(new_caste_label);

			if(!religion_value)
			{
				for (counter = 0; counter < chk_name.length; counter++)
				{
					if(!chk_name[counter].value)
					{
						chk_name[counter].checked=true;
						break;
					}
				}
			}	

			fn_js_cast_selected = new_caste_value;

		}

		if(document.getElementById('religion1'))
			hide_div("religion1");
	}

	hide_div("show_refine_sub_div");

	return false;
}


function short_string(full_string)
{
	if(full_string == "")
	{
		return new_string = "Doesn't Matter";
	}

	var string = new String();
	var new_string  = new String();
	var string_temp2 = new Array();
	
	string_temp = full_string.substring(1,full_string.length-2);

	string_temp2 = string_temp.split("|");
	
	new_string = string_temp2[0];
	
	if(string_temp2[0].length > 13 || string_temp2.length > 1)
	{
		string = string_temp2[0].substring(0,13);
		new_string = string + "...";
	}
		
    new_string = "<a name=\"#\" class=\"tip\" alt='"+string_temp2+"' title='"+string_temp2+"'>&nbsp;"+new_string+"</a>";

	
	return new_string;

}


function refine_validation(srch_name)
{
	var alert_str='';
	var motherounge_selected_flag =0;
	var cast_selected_flag =0;
	var country_selected_flag =0;
	var ageto = document.getElementById('ageto').options[document.getElementById('ageto').selectedIndex].text;
	var agefrom = document.getElementById('agefrom').options[document.getElementById('agefrom').selectedIndex].text;
	
	if(fn_js_cast_selected)
	{
		motherounge_selected_flag = 1;
	}

	if(fn_js_mothertongue_selected)
	{
		cast_selected_flag = 1;
	}
	
	if(srch_name == "city_search" && document.getElementById('country-state-city').value != "")
	{
		country_selected_flag = 1;
	}
	else if(srch_name != "city_search" && document.getElementById('country').value != "")
	{
		country_selected_flag = 1;
	}

	if(ageto < agefrom)
	{
		alert_str = alert_str + "Invalid Age selected\n";
	}

	if(eval(ageto - agefrom) > 10)
	{
		alert_str = alert_str + "Age ranges exceeds 10 years.\nChange age ranges or use Smart Search\n";
	}


	if((motherounge_selected_flag !=1 && cast_selected_flag != 1 && country_selected_flag != 1 && !document.getElementById('religion').value) || ( !document.getElementById('religion').value && !document.getElementById('mothertongue').value && !document.getElementById('caste').value && !document.getElementById('country').value ))
	{
		alert_str = alert_str + "Please select atleast Mother Tongue or Religion/Caste or Country.\n";
	}

	if(srch_name == "keyword_search")
	{
		if(document.getElementById('keyword_txt') != null)
		{
			if(document.getElementById('keyword_txt').value != "min. 4 characters")
			{
				//alert("sssss"+document.getElementById('keyword_txt'));
				return check_keyword_refine(document.getElementById('keyword_txt'));
			}
		}

	}
	if(alert_str != '')
	{
		alert(alert_str);
		return false;
	}


}

function keyword_label_to_textbox(keyword)
{
	document.getElementById('keyword_id').innerHTML = "<input type='text' name='keyword_txt' id='keyword_txt' value='"+keyword+"'>";

}

function hide_div_multi(divid){
	document.getElementById(divid).innerHTML='';
}


//PSL-PHASE II Bugfixes
/*
*@author prajakta
*function to clear both the popups on click of any link
*/
function hide_top_bottom_div()
{
	//PSL Phase II Bug Fixes
    document.getElementById('show_main_div').style.display='none';
	var hideControls = document.getElementById('multi_exp_div1');
	if(hideControls)
	{
	document.getElementById('multi_exp_div1').innerHTML='';
	}//EO if(hideControls)
	var hideControls = document.getElementById('multi_exp_div2');
	if(hideControls)
	{
	document.getElementById('multi_exp_div2').innerHTML='';
	}//EO if(hideControls)

}


//PSL-EN 4   Function call for multiple express Interest Validation  Start//
function validate_multiple(member_div,chkexpressint)
{
 
	if (document.getElementById(chkexpressint).checked == true)
	{
		document.getElementById(member_div).style.backgroundImage="url("+IMG_PATH+"/imgs/background/blue-bar.gif)";
	}
	else
	{
 		document.getElementById(member_div).style.backgroundImage="url("+IMG_PATH+"/imgs/background/search-header-bg-1.gif)";
	}
}

//PSL-EN 4   Function call for multiple express Interest Validation   End//

/*
* @author prajakta
* function to explode an array
*/
function explodeArray(item,delimiter)
{
	tempArray=new Array(1);
	var Count=0;
	var tempString=new String(item);
	while (tempString.indexOf(delimiter)>0)
	{
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);
		Count=Count+1
	}	
	tempArray[Count]=tempString;
	return tempArray;
}


//PSL -PHASE II BUGFIXES
/*
* function to toggle the ckeckbox on click of topbar
*/
function toggle_checkbox(val)
 {
	if(document.getElementById(val).disabled == false)
	{
		if(document.getElementById(val).checked)
			document.getElementById(val).checked=false;
		else
			document.getElementById(val).checked=true;
	}//EO if(document.getElementById(val).disabled == false)
 }

/*
* @author bhushan
* function to get element's left position
*/

function get_element_left(m_elem) {
	var x = 0;
	var elem;
	
	if(typeof(m_elem) == "object")
		elem = m_elem;
	else
		elem = document.getElementById(m_elem);

	while (elem != null)
	{
		x += elem.offsetLeft;
		elem = elem.offsetParent;
	}
	return parseInt(x);
}

/*
* @author bhushan
* function to get element's top position
*/

function get_element_top(m_elem) {
	var y = 0;
	var elem;
	
	if(typeof(m_elem) == "object")
		elem = m_elem;
	else
		elem = document.getElementById(m_elem);

	while (elem != null)
	{
		y += elem.offsetTop;
		elem = elem.offsetParent;
	}
	return parseInt(y);
}

/*
* @author bhushan
* function to get element's width
*/

function get_element_width(m_elem) {
  var elem;
  if(typeof(m_elem) == "object")
  {
    elem = m_elem;
  }
  else
  {
    elem = document.getElementById(m_elem);
  }
  return parseInt(elem.offsetWidth);
}

/*
* @author bhushan
* function to get element's height
*/
function get_element_height(m_elem) {
  var elem;
  if(typeof(m_elem) == "object")
  {
    elem = m_elem;
  }
  else
  {
    elem = document.getElementById(m_elem);
  }
  return parseInt(elem.offsetHeight);
}

/*
* @author bhushan
* function to cause expansion transition
* Please change the transition_delay value (declared at top) only, if transition needs to be modified.
*/

function expand_transition(prepg,first,second,container,expand_div,restore_div,track_info)
{

	if(in_array(first,arr_exp_int))
		return false; // To avoid the action on multiple clicks on same button.
	else
		arr_exp_int.push(first); //To insert expanded div id in arr_exp_int.

	var second_div_obj = document.getElementById(second);
	if (second_div_obj.innerHTML == "" || second_div_obj.innerHTML == "Sorry we could not fetch the content this time")
	{
		p_id = first.substr(0,first.indexOf("first_div"));
		get_mini_profile_contents(p_id, "yes",track_info);
	}

	hide_top_bottom_div();	
	
	$("#"+first).fadeOut(transition_delay);
	setTimeout("ppg_display('"+prepg+"','"+first+"')",transition_delay * 1.2);

	if(ppg_loading == 0 || second_div_obj.innerHTML != "")
	{
		expand_transition_part2(prepg,first,second,container,expand_div,restore_div);
	}

	return false;
}

function expand_transition_part2(prepg,first,second,container,expand_div,restore_div)
{
	document.getElementById(second).style.display='block';
	var div_main_height = document.getElementById(second).offsetHeight;
	var div_content = second.replace(/second_div/gi, "about_me");
	var div_content_height = document.getElementById(div_content).offsetHeight;
	if(div_content_height > 93)
	{
		div_main_height = div_main_height - div_content_height + 93;
		div_content_height = 93;
	}
	document.getElementById(div_content).style.height = div_content_height+'px';
	document.getElementById(second).style.display='none';

	setTimeout("revert_ppg_display('"+prepg+"','"+expand_div+"','"+restore_div+"','expand')",transition_delay * 5);
	setTimeout(function(){$("#"+container).animate({height:eval(div_main_height + 2)},transition_delay * 2);},transition_delay * 3);
	setTimeout(function(){$("#"+second).fadeIn(transition_delay * 2.5);},transition_delay * 5);
	setTimeout(function(){document.getElementById(container).style.borderWidth = '3px';},transition_delay * 5.1);
}

/*
* @author bhushan
* function to restore expansion transition
* Please change the transition_delay value (declared at top) only, if transition needs to be modified.
*/

function restore_transition(prepg,first,second,container,expand_div,restore_div)
{
	if(!in_array(first,arr_exp_int))
		return false; // To avoid the action on multiple clicks on same button.
	else
		remove_frm_array(first,arr_exp_int); //To remove expanded div id from the arr_exp_int.
	
	hide_top_bottom_div();


	document.getElementById(first).style.display='block';
	var div_first_height = document.getElementById(first).offsetHeight;
	document.getElementById(first).style.display='none';	
	
	$("#"+second).fadeOut(transition_delay * 0.8);
	setTimeout(function(){document.getElementById(container).style.borderWidth = '1px';},transition_delay * 2);
	setTimeout(function(){$("#"+container).animate({height:eval(div_first_height)},transition_delay * 2);},transition_delay * 2);
	setTimeout("revert_ppg_display('"+prepg+"','"+expand_div+"','"+restore_div+"','restore')",transition_delay * 4.5);
	setTimeout(function(){$("#"+first).fadeIn(transition_delay * 3);},transition_delay * 3);

	return false;
}

/*
* @author bhushan
* function to manage loading div display
* Please change the transition_delay value (declared at top) only, if transition needs to be modified.
*/

function ppg_display(prepage,firstDiv) {

	obj_ppg = document.getElementById(prepage);
	odj_first = document.getElementById(firstDiv);

	if(odj_first.style.display == '')
	{
		setTimeout("ppg_display2('"+prepage+"')",transition_delay * 1.4);
	}
	else
	{
		ppg_display2(prepage);
	}

	return true;
}

function ppg_display2(prepage) 
{
	obj_ppg = document.getElementById(prepage);
	if (obj_ppg!=null || typeof(obj_ppg)!='undefined')
	{
		obj_ppg.style.background = '#FFFFFF';
		obj_ppg.style.display = 'block';
		obj_ppg.style.zIndex = 1;
		prepage_inner_html = obj_ppg.innerHTML;
	}
	return true;
}

/*
* @author bhushan
* function to manage loading div display and expand restore buttons
* Please change the transition_delay value (declared at top) only, if transition needs to be modified.
*/

function revert_ppg_display(prepage,expand_div,restore_div,prepg_trans_lbl) 
{
	
	obj_ppg = document.getElementById(prepage);

	if (prepg_trans_lbl == 'expand')
	{
		obj_ppg.style.zIndex = -1;
		obj_ppg.style.display = 'none';
		document.getElementById(expand_div).style.display = 'none';
		document.getElementById(restore_div).style.display = 'block';
	}
	else if (prepg_trans_lbl == 'restore')
	{
		document.getElementById(restore_div).style.display = 'none';
		document.getElementById(expand_div).style.display = 'block';
	}
	return true;
}

/*
/@author prajakta
/function to show the conditional Thank You layer on Click of SKIP
*/
function skip_show(file_url, div_multi)
{
	var status = AjaxRequest.get(
		{

		'url':file_url
		,'onSuccess':function(req){

		show_hidden_person_div(div_multi);
		div_id=document.getElementById(div_multi)
		div_id.innerHTML = req.responseText;

		// Code to fix sortby selection box display above popup in IE.

		if(document.all)
		{
			var ifr = document.createElement("iframe");
			var div_ref = document.getElementById(div_multi);

			if(ifr !=null && div_ref !=null){
				ifr.style.setAttribute('position', 'absolute');
				ifr.frameBorder = 0;
				ifr.scrolling = 'no';
				ifr.style.top = '8px';
				ifr.style.left = '5px';
				ifr.style.width = get_element_width(div_ref) - 13 + 'px';
				ifr.style.height = get_element_height(div_ref) -22 + 'px';
				ifr.style.zIndex = - 1;
				ifr.style.display = "block";
				div_ref.appendChild(ifr);
			}
		}

		//PSL PHASE II Bugfixes

		}
		,'timeout':30000
		,'onTimeout':function(req){ alert('A problem occurred while communicating with the server.\nPlease make sure you are connected to the Internet and try again in sometime.'); return false;}
		,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
		}
	);

}

//PSL PHASE II TEST REPORT FIXES
/*
/@author prajakta
//function to highlight the div dropdown menu on mouse hover
*/
function show_btn(div_id1,div_id2){
	var div_id1	= document.getElementById(div_id1);
	var div_id2	= document.getElementById(div_id2);
 
	div_id2.style.display='block';
	div_id1.style.display='none';

}

//PSL PHASE II TEST REPORT FIXES
/*
/@author prajakta
//function to show the original div dropdown menu on mouse out
*/
function show_btn_out(div_id1,div_id2){ 
 	var div_id1	= document.getElementById(div_id1);
	var div_id2	= document.getElementById(div_id2);
 
	div_id1.style.display='block';
	div_id2.style.display='none';
}

/*
/@author Bhushan
/function to remove element from array
*/
function remove_frm_array(id,arr){
	var i = arr.indexOf(id);
	if(i != -1)arr.splice(i, 1);
}

/*
/@author Bhushan
/Function to check whether an elment is in array
*/
function in_array(needle, haystack) {
var n = haystack.length;
	
	for (var i=0; i<n; i++) {
		if (haystack[i]==needle) {
			return true;
		}
	}
}

function express_link_content_layer(profileid, layer_type)
{
    var msg;

    if(layer_type!='multiple')
    {
        msg = "<form id='expressform' method='post'  action='#' onSubmit='return_false();' name='expressform' style='margin: 0 0 0 0px;\'><input type='hidden' name='confirm' value='Y'><input type='hidden' name='from_page' value='search_result'><input type='hidden' name='profileid' value=''><input type='hidden' name='memberlogin' value=''><input type='hidden' name='se' value=''><input type='hidden' name='photo_password_requested' value=''></form><table width='100%' border='0' cellpadding='0' cellspacing='0' align='right' style='position:relative;'><tr><td class='top_left_png' align='left'></td><td class='top_middle_png'></td><td class='top_right_png'></td></tr><tr><td class='left_border_png' align='left'></td><td bgcolor='#ffffff' style='font: normal 11px verdana;' valign='top'><table border='0' cellpadding='0' cellspacing='0' style='margin-left:3px;' ><tr><td style='font: normal 11px verdana;' valign='top' id='show_inside_content_div_" + escape(profileid) + "'></td></tr></table></td><td class='right_border_png'></td></tr><tr><td class='left_border_png' width='15px'></td><td bgcolor='#ffffff' align='right'><span id='close_id'><a href='#' onclick='Javascript:hide_div(\"show_main_div\");return false;' class='smallbluelink' >Close</a></span></td><td class='right_border_png' width='15px'></td></tr><tr><td class='bottom_left_png'></td><td class='bottom_middle_png'></td><td class='bottom_right_png'></td></tr></table>";
    }
    else
    {
        msg = "<form name='frm_express_int_multi' method='Post' style='margin: 0 0 0 0px;'><input type='hidden' name='profileids' value='' ><input type='hidden' name='loggerlogin' value='' ><input type='hidden' name='profileid_filtered' value='' ><input type='hidden' name='profileid_filtered_disp' value='' ><input type='hidden' name='profileid_cancelled' value='' ><input type='hidden' name='profileid_cancelled_disp' value='' ><input type='hidden' name='profileid_nt_filt_canl' value=''><input type='hidden' name='per_msg' value=''><input type='hidden' name='go' value=''></form>";
    }

    return msg;

}

function mediator_express_link(profileid, url, featured, expand_image)
{
    hide_top_bottom_div();
	var inside_inner_div = document.getElementById('show_main_div');
    inside_inner_div.innerHTML = express_link_content_layer(profileid);

    if(expand_image)
    {
        show_link_td_id = "link_change_id1_" + profileid;
    }
    else
    {
        show_link_td_id = "link_change_id_" + profileid;
    }

    if (featured == "Y")
    {
        show_link_td_id = "featured_link_change_id_" + profileid;
    }
    b = document.getElementById(show_link_td_id);
    show_div(inside_inner_div, b);
    inside_inner_div.style.display = 'none';

    frmob = document.expressform;
    
    var t = this.title || this.name || this.href || null;
    $("body").css("overflow", "hidden");

    var pos = function(){ $.tweenbox.position($('#tweenContent')[0]); };
    try{ $("body").tweenbox(url);}
    catch(e){}
}

function mediator_multiple_express_link(multi_exp_div, url)
{
 	hide_top_bottom_div();
	var len = document.frmExpressIntrest.chkexpressint.length;
	var arr_ids = new Array();
	var j =0;
    var profileids = '';
	if(len){
		for(var i=0; i < len; i++)
		{
			if(document.frmExpressIntrest.chkexpressint[i].checked)
			{
				if(document.frmExpressIntrest.chkexpressint[i].disabled == false)
				{
					arr_ids[j] = document.frmExpressIntrest.chkexpressint[i].value;
					j++;
				}
			}
		}

		profileids  = implode(',',arr_ids );
	}
 	//PSL-PHASE II Bug fixes
	//if single checkbox is selected

	if(len == null)
	{
		if(document.frmExpressIntrest.chkexpressint.checked)
		{
			if(document.frmExpressIntrest.chkexpressint.disabled == false)
			{
				profileids = document.frmExpressIntrest.chkexpressint.value
			}
		}
	}

	url  = url+'&profileids='+escape(profileids)+"&multiple=yes"+"&div_id_mul="+escape(multi_exp_div)+"&flag_from=1";

    document.getElementById(multi_exp_div).innerHTML = express_link_content_layer(profileids,'multiple');

    frmob = document.frm_express_int_multi;

    var t = this.title || this.name || this.href || null;
    $("body").css("overflow", "hidden");

    var pos = function(){ $.tweenbox.position($('#tweenContent')[0]); };
    try{ $("body").tweenbox(url); }
    catch(e){}


  } // EO function_name()
