var agt = navigator.userAgent.toLowerCase();
var versInt = parseInt(navigator.appVersion);
var is_ie	= ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (versInt < 4));
var is_ie4    = (is_ie && (versInt == 4) && (agt.indexOf("msie 4")!=-1) );
var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);
var is_aol5  = (agt.indexOf("aol 5") != -1);
var is_aol6  = (agt.indexOf("aol 6") != -1);
var is_comp   = (agt.indexOf("compuserve") != -1);
var is_comp2000   = (agt.indexOf("cs") != -1);	 
var is_compie = (is_comp && is_ie);

function pro_goTo( url ) {
	window.location.href = url;
}

function pro_navBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#69c';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#3169a5';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#3169a5';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
				}
		}
	}
}

function pro_navBarClick( tableCellRef, navStyle, url ) {
	pro_navBar( tableCellRef, 0, navStyle );
	pro_goTo( url );
}

function Click( url ) {
	pro_goTo( url );
}


function checkDataInput()
{	
	if (!isEmpty(document.getElementById("order_name").value))
	{
		alert('You must input your name!');
		return false;
	}
	
	if (!isEmpty(document.getElementById("order_phone").value))
	{
		alert('You must input your phone number!');
		return false;
	}
	
	if (!isPhone(document.getElementById("order_phone").value))
	{
		alert('Invalid phone number!');
		return false;
	}
	
	if (!isEmpty(document.getElementById("order_email").value))
	{
		alert('You must input your email address!');
		return false;
	}
	
	if (!isEmail(document.getElementById("order_email").value))
	{
		alert('Invalid email address!');
		return false;
	}
	
	if (!isEmpty(document.getElementById("order_message").value))
	{
		alert('You must input your message!');
		return false;
	}
	 
	return true;
	
}
function changeActionPIBack()
{
	var frm=document.getElementById("form");
	frm.action="products.php";
	frm.submit();
}
function changeActionDetailPrice()
{
	var frm=document.getElementById("form");
	frm.action="order.php";
	frm.submit();
}
function changeActionPIDetail(standard_id)
{
	var frm=document.getElementById("form");
	frm.action="detail_price.php@standard_id=" + standard_id;
	frm.submit();
}

