	/* JavaScript Document for Common functions  */
	/*---------------------------------------------------------------------------------------*/
	/* Call AJAX by GET Method
	@params : params => to be sent to the server page.
	@params	: url	=> URL of the server page	
	@params	: container	=> object of the container where the output will be shown.
	
	*/
	function callAjax(params, url, container)
	{
		$.ajax({
	
					method: "GET",
					url: url, 
					data: params,

					beforeSend: function()
					{
						var loadingHTML	=	'<div align="center"><br /><br /><br /><img src="'+ mainroot + 'images/loadingAnimation.gif"></div>';
						if(container != "JAlert")
							container.html(loadingHTML);
						else if(container == "JAlert")
						{
							$.alerts.okButton 	 = "Cancel"; // set Ok Button Caption to Cancel 
							jAlert(loadingHTML,  "Loading List, Press cancel if you want to return.");	
						}
					}, //show loading just when link is clicked

					success: function(msg)
					{ 
						if(container != "JAlert")
							container.html(msg);
						else if(container == "JAlert")
						{
							jAlert(msg, "Select from List:");	
						}	
						
					} //Closing of success: function(html)
	
			 }); //close $.ajax()
	}/* Closing of function callAjax(params)*/
	/*---------------------------------------------------------------------------------------*/
	/* Call AJAX by POST Method
	@params : params => to be sent to the server page.
	@params	: url	=> URL of the server page
	@params	: callBackFunc	=> call Back Function if any. [optional]
	@params	: container	=> object of the container where the output will be shown. [optional]
	
	*/

	function callAjaxPost(params, url, callBackFunc, container)
	{
		$.post(url, params, 
					function(msg)
					{ 
							if(typeof callBackFunc != "undefined" && callBackFunc != null && typeof callBackFunc == "string")
								eval(callBackFunc);
							else if (typeof callBackFunc != "undefined" && callBackFunc != null && typeof callBackFunc == "function")	
								callBackFunc(msg);
					} /*Closing of success: function(msg)*/
	
			 ); /*close $.ajax()*/
	}/* Closing of function callAjax(...)*/
	/*---------------------------------------------------------------------------------------*/
	/*	The purpose of this method is to submit a form using javascript
		inputs: 
			@param: form id as string
		output: 
			Submits the form
	*/

	function submitForm(frm)
	{
		$("#" + frm).submit();
	}/* Closing of submitForm(...)*/
	
	/*---------------------------------------------------------------------------------------*/
	/*	The purpose of this method is to hide the overlay on some pages where it is required.
		inputs: 
			@param: nothing
		output: 
			removes the overlay
	*/
	
	$(window).load(function() {
		 $('#blankout').fadeOut( 1000 );
	});
	
	/*---------------------------------------------------------------------------------------*/	
	/*
		in URL parameter, pass only query string part and leave the part before ? sign.
		query string variable of which value is required
	*/
	function getQueryVariable(URL ,variable) 
	{
		var query ; 
	 
		if(typeof URL == "undefined")
			query = window.location.search.substring(1); 
		else
			query = URL;
		
		var vars = query.split("&");
		for (var i=0;i<vars.length;i++) 
		{
			var pair = vars[i].split("=");
		
			if (pair[0] == variable) 
			{
			  return pair[1];
			}
		}
		return false;
	}
	/*---------------------------------------------------------------------------------------*/
	/*	The purpose of this method is to make a hand cusor on the sorting columns' heading text
		inputs: 
			@param: field as object
		output: 
			Makes Hand Cursor Pointer
	*/

	function makeHandCursor( objField)
	{
		$(objField).css({
							cursor: 'pointer'
					 });
	}/*Closing of makeHandCursor( objField)*/
	/*---------------------------------------------------------------------------------------*/			
	/*	The purpose of this method is to remove Hand cursor
		inputs: 
			@param: field as object
		output: 
			Removes Hand Cursor Pointer
	*/
	function removeHandCursor( objField)
	{
		$(objField).attr("style", "");
	}/*Closing of removeHandCursor( ... ) */

	/*---------------------------------------------------------------------------------------*/
	/*	The purpose of this method is to apply sorting functionality on clicking on any sorted heading TD
		inputs: 
			@param: URL as string
		output: 
			Makes Hand Cursor Pointer
	*/
	
	function sortMe(URL)
	{
		window.location.href	=	URL;
	}/*Closing of sortMe(URL)*/
	/*---------------------------------------------------------------------------------------*/

	/*	The purpose of this method is to hide the search panels
		inputs: 
			@param: module name as string
			@param: name of the page where to apply as string.
		output: 
			none; just refreshs the same page.
	*/
	function hide_search_panel(module, pageName)
	{
		$('#search_panel').fadeOut('slow');
		
		if(typeof module != "undefined")
		{
			// Also delete the sessions
			if(typeof pageName != "undefined")
			 window.location = root + 'modules/' + module + "/"+ pageName +"?delSearchQuery=true";
			else
			  window.location = root + 'modules/' + module + "/index.php?delSearchQuery=true";
		}	
	}/* Closing of hide_search_panel (...) */
	/*---------------------------------------------------------------------------------------*/
	function show_search_panel()
	{
		$('#search_panel').fadeIn('slow');
	}/* Closing of show_search_panel (...) */
	
	/*---------------------------------------------------------------------------------------*/	
	/* check page are you sure stuff*/
	var changes = true;        
	/*---------------------------------------------------------------------------------------*/
	/*
		This method is used to show the message to the user if sections or Main categories is not empty.
		Inputs: module Name
				Id
		Outputs: Message box
		Calls: It uses jquery.alerts.js , So it must be included above before calling this method.
	*/
	
	function showAlertBox(intIdPk, module)
	{
		//Check there are some products attached or not
		var params 		= 	"intIdPk=" + encodeURI( intIdPk ) + "&module=" + encodeURI( module )  ;  
		var url			= 	root + "modules/"+ module +"/getTotalAttachedCategoriesAjax.php";  
		var txtHTML;
		
		switch(module)
		{
			case "sections" :
					
				txtHTML		=	"<span class='clsError'>This section is not empty and has";
			break;

			case "section_categories" :
				
				txtHTML		=	"<span class='clsError'>This Category is not empty and has";
			break;

		}/* Closing of switch(module) */
		
		// Call to Ajax method.
		callAjaxPost(params, url, 
		function(response)
		{
			if(response == "delete")
			{
				jConfirm('Are you sure you want to delete this record? Click \'ok\' to proceed and \'cancel\' to return?', 'Confirm Deletion', function(result) {
						if(result) deleteRec(intIdPk, module, params);
					});
			}
			
			else if(response == "No")
			{
				$.alerts.okButton 	 = "Ok"; /* set Ok Button Caption to Cancel*/

				jAlert("Primary Key is not valid", "Warning!");
	
			}
			else
			{
				$.alerts.okButton 	 = "Ok"; /* set Ok Button Caption to Cancel*/
				txtHTML		+=	" "+ response +" category(ies) attached with it. Please delete the attached categories first before deleting it.</span>";
				jAlert(txtHTML, "Warning!");
			}			
			
		}/* Closing of function(response) */);
	}/*Closing of showAlertBox(...)*/
	/*---------------------------------------------------------------------------------------*/
	/*
		This method is used to show the options box at the time of deletion.
		Inputs: module Name
				Id
		Outputs: Message box
		Calls: It uses jquery.alerts.js , So it must be included above before calling this method.
	*/
	
	function showMsgBox(intIdPk, module, intMainCatIdPk)
	{
		//Check there are some products attached or not
		var params 		= 	"intIdPk=" + encodeURI( intIdPk ) + "&module=" + encodeURI( module )  ;  
		var url			= 	root + "modules/products/get_attached_products.php"; 
		
		// Call to Ajax method.
		callAjaxPost(params, url, 
		function(response)
		{
			if(response == "yes")
			{
				var txtTitle	=	"There are some products associated with this ";
				var	singMod		=	"";
					
				switch(module)
				{
					case "presenters" :
						txtTitle =	txtTitle + " Presenter.";
						singMod	 =	" Presenter";
					break;	
					case "categories" :	
						txtTitle = 	"There are some products or News associated with this Category.";
						singMod	 =	" Category";
					break;
					case "tags" :	
						txtTitle = 	txtTitle + " Tag.";
						singMod	 =	" Tag";
					break;
				}// Closing of switch
				
				var url	 =	root + "modules/"+ module +"/get_list.php"; 
				
				txtTitle = txtTitle + " Please choose the following options to proceed:";
			
				var txtHTML	=	'<div align="center" id="divMsgBox">';
				
				// This check was put after having discussion on 4th of November, 2009
				// Don't show remove All attached products button if request is coming from categories and presenters.
				if(module !=  "presenters" && module !=  "categories")
				
				
				//	txtHTML		+=		'<input type="button" value="Remove all products attached with this' + singMod + '" onClick="deleteRecord(\''+intIdPk+'\', \''+ module+'\', \'remove\')" />&nbsp;';
				
				
				//txtHTML		+=		'<input type="button" value="Move the products to another' + singMod + '" onClick="showMoveLists(\''+intIdPk+'\', \''+ module+'\', \''+ url +'\', \''+ intMainCatIdPk +'\')" />' +'</div>';
				
					txtHTML		+=		'<input type="button" class="button_5" value="Remove attached products" onClick="deleteRecord(\''+intIdPk+'\', \''+ module+'\', \'remove\')" />&nbsp;';
				
				
				txtHTML		+=		'<input type="button" class="button_5" value="Move attached products" onClick="showMoveLists(\''+intIdPk+'\', \''+ module+'\', \''+ url +'\', \''+ intMainCatIdPk +'\')" />' +
								'</div>';
			
				$.alerts.okButton 	 = "Cancel"; /* set Ok Button Caption to Cancel*/
				jAlert(txtHTML, txtTitle);
			}/*Closing of if(response == "yes")*/
			else
				deleteRecord(intIdPk, module);
	
		  });	
		
	}/* Closing of function deleteRecord(...)*/

	/*---------------------------------------------------------------------------------------*/
	function  moveRec(intIdPk, module, intNewId)
	{
		var params 	= 	"intIdPk=" + encodeURI( intIdPk ) + "&intNewId=" + intNewId + "&delType=move";
		deleteRec(intIdPk, module, params, true);
	}/* Closing of moveRec(...)*/

	/*---------------------------------------------------------------------------------------*/
	/*
		This method is used to show the list of presenters or categories depending upon request.
		Inputs: Id
				module Name
				url
				Main Cat Id [OPTIONAL]	
		Outputs: shows a popup with list
		Calls: Make calls to Jquery Ajax Method
	*/
	
	function showMoveLists(intIdPk, module, url, intMainCatIdPk)
	{
		//Hide the current options box
		$.alerts._hide();

		var container	=	"JAlert";
		var params 		= 	"intIdPk=" + encodeURI( intIdPk ) + "&module=" + encodeURI( module )  ;  
		
		if(typeof intMainCatIdPk != "undefined" && module	==	"categories")
			params 		+=	"&intMainCatIdPk=" + encodeURI( intMainCatIdPk );
		
		//show_Container(container);
		callAjax(params, url, container);
		
	}/*Closing of showMoveLists(...)*/
	/*---------------------------------------------------------------------------------------*/

	/*
		This method is used to Delete the Record from the Db
		Inputs: Id
				module Name
				delType => remove, move
		Outputs: Sucess or Failure Message
		Calls: Make calls to Jquery Ajax Method
	*/
	
	function deleteRecord(intIdPk, module, delType)
	{
		var params 		= 	"intIdPk=" + encodeURI( intIdPk ) ;  
		var isConfirmed	= false;
		/*---------------------------------------------------------------------------------------*/

		if(typeof delType == "undefined" || delType == null)
		{
			$.alerts.okButton 	 = "Ok"; // set Ok Button Caption to Ok 
			jConfirm('Are you sure you want to delete this record? Click \'ok\' to proceed and \'cancel\' to return?', 'Confirm Deletion', function(result) {
						if(result) deleteRec(intIdPk, module, params);
					});
		}
		else
		{
			 params	=	params + "&delType=" + delType;
			 deleteRec(intIdPk, module, params);
		}
		
		return ;
	}/*Closing of deleteRecord(...)*/
	
	/*---------------------------------------------------------------------------------------*/
	function deleteRec(intIdPk, module, params, isMove)
	{
		//Now make the request through HTTP to deletion pages
		
		url			= 	root + "modules/"+ module +"/exec_del.php";
		
		var delRow	=	 ("#tr_Id_" + intIdPk).replace(/=/g,'');

		// Call to Ajax method.
		callAjaxPost(params, url, 
					 function(msg)
					 	{
							var title	=	"";
							
							if(msg.match('successfully') == "successfully")
								$(delRow).fadeOut("slow", function()
								{
										// Remove the deleted row.
										$(delRow).remove();
								
										/*here  add the total number of records to the row where products have been moved. Added on 12/11/2009*/
										if(typeof isMove != "undefined")
										{
											var intNewId;
											intNewId	=	Base64.encode(getQueryVariable(params,  "intNewId")); 
										
											//Get Total Products in the category, or author or tag etc where the products have been moved.
											url			= 	root + "modules/products/getTotalAttachedProductsAjax.php?module="+ encodeURI(module) + "&intIdPk=" + encodeURI(intNewId)+ "&date=" + encodeURI(Date());
											
											$("#td_" + intNewId.replace(/=/g,'')).load(url);
										}
								
										var totalRec = $(".data_table tbody").children().length;
									
										if(totalRec == 0)
										{
											addNewRow(true);
									
											$("#sp_PgNo").html("0"); /*Change the total pages counter to zero*/
										}
																		
										title	=	"Success";
									});
							else
								title	=	"Failure";
							
							/*Show the message*/
							$.alerts.okButton 	 = "Ok"; /* set Ok Button Caption to Ok*/
							jAlert(msg, title);	
							
						}//Closing of callback function
					 );

	}/* Closing of deleteRec(...)*/

	/*---------------------------------------------------------------------------------------*/	
	function submitData(page, module)
	{
		var value 		= 	$("#value").val();
		var txtFileName	=	page +"_add_edit.php";			
		
		var params 		= 	"value=" + encodeURI( value ) + "&mode=Add";  
		var url			= 	root + "modules/"+ module +"/"+ txtFileName; 
		
		// Call to Ajax method.
		callAjaxPost(params, url, "showResponse('"+ Base64.encode( value ) +"', msg, container, '"+ module +"', '"+ txtFileName +"')" , "#msgContainer");
	}/* Closing of submitData()*/
	/*---------------------------------------------------------------------------------------*/	
	function showResponse(value, msg, container, module, txtFileName)
	{
		value = Base64.decode(value);
		
		/*Split the message*/
		var aryData	=	msg.split("^^^~~~");
		
		if(typeof aryData[1] != "undefined")
		{
			msg = aryData[1];
			
			addNewRow(false, aryData[0], value, module);						
		/*---------------------------------------------------------------------------------------*/		
		var totalRec = $(".data_table tbody").children().length;
		
		if(typeof recPerPage == "undefined")
			recPerPage	=	10;
		
		var objLastRow	=	 $(".data_table tbody  tr:last");
		var lastRowId	=	objLastRow.attr( "id" );
		
		/* It is to maintain the total number of records per page.*/
		if((totalRec > recPerPage) || (lastRowId == "tr_noRec"))
		{
			/* Remove the last row*/
			 objLastRow.fadeOut("slow", function()
										{
											$(this).remove();
										  });
		}// Closing of if(totalRec > 12);
		/*---------------------------------------------------------------------------------------*/
		
			/* Call editable grid again*/
			editable(txtFileName);	
		}/*Closing of if(typeof aryData[1] != "undefined")*/
		
		/*---------------------------------------------------------------------------------------*/
		/*	Note: now at the time of pagination on adding or deleting new row, change the count manually so that user may know something is being done*/
		if(lastRowId == "tr_noRec")
		{
			$("#sp_PgNo").html("1");
		}
		/*---------------------------------------------------------------------------------------*/
		if($(container).is(":hidden"))
			$(container).append(msg).fadeIn(2000);
		else
			$(container).append(msg).fadeOut(2000);
	}
	/*---------------------------------------------------------------------------------------*/
	 /*
	 Inputs: 1: File name where the request will be sent for updation as string. 
	 		 2: Class name applied on the field that you want to make editable.
	 		 root variable is global it must be defined in the page above this file.
			 It also requires jquery.jeditable.js to be run and must be defined above this file in the head.
			 3: Width of the field [optional]
	 Output: It makes any field with in table editable.
			 
	 */
	 function editable(txtFileName, txtClsName, intWidth)
	 {
	
		if(typeof txtFileName == "undefined" || txtFileName == null) return;
		
		// If class has not been defined, use default .title class
		if(typeof txtClsName == "undefined" || txtClsName == null)
			txtClsName = ".title";

		if(typeof intWidth == "undefined" || intWidth == null)
			intWidth = 170;

		$(txtClsName).editable(txtFileName, { 
		  tooltip   : "Click to edit...",
		 // event     : "dblclick",
		  width 	: intWidth,
		  submit    : "Ok",
		  indicator : '<img src="'+ mainroot +'images/loading.gif" alt="loading..." />',
		  style     : "inherit",
		  cssclass  : 'inputtext'
		 });
	 }//Closing of function editable()
	/*---------------------------------------------------------------------------------------*/
	// This method is used to show the detail of news, products etc
	 /*
	 Inputs:	1: Id. 
	 			2: module Name
				3: width of the window		[optional]
				4: Height of the window 	[optional]
				5: Top Margin of the window [optional]
				6: member Id	[in the case of orders only] [optional]
				7: Page Name	[in the case of order Reports  only] [optional]
				
	 Output: It returns the Detail and show that into the Pretty Photo.
			 
	 */
	 function viewDetail(intIdPk, module, width, height, top_margin, intMemberId, txtViewDetailPage)
	 {
		var params 		= 	"intIdPk=" + encodeURI( intIdPk );  

		if(typeof txtViewDetailPage == "undefined")
			txtViewDetailPage	=	"view_detail_ajax.php";
			
		var url			= 	root + "modules/" + module + "/"+ txtViewDetailPage ; 
		
		if(typeof intMemberId == "undefined")
			params 		+= "&intMemIdPk=" + encodeURI( intMemberId ); 

		if(typeof width == "undefined")
			width	=	"920";

		if(typeof height == "undefined")
			height	=	"395";
		
		if(typeof height == "undefined"){
			top_margin	=	"180";
		}else{
			
		}
		
		
		details = '&iframe=true&width='+width+'&height='+height+'&top='+top_margin;

		// Show the page	
		pageAjax = url+'?'+params+details;//'&iframe=true&width='+ width +'&height='+ height;
	
		$.prettyPhoto.open(pageAjax);
		
	}//Closing of function viewDetail()

	/*---------------------------------------------------------------------------------------*/
	/* End of mutli box related functions*
	/*---------------------------------------------------------------------------------------*/
	function addNewRow(isNoRecRow, id, value, module)
	{
		var newRow = "";

		if((isNoRecRow == false)
			&& (typeof isNoRecRow != "undefined" && typeof value != "undefined" && typeof module != "undefined" )
			)
		{
			 
			 var txtATitle;

			if(module == "presenters")
				txtATitle	=	"View Products written/produced by '"+ value +"'";
			else
				txtATitle	=	"View Products with which this tag '"+ value +"' has been attached.'";
			 
			 newRow = "<tr id='tr_Id_"+  Base64.encode(id).replace(/=/g,'') + "'>";
			 newRow += "<td align='left'><span class='title' id='title_"+ id +"'>" + value + "</td>";
			 
			 newRow += "<td align=\"center\" id=\"td_"+ Base64.encode(id).replace(/=/g,'') +"\">";
			/* newRow += " <a href=\"javascript:viewDetail(\'"+ Base64.encode(id) +"\', \'"+ module + "\')\">";*/
			 newRow += " 0 Product(s)";
			 newRow += "</td>";
			 
			 newRow += "<td align='center'>";
			 newRow += "  <a href=\"javascript:deleteRecord(\'" + Base64.encode(id) + "\', \'"+ module + "\'); \">";
			 newRow += "	 <img src=\"" + root + "images/icons/delete.png\" width=\"16\" height=\"16\" alt=\"Del\" />";
			 newRow += "  </a></td>";
			 newRow += "</tr>";
			 
	 		/*Append it to the table*/
			$(".data_table tbody tr:first").before(
											newRow
										   );	


		}/*Closing of if(typeof isNoRecRow == "undefined" || isNoRecRow == null)*/
		else if(isNoRecRow)
		{
			 newRow = "<tr id='tr_noRec'>";
			 newRow += "<td colspan='8' align='center' >No Record Found</td>";
			 newRow += "</tr>";
			
			/*Append it to the table*/
			$(".data_table tbody").append(
											newRow
										   );	

		}
		
	}
	/*---------------------------------------------------------------------------------------*/	
	/*
		inputs: Container name where the fields will be appended.
				Total Number of fields to be allowed. if left empty, unlimited fields can be added.	
		output: Text Field.
	
	*/
	
	function addNewTextField(txtContainerName, intTotalFields)
	{
		var id = $("#hid_id").val();

		if(parseInt(id) >= intTotalFields  && typeof intTotalFields != "undefined")
		{
			$.alerts.okButton 	 = "Ok"; 
			jAlert("You can only attach maximum "+ intTotalFields  +" measures with this product.", "Alert!");	
			return false;			
		}

		var txtNewField;
		var inc =  parseInt(id) + 1;

		txtNewField	=	"<a href='#' onClick='removeFormField(\"#" + txtContainerName + "_" + inc + "\"); return false;' title=\"Remove this row\">";
		txtNewField	+=	"<img src=\""+ root + "images/icons/delete.png\" width=\"16\" height=\"16\" alt=\"Remove\" align=\"absmiddle\" />";
		txtNewField	+=	"</a>";
		
		$("#" + txtContainerName + "_1").clone(true)
		.insertAfter("#" + txtContainerName + "_" +  id)
		.attr("id" , txtContainerName + "_" + inc).find("label")
		.append(txtNewField);

		/*Empty the new cloned row boxes*/
		$("#" + txtContainerName + "_" +  inc).find("option").removeAttr( "selected" );
		$("#" + txtContainerName + "_" +  inc).find("input").val("");
		
		$("#hid_id").val(inc);	
		
			return true;
	}/*losing of addNewTextField(...)*/
	
	/*---------------------------------------------------------------------------------------*/	
	/*
		Removes added text Field.
	*/
	function removeFormField(objRow) 
	{
		$(objRow).remove();
		
		var intCount = $("#hid_id").val();
		
		intCount = parseInt(intCount) - 1;
		
		$("#hid_id").val(intCount);			
	}
	
	/*---------------------------------------------------------------------------------------*/	
	/*
		This method is used to get the Available SKU Codes at any location from DB.
		
	*/	
	function getAvailableSKUCodes(objLoc, ctrlID)
	{

		locIdPk	=	$(objLoc).val();
		
		// Get the Product Id
		aryData	=	$(objLoc).parents('tr:eq(0)').attr('id').split("_");
		
		var params 	= 	"locIdPk=" + encodeURI( locIdPk ) + "&intProdId=" + encodeURI( aryData[1] ) + "&ctrlID=" + ctrlID;  
		var url		= 	root + "modules/products_inventory/get_sku_at_loc_ajax.php"; 

		callAjaxPost(params, url, 
			function(response)
			{		
				if(response!= "")
				{
					$("#intAvQty_"+ ctrlID).html(response);
				}
				else
				{
					//$("#intAvQty_"+aryData[1]).html('0');
					$("#cmb_sku_"+ctrlID).html('No Sku Code');
				}
			}
		);
	}/*Closing of getAvailableSKUCodes(...)*/
	
	/*---------------------------------------------------------------------------------------*/	
	function saveUrgentShippingCost()
	{
		var txt_urgent	= 	$("#txt_urgent").val();
		
		var params 			= 	"txt_urgent=" + encodeURI( txt_urgent );  
		var url				= 	root + "modules/rates/urgent_rate_add_edit_ajax.php"; 
		
		// Call to Ajax method.
		callAjaxPost(	params, 
						 url, 
						function (msg)
						{
							$("#msgContainer").html(msg);
						}		 
					);		
	}/*Closing of saveUrgentShippingCost()*/
	/*---------------------------------------------------------------------------------------*/	
	/*
		Opens Move Inventory Location
		@param: Width as integer [optional]
		@param: Height as integer [optional]
		@param: Top as integer [optional]	
	*/
	/*---------------------------------------------------------------------------------------*/
	function openMoveLocationWindow(width, height, top)
	{
		var intInvId	=	Array();
		$i = 0;
		
		$('#invList').find(":checked").each(function() 
											   {
													intInvId[$i++]	=	$(this).val();   
												}
											   );
		if($i > 0)
		{
			var params 		= 	"chk_ProdMov=" + encodeURI( intInvId )+ "&amp;isAjaxCall=true";  
			var url			= 	root + "modules/products_inventory/change_location_ajax.php"; 
			
			if(typeof width == "undefined")
				width	=	"40%";
	
			if(typeof height == "undefined")
				height	=	"80%";


			if(typeof top == "undefined")
				height	=	"2%";

			// Show the Div	
			pageAjax = url+'?'+params+'&iframe=true&width='+ width +'&height='+ height+'&top='+ top;
			$.prettyPhoto.open(pageAjax);
		}
		else
		{
				$.alerts.okButton 	 = "Ok"; /* set Ok Button Caption to Cancel*/

				jAlert("Please select any item to be moved to other location.", "Warning!");
		}
	}/*Closing of openMoveLocationWindow(...)*/
	/*---------------------------------------------------------------------------------------*/	
	/*
		Shows message if any.
		@param: Message as string
	*/
	/*---------------------------------------------------------------------------------------*/
	
	function showMessage(txtMsg)
	{
		$.alerts.okButton 	 = "Ok"; /* set Ok Button Caption to Cancel*/

		jAlert(txtMsg, "Alert!");
	}/*Closing of showMessage(...)*/
	/*---------------------------------------------------------------------------------------*/	
	/*
		Logout from the system.
	*/
	/*---------------------------------------------------------------------------------------*/
	
	function logout()
	{
		$("#logout").click(function(){ window.location.href= root + "logout.php";  });	
	}/*Closing of logout*/	

	/*---------------------------------------------------------------------------------------*/	
	/*
		Logout from the system.
	*/
	/*---------------------------------------------------------------------------------------*/
	
	function backToHome()
	{
		$("#logo").css({
							cursor: 'pointer'
					 });

		$("#logo").click(function(){ window.location.href= root + "index.php";  });	
	}/*Closing of logout*/	
	
	/*---------------------------------------------------------------------------------------*/	
	/*
		method for triming
	*/
	/*---------------------------------------------------------------------------------------*/

	function trim(str)
	{
		if(!str || typeof str != 'string')
			return null;
	
		return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
	}/* end of trim() */
	
	/*---------------------------------------------------------------------------------------*/	
	/*
		method to check the if number keys have been pressed
	*/
	/*---------------------------------------------------------------------------------------*/

	
	function isNumberKey(evt)
	{
		var charCode = (evt.which) ? evt.which : event.keyCode
	
		if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;
	
		return true;
	}//end of isNumberKey(evt)