// JavaScript Document
function ShowOptionsMenu( int_psf_sn , obj_btn )
{	
	request = createRequest();
	var url = "ajax_get_spec_options.php";
	request.open( "POST" , url , true );
	request.onreadystatechange = function()
	{
		if( Response() )
		{
			//alert( request.responseText );
			
			var xmldoc = request.responseXML;
			var obj_field_options = xmldoc.getElementsByTagName( "option" );

			var obj_option_menu = document.getElementById( "option_menu_frame" );
			var obj_options = document.getElementById( "option_menu" );
				
			obj_option_menu.innerHTML = "";
			
			for( i = 0 ; i < obj_field_options.length ; i++ )
			{	
				obj_option_menu.innerHTML += "<div class=\"search_field_option\" onmouseover=\"this.className = 'search_field_option_over'\" onmouseout=\"this.className = 'search_field_option'\" onclick=\"SetValue( '" + int_psf_sn + "' , '" + obj_field_options.item(i).childNodes[0].nodeValue + "' )\">" + 
				trim( obj_field_options.item(i).childNodes[0].nodeValue ) + 
				"</div>";
			}
			
			obj_options.style.display = "";
			//obj_btn.parentNode.insertBefore( obj_options , obj_btn.nextSibling );
			document.getElementById( "field_frame_" + int_psf_sn ).appendChild( obj_options );
			
		}
	};
	request.setRequestHeader( "Content-Type","application/x-www-form-urlencoded" );
	request.send( "psf=" + int_psf_sn );	
}

function SetValue( int_psf_sn , str_option_value )
{
	var obj_spec_input = document.getElementById( "field_" + int_psf_sn );
	var obj_option_menu = document.getElementById( "option_menu" );
	
	obj_spec_input.value = str_option_value;
	obj_option_menu.style.display = "none";
}

function ChangeSeriesList( obj_arrow , str_arrow_id , str_list_id , int_line )
{
	obj_arrow.style.display = "none";
	
	document.getElementById( str_arrow_id ).style.display = "";
	
	var list = document.getElementById( str_list_id ).getElementsByTagName( "tr" );
	
	for( i = 5 * int_line ; i < list.length - 1 ; i++ )
	{
		if( list[i].className == "product_series_row" )
		{
			if( list[i].style.display == "" )
			{
				list[i].style.display = "none";
				//alert(i);
			}
			else
				list[i].style.display = "";
		}
	}
}

function CheckProductEmail( str_btn_text , str_send_message )
{
	if( CheckEmail() )
	{
		//按鈕狀態
		document.getElementById( "btn_send" ).disabled = true;
		document.getElementById( "btn_send" ).value = str_btn_text;
		
		//更換訊息文字
		document.getElementById( "product_email_message" ).innerHTML = str_send_message;
		
		//document.getElementById( "product_email_form" ).submit();
		return true;
	}
	else
	{
		return false;	
	}
}

function CheckEmail()
{
	var obj_email = document.getElementById( "email" );
	
	var reg_email = new RegExp( "[a-zA-Z0-9\._\+]{1,}@[a-zA-Z0-9]{1,}" );	
	
	var bool_email_available = false;
	
	if( trim( obj_email.value ).length > 0 )
	{	
		if( obj_email.value.match( reg_email ) )
		{
			obj_email.style.backgroundColor = '';
			return true;
		}
		else
		{
			obj_email.style.backgroundColor = '#66CCFF';
			obj_email.focus();
			return false;
		}
	}
	else
	{
		obj_email.style.backgroundColor = '#66CCFF';
		obj_email.focus();		
		return false;
	}
}

function CategoryOver( obj )
{
	obj.className = 'product_categories_name product_categories_focus';
	obj.previousSibling.firstChild.style.visibility = 'visible';
}

function CategoryOut( obj )
{
	obj.className = 'product_categories_name product_categories_blur';
	obj.previousSibling.firstChild.style.visibility = 'hidden';
}























function Redirect()
{
	location.href = 'http://60.250.4.34/applicat.php';
}

function Redirect_Search()
{
	location.href = 'http://60.250.4.34/search.php?tps=0';
}






























