// JavaScript Document which calculates Plusnet FUP/SUPs for various accounts.
// script created by kitz.
//wef 30th July 2006

function CalculateSUP(){
	var v1 = document.SUPFUP.product.value;
	var Peak = "";
	var Off = "";
	var inf = '';
	var peakinf = '';
	//limit level
	var l1 = '';
	var l2 = '';
	var l3 = '';
	var l4 = '';
	var l5 = '';
	
	//line speed
	var s1 = "";
	var s2 = "";
	var s3 = "";
	var s4 = "";
	var s5 = "";
	
	//p2p speed
	var p1 = "";
	var p2 = "";
	var p3 = "";
	var p4 = "";
	var p5 = "";
	
	var prod = ""; 
	var premierdisplay ="";
	//Left Info Box (Product info)
	var inf1 = "<br>~ All traffic (aside from P2P/Usenet/FTP) is given priority and therefore should see no slow downs within the relevant speed bands.<br>P2P/Usenet/FTP traffic have their own limitations. <br>~ The more data you use, the more your speeds will slow down. - See table on the right. ";
	var inf2 = "<br> This account is not recommended for heavy downloading. <br>Gaming, Surfing, web (http) and mail services should be up to line speed. <br> P2P/usenet etc is heavily shaped - particulary during peak times"; 
	var inf3 = "<br> &nbsp; PAYG comes with 2GB of data transfer included. <br><br> &nbsp; Pre-paid additional data transfer is £1.50 per 2GB, <br> &nbsp; or pay as you use them at £1.80 per 2GB. <br><br> &nbsp; Overnight downloads are free.";	
	var inf4 = "<br> &nbsp; Basic comes with 450MB of data transfer included. <br><br> &nbsp; Email + Webspace additional £1.99 per month. " ;
	//Right info box (traffic shaping info)
	var ts1 = "<br>Limits only apply during the peak hours of 4pm to midnight.<br><br>";
	var ts2 = "<br>Although there is no official usage cap, the product is designed for up to 4 GB of peak time time usage.<br><br> If you go over this usage, downloads and surfing will get progressively slower until the start of your next billing month when your usage is reset. <br>Go over 10GB peak and your line speed will be reduced to 128kbps.<br><br> Off peak usage is not so heavily shaped, but as a guideline a maximum of 50GB is recommended.";
	var ts3 = "<br><br>~ No peak time limit applies as you pay for each GB of data transfer that you use. <br><br>~ Usage during the hours of midnight to 8am does not count towards any paid for GBs. <br><br>~ Although no off peak limit has been set by PlusNet, it is recommended that you follow the Premier guideline of 100GB.<br><br>";
	var ts4 = "<br><br>~ No peak time limit applies as you pay for each MB of data transfer that you use. <br><br>~ Additional data transfer is 0.224p per MB <br> &nbsp; &nbsp; (equivalent of £2.24 per GB) <br><br><br> <br>";
	//Bottom right links
	var footer_1 = "<br>More detailed information on the SUP can be found <a href='http://www.plus.net/support/broadband/network/sustainable_usage_guide.shtml' target='_blank'>here</a>.";
	var footer_2 = "<br>More detailed information on Traffic Management can be found <a href='http://www.plus.net/support/broadband/network/bb_premier1.shtml' target='_blank'>here</a>." ;
	var footer_2a = "<br>More detailed information on Traffic Management can be found <a href='http://www.plus.net/support/broadband/network/bb_plus.shtml' target='_blank'>here</a>." ;
	var footer_2b = "<br>More detailed information on Traffic Management can be found <a href='http://www.plus.net/support/broadband/network/bb_payg.shtml' target='_blank'>here</a>." ;	
	var footer_3 = "<br>Once you have hit the final SUP, all internet activity will be reduced to 128kbps at all times, until your next billing date.";
	var footer_4 = "<br><br> From observations Off peak speeds for p2p/usenet are expected to be in the region of 256-512kb.<br>" ;
	var footer_5 = "<br>Customers pay for each GB of traffic they use therefore no traffic shaping should be in evidence on any protocol during peak time.<br>" ;
	var footer_6 = "<br>Customers pay for each MB of traffic they use therefore no traffic shaping should be in evidence on any protocol.<br>" ;
	//peak time variables
	var peak1 = "&#8224; Peak Time is between the hours of 4pm to midnight";
	var peak2 = "&#8224; Peak Time is between the hours of 08:00 to 00:00"; 
	
	//premier 21.99 limits
	if (v1 == 0){
		Peak = "20 GB see table";
		Off = "Suggested 100 GB";
		//set the limits
		l1 = "  0 - 13 GB";
		l2 = "13 - 17 GB";
		l3 = "17 -  20 GB";
		l4 = " over  20 GB";
		l5 = "30 GB SUP";
	}
	
	//premier 29.99 limits
	if (v1 == 1){
		Peak = "30 GB see table";
		Off = "Suggested 150 GB";
		l1 = "0 - 20 GB";
		l2 = "20 - 25 GB";
		l3 = "25 - 30 GB";
		l4 = "over  30 GB ";
		l5 = "45 GB SUP";
	}
	
	//premier 39.99 limits
	if (v1 == 2){
		Peak = "40 GB see table";
		Off = "Suggested 200 GB";
		l1 = "0 - 27 GB";
		l2 = "27 - 33 GB";
		l3 = "33 - 40 GB";
		l4 = "over 40 GB";
		l5 = "60 GB SUP";
	}
	
	// all premier line speed
	if (v1 >= 0 && v1 <= 2){
		s1 = "Line Speed";
		s2 = "2 Mbps";
		s3 = "1 Mbps";
		s4 = "512 kbps";
		s5 = "128 kbps";
		
		// all premier p2p speed		
		p1 = "Line Speed";
		p2 = "256 kbps";
		p3 = "128 kbps";
		p4 = "Blocked";
		p5 = "At all times";
		
		
		prod = "Premier Account";
		inf = inf1;
		TSinf = ts1;
		premierdisplay = "";
		footer1 = footer_2;
		footer2 = footer_3 + footer_1;
		SUPpeak = peak1;
		}
	
	
		//broadband plus
		if (v1 == 3){
		Peak = "4 GB";
		Off = "Suggested 50 GB";
						
		prod = "Broadband Plus ";
		inf = inf2;				
		TSinf = ts2;
		premierdisplay = "none";		
		footer1 = footer_1;
		footer2 = footer_4 + footer_2a;
		SUPpeak = peak1;
	}
		//payg
		if (v1 == 4){
		Peak = "n/a";
		Off = "n/a";
				
		prod = "PAYG has no";
		inf = inf3;
		TSinf = ts3;
		premierdisplay ="none";		
		footer1 = " ";
		footer2 = footer_5 + footer_2b;
		SUPpeak = peak2;
	}
	
		//Basic
		if (v1 == 5){
		Peak = "n/a";
		Off = "n/a";
				
		prod = "Basic has no";
		inf = inf4;
		TSinf = ts4;
		premierdisplay ="none";		
		footer1 = " ";
		footer2 = footer_6;
		SUPpeak = " ";
	}
	


	document.SUPFUP.SUPPeak.value = Peak;
	document.SUPFUP.SUPOff.value = Off;	
	document.SUPFUP.level1.value = l1;
	document.SUPFUP.level2.value = l2;
	document.SUPFUP.level3.value = l3;
	document.SUPFUP.level4.value = l4;
	document.SUPFUP.level5.value = l5;
	document.SUPFUP.speed1.value = s1;
	document.SUPFUP.speed2.value = s2;
	document.SUPFUP.speed3.value = s3;
	document.SUPFUP.speed4.value = s4;
	document.SUPFUP.speed5.value = s5;
	document.SUPFUP.p2p1.value = p1;
	document.SUPFUP.p2p2.value = p2;
	document.SUPFUP.p2p3.value = p3;
	document.SUPFUP.p2p4.value = p4;
	document.SUPFUP.p2p5.value = p5;
	document.getElementById("info").innerHTML = inf;
	document.getElementById("account").innerHTML = prod;
	document.getElementById("foot1").innerHTML = footer1;
	document.getElementById("foot2").innerHTML = footer2;
	document.getElementById("TSinfo").innerHTML = TSinf;
	document.getElementById("peaktime1").innerHTML = SUPpeak;
	document.getElementById("premier").style.display = premierdisplay;

}