﻿$(document).ready(
function(){
 $("#gameid").change(function(){
	if($(this).val()==0){return;}
	$("#serverid")[0].options.length=1;
	try{$("#productid")[0].options.length=1;}catch(e){}
	$("#serverid")[0].options[0].text="  --- Loading ... ... ... ... ... --- ";
	$.get("/ajax/fastorder.cfm",{gid:$(this).val()},function(data){
		eval("var sarray="+data);
		for(var i=0;i<sarray.length;i++){
			$("<option value=\""+sarray[i][0]+"\" title=\""+sarray[i][1]+"\">"+sarray[i][1]+"</option>").appendTo($("#serverid"));	
		}
		$("#serverid")[0].options[0].text="- Please select the server - ";
	});	
  });
 $("#serverid").change(function(){
	if($(this).val()==0){return;}
	$("#productid")[0].options.length=1;
	$("#productid")[0].options[0].text="  --- Loading ... ... ... ... ... --- ";
	$.get("/ajax/fastorder.cfm",{sid:$(this).val()},function(data){
		eval("var parray="+data);
		for(var i=0;i<parray.length;i++){
			$("<option value=\""+parray[i][0]+"\" title=\""+parray[i][1]+parray[i][2]+"\">"+parray[i][1]+parray[i][2]+"</option>").appendTo($("#productid"));	
		}
		$("#productid")[0].options[0].text="- Please select the product - ";
	});
 });
 $("#fastordera").click(function(){
	if($("#gameid").val()==0){
		alert("Please select the game.");return false;	
	}
	if($("#serverid").val()==0){
		alert("Please select the server.");return false;	
	}
	if($("#productid").val()==0){
		alert("Please select the product.");return false;	
	}
	$("#checkpriceid").val($("#productid").val());
	document.getElementById("fastorderform").submit();
 });
 $("#fastorderb").click(function(){
	if($("#serverid").val()==0){
		alert("Please select the server.");return false;	
	}
	if($("#productid").val()==0){
		alert("Please select the product.");return false;	
	}
	$("#hidsid").val($("#serverid").val());
	$("#checkpriceid").val($("#productid").val());
	document.getElementById("fastorderform").submit();
 });
}				  
);
var	app_tempword="<p>-Price Comparison shows current price of selected websites once you choose your game in fast order blank.</p><p>-Fast Order allows you to quickly find and order products without entering Product Categories.</p>";
function GetPrice(str)
{
if(str==""||str=="0"||str==0){return;}	
$.ajax({
url: "/ajax/ComparePrice.cfm?GameID="+str+"&t="+new Date().toString(),
async: true,
success: function(res){if($.trim(res)==""){$("#result").html(app_tempword);}else{$("#result").html(res);}}
});
} 
