//Some basic info about the store used by cookie.js for saving cookies
var cart_cookie_name = "tnt_cart";
//Non-inline frame cart requires these to be set
var cart_count = 0;
var basket = "";
//Set the store tracker cookie
var expdate = new Date();
FixCookieDate(expdate); //fix date for Macs
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000)); //24 hours from now
SetCookie("gs_st","38.107.191.108-1283912056",expdate,"/",null,false);
//build the pid objects
//basic info will be need to display on the form
var pid_list = new Array;
//This keeps track of the type of subs we have
//This way we can turn on and off certain type of subscription services
var sub_type_pids = new Array;
//Used to keep subscriptions and non-subs organized
var ptype = new Array(2);
function formBuilder()
{
//No one loaded storetracker with any products
if(pid_list.length == 0){
alert("No Product Ids were loaded in Store Tracker to build a form with. Cannot build the form");
return(false);
//They are trying to build a form without any products/services
} else if(arguments.length == 0){
alert("No Product Ids were passed in to build a form with. Cannot build the form");
return(false);
}
//This is for the two type of forms we have to build
//Non-Sub are not categorized by type... very simple
//Sub forms have groups and service types
ptype[0] = new Array; //Non-Sub
ptype[1] = new Array; //Sub
//begin writing the basic stuff for the form
document.writeln("
");
document.writeln("
");
document.writeln("");
}
function loadPid(pid)
{
//Make sure the product we are loading has been declared and grab the details for the item being loaded
//This protects against hybrid product ids for subscriptions
//ie product_id-rate_id
if(pid.toString().match(/-/g))
pid = pid.split(/-/)[0];
if(pid_list.length < pid || pid_list[pid] == undefined){
alert("Sorry... Product id: "+pid+" was not loaded in the store_tracker declaration. Cannot build the form.");
return(false);
}
return(pid_list[pid]);
}
function writePid(d,pid_form_type)
{
//Show the product
document.writeln("
");
//This keeps the name and the prices in line
//otherwise, a checkbox may cause them to not line up as nice
var tab = "";
if(!pid_form_type.match(/hidden/g))
tab = " ";
//If there is a savings to promote... do it!
if(d.savings > 0)
document.writeln("
"+tab+"Regularly $"+d.msrp+" Save $"+d.savings+"
");
//Finally show then the final price... rock bottom prices everyday :)
document.writeln("
"+tab+"Only $"+d.price+"
");
}
//Ok this one is fun...
function writeSubs(list)
{
//list should be an array of service pids...
//This array keeps each type of services separate... ie Futures is not the same as Options
//likewise newsletters are not the same as data services
//since you have a futures and options service and since all form fields are named 'pid'... this causes problems
//because in a radio button world, you can only have one unless you use separate forms or separate form field names
//we could use check boxes... but would be misleading... can I really have a monthly and an annual at once?
//yah, yah, yah... we can control selecting both, but radio buttons are a better fit.
//we will use separate form field names based on type and then put the into the correct names during submission
//loop through all of the services we have
for(var i=0; i"+d.name+"");
document.writeln("
");
//if the service matches the type... then show it.
for(var r=0; r
");
//This keeps an idex of where all services are for the type
//this way when we want to turn on only the Futures services... we now to turn on pid_1[0] - pid_1[2] and so forth
// sub_type_pids[t].push(found);
// found++;
}
document.writeln("
");
}
//Show the man how much he is spending for all of his services... especially how much he is saving
//document.writeln("
Service Total: $
");
}
//This allows us to turn on and off all of the services for a given service type.
function enableSubs(form,sub_type)
{
var status = true;
if(sub_type.checked)
status = false;
var pid = sub_type.value;
var found = 0;
for(var f=0; f 0)
tot_obj.savings_percent = (tot_obj.savings_percent/tot_obj.found);
var tot_txt = tot_obj.total.toFixed(2);
if(tot_obj.savings > 0)
tot_txt += " ... Total Savings: $"+tot_obj.savings.toFixed(2)+" ( "+tot_obj.savings_percent.toFixed(1)+"% )";
if(form.service_total)
form.service_total.value = tot_txt;
function updateSubSave(form,pid,tot_obj)
{
var rate_found = 0;
for(var f=0; f