<!--



	/*	This funciton Creates a New Option Tag



			inputs: 



					1: Container Name which will be made empty.



					2: Second Container in the case of First level.



			output: none



	*/

	function emptySubBoxes(container, container_2)
	{		
		document.getElementById(container).innerHTML	=	"";
		if(container_2 !="")
			document.getElementById(container_2).innerHTML	=	"";
	}//Closing of emptySubBoxes()
	//--------------------------------------------------------------------------
	/*	This funciton Creates a New Option Tag



			inputs: 



					1: Container Name where the output will be added.



					2: Label to be displayed



					3: Value to be stored.



					



			output: none



		*/



		function CreateOption(txtComboName, txtNewOptionText, value)
		{
			//Create a New Option Tag
			var objOpt		=	document.createElement('option');
			//Add the Label of the Option Tag
			objOpt.text		=	txtNewOptionText;
			//Add the Value of the Option Tag
			objOpt.value	=	value;
			objOpt.selected	=	value;
			//Get the object of the Destination.
			var objDest	=	document.getElementById(txtComboName);
			//Now finally add.
			try

			{	



					objDest.add(objOpt,null); // standards compliant



			}
			catch(ex)



			{



				objDest.add(objOpt); // IE only



			}



		}// Closing of CreateOption(...)



	//--------------------------------------------------------------------------







	/*	This funciton gets sub Categories



		inputs: 1: Type



				2: Container name where the output will be displayed.



				3: Selected Type [OPTIONAL]



			



		output: response from the server



	*/



	function getSubCat(txtType, container, selectedType)



	{



		var poststr 		= 	"intSubIdPk=" + encodeURI( txtType ) ;  



						



		if(selectedType != "")		



			poststr = poststr +	"&selected=" + encodeURI(selectedType) ;



			



		//---------------------------------------------------------------------------------------



		//Now make the request through HTTP and get the Sub Categories



		// This is JQuery Ajax method.



		$.ajax({



				method: "get",



				url: root + "ul/pets/get_subcat.php", 



				data: poststr,



				beforeSend: function(){$("#" + container).html("Loading...");}, //show loading just when link is clicked



				//complete: function(){ $("#" + container).html("");}, //stop showing loading when the process is complete



				success: function(msg)



				{ 



					$("#" + container).html(msg); //show the html inside .content div	



				} //Closing of success: function(html)



		 }); //close $.ajax(



		



	}// Closing of function getSubCat(...)



	



	//--------------------------------------------------------------------------



	/* 



		This method is used to toggle the panel which is passed to it.



		Inputs: Id of the pane, 



				flag ("true" to display and "false" to hide)



				Button (Event Raiser) Id [OPTIONAL], If you want to enable or disable the button



		Outputs: toggling of the pane (hide or display)



		Calls: getElementById(...) method of the Javascript



	*/



	//--------------------------------------------------------------------------



	function togglePane(paneId, flag, btnId)



	{



		if(flag)
		{


			document.getElementById(paneId).style.display = 'block';
	



			if(btnId != null)



				document.getElementById(btnId).disabled	= true;



		}	



		else if(!flag)



		{



			document.getElementById(paneId).style.display = 'none';



	



			if(btnId != null)



				document.getElementById(btnId).disabled	= false;



		}	







	}// Closing of togglePane(...)



	//--------------------------------------------------------------------------



	/* 



		This method is used to toggle the panel which is passed to it.



		Inputs: Id of the object which you rquire to show / hide



				Id of the object which you rquire to hide / show



				



				flag ("true" to display and "false" to hide)



				



				Button (Event Raiser) Id [OPTIONAL], If you want to enable or disable the button







		Outputs: toggling of the pane (hide or display)



		Calls: getElementById(...) method of the Javascript



	*/



	//--------------------------------------------------------------------------



	function toggleBoxes(objId, objId2, flag, btnId)



	{



		if(flag)



		{



			document.getElementById(objId).style.display = 'inline';



			document.getElementById(objId2).style.display = 'none';	







			if(btnId != null)



				document.getElementById(btnId).disabled	= true;



			



		}	



		else if(!flag)



		{



			document.getElementById(objId).style.display = 'inline';



			document.getElementById(objId2).style.display = 'none';



			



			if(btnId != null)



				document.getElementById(btnId).disabled	= false;



		}	







	}// Closing of toggleBoxes(...)



	//--------------------------------------------------------------------------



	/* 



		This method is used to add a new value to Combo Boxes only.



		Creates an Option Tag on Run Time



		Inputs: Field Id from where the value will be added.



				



				Id of the object Where the new Added Option will go.







		Outputs: New Option tag to the Existing Combobox (Dropdown)



		Calls: getElementById(...) method of the Javascript



	*/



	//--------------------------------------------------------------------------



	function addValue2Combo(objTxtField, objDestination)



	{



		



		//Get the Value of the Text Field



		var txtNewOptionText	=	document.getElementById(objTxtField).value;



		



		



		//If the value is not empty then perform required Action



		



		if(txtNewOptionText != "")



		{		



			//Create a New Option Tag



			var objOpt				=	document.createElement('option');







			//Add the Label of the Option Tag



			objOpt.text				=	txtNewOptionText;



			



			//Add the Value of the Option Tag



			objOpt.value			=	txtNewOptionText;



			



			//Get the object of the Destination.



			var objDest	=	document.getElementById(objDestination);



			



			



			try



			{	



					objDest.add(objOpt,null); // standards compliant



			}



			catch(ex)



			{



				objDest.add(objOpt); // IE only



			}



			



			//Show the message to the User.



			alert("This value '"+ document.getElementById(objTxtField).value +"' has been added successfully.");



			



			//Now empty the field.



			document.getElementById(objTxtField).value	=	'';



		}// Closing of 	if(txtNewOptionText != "")



		else



			alert("Please provide some value to be added.");



	}// Closing of function addValue2Combo(...)



	



	//--------------------------------------------------------------------------



	/* 



		This method is used to add a tab panel on the web page.



		Inputs: Currently it is taking no parameter and You must 



		define a class with the Name of the "Tab" for the Anchor.



		There must also be a class (no need to define just put the name) 'active'



		



		You must also have an attribute "Title" of Anchor tab.



		



		Outputs: tabed behaviour of the page.



		Calls: It is using and calling the JQuery's $ to refer to JQuery method, 'removeClass', 



		slideUp() and "attr" of the jquery-1.2.6.min.js



	*/



	//--------------------------------------------------------------------------



	function init()



	{







		 // When the document loads do everything inside here ...



		  $(document).ready(function()



		  {



			// When a link is clicked



			$("a.tab").click(function () 



			{



				/*  



					These below two lines perform the following actions:



					-	switch all tabs off



					-	// switch this tab on



					



					It controls the tabs shifting behavior. 



					It feels like the tab is being selected.



				*/



				$(".active").removeClass("active");



				$(this).addClass("active");



				



				// slide all content up



				$(".tab_Contents_Panel").slideUp();



				



				// slide this content up



				var content_show = $(this).attr("title");



				$("#"+content_show).slideDown();



			  



			});



		



		  });



	 }// Closing of init()



	 



	 //--------------------------------------------------------------------------



	 // Pet's Pages validations



	 //--------------------------------------------------------------------------



	 



		function validateProductForm( )



		{



			var objFV = new FormValidator("frmPetProduct");



		



			if (!objFV.validate("txtBusinessName", "B", "Please enter Name of Business."))



				return false;		







			if (!objFV.validate("txtLocation", "B", "Please enter Location."))



				return false;		



		



			if (!objFV.validate("txtEmail", "B, E", "Please enter a valid Email"))



				return false;		



		



			if (!objFV.validate("txt_CC", "B", "Please enter your Phone Country Code Number"))



				return false;		







			if (!objFV.validate("txt_AC", "B", "Please enter your Phone Location Number"))



				return false;		







			if (!objFV.validate("txt_Phone", "B", "Please enter your Phone Number"))



				return false;		







			if (!objFV.validate("txtContactPerson", "B", "Please enter Contact Person"))



				return false;	



		



			return true;



		}//Closing of validateProductForm( )







		//--------------------------------------------------------------------------



		function enableReward(value, mode)



		{



			if(value	==	"Lost")	



			{
	
				
				$("#div_reward").show();



				$("#lbl_Area").html("* Area Last Seen:");


				
				$("#lbl_Date").html("* Date Lost:");



				$("#lbl_Req").html("* ");



				$("#cmd_Save").val("Submit Lost Pet Ad");







				if(mode != "Edit")



					$("#div_Title").html("New Lost Pet Ad");



			}



			else



			{

	

				$("#div_reward").hide();



				$("#lbl_Area").html("* Area Found:");



				$("#lbl_Date").html("* Date Found:");



				$("#lbl_Req").hide();



				$("#cmd_Save").val("Submit Found Pet Ad");



				



				if(mode != "Edit")



					$("#div_Title").html("New Found Pet Ad");







			}



		}// Closing of enableReward(...)



		//--------------------------------------------------------------------------



	



		function addFileBoxes()



		{	



			var x = document.getElementById('cmb_Image');







			if ((x.selectedIndex) != 0)



			{



				var imgboxes = x.selectedIndex;



				var uploadBoxes = '';



				



				for(var i = 1; i<=imgboxes; i++)



				{



						uploadBoxes += "<input type='file' class='fileFrm' name='fileAttach" + i + "' id='fileAttach" + i +"' /><br /><br /> ";



				}







				//Finally embed the boxes to the div container.



				document.getElementById('inputFile').innerHTML = uploadBoxes;



			}



			else



			{



				//alert('Please specify the No. of images required to upload for your pet.');



				document.getElementById('inputFile').innerHTML = "<input type='file' class='fileFrm' name='fileAttach11' id='fileAttach1' />";



			}	



			



		}// Closing of addFileBoxes(...)







		//---------------------------------------------------------------------------------------



		/*	This funciton deletes a specific picture



			inputs: 



					1: Picture Id



					2: Page Type



					



			output: just displays Deleting... when the action is being performed.



		*/



		function deletePic(intIdPk, intType, container)



		{



		var poststr 		= 	"intIdPk=" + encodeURI( intIdPk )  



			 		 		+ 	"&type=" + encodeURI( intType ) ;



							



		//---------------------------------------------------------------------------------------



		//Now make the request through HTTP and get the Sub Categories



		// This is JQuery Ajax method.



		$.ajax({



				method: "get",



				url: root + "ul/delete_pic_exec.php", 



				data: poststr,



				beforeSend: function(){$("#" + container).show()}, //show loading just when link is clicked



				//complete: function(){ $("#" + container).hide()}, //stop showing loading when the process is complete



				success: function(msg)



				{ 



					//Reload the page

					window.location.reload(); 

					//$("#" + container).html(msg); //show the html inside .content div	



				} //Closing of success: function(html)



		 }); //close $.ajax(



		



			



		}// Closing of deletePic()







	//---------------------------------------------------------------------------------------



	// Takes from http://labnol.blogspot.com/2006/01/add-to-favorites-ie-bookmark-firefox.html



	// This is used to book mark the page.



	//---------------------------------------------------------------------------------------



	 function CreateBookmarkLink() 



	 {



		 title = document.title; 



		  // Blogger - Replace with <$BlogItemTitle$> 



		  // MovableType - Replace with <$MTEntryTitle$>



		



		 url = window.location.href;



		  // Blogger - Replace with <$BlogItemPermalinkURL$> 



		  // MovableType - Replace with <$MTEntryPermalink$>



		  // WordPress - <?php bloginfo('url'); ?>



		



			if (window.sidebar) { // Mozilla Firefox Bookmark



				window.sidebar.addPanel(title, url,"");



			} else if( window.external ) { // IE Favorite



				window.external.AddFavorite( url, title); }



			else if(window.opera && window.print) { // Opera Hotlist



				return true; }



	 }//Closing of function CreateBookmarkLink() 



	



	//---------------------------------------------------------------------------------------



	// Calls the CreateBookmarkLink() 



	// This is used to book mark the page.



	//---------------------------------------------------------------------------------------



	



	function addBookMark()



	{



		 if (window.external) 



		 {



			 document.write('<a href = "javascript:CreateBookmarkLink()");">Add to Favourties</a>'); 



		 } 



		 else  if (window.sidebar) 



		 {



			  document.write('<a href = "javascript:CreateBookmarkLink()");">Bookmark Page</a>'); 



		 } 



		 else if (window.opera && window.print) 



		 {	



			  document.write('<a href = "javascript:CreateBookmarkLink()");">Add Bookmark</a>');



		 } 



	}// Closing of function addBookMark()







	/**



	 * marks all rows and selects its first checkbox inside the given element



	 *



	 */



	function markAllRows(field ) 



	{



		if(field.length > 0)



		{



		   for (i = 0; i < field.length; i++)



		   {



				field[i].checked = true ;



		   }



		}



		else



			field.checked = true ;



	}



	



	/**



	 * marks all rows and selects its first checkbox inside the given element



	 *



	 */



	function unMarkAllRows( field ) 



	{



		if(field.length > 0)



		{



		  for (i = 0; i < field.length; i++)



		  {



			field[i].checked = false ;



		  }



		}



		else



			field.checked = false ;



	}



		//---------------------------------------------------------------------------------------



		/*	This funciton enables or disables a specific users and pets



			inputs: 



					1: Status



					2: CheckBox Array



					3: Container name to display message.



					4: It tells the function where to send the request.



					5: Single Selection Bit



					



			output: displays Status being updates... when the action is being performed.



					displays Status Updated... when the action has been performed.



		*/



		function changeStatus(intStatus, chkArray, container, pgType, isSingle)



		{



			var aryIds = Array();



			var j=0;



			



			// before passing to the file check that user has selected any value



			for (i = 0; i < chkArray.length; i++)



	  		{



				if(chkArray[i].checked != false)



				{



					aryIds[j]	=	chkArray[i].value;



					j = j+1;



				}



	  		}//Closing of for loop







			if(chkArray.checked == true && isSingle == false && aryIds.length == 0)



				aryIds[0] = chkArray.value;



			else if(isSingle == true)



				aryIds[0] = chkArray;







			//Check that something has been selected



			if(aryIds.length > 0)



			{



				//---------------------------------------------------------------------------------------



				var poststr;



				



				if(isSingle == false)



					poststr 		= 	"chkArray=" + encodeURI( aryIds )  



									+ 	"&status=" + encodeURI( intStatus ) ;



				else if(isSingle == true)



					poststr 		= 	"intIdPk=" + encodeURI( aryIds[0] )  



									+ 	"&status=" + encodeURI( intStatus ) ;



				



				



				if(pgType != 0)



					poststr	=	poststr + 	"&pg=" + encodeURI( pgType ) ;



				



				//---------------------------------------------------------------------------------------



				var urlExec;



			



				//---------------------------------------------------------------------------------------



				// Redirection in the Case of multiple Selection



				//---------------------------------------------------------------------------------------



				if(pgType == 0 && isSingle == false)



					urlExec	=	root + "acp/users/status_all_exec.php";					



				else if(pgType != 0 && isSingle == false)



					urlExec	=	root + "acp/status_all_exec.php";







				//---------------------------------------------------------------------------------------



				// Redirection in the Case of Single Selection



				//---------------------------------------------------------------------------------------



				if(pgType == 0 && isSingle)



					urlExec	=	root + "acp/users/status_exec.php";					



				else if(pgType != 0 && isSingle)



					urlExec	=	root + "acp/status_exec.php";







				//---------------------------------------------------------------------------------------



				//Now make the request through HTTP and get the Sub Categories



				// This is JQuery Ajax method.



				$.ajax({



						method: "get",



						url: urlExec, 



						data: poststr,



						beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked



						//complete: function(){ $("#" + container).hide()}, //stop showing loading when the process is complete



						success: function(msg)



						{ 



							$("#" + container).html(msg); //show the html inside div	



						



							//Reload the page after some delay



							setTimeout('window.location.reload()', 600);



			



						} //Closing of success: function(msg)



				 }); //close $.ajax(



			}// Closing of if(aryIds.length >0)



			else



				alert("Please select any one from list before proceeding.");



		}// Closing of changeStatus(...)







	//---------------------------------------------------------------------------------------	



	



		/*	This funciton marks any pet as Pet of the Month



			inputs: 



					1: Pet Id



			output: displays nothing.



		*/



		function markPetofMonth(intIdPk)



		{



				var poststr 		= 	"intIdPk=" + encodeURI( intIdPk ) ;



				



				//---------------------------------------------------------------------------------------



				var urlExec;



			



				//---------------------------------------------------------------------------------------



				// Redirection URL



				//---------------------------------------------------------------------------------------



					urlExec	=	root + "acp/pets/mark_petofmonth_exec.php";					



				//---------------------------------------------------------------------------------------



				//Now make the request through HTTP and get the Sub Categories



				// This is JQuery Ajax method.



				$.ajax({



						method: "get",



						url: urlExec, 



						data: poststr,



						//complete: function(){ $("#" + container).hide()}, //stop showing loading when the process is complete



						success: function(msg)



						{ 



							



							//Reload the page after some delay



							setTimeout('window.location.reload()', 500);



			



						} //Closing of success: function(msg)



				 }); //close $.ajax(



		}// Closing of markPetofMonth(...)







	//---------------------------------------------------------------------------------------	







	function showRelevantFields(type)



	{



		switch(type)



		{



			case "Pet":



				$("#div_Type").show();



				$("#div_Name").show();



				$("#div_Age").show();



				$("#div_Gender").show();



				$("#div_Breed").show();



				$("#div_Color").show();



				$("#div_Country").show();



				$("#div_City").show()



				



				//hide the fields which are not required.



				$("#div_DRange").hide();



				$("#div_Area").hide();



				$("#div_Price").hide();



				$("#div_Email").hide();



				$("#div_BType").hide();



				$("#div_Break").hide();



				



			break;



			



			case "Lost":



			case "Found":



				$("#div_Type").show();



				$("#div_Name").show();



				$("#div_Age").show();



				$("#div_Gender").show();



				$("#div_Breed").show();



				$("#div_Color").show();



				$("#div_Country").show();



				$("#div_City").show()



				$("#div_DRange").show();







				//hide the fields which are not required.



				



				$("#div_Price").hide();



				$("#div_Email").hide();



				$("#div_BType").hide();



				$("#div_Break").hide();



			break;	



			



			case "Buy":



			case "Sell":



				



				$("#div_Type").show();



				



				if(type == "Sell")



					$("#div_Name").show();



				else



					$("#div_Name").hide();



				



				$("#div_Age").show();



				$("#div_Gender").show();



				$("#div_Breed").show();



				$("#div_Color").show();



				$("#div_Price").show();



				$("#div_Country").show();



				$("#div_City").show();



				



				//hide the fields which are not required.



				



				$("#div_Area").hide();



				$("#div_Email").hide();



				$("#div_BType").hide();



				$("#div_DRange").hide();



				$("#div_Break").hide();



				



			break;	



			



			case "Wanted":



			case "Not Wanted":



				$("#div_Type").show();



			



				if(type == "Not Wanted")



					$("#div_Name").show();



				else



					$("#div_Name").hide();







				$("#div_Age").show();



				$("#div_Gender").show();



				$("#div_Breed").show();



				$("#div_Color").show();



				$("#div_Country").show();



				$("#div_City").show();



				/*$("#div_DRange").show();*/



				



				//hide the fields which are not required.



				$("#div_Price").hide();



				$("#div_Email").hide();



				$("#div_BType").hide();



				$("#div_DRange").hide();



				$("#div_Break").hide();



				



			break;						







			case "Cemetery":



				$("#div_Type").show();



				$("#div_Name").show();



				$("#div_Age").show();



				$("#div_Gender").show();



				$("#div_Breed").show();



				$("#div_Color").show();



				//hide the fields which are not required.



				



				$("#div_Area").hide();



				/*$("#div_DRange").hide();*/



				$("#div_Price").hide();



				$("#div_Country").hide();



				



				$("#div_Email").hide();



				$("#div_BType").hide();



				$("#div_City").hide();



				$("#div_Break").hide();







			break;



			



			case "Services":



				



				$("#div_Name").show();



				$("#div_Country").show();



				$("#div_Email").show();



				$("#div_BType").show();



				$("#div_City").show();



				$("#div_Break").show();



				



				//hide the fields which are not required.



				



				$("#div_Type").hide();



				$("#div_Area").hide();



				$("#div_DRange").hide();



				$("#div_Age").hide();



				$("#div_Price").hide();



				$("#div_Color").hide();



				$("#div_Breed").hide();



				$("#div_Gender").hide();



			break;



			







		}// closing of switch(type)



	}// Closing of function showRelevantFields(type)



	



	//---------------------------------------------------------------------------------------	



	/*This Function is to show the video



	  Ref: http://flowplayer.org/	



	*/



	



		function showVideo(txtURL, container)



		{



			$("#mainpic").hide();







			//Hide all other Containers



			disablePic(container);







			//Show the Current Container



			$("#" + container).show();



			



			 var css = {}; 



			 var player =  $f( container, root + "includes/plugnplay/flvplayer/flowplayer-3.0.0-rc4.swf", {



			



			



			clip: {  



				url: txtURL, 



				autoPlay: false ,



				scaling: 'fit'



				



				// when this clip is clicked go here 



				//linkUrl: 'http://wwww.etrix.ie', 



				



				// an event property which are discussed later 



				/*onStart: function(clip) { 



				googleStatistics(clip);         



				} */



				}







			});



		}



	//---------------------------------------------------------------------------------------	



	/*	This Function is to show the images and hide the video(s)



		inputs:Current Video Containers.



	*/



	



	function enablePic(container)



	{



		$("#mainpic").show();



		//Hide all Containers



		disablePic(container);



	}







	//---------------------------------------------------------------------------------------	



	/*	This Function is to hide the video(s)



		inputs: Current Video Containers.



	*/



	



	function disablePic(container)



	{



		for(i=1; i <= totalVideos; i++)



		{



			//Hide all Containers other than the current



			if(("player" + i) != container)



				$("#player" + i).hide();



		}// Closing of for(i=0; i < totalVideos; i++)



	}



	



	//---------------------------------------------------------------------------------------	



	function addAsFriend(intUsrId, intPetOwnerId)



	{



		var poststr 	= 	"intUsrId=" + encodeURI( intUsrId )  +



							"&intPetOwnerId=" + encodeURI( intPetOwnerId ) ; 



		//---------------------------------------------------------------------------------------



		// Redirection URL



		var urlExec	=	root + "ul/users/become_friend_exec.php";					



		//---------------------------------------------------------------------------------------



		//Now make the request through HTTP and get the Sub Categories



		// This is JQuery Ajax method.



		$.ajax({



				method: "get",



				url: urlExec, 

				data: poststr,

				success: function(msg)
				{ 
					alert(msg);
					//Reload the page after some delay
					setTimeout('window.location.reload()', 100);
					//window.location.reload();
				} //Closing of success: function(msg)

		 }); //close $.ajax(

	}// Closing of addAsFriend($intUsrId, $intPetOwnerId)

		//---------------------------------------------------------------------------------------

		/*	This funciton Makes or removes any selected friend



			inputs: 

					1: CheckBox Array

					2: Senders List

					3: Container name to display message.

					4: bit 1: Make Friends 2=> Remove Friends



			output: displays Status being updates... when the action is being performed.



					displays Status Updated... when the action has been performed.



		*/



		function friends_actions(chkArray, hidSenders, container, bit)

		{

			var aryIds 		 = Array();

			var arySenderIds = Array();

			var j=0;



			// before passing to the file check that user has selected any value



			for (i = 0; i < chkArray.length; i++)

	  		{

				if(chkArray[i].checked != false)

				{

					aryIds[j]		=	chkArray[i].value;

					arySenderIds[j]	= 	hidSenders[i].value;



					j = j+1;

				}



	  		}//Closing of for loop



			if(chkArray.checked == true && aryIds.length == 0)

			{



				aryIds[0] 		=	chkArray.value;

				arySenderIds[0]	= 	hidSenders.value;



			}



			//Check that something has been selected



			if(aryIds.length > 0)
			{
				
				//---------------------------------------------------------------------------------------

				var poststr;

				poststr 		= 	"chkArray=" + encodeURI( aryIds )  +



									"&hidSenders=" + encodeURI( arySenderIds ) ;
				//---------------------------------------------------------------------------------------

				var urlExec;

				//---------------------------------------------------------------------------------------



				// Redirection in the Case of multiple Selection



				//---------------------------------------------------------------------------------------



				if(bit == 1)

					 urlExec	=	root + "ul/users/approve_friend_exec.php";

				else if(bit == 2)

					 urlExec	=	root + "ul/users/remove_friend_exec.php";



				else if(bit == 3)

					 urlExec	=	root + "ul/users/ignore_friend_exec.php";



				//---------------------------------------------------------------------------------------



				//Now make the request through HTTP and get the Sub Categories



				// This is JQuery Ajax method.



				$.ajax({



						method: "get",



						url: urlExec, 



						data: poststr,



						beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked



						success: function(msg)

						{ 

							$("#" + container).html(""); //show the html inside div	



							alert(msg);	

							//Reload the page after some delay

							setTimeout('window.location.reload()', 600);

						} //Closing of success: function(msg)



				 }); //close $.ajax(



			}// Closing of if(aryIds.length >0)



			else

				alert("Please select any friend from list before proceeding.");



		}// Closing of friends_actions(...)



	//---------------------------------------------------------------------------------------

		/*	This funciton marks the messages read, unread, and deleted.



			inputs: 

					1: CheckBox Array

					2: Page Box

					3: Container name to display message.

					4: c: bit d: Delete r=> Read, u=> unRead

					5: 1 for Deletion and 0 for setting status

			output: displays Status being updates... when the action is being performed.

					displays Status Updated... when the action has been performed.



		*/



		function message_actions(chkArray, txtBox ,container, status, bit)

		{

			var aryIds 		 = Array();

			var j	=	0;



			// before passing to the file check that user has selected any value



			for (i = 0; i < chkArray.length; i++)

	  		{

				if(chkArray[i].checked != false)

				{

					aryIds[j]		=	chkArray[i].value;

				}

				

				j = j + 1;



	  		}//Closing of for loop



			if(chkArray.checked == true && aryIds.length == 0)

			{



				aryIds[0] 		=	chkArray.value;

			}



			//Check that something has been selected



			if(aryIds.length > 0)

			{



				//---------------------------------------------------------------------------------------

				var poststr;

				poststr 		= 	"chkArray=" + encodeURI( aryIds )  +



									"&status=" + encodeURI( status ) +

									

									"&txtBox=" + encodeURI( txtBox ) 

									;



				//---------------------------------------------------------------------------------------



				var urlExec;

				//---------------------------------------------------------------------------------------



				// Redirection in the Case of multiple Selection



				//---------------------------------------------------------------------------------------

				 if(bit == 0)

					 urlExec	=	root + "ul/messages/mark_messages_exec.php";

				  else if(bit == 1)	

				 	 urlExec	=	root + "ul/messages/delete_messages_exec.php";

				//---------------------------------------------------------------------------------------



				//Now make the request through HTTP and get the Sub Categories



				// This is JQuery Ajax method.



				$.ajax({



						method: "get",



						url: urlExec, 



						data: poststr,



						beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked



						success: function(msg)

						{ 

							$("#" + container).html(""); //show the html inside div	



							alert(msg);	

							//Reload the page after some delay

							setTimeout('window.location.reload()', 600);

						} //Closing of success: function(msg)



				 }); //close $.ajax(



			}// Closing of if(aryIds.length >0)



			else

				alert("Please select any message from list before proceeding.");



		}// Closing of message_actions(...)



	//---------------------------------------------------------------------------------------



		/*	This funciton removes any selected friend



			inputs: 



					



					1: friend Id



					2: Senders Id



					



			output: displays Status being updates... when the action is being performed.



					displays Status Updated... when the action has been performed.



		*/

