function profilepagelinks (ID1,ID2)
	{
		
		var searchtype = new String(Get_Cookie('SearchType'));
	
		if (searchtype=="3")
			{
				//Set_Cookie ('MemberXML',document.frmSearch.MemberArray.value);
				Set_Cookie ('MemberProfile',ID2);
				var Query =  "selGender=" + document.frmSearch.selGender.value + "&selGenderSeek=" + document.frmSearch.selGenderSeek.value + "&searchpage=" + document.frmSearch.searchpage.value + "&selAgeMin=" + document.frmSearch.selAgeMin.value + "&selAgeMax=" + document.frmSearch.selAgeMax.value + "&selMiles=" + document.frmSearch.selMiles.value + "&rdoPhotos=" + document.frmSearch.rdoPhotos.value + "&txtPostalCode=" + document.frmSearch.txtPostalCode.value + "&rdoSearchWhere=" + document.frmSearch.rdoSearchWhere.value + "&chkActivity=" + document.frmSearch.chkActivity.value;

				window.location.href="_profile_myview_anm.aspx?" + Query;
			}
		else
			{
				//Set_Cookie ('MemberXML',document.frmSearch.MemberArray.value);
				Set_Cookie ('MemberProfile',ID2);
				window.location.href="_profile_myview_anm.aspx?id_member=" + ID1;
			}
	}
	
function GoToNext(ID,ID1, formInput, selectedID, NperPage)
	{	
		if(!NperPage) {NperPage = 10}; // N of items to display per page
		document.frmSearch.search_type.value = searchtype;
		
		if (searchtype=="1")
			{
				document.frmSearch.GoToPage.value = ID;

				if (formInput.length == null) {
					document.frmSearch.id_member1.value = formInput.value;
					document.frmSearch.membercount.value = 1;
					document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage )
				
				} else 
				{

					for (i=0; i<formInput.length; i++) {
						document.frmSearch.membercount.value = formInput.length;
						if(selectedID == formInput[i].value) 
						{
							document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage + i)
						}
					}
				}
				if(selectedID > 0)
					{						
					document.frmSearch.page_from.value = "ext_search";
					document.frmSearch.search_query.value = Query;
					document.frmSearch.id_member.value = selectedID;
				    document.frmSearch.action = "_profile_myview.aspx?id_member=" + selectedID;	
				    }
						
				else
					{
					if(document.getElementById("pageAction").value != "none")
					 {
					   if(document.getElementById("pageAction").value != "eyeContact")
					   {
						document.frmSearch.action = "mycupid.aspx?pagename=B16&pgid=prExtS&"+ Query;	
						
					   }
					   
					   else
						{
						document.frmSearch.action = "members.aspx?pagename=A5a7&pageAction=" + document.getElementById("pageAction").value + "&MemberID=" + document.getElementById("memberID").value + "&pgid=prExtS&Handle=" + document.getElementById("memHandle").value + "&" + Query;	
						}
					}
					   else
					   {
						
						document.frmSearch.action = "_profile_search_ext.aspx?" + Query;	
						}
					}
				
				document.frmSearch.submit();
			}
	
		if (searchtype=="2")			
			{	
				Set_Cookie ('Page',ID)
				window.location.href="_profile_search.aspx?id_user=" + ID1;
			}
	
		if (searchtype=="3")
			{
				document.frmSearch.GoToPage.value = ID;
				if (formInput.length == null) {
					document.frmSearch.id_member1.value = formInput.value;
					document.frmSearch.membercount.value = 1;
					document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage )
				} else {
					for (i=0; i<formInput.length; i++) {
						document.frmSearch.membercount.value = formInput.length;
						if(selectedID == formInput[i].value) 
						{
						  	document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage + i)
							//document.write("Page number-1: " + (document.frmSearch.PageNumber.value - 1) + " NperPage: " + NperPage + " i: " + i);
						}
					}
				}

				if(selectedID > 0)
					{	
						document.frmSearch.page_from.value = "quick_search";
						document.frmSearch.search_query.value = Query;
						document.frmSearch.id_member.value = selectedID;
						document.frmSearch.action = "_profile_myview.aspx?id_member=" + selectedID;	
					}
						
				else
				{	
					if(document.getElementById("pageAction").value != "none")
					 {
					   if (document.getElementById("pageAction").value != "eyeContact")
						{
							document.frmSearch.action = "mycupid.aspx?pagename=B16&pgid=prQS&pageAction=" + document.getElementById("pageAction").value + "&MemberID=" + document.getElementById("memberID").value + "&Handle=" + document.getElementById("memHandle").value + "&" + Query;
						}
						else
						{
						//alert(Query);
						document.frmSearch.action = "members.aspx?pagename=A5a7&pageAction=" + document.getElementById("pageAction").value + "&MemberID=" + document.getElementById("memberID").value + "&pgid=prQS&Handle=" + document.getElementById("memHandle").value + "&" + Query;	
						}
					}
					 else
					 {
					 if(Query.indexOf("Handle=") == -1 && document.getElementById("memHandle") != undefined) Query = Query + "&Handle=" + document.getElementById("memHandle").value;
					 document.frmSearch.action = "_profile_search.aspx?" + Query;
					 }
				}
				
				document.frmSearch.submit();
			}
		
		if (searchtype=="4")
			{
				document.frmSearch.GoToPage.value = ID;
				if (formInput.length == null) {
					document.frmSearch.id_member1.value = formInput.value;
					document.frmSearch.membercount.value = 1;
					document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage )
				} else {
					for (i=0; i<formInput.length; i++) {
						document.frmSearch.membercount.value = formInput.length;
						if(selectedID == formInput[i].value) 
						{
						  	document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage + i)
						}
					}
					
				}
				if(selectedID > 0)
				{	
					document.frmSearch.page_from.value = "handle_search";
					document.frmSearch.search_query.value = Query;
					document.frmSearch.id_member.value = selectedID;
					
						document.frmSearch.action = "_profile_myview.aspx?id_member=" + selectedID;	
						
				}
				else
				{	
					if(document.getElementById("pageAction").value != "none")
					{
					   if(document.getElementById("pageAction").value != "eyeContact")
					   {
					   //alert(document.getElementById("pageAction").value);
						document.frmSearch.action = "mycupid.aspx?pagename=B16&pgid=prHS&" + Query;	
						}
						else
						{
						document.frmSearch.action = "members.aspx?pagename=A5a7&pageAction=" + document.getElementById("pageAction").value + "&MemberID=" + document.getElementById("memberID").value + "&pgid=prHS&Handle=" + document.getElementById("memHandle").value + "&" + Query;	
						}
					}
					else
					   {
						document.frmSearch.action = "_profile_search_handle.aspx?" + Query;
						}
				}
				document.frmSearch.submit();
			}
		//added by T. Kelly 3/20/06
		//For Who's Online, Newest Photos, Member Birthdays Pages to handle previous/next profile links from profile_my_view
		if (searchtype=="5")
			{
				document.frmSearch.GoToPage.value = ID;
			
				var formInput_array = formInput.split(",");
					
				if (formInput_array.length == null) {
					document.frmSearch.id_member1.value = formInput_array.value;
					document.frmSearch.membercount.value = 1;
					document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage )
					
				} 
				
				else {
					for (i=0; i<formInput_array.length; i++) { //for 
					
						document.frmSearch.membercount.value = formInput_array.length;
												
						if(selectedID == formInput_array[i])
						{//if
									
						  	document.frmSearch.selected_position.value = ((document.frmSearch.PageNumber.value - 1) * NperPage + i)
						  	
						}
						
					}
				
				}
				
				if(selectedID > 0)
				{	if(viewtype=="a") //var viewtype declared in 108.xsl,87c.xsl
						{
							document.frmSearch.page_from.value = "whos_online";
						}
					else if (viewtype=="b")
						{
							document.frmSearch.page_from.value = "newest_photos";
						}
					else if (viewtype=="c")
						{	
							document.frmSearch.page_from.value = "member_birthdays";
						}
					document.frmSearch.search_query.value = Query;
					document.frmSearch.id_member.value = selectedID;
					document.frmSearch.action = "_profile_myview.aspx?id_member=" + selectedID;	

					}
				else
					{
					//var viewtype declared in 108.xsl,87c.xsl, 109.
					if(viewtype=="a") //Who's Online Now
						{
							document.frmSearch.action = "dating-chat.aspx?";
						}
					else if (viewtype="b") //Newest Photos
						{
							document.frmSearch.action = "members.aspx?pagename=A12";
						}
					else if (viewtype="c") //Member Birthdays
						{
							document.frmSearch.action = "members.aspx?pagename=A15";
						}
					}
						
				document.frmSearch.submit();
			}
			//Add another search type
			//memberid list will have to be split here, coming in as a string instead of obj array
	}
	
	function SwitchMode(newMode)
	{
	  //total records will be 200 unless members have been removed from this particular search
	  var total_records = document.frmSearch.totalrecords.value;
	  	  if (document.frmSearch.newtotalrecords.value > 0)
	    {
		 total_records = document.frmSearch.newtotalrecords.value;
		}
		
		var records_per_page;
		if (newMode == 'regular')
		{
		  Query = Query.replace('gallery', 'regular');
		  records_per_page = 10;
		}
		else
		{
		  Query = Query.replace('regular', 'gallery');
		  records_per_page = 20;
		}
		//document.write(Query);
		
		//go back to page 1 when switching modes  
		document.frmSearch.PageNumber.value = 1;
		document.frmSearch.GoToPage.value = 1;
		document.frmSearch.selected_position.value = 1;
		//document.frmSearch.membercount.value = document.frmSearch.MemberID_1.length;
		
		var x = parseInt(total_records / records_per_page);
		
        var y = total_records % records_per_page;
		 if (y == 0)
            document.frmSearch.totalpages.value = x;
        else
            document.frmSearch.totalpages.value = x + 1;
			
		document.frmSearch.selMode.value = newMode;
		
		if (total_records >= records_per_page)
			document.frmSearch.membercount.value = records_per_page;
		else
			document.frmSearch.membercount.value = total_records;
			
		//document.write("Total pages: " + document.frmSearch.totalpages.value); 
		 
		 if (searchtype == "1") 
		 	document.frmSearch.action = "_profile_search_ext.aspx?" + Query;	
		 else if (searchtype == "3")
		 	document.frmSearch.action = "_profile_search.aspx?" + Query;
		 else if (searchtype == "4")
		 	document.frmSearch.action = "_profile_search_handle.aspx?" + Query;
			
		document.frmSearch.newMode.value = "1";
		//document.write("Action: " + document.frmSearch.action + "\nTotal pages: " + document.frmSearch.totalpages.value + "\nTotal records: " + document.frmSearch.totalrecords.value + "\nMember count: " + document.frmSearch.membercount.value + "\nRecords per page: " + records_per_page + "\nNew mode: " + document.frmSearch.selMode.value + " Prev num pages: " + document.frmSearch.totalpagesprev.value);
		
		document.frmSearch.submit();
		   
	}
	
	function ClearAction()
	{
	document.getElementById("pageAction").value = "none";
	document.getElementById("memHandle").value = "";
	document.getElementById("memberID").value = "";
	
	}
	
	function SortSearch(searchType, sort)
	{
	document.sortForm.selGenderSeek.value = SplitValues(document.frmSearch.selGenderSeek.value);
	document.sortForm.selGender.value = SplitValues(document.frmSearch.selGender.value);
	document.sortForm.selAgeMin.value = SplitValues(document.frmSearch.selAgeMin.value);
	document.sortForm.selAgeMax.value = SplitValues(document.frmSearch.selAgeMax.value);
	document.sortForm.selMiles.value = SplitValues(document.frmSearch.selMiles.value);
	document.sortForm.rdoPhotos.value = SplitValues(document.frmSearch.rdoPhotos.value);
	document.sortForm.chkActivity.value = SplitValues(document.frmSearch.chkActivity.value);
	document.sortForm.txtPostalCode.value = SplitValues(document.frmSearch.txtPostalCode.value);
	document.sortForm.rdoSearchWhere.value = SplitValues(document.frmSearch.rdoSearchWhere.value);
	document.sortForm.selMode.value = SplitValues(document.frmSearch.selMode.value);
	

	switch(searchType)
	{
		case 1:
		ExpSort(sort);
		break;
		
		case 3:
		QSort(sort);
		break;
		
		case 4:
		//HSort(sort);
		break;

	}
	
	}
	
	function SplitValues(val)
	{
	var valueArray;
	var retrievedVal;
	
	valueArray = val.split("=");
	retrievedVal = valueArray[1];
		
	return retrievedVal;
	}
	
	
	function ExpSort(sort)
	{
	
	document.sortForm.selHeightAFrom.value = SplitValues(document.frmSearch.selHeightAFrom.value);
	document.sortForm.selHeightBFrom.value = SplitValues(document.frmSearch.selHeightBFrom.value);
	document.sortForm.selHeightATo.value = SplitValues(document.frmSearch.selHeightATo.value);	
	document.sortForm.selHeightBTo.value = SplitValues(document.frmSearch.selHeightBTo.value);
	document.sortForm.selOrder.value = sort;
	document.sortForm.OrderBy.value = sort;
	document.sortForm.activity.value = SplitValues(document.frmSearch.activity.value);
	document.sortForm.action = "_profile_search_ext.aspx";
	document.sortForm.submit();
	}
	
	
	
	
	function QSort(sort)
	{

	document.sortForm.selOrder.value = sort;
	document.sortForm.action = "_profile_search.aspx";
	document.sortForm.submit();
	
	}