var maint_rate = 0.18;
//if you change this ratio, you MUST change the ratio used in c:\bp\public_html\downloadpipe.com\urls.php
var euro_conv = 0.832229;
var aud_conv = 1.35105;
var gbp_conv = 0.572705;
var cad_conv = 1.15601; //Canadian
var nzd_conv = 1.46386;


//price calculations
function price_of( product_id )
{
var prices = new Array();
//regenerate using http://www.datamystic.com/admin/prices.php

prices[188875] 	= 595; 	//AbusePipe Single User License
prices[157148] 	= 1990; 	//Arc Menu Enterprise License
prices[132561] 	= 19.95; 	//Arc Menu Single User License
prices[202599] 	= 199; 	//Authorized Reseller Annual Fee (awaiting approval)
prices[2025990] 	= 199; 	//Authorized Reseller NFR downloads
prices[131903] 	= 9.99; 	//BabyShield Single User License
prices[195484] 	= 9.99; 	//Clean 'n' Go Single User License
prices[161425] 	= 1; 	//Consulting Payment
prices[131902] 	= 1; 	//Conversion Payment
prices[179661] 	= 19.99; 	//DataMystic CD
prices[140629] 	= 495; 	//DataPipe Single CPU License
prices[138135] 	= 495; 	//DataPipe Single User License
prices[155969] 	= 6990; 	//DataPipe Site License
prices[1000] 	= 20; 	//Demo Product
prices[151810] 	= 3990; 	//DetachPipe Enterprise License
prices[138333] 	= 29.95; 	//DetachPipe Lite License
prices[166394] 	= 699; 	//DetachPipe Server License
prices[146668] 	= 49.95; 	//DetachPipe Single User License
prices[132564] 	= 29.95; 	//DirDate Single User License
prices[300328594] 	= 29.95; 	//DirDate Portable User License
prices[140086] 	= 349; 	//DirSize Server License
prices[132558] 	= 19.95; 	//DirSize Single User License
prices[140426] 	= 599; 	//DirSize Site License
prices[224122] 	= 1; 	//downloadpipe.com Advertising Units
prices[300036858] 	= 2999; 	//downloadpipe.com Data
prices[300034572] 	= 4.99; 	//downloadpipe.com Developer Tools
prices[300036857] 	= 999; 	//downloadpipe.com Engine
prices[300036861] 	= 3999; 	//downloadpipe.com Engine + Data
prices[300038586] 	= 39; 	//DropConvert Single User License
prices[211244] 	= 199; 	//EasyPattern Engine - programmers DLL
prices[224126] 	= 19.95; 	//EasyPattern Helper
prices[200] 	= 19.95; 	//EasyPattern Helper (free version no longer available)
prices[198245] 	= 399; 	//EmailPipe Single User Starter Pack
prices[203085] 	= 50; 	//ExcelPipe Document Block
prices[300041895] 	= 1299; 	//ExcelPipe Floating License
prices[186921] 	= 49.95; 	//ExcelPipe Lite License
prices[186919] 	= 499; 	//ExcelPipe Single User License
prices[186922] 	= 3195; 	//ExcelPipe Site License
prices[146467] 	= 1; 	//Extended Upgrade Units
prices[139425] 	= 1; 	//Extended Upgrades (18%)
prices[143504] 	= 70; 	//Extended Upgrades (per Single User License)
prices[300001022] 	= 49.99; 	//HookKeys DLL
prices[205713] 	= 9.99; 	//KeyboardLocker Single User License
prices[131928] 	= 39.95; 	//LFNit! Single User License
prices[184237] 	= 20; 	//PatternHelper Single User License
prices[300010268] 	= 50; 	//PowerPointPipe Document Block
prices[220500] 	= 499; 	//PowerPointPipe Single User License
prices[190386] 	= 395; 	//Premium Support Plan
prices[161424] 	= 1; 	//Referral Payment
prices[200766] 	= 125; 	//ResumePipe Email Block
prices[151487] 	= 1499; 	//ResumePipe Lite Single User Starter Pack
prices[164653] 	= 10000.01;  //**Estimate; 	//ResumePipe Pro Enterprise License
prices[137750] 	= 695; 	//ResumePipe Pro Single User License
prices[164652] 	= 10000.01;  //**Estimate; 	//ResumePipe Pro Site License
prices[167144] 	= 400; 	//ResumeTemplate Single User License
prices[167146] 	= 2000; 	//ResumeTemplate Site License
prices[216285] 	= 9.99; 	//Software Download Protection
prices[217177] 	= 795; 	//TextPipe and WordPipe Bundle
prices[132910] 	= 500; 	//TextPipe Engine Lite - programmers DLL
prices[184687] 	= 500; 	//TextPipe Engine Pro - programmers DLL
prices[168911] 	= 39; 	//TextPipe for askSam Run Time Single User License
prices[168910] 	= 89; 	//TextPipe for askSam Single User License
prices[171179] 	= 99; 	//TextPipe Pro 10 Days Full Use License
prices[136050] 	= 3990; 	//TextPipe Pro Educational Site License
prices[136049] 	= 7990; 	//TextPipe Pro Enterprise License
prices[300041893] 	= 990; 	//TextPipe Pro Floating License
prices[147438] 	= 499; 	//TextPipe Pro Run Time Server License
prices[147437] 	= 99; 	//TextPipe Pro Run Time Single User License
prices[131822] 	= 699; 	//TextPipe Pro Server License
prices[131686] 	= 395; 	//TextPipe Pro Single User License
prices[136051] 	= 4990; 	//TextPipe Pro Site/200 User License
prices[137374] 	= 199; 	//TextPipe Standard License
prices[157097] 	= 29.95; 	//TextPipe Lite Single User License
prices[300030413] 	= 999; 	//TextPipe Lite Site License
prices[217179] 	= 1695; 	//TextPipe, WordPipe, ExcelPipe and PowerPointPipe bundle
prices[162196] 	= 19.95; 	//Time Zone Helper Single User License
prices[300044426] 	= 199; 	//Web Copyrighter Single User License
prices[300037881] 	= 39.95; 	//Web Search and Replace Single User License
prices[300046725] 	= 99; 	//WebPipe Single User License
prices[205364] 	= 1299; 	//WordPipe (Search Only) Single User License
prices[217178] 	= 895; 	//WordPipe and ExcelPipe Bundle
prices[200779] 	= 50; 	//WordPipe Document Block
prices[300041894] 	= 1299; 	//WordPipe Floating License
prices[138332] 	= 99; 	//WordPipe Lite License
prices[187721] 	= 899; 	//WordPipe Server License
prices[138134] 	= 499; 	//WordPipe Single User License
prices[138334] 	= 3195; 	//WordPipe Site License
prices[220519] 	= 1395; 	//WordPipe, ExcelPipe and PowerPointPipe Bundle
prices[100503] 	= 19.95; 	//ZeroIn Single User License
prices[300058591] 	= 9.95; 	//detachpipe.com
prices[300059965] 	= 4.95; 	//detachpipe.com
prices[300060686] 	= 9.95; 	//eval cd
prices[300064574] = 1.00; //refund fee
prices[300070170] = 899.00; //excelpipe server
prices[300070490] = 899.00; //pppipe server
prices[300071460] = 49.95; //pppipe lite
prices[300084830] = 199.95; //lite bundle
prices[300101476] = 9.99; //PDF manual
prices[300109060] = 24.95; //FileWatcher
prices[300165501] = 195.00; //FileWatcher Server
prices[300120015] = 6.95; //downloadpipe.cm 100 watches

return prices[ product_id ];
}

//remove the cents if there aren't any to show
function nocents( X )
{
var S=new String(X);
if ( S.indexOf('.') >= 0 )
{
//ensure there are trailing zeroes
S = S + '00';
return S.substr( 0, S.indexOf('.') + 3 )
}
else
return S;
}


function bestdate()
{
var d;
d = new Date();

if (d.getDate() < 14)
d.setDate(14);
else
{
//find the last day of this month
//first move to next month
d.setMonth(d.getMonth() + 1);
// change to first day
d.setDate( 1 );
//now subtract one day
d.setDate( d.getDate()-1 );
}
d.setHours( 0 );
d.setMinutes( 0 );
d.setSeconds( 0 );
document.write( d.toLocaleString() );
}

function price( usd_price )
{
if (GetCookie('currency') == 'AU')
return ('AU$ ' + nocents( usd_price * aud_conv ) + ' (US$ ' + nocents( usd_price ) + ')' );
else if (GetCookie('currency') == 'UK')
return ('GB&#x00A3; ' + nocents( usd_price * gbp_conv ) + ' (US$ ' + nocents( usd_price ) + ')' );
else if (GetCookie('currency') == 'CA')
return ('CA$ ' + nocents( usd_price * cad_conv ) + ' (US$ ' + nocents( usd_price ) + ')' );
else if (GetCookie('currency') == 'NZ')
return ('NZ$ ' + nocents( usd_price * nzd_conv ) + ' (US$ ' + nocents( usd_price ) + ')' );
else
return ('US$ ' + nocents( usd_price ) +
'/EU&#x20AC; ' + nocents( usd_price * euro_conv ) +
'<a href="/buy/currency.html?usd=' + usd_price + '" target="_blank" title="Approximately: EU&#x20AC;' + nocents( usd_price * euro_conv ) +
'/GB&#x00A3; ' + nocents( usd_price * gbp_conv ) +
'/AU$ ' + nocents( usd_price * aud_conv ) +
'. Click here for a currency converter' +
'">*</a>' );
}

function doprice( usd_price )
{
document.write( price( usd_price ) );
}

function priceid( product_id )
{
return price( price_of( product_id ) );
}

function dopriceid( product_id )
{
document.write( priceid( product_id ) );
}

function cdinfo()
{
document.write( "Product on CD [<a href=\"cd.html\" target=\"_blank\">more info</a>] (" + priceid( 179661 ) + ")" );
}

function backupinfo()
{
document.write( "2 Years <a href=\"protection.html\" target=\"_blank\">Extended Download Service</a> (" + priceid( 216285 ) + "). If your computer " +
"fails or your hard disk gets corrupted, we will send you the last version you downloaded." );
}

function buynow( usd_price )
{
document.write( 'Now (' + price( usd_price ) + ')' );
}

function buynoweach( usd_price )
{
document.write( 'Now (' + price( usd_price ) + ' each)' );
}

//maintenance
//price of a premium support plan
function premium_support()
{
document.write( ' - highly recommended for mission critical processing. ' +
priceid( 190386 ) + ' per year or for 5 hours, whichever comes first. '+
'We can also arrange <a href="/buy/support.html">24x7 phone support</a> if required'
);
}


function price_diff( id1, id2 )
{
document.write( Math.abs( price_of(id2) - price_of(id1) ) );
}

function shareit_diff( id1, id2 )
{
var d;
d = Math.abs( price_of(id2) - price_of(id1) );
document.write( '<a href="https://sshop.element5.com/shareit/cart.html?PRODUCT[131902]=' +
+ d + '&stylefrom=131686">Convert Now (' + price( d ) + ')</a>' );
}

function swreg_diff( id1, id2 )
{
var d;
d = Math.abs( price_of(id2) - price_of(id1) );
document.write( '<a href="https://usd.swreg.org/cgi-bin/s.cgi?s=4483&p=4483131902&v=0&d=0&q=' +
+ d + '">Convert Now (' + price( d ) + ')</a>' );
}
