		/*-------------------------------------------------------------------*/
		/* JAVASCRIPT														 */ 
		/*-------------------------------------------------------------------*/	
		
		var default_language =   document.formFields.default_language.value;
		
		
		function aboutSite()
		{
			var str = "/common_html/aboutSite.php";				
			wnd = window.open(str,"aboutSite",
					"height=630, width=820, status, top, left, resizable, scrollbars, dependent");
			wnd.focus();
		}
		function submit_advSearch ()
		{		
			rt_status = "1";
			search_type = "";
			
			search_text = document.formFields.search_text.value;
			productId = document.formFields.productId.value;
			user_name =	document.formFields.user_name.value;
			store_name =	document.formFields.store_name.value;

			search_type = (user_name != "") ? "user_name" : search_type;	
			search_type = (store_name != "") ? "store_name" : search_type;			
			search_type = (productId != "") ? "productId" : search_type;			
			search_type = (search_type == "") ? "search_text" : search_type;		
				

			/* ----------------------------------------- */
			// check search text fields
			if (search_type == "search_text")
			{
				if (rt_status != '0')
				{
					search_text = document.formFields.search_text.value;

					text_array = search_text.split(" ");

					array_status = "";
					for (i=0;i<text_array.length;i++ )
					{
						if (text_array[i].length > 1)
						{
							array_status = '1';
						}
					}
					if (array_status == '')
					{
						msg = getMsg('INVALID_TEXT',default_language);
						alert (msg);						
						rt_status = "0";
					}
				}

				min_price = document.formFields.min_price.value;
				min_price_dec = document.formFields.min_price_dec.value;
				max_price = document.formFields.max_price.value;
				max_price_dec = document.formFields.max_price_dec.value;
				
				if (parseInt(min_price_dec) == 0)
				{
					if (min_price == "")
					{
						document.formFields.min_price_dec.value = "";
						min_price_dec = "";
					}
				}
				if (parseInt(max_price_dec) == 0)
				{
					if (max_price == "")
					{
						document.formFields.max_price_dec.value = "";
						max_price_dec = "";
					}
				}

				if (rt_status != '0')
				{
					
					if (
						(min_price != "") ||
						(min_price_dec != "") ||
						(max_price != "") ||
						(max_price_dec != "") 
						
						)
					{
						if (
							(!(is_int(min_price))) ||
							(!(is_int(min_price_dec))) ||
							((parseInt(min_price) < 0)) ||
							((parseInt(min_price_dec) < 0)) ||
							(!(parseInt(min_price) +
								parseInt(min_price_dec) >= 0))
							)
						{
							msg = getMsg('INVALID_MIN_PRICE',default_language);
							alert (msg);
							rt_status = '0';
						}					
						if (rt_status != '0')
						{
							min = parseInt(min_price) +
								parseInt(min_price_dec);
								
							max = parseInt(max_price) +
									parseInt(max_price_dec);
							
							if (				
								(!(is_int(max_price))) ||
								(!(is_int(max_price_dec))) ||
								((parseInt(max_price) < 0)) ||
								((parseInt(max_price_dec) < 0)) ||
								(!(parseInt(max_price) +
									parseInt(max_price_dec) > 0)) ||
								(!(max > min))
								)
							{
								
								msg = getMsg('INVALID_MAX_PRICE',default_language);
								alert (msg);
								rt_status = '0';
							}
						}	
					}
				}				
			}
			/* ----------------------------------------- */			
			// check product_id field
			if (search_type == "productId")
			{
				if (rt_status != '0')
				{
					if (				
					(!(is_int(document.formFields.productId.value))) ||					
					(!(document.formFields.productId.value > 0))
					)
					{
						msg = getMsg('INVALID_PRODUCT_CODE',default_language);
						alert (msg);
						rt_status = '0';
					}
				}
			}
			/* ----------------------------------------- */			
			// check user_name field
			if (search_type == "user_name")
			{
				if (rt_status != '0')
				{
					if (user_name.length < 3)
					{
						msg = getMsg('INVALID_PRODUCT_CODE',default_language);
						alert (msg);
						rt_status = '0';
					}
				}
			}
			/* ----------------------------------------- */			
			// check user_store field
			if (search_type == "user_store")
			{
				if (rt_status != '0')
				{
					if (store_name.length < 3)
					{
						msg = getMsg('INVALID_PRODUCT_CODE',default_language);
						alert (msg);
						rt_status = '0';
					}
				}
			}
			/* ----------------------------------------- */					
			if (rt_status == '1')
			{
				if (search_type == "search_text")
				{
					document.formFields.goto_app.value = "search_text";					
				}
				else
				if (search_type == "productId")
				{
					document.formFields.goto_app.value = "productId";					
				}
				else
				if (search_type == "user_name")
				{
					document.formFields.goto_app.value = "user_name";				
				}
				else
				if (search_type == "store_name")
				{
					document.formFields.goto_app.value = "store_name";				
				}				
				
				document.formFields.submit();
				
			}			
		}

		function setField(ctrl, field)
		{
			
			if (ctrl == '1')
			{
				document.formFields.productId.value = "";
				document.formFields.user_name.value = "";
				document.formFields.cur_sale_box.checked = false;
				document.formFields.store_name.value = "";
				document.formFields.store_desc_box.checked = false;

				if (
					(field.name == "min_price") ||
					(field.name == "min_price_dec")
					)
				{
					if (document.formFields.min_price_dec.value == "")
					{
						document.formFields.min_price_dec.value = "00";
					}
				}
				if (
					(field.name == "max_price") ||
					(field.name == "max_price_dec")
					)
				{
					if (document.formFields.max_price_dec.value == "")
					{
						document.formFields.max_price_dec.value = "00";
					}
				}

			}
			else
			if (ctrl == '2')
			{
				document.formFields.search_text.value = "";
				//document.formFields.title_desc_box.checked = false;
				document.formFields.min_price.value = "";
				document.formFields.min_price_dec.value = "";
				document.formFields.max_price.value = "";
				document.formFields.max_price_dec.value = "";
				document.formFields.user_name.value = "";
				document.formFields.cur_sale_box.checked = false;
				document.formFields.store_name.value = "";
				//document.formFields.store_desc_box.checked = false;
			}
			else
			if (ctrl == '3')
			{
				document.formFields.search_text.value = "";
				//document.formFields.title_desc_box.checked = false;
				document.formFields.min_price.value = "";
				document.formFields.min_price_dec.value = "";
				document.formFields.max_price.value = "";
				document.formFields.max_price_dec.value = "";
				document.formFields.productId.value = "";
				document.formFields.store_name.value = "";
				//document.formFields.store_desc_box.checked = false;

			}	
			else
			if (ctrl == '4')
			{
				document.formFields.search_text.value = "";
				//document.formFields.title_desc_box.checked = false;
				document.formFields.min_price.value = "";
				document.formFields.min_price_dec.value = "";
				document.formFields.max_price.value = "";
				document.formFields.max_price_dec.value = "";
				document.formFields.productId.value = "";
				document.formFields.user_name.value = "";
				//document.formFields.cur_sale_box.checked = false;
			
			
			}
		}
		
		