/*custom ajax added on 04-05-2009*/
	
function createRequestObject()
{
	//alert("welcome");
	var request_o;
	var browser = navigator.appName;

	if (browser == "Microsoft Internet Explorer")
	{
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		request_o = new XMLHttpRequest();
	}
	return request_o;

}	//	End of createRequestObject()
var http = createRequestObject();
	function removeFriend(friendId, intSender)
	{	
		var aryIds 		 = Array();
		var arySenderIds = Array();
		aryIds[0] 		= friendId;			
		arySenderIds[0]	= 	intSender;
		//Check that something has been selected
		if(aryIds.length > 0)
		{
			if(confirm("Do you want to delete the Selected Friend(s)?"))
			{
				//---------------------------------------------------------------------------------------
				var poststr;
				poststr 		= 	"chkArray=" + encodeURI( aryIds )  +

									"&hidSenders=" + encodeURI( arySenderIds ) ;
				//---------------------------------------------------------------------------------------
				
				var urlExec;
				
				//---------------------------------------------------------------------------------------

				// Redirection in the Case of multiple Selection


				//---------------------------------------------------------------------------------------


				 urlExec	=	root + "ul/users/remove_friend_exec.php";

				http.open('POST',urlExec);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = update_removeFriend;	

		http.send(poststr);
			
			}// end if confirm
		
		}// Closing of if(aryIds.length >0)



		else
			alert("Please select any friend before proceeding.");



	}// Closing of removeFriend(...)
	function update_removeFriend()
	{
	
		
		if(http.readyState == 4)
		{
			var response = http.responseText;		
			var results = response;			
			if(results == "success")
			{
				alert("Friend has been removed successfully.");
				setTimeout(window.location.reload(), 100);
			}
			else
			{
					alert(results);
			}
		}// end if(http.readyState == 4)
	}

	/*	function removeFriend(friendId, intSender)
		{	
			alert("in function");
			alert(root);
			var aryIds 		 = Array();
			var arySenderIds = Array();
			aryIds[0] 		= friendId;			
			arySenderIds[0]	= 	intSender;
			//Check that something has been selected
			if(aryIds.length > 0)
			{
				if(confirm("Do you want to delete the Selected Friend(s)?"))
				{
					//---------------------------------------------------------------------------------------
					var poststr;
					poststr 		= 	"chkArray=" + encodeURI( aryIds )  +

										"&hidSenders=" + encodeURI( arySenderIds ) ;
					//---------------------------------------------------------------------------------------
					
					var urlExec;
					
					//---------------------------------------------------------------------------------------

					// Redirection in the Case of multiple Selection


					//---------------------------------------------------------------------------------------


					 urlExec	=	root + "ul/users/remove_friend_exec.php";



					//---------------------------------------------------------------------------------------



					//Now make the request through HTTP and get the Sub Categories



					// This is JQuery Ajax method.



					$.ajax({



							method: "get",



							url: urlExec, 



							data: poststr,



							//beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked
					
							

							success: function(msg)



							{ 


								alert("success");
								alert(msg);	

								

								//Reload the page after some delay



								setTimeout('window.location.reload()', 110);



				



							} //Closing of success: function(msg)


					 }); //close $.ajax(



					
					 return true;



				}



				else



					return false;



			}// Closing of if(aryIds.length >0)



			else
				alert("Please select any friend before proceeding.");



		}// Closing of removeFriend(...)


*/




	//---------------------------------------------------------------------------------------	



		/*	This funciton removes any selected User (Called from Admin End)



			inputs: 



					



					1: User Id



					2: Container Id Where the message will be displayed.



					3: Bit 



						1-> For User



						2-> For Service Messages



						3-> For Pets







			output: displays Status being updates... when the action is being performed.



					displays Status Updated... when the action has been performed.



		*/



		function removeRecords(chkArray, container, bit)



		{



			



			var aryIds 		 = Array();







			var j=0;



			



			// before passing to the file check that user has selected any value



			for (i = 0; i < chkArray.length; i++)



			{



				if(chkArray[i].checked != false)



				{



					aryIds[j]		=	chkArray[i].value;



					j = j+1;



				}



			}//Closing of for loop







			if(chkArray.checked == true && aryIds.length == 0)



			{



				aryIds[0] = chkArray.value;



			}



			



			//Check that something has been selected



			if(aryIds.length > 0)



			{



				if(confirm("Do you want to delete the Selected records?"))



				{



					//---------------------------------------------------------------------------------------



					var poststr;



					



					poststr 		= 	"chkArray=" + encodeURI( aryIds ) ;



					//---------------------------------------------------------------------------------------



					var urlExec;



				



					//---------------------------------------------------------------------------------------



					// Redirection in the Case of multiple Selection



					//---------------------------------------------------------------------------------------



					 if(bit==1)



						 urlExec	=	root + "acp/users/remove_all_user_exec.php";



					else if (bit==2)



						urlExec		=	root + "acp/services/remove_all_msgs_exec.php";	



					//---------------------------------------------------------------------------------------



					//Now make the request through HTTP and get the Sub Categories



					// This is JQuery Ajax method.



					$.ajax({



							method: "get",



							url: urlExec, 



							data: poststr,



							beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked



							success: function(msg)



							{ 



								$("#" + container).html(msg); //show the html inside div	



	



								//Reload the page after some delay



								setTimeout('window.location.reload()', 500);



				



							} //Closing of success: function(msg)



					 }); //close $.ajax(







					return true;



				}



				else



					return false;



			}// Closing of if(aryIds.length >0)



			else



				alert("Please select any friend from list before proceeding.");



			



		}// Closing of removeUsers(...)







	//---------------------------------------------------------------------------------------	



	/*$(document).ready(function()



	{



		// These below lines are to fill the action field



		$("#cmd_Product").click( 



								



								function()



										 {



											$("#frmPetProduct").attr( "action", root + "" ) ;



											$("#frmPetProduct").attr( "submit");



										 });



						



	});*/







	function hideButton()
	{

	//	$('#cmd_SaveService').attr('disabled', 'true');
		$("#div_Process").hide(); 



		$('#div_Back').hide(); 



		$('#p_Message').show();	



		return true;



	}







	//---------------------------------------------------------------------------------------



		/*	This funciton removes any uploaded files of the services



			inputs: 



					1: Actal File Name



					2: File Name



					3: Index of the File



					



			output: displays Status being updates... when the action is being performed.



					displays Status Updated... when the action has been performed.



		*/



		function removeServiceFile(originalName, fileName, index)



		{



			



				//---------------------------------------------------------------------------------------



				var poststr = 	"fileName=" + encodeURI( fileName ) +  



								"&index=" + encodeURI( index ) +



								"&originalName=" + encodeURI( originalName );



				//---------------------------------------------------------------------------------------



				// Service URL



				var urlExec =	root + "ul/products/remove_picture_exec.php";



			



				//---------------------------------------------------------------------------------------



				//Now make the request through HTTP and get the Sub Categories



				// This is JQuery Ajax method.



				$.ajax({



						method: "get",



						url: urlExec, 



						data: poststr,



						//beforeSend: function(){$("#" + container).html('Updating Status...')}, //show loading just when link is clicked



						success: function(msg)



						{ 



							if(msg != "")



								$("#UploadedFiles").html(msg);



							else



								$("#UploadedFiles").html('none')



						} //Closing of success: function(msg)



				 }); //close $.ajax(



			



		}// Closing of removeServiceFile(...)







	//---------------------------------------------------------------------------------------	



	//---------------------------------------------------------------------------------------	



	/*	This Function is to hide / show the panel(s)



		inputs: Type



				bit 1 = coming from front, 2 = coming from Admin



	*/



	



	function togglePanes(txtType, bit)



	{



		if(txtType=='Buy')



		{



			$('#div_Title').html("Buy a Pet");



			$('#divImagePane').hide();



			$('#div_Name').hide();



			



			if(bit == 2)



				$('#divImagePane2').hide();



		}



		else 



		{



			$('#div_Title').html("Sell a Pet");



			$('#divImagePane').show();



			



			if(bit == 2)



				$('#divImagePane2').show();



			



			$('#div_Name').show();



		}



	}







	//---------------------------------------------------------------------------------------	



	/*	This Function is to hide / show the panel(s)



		inputs: Type



				bit 1 = coming from front, 2 = coming from Admin



	*/



	



	function toggleAdoptPanes(txtType, bit)



	{



		if(txtType=='Wanted')



		{



			$('#div_Title').html("Adopt a Pet");



			$('#divImagePane').hide();



			$('#div_Name').hide();



			



			if(bit == 2)



				$('#divImagePane2').hide();



		}



		else 



		{



			$('#div_Title').html("Put for Adoption");



			$('#divImagePane').show();



			



			if(bit == 2)



				$('#divImagePane2').show();



			



			$('#div_Name').show();



		}



	}
//== manage add products/services form	
function changeForm(tvalue)
{	
	var fld;		
	fld = document.getElementById('cmb_type');
	if((tvalue != null && tvalue != "") || fld!= null){
		if(tvalue == "product" || fld.value == "product")
		{
			document.getElementById('lbl_name').innerHTML = "* Product Name:";
			document.getElementById('lbl_type').innerHTML = "* Product Type:";
			document.getElementById('lbl_details').innerHTML = "Product Details:";
			document.getElementById('div_country').style.display = "none";
			document.getElementById('div_city').style.display = "none";
			document.getElementById('div_address').style.display = "none";
			document.getElementById('div_email').style.display = "none";
			document.getElementById('div_phone').style.display = "none";
			document.getElementById('div_fax').style.display = "none";
			/*document.getElementById('div_cperson').style.display = "none";*/
		}
		else if(tvalue == "service" || fld.value == "service")
		{
			
			document.getElementById('lbl_name').innerHTML = "* Name of Business:";
			document.getElementById('lbl_type').innerHTML = "* Type of Business:";
			document.getElementById('lbl_details').innerHTML = "Business / Service Details:";
			document.getElementById('div_country').style.display = "block";
			document.getElementById('div_city').style.display = "block";
			document.getElementById('div_address').style.display = "block";
			document.getElementById('div_email').style.display = "block";
			document.getElementById('div_phone').style.display = "block";
			document.getElementById('div_fax').style.display = "block";
			/*document.getElementById('div_cperson').style.display = "block";*/
		
		}
	}// end if fld != null
}//function changeForm()

///===== manage search forms in right panel
function manageSearch(searchType)
{
	if(searchType == "products")
	{
		document.getElementById('div_search_pets').style.display  = "none";	
		document.getElementById('div_search_products').style.display  = "block";	
		document.getElementById('search_pet').className = "";
		document.getElementById('search_product').className = "active";
	}
	else if(searchType == "pets")
	{
		document.getElementById('div_search_products').style.display  = "none";	
		document.getElementById('div_search_pets').style.display  = "block";	
		document.getElementById('search_product').className = "";
		document.getElementById('search_pet').className = "active";
	}
}// end function manageSearch(searchType)

function selectArea(aid)
{
	document.getElementById(aid).select();
}

//-->
