function getval(k) {
  var lck = k.toLowerCase();
  var query = ""+document.location.search;
  var lcquery = query.toLowerCase();
  var pos = lcquery.indexOf(lck+'=');
  var pos2 = -1;
  var res = '';
  if(pos != -1) {
    pos += k.length + 1;
    pos2 = query.indexOf('&',pos);
    pos2 = (pos2 == -1) ? query.length : pos2;
    res = query.substring(pos,pos2);
  }
  return res;
}

function getcode() {
  var pageurl = document.location + "";
  var defaultcode = "";

  //Dell products page default code - Added by Senh 31/03/03
  if(pageurl.match(/index_dell.html/)){
    defaultcode = "TF-PS-11AW";
  }else{
    defaultcode = "NN-HB-0282";
  }
  var code = getval("disk") || getval("code") || defaultcode;
  
  code = code.toUpperCase();
  return code;
}

// for /promo/whsmith/ pages. Gets the srccode
function getwsccode(){
	var srccodeloc = "" + window.location;
	if(srccodeloc.indexOf("srccode=") != -1){
	 	return getval('srccode');
	}else{
		return "COD_721"; // default code
	}
}

function getmode() {
  var mode = getval("GETMODE") || "";
  // This bit is temporary.
  // Codes that need GETMODE set to cd.
  var cds = new Array();
cds["AB-BR-11AB"] = 1;
cds["AB-BR-11AC"] = 1;
cds["AB-BR-11AD"] = 1;
cds["AB-BR-11AE"] = 1;
cds["AB-BR-11AF"] = 1;
cds["AB-BR-11AG"] = 1;
cds["AB-BR-11AH"] = 1;
cds["AB-BR-11AJ"] = 1;
cds["AB-BR-11AK"] = 1;
cds["AB-BR-11AL"] = 1;
cds["AB-BR-11AM"] = 1;
cds["AB-BR-11AN"] = 1;
cds["AB-BR-11AP"] = 1;
cds["AB-BR-11AR"] = 1;
cds["AB-BR-11AT"] = 1;
cds["AB-BR-11AU"] = 1;
cds["AB-BR-11AV"] = 1;
cds["AB-BR-11AW"] = 1;
cds["AB-BR-11AX"] = 1;
cds["AB-BR-11AY"] = 1;
cds["AB-BR-11BA"] = 1;
cds["AB-BR-11BB"] = 1;
cds["AB-BR-11BC"] = 1;
cds["AB-BR-11BD"] = 1;
cds["AB-BR-11BE"] = 1;
cds["AB-BR-11BF"] = 1;
cds["AB-BR-11BG"] = 1;
cds["AB-BR-11BH"] = 1;
cds["AB-BR-11BJ"] = 1;
cds["AB-BR-11BK"] = 1;
cds["AB-BR-11BL"] = 1;
cds["AB-BR-11BM"] = 1;
cds["AB-BR-11BN"] = 1;
cds["HK-DM-11AB"] = 1;
cds["HK-DM-11AC"] = 1;
cds["HK-DM-11AD"] = 1;
cds["HK-DM-11AF"] = 1;
cds["HK-DM-11AG"] = 1;
cds["HK-DM-11AH"] = 1;
cds["HK-RT-11AB"] = 1;
cds["HK-RT-11AC"] = 1;
cds["HK-RT-11AD"] = 1;
cds["HK-RT-11AE"] = 1;
cds["HK-RT-11AF"] = 1;
cds["HK-RT-11AG"] = 1;
cds["HK-RT-11AH"] = 1;
cds["HK-RT-11AJ"] = 1;
cds["HK-RT-11AK"] = 1;
cds["HK-RT-11AL"] = 1;
cds["HK-RT-11AN"] = 1;
cds["HK-RT-11AU"] = 1;
cds["HK-RT-11AV"] = 1;
cds["HK-RT-11AW"] = 1;
cds["HK-RT-11AX"] = 1;
cds["HK-RT-11AY"] = 1;
cds["HK-RT-11BA"] = 1;
cds["HK-RT-11BB"] = 1;
cds["HK-RT-11BC"] = 1;
cds["HK-RT-11BD"] = 1;
cds["HK-RT-11BE"] = 1;
cds["HK-RT-11BF"] = 1;
cds["HK-RT-11BG"] = 1;
cds["HK-RT-11BH"] = 1;
cds["MH-SP-11AD"] = 1;
cds["MH-SP-11AE"] = 1;
cds["MH-SP-11AF"] = 1;
cds["NN-EC-032X"] = 1;
cds["NN-EC-032Y"] = 1;
cds["NN-EC-032Z"] = 1;
cds["NN-EC-0330"] = 1;
cds["NN-EC-0332"] = 1;
cds["NN-EC-0334"] = 1;
cds["NN-EC-0336"] = 1;
cds["NN-EC-0338"] = 1;
cds["NN-EC-033A"] = 1;
cds["NN-EC-033B"] = 1;
cds["NN-EC-033C"] = 1;
cds["NN-EC-035Z"] = 1;
cds["NN-KB-02MG"] = 1;
cds["ZZ-DM-11AF"] = 1;
cds["ZZ-DM-11AG"] = 1;
cds["ZZ-DM-11AH"] = 1;
cds["ZZ-DM-11AJ"] = 1;
cds["ZZ-DM-11AK"] = 1;
cds["ZZ-DM-11AL"] = 1;
cds["ZZ-NL-11BH"] = 1;
cds["ZZ-NL-11BK"] = 1;
cds["ZZ-NL-11BL"] = 1;
cds["ZZ-NL-11ER"] = 1;
cds["ZZ-PS-11AF"] = 1;
cds["ZZ-PS-11AG"] = 1;
// to here

  // Exceptions.
  var exc = new Array();
exc["HA-NL-11AE"] = 1;
exc["HA-RT-11BG"] = 1;
exc["LL-MS-11AB"] = 1;
exc["LL-MS-11AC"] = 1;
exc["LL-MS-11AD"] = 1;
exc["MH-MS-11AC"] = 1;
exc["MH-MS-11AD"] = 1;
exc["MH-SP-11YG"] = 1;
exc["SM-NL-11AB"] = 1;
exc["SM-NL-11AC"] = 1;
exc["SM-NL-11AD"] = 1;
exc["SM-NL-11AE"] = 1;
exc["SM-NL-11AF"] = 1;
exc["SM-NL-11AG"] = 1;
exc["SM-NL-11AH"] = 1;
exc["SM-NL-11AJ"] = 1;
exc["SM-NL-11AK"] = 1;
exc["SM-NL-11AL"] = 1;
exc["SM-NL-11AM"] = 1;
exc["SM-NL-11AN"] = 1;
exc["SM-NL-11AP"] = 1;
exc["SM-NL-11AR"] = 1;
exc["SM-NL-11AT"] = 1;
exc["SM-NL-11AU"] = 1;
exc["SM-NL-11AV"] = 1;
exc["SM-NL-11AW"] = 1;
exc["SM-NL-11AX"] = 1;
exc["SM-PS-11AC"] = 1;
exc["SM-PS-11AD"] = 1;
exc["SM-PS-11AE"] = 1;
exc["TF-NL-11AB"] = 1;
exc["TF-PS-11AB"] = 1;
exc["TF-PS-11AD"] = 1;
exc["TF-PS-11AG"] = 1;
exc["TF-PS-11AK"] = 1;
exc["TF-PS-11AR"] = 1;
exc["TF-PS-11AT"] = 1;
exc["TF-PS-11AU"] = 1;
exc["TF-PS-11AV"] = 1;
exc["TF-PS-11BB"] = 1;
exc["TF-PS-11BG"] = 1;
exc["TF-PS-11BH"] = 1;
exc["TF-PS-11BN"] = 1;
exc["TF-PS-11BP"] = 1;
exc["TF-PS-11BY"] = 1;
exc["TF-PS-11CA"] = 1;
exc["TF-PS-11CB"] = 1;
exc["TF-PS-11CE"] = 1;
exc["TF-PS-11CF"] = 1;
exc["TF-PS-11CH"] = 1;
exc["TF-PS-11EN"] = 1;
exc["TF-PS-11EP"] = 1;
exc["TF-PS-11ER"] = 1;
exc["TF-PS-11ET"] = 1;
exc["TF-PS-11EX"] = 1;
exc["TF-PS-11EY"] = 1;
exc["TF-PS-11FF"] = 1;
exc["TF-PS-11FH"] = 1;
exc["TF-PS-11FV"] = 1;
exc["TF-PS-11FW"] = 1;
exc["TF-PS-11GU"] = 1;
exc["TF-PS-11GV"] = 1;
exc["TF-PS-11HM"] = 1;
exc["TF-PS-11HY"] = 1;
exc["TF-PS-11JF"] = 1;
exc["TF-PS-11JK"] = 1;
exc["MH-SP-12DB"] = 1;
exc["MH-SP-12HL"] = 1;
exc["MH-SP-12HM"] = 1;
exc["MH-SP-12HN"] = 1;
exc["MH-SP-12KN"] = 1;
exc["MH-SP-12KP"] = 1;
exc["MH-SP-12KR"] = 1;
exc["MH-SP-12KT"] = 1;
exc["MH-SP-12KU"] = 1;
exc["MH-SP-12KV"] = 1;
exc["MH-SP-12KW"] = 1;
exc["MH-SP-12KX"] = 1;
exc["MH-SP-12KY"] = 1;
exc["MH-SP-12LA"] = 1;
exc["MH-SP-12LB"] = 1;
exc["MH-SP-12LC"] = 1;
exc["MH-SP-12LD"] = 1;
exc["MH-SP-12LE"] = 1;
exc["MH-SP-12LF"] = 1;
exc["MH-SP-12LG"] = 1;
exc["MH-SP-12LH"] = 1;
exc["MH-SP-12LJ"] = 1;
exc["MH-SP-12LK"] = 1;
exc["MH-SP-12LL"] = 1;
exc["MH-SP-12LM"] = 1;
exc["MH-SP-12LN"] = 1;
exc["MH-SP-12MD"] = 1;
exc["MH-SP-12RT"] = 1;
exc["MH-SP-12RU"] = 1;
exc["MH-SP-12RV"] = 1;

  var code = getcode().toUpperCase();
  if((cds[code] == 1) || (code.match(/^(MH|LL|TF|SM|HA)-..-....$/))) {
    if(exc[code] != 1) {
      mode = "cd";
    }
  }
  
  // dell and whsmith getmode field
  var pageloc = "";
  var pageloc = "" + window.location;
  if(pageloc.indexOf("/products/dell/") != -1){
  	mode = "dell";
  }else if(pageloc.indexOf("/products/whsmith/") != -1){
  	mode = "whsmith";  
  }
  
  return mode;
}

function gotourl(url,targ,except) {
  var fullurl = url;
  if(fullurl.indexOf("?") == -1) {
    fullurl += "?";
  } else {
    fullurl += "&";
  }

  //Ensure GETMODE is passed on
  var gm = "";
  var gmloc = "" + window.location;
  if(gmloc.indexOf("GETMODE=") != -1){
  	gm = "&GETMODE=" + getmode();
  }

  //Ensure srccode is passed on
  var srccode = "";
  var srccodeloc = "" + window.location;
  if(srccodeloc.indexOf("srccode=") != -1){
  	srccode = "&srccode=" + getval('srccode');
  }  

  var bbcode1 = "ZZ-MS-11DK"; //default business broadband code #1
  var bbcode2 = "ZZ-MS-11DL"; //default business broadband code #2  
  var code = getcode();
  
  // If the link is the business broadband link in products then ensure 
  // that all TF-PS partner codes are passed otherwise use the default business broadband code
  if((except!=null)&&((except=="bb1")||(except=="bb2"))){
	  if(code.match(/^(TF-PS)/)){ 
		  fullurl += "code=" + code + gm;
	  }else if(except=="bb1"){
		  fullurl += "code=" + bbcode1 + gm; 
	  }else if(except=="bb2"){
		  fullurl += "code=" + bbcode2 + gm; 
	  }
  }else{
	  fullurl += "code=" + code + gm + srccode;
  }

  if(!targ) {
    targ = "_self";
  }
  var win = window.open(fullurl,targ);
}

function prodinfo(type) {
  var url = "";
  if((type == "classic") || (type== "adsl") || (type == "anytime") || (type == "offpeak") || (type == "daytime")) {
//    url = "/products/classic_description.html";    
    url = "/products/products_"+type+".html";    
  }
  if(url != "") {
    var win = window.open(url+"?code="+getcode()+"&GETMODE="+getmode(),"_self");
  }
}

function signup(type,disk,target,cli,resellercode,accountsrc,voice) {
  var code = disk || getcode();
  var mode = getmode();
  var winfeatures = "height=500,width=750,toolbar=no,menubar=no,location=no,toolbar=no,menubar=no,scrollbars=yes,resize=no,left=40,top=40,status=yes";
  var url = "";

  if(type == "classic") {
    //url = "http://register.tiscali.co.uk/?code="+code+"&GETMODE="+mode;
	url = getregurl(22,code,mode,null,"payg");
  } else if(type == "anytime") {
    url = getregurl(24,code,mode,null,"anytime");
  } else if(type == "anytime_1") {
    url = getregurl(45,code,mode,null,"anytime");
  } else if(type == "anytime_2") {
    url = getregurl(47,code,mode,null,"anytime");
  } else if(type == "anytime_3") {
    url = getregurl(49,code,mode,null,"anytime");
  } else if(type == "anytime_4") {
    url = getregurl(106,code,mode,null,"anytime");
  } else if(type == "anytime_5") {
    url = getregurl(585,code,mode,null,"anytime");
  } else if(type == "offpeak") {
    url = getregurl(26,code,mode,null,"offpeak");
  } else if(type == "offpeak_1") {
    url = getregurl(57,code,mode,null,"offpeak");
  } else if(type == "offpeak_2") {
    url = getregurl(59,code,mode,null,"offpeak");
  } else if(type == "offpeak_3") {
    url = getregurl(61,code,mode,null,"offpeak");
  } else if(type == "offpeak_4") {
    url = getregurl(108,code,mode,null,"offpeak");
  } else if(type == "daytime") {
    url = getregurl(28,code,mode,null,"daytime");
  } else if(type == "daytime_1") {
    url = getregurl(51,code,mode,null,"daytime");
  } else if(type == "daytime_2") {
    url = getregurl(53,code,mode,null,"daytime");
  } else if(type == "daytime_3") {
    url = getregurl(55,code,mode,null,"daytime");
  } else if(type == "daytime_4") {
    url = getregurl(110,code,mode,null,"daytime");
  } else if(type == "daytime_ow") {
    url = getregurl(30,code,mode,null,"daytime");
  } else if(type == "daytime_plus") {
    url = getregurl(94,code,mode,null,"daytimeplus");
  } else if(type == "adsl") {
    //url = getregurl(142,code,mode,cli,"broadband");
    url = "http://www.tiscali.co.uk/products/broadband/";
  } else if(type == "adsl_1") {
    url = getregurl(36,code,mode,cli,"broadband");
  } else if(type == "adsl_3") {
    url = getregurl(38,code,mode,cli,"broadband");
  } else if(type == "adsl_4") {
    url = getregurl(44,code,mode,cli,"broadband");
  } else if(type == "adsl_5") {
    url = getregurl(251,code,mode,cli,"broadband");	
  } else if(type == "adsl_2") {
    url = getregurl(180,code,mode,cli,"broadband");
  } else if(type == "adsl_2ff") {
    url = getregurl(181,code,mode,cli,"broadband");
  } else if(type == "broadband") {
  	url = getregurl(142,code,mode,cli,"broadband");
    // url = getbroadbandurl(cli);
  } else if(type == "broadband_2") {
  	url = getregurl(142,code,mode,cli,"broadband");
  } else if(type == "broadband_3") {
  	url = getregurl(87,code,mode,cli,"broadband");
  } else if(type == "broadband_4") {
  	url = getregurl(158,code,mode,cli,"broadband");
  } else if(type == "broadband_5") {
  	url = getregurl(86,code,mode,cli,"broadband");
  } else if(type == "broadband_6") {
  	url = getregurl(166,code,mode,cli,"broadband");
  } else if(type == "broadband_7") {
  	url = getregurl(166,code,mode,cli,"broadband");
  } else if(type == "broadband_8") {
    url = getregurl(268,code,mode,cli,"broadband");
  } else if(type == "broadband_9") {
    url = getregurl(266,code,mode,cli,"broadband");
  } else if(type == "broadband_10") {
    url = getregurl(270,code,mode,cli,"broadband");
  } else if(type == "broadband_11") {
  	url = getregurl(164,code,mode,cli,"broadband");
  } else if(type == "broadband_12") {
  	url = getregurl(96,code,mode,cli,"broadband");	
  } else if(type == "broadband_13") {
  	url = getregurl(152,code,mode,cli,"broadband");
  } else if(type == "broadband_14") {
  	url = getregurl(415,code,mode,cli,"broadband");	
  } else if(type == "broadband_15") {
  	url = getregurl(152,code,mode,cli,"broadband");		
  } else if(type == "broadband_16") {
  	url = getregurl(418,code,mode,cli,"broadband");
  } else if(type == "broadband_17") {
  	url = getregurl(600,code,mode,cli,"broadband");
  } else if(type == "broadband_18") {
  	url = getregurl(591,code,mode,cli,"broadband");
  } else if(type == "broadband_19") {
  	url = getregurl("588",code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_20") {
  	url = getregurl("593",code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_21") {
  	url = getregurl("596",code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_22") {
  	url = getregurl("604",code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_23") {
  	url = getregurl(416,code,mode,cli,"broadband");
  } else if(type == "broadband_24") {
  	url = getregurl("612",code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_25") {
  	url = getregurl(616,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_26") {
  	url = getregurl(614,code,mode,cli,"broadband");
  } else if(type == "broadband_27") {
  	url = getregurl(613,code,mode,cli,"broadband");
  } else if(type == "broadband_28") {
  	url = getregurl(618,code,mode,cli,"broadband");
  } else if(type == "broadband_29") {
  	url = getregurl(616,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_30") {
  	url = getregurl(668,code,mode,cli,"broadband");
  } else if(type == "broadband_31") {
  	url = getregurl(670,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_32") {
  	url = getregurl(676,code,mode,cli,"broadband");
  } else if(type == "broadband_33") {
  	url = getregurl(547,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_34") {
  	url = getregurl(658,code,mode,cli,"broadband");
  } else if(type == "broadband_35") {
  	url = getregurl(660,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_36") {
  	url = getregurl(691,code,mode,cli,"broadband");
  } else if(type == "broadband_37") {
  	url = getregurl(699,code,mode,cli,"broadband");
  } else if(type == "broadband_38") {
  	url = getregurl(658,code,mode,cli,"broadband");
  } else if(type == "broadband_39") {
  	url = getregurl(701,code,mode,cli,"broadband");
  } else if(type == "broadband_40") {
  	url = getregurl(692,code,mode,cli,"broadband");
  } else if(type == "broadband_41") {
  	url = getregurl(694,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_43") {
  	url = getregurl(709,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_44") {
  	url = getregurl(672,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_45") {
  	url = getregurl(717,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_46") {
  	url = getregurl(715,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_47") {
  	url = getregurl(705,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_48") {
  	url = getregurl(685,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_49") {
  	url = getregurl(722,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_50") {
  	url = getregurl(728,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_51") {
  	url = getregurl(707,code,mode,cli,"broadband");
  } else if(type == "broadband_52") {
  	url = getregurl(746,code,mode,cli,"broadband");
  } else if(type == "broadband_53") {
  	url = getregurl(713,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_54") {
  	url = getregurl(711,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_55") {
  	url = getregurl(693,code,mode,cli,"broadband");
  } else if(type == "broadband_56") {
  	url = getregurl(666,code,mode,cli,"broadband");
  } else if(type == "broadband_57") {
  	url = getregurl(782,code,mode,cli,"broadband");
  } else if(type == "broadband_58") {
  	url = getregurl(784,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_59") {
  	url = getregurl(786,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_60") {
  	url = getregurl(772,code,mode,cli,"broadband");
  } else if(type == "broadband_61") {
  	url = getregurl(778,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_62") {
  	url = getregurl(776,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_63") {
  	url = getregurl(790,code,mode,cli,"broadband");
  } else if(type == "broadband_64") {
  	url = getregurl(793,code,mode,cli,"broadband");
  } else if(type == "broadband_65") {
  	url = getregurl(780,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_66") {
  	url = getregurl(791,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_67") {
  	url = getregurl(803,code,mode,cli,"broadband");
  } else if(type == "broadband_68") {
  	url = getregurl(798,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_69") {
  	url = getregurl(556,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_70") {
  	url = getregurl(831,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_71") {
  	url = getregurl(495,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_72") {
  	url = getregurl(726,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_73") {
  	url = getregurl(801,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_74") {
  	url = getregurl(840,code,mode,cli,"broadband",accountsrc,voice);			
  } else if(type == "broadband_75") {
  	url = getregurl(839,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_76") {
  	url = getregurl(788,code,mode,cli,"broadband");				
  } else if(type == "broadband_77") {
  	url = getregurl(843,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_78") {
  	url = getregurl(840,code,mode,cli,"broadband");				
  } else if(type == "broadband_79") {
  	url = getregurl(839,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_80") {
  	url = getregurl(860,code,mode,cli,"broadband");				
  } else if(type == "broadband_81") {
  	url = getregurl(711,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_82") {
  	url = getregurl(833,code,mode,cli,"broadband");				
  } else if(type == "broadband_83") {
  	url = getregurl(867,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_84") {
  	url = getregurl(858,code,mode,cli,"broadband");				
  } else if(type == "broadband_85") {
  	url = getregurl(854,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_86") {
  	url = getregurl(852,code,mode,cli,"broadband",accountsrc,voice);
  } else if(type == "broadband_87") {
  	url = getregurl(703,code,mode,cli,"broadband");
  } else if(type == "broadband_88") {
  	url = getregurl(850,code,mode,cli,"broadband");
  } else if(type == "broadband_89") {
  	url = getregurl(851,code,mode,cli,"broadband",accountsrc,voice);	
  } else if(type == "broadband_dabs") {
    url = getregurl(281,code,mode,cli,"broadband");
  } else if(type == "dialup2broadband") {
    url = getdialup2broadbandurl(142,code);
  } else if(type == "securemail") {
    url = getsecuremail('tispureaddonsecuremail_89');
  } else if(type == "securemail_1") {
    url = getsecuremail('addon_978');	
  } else if(type == "securemailextra") {
    url = getsecuremailextra(code);
  } else if(type == "securepc_av1m") {
    url = getaddon('symantec_167');
  } else if(type == "securepc_av2m") {
    url = getaddon('symantec_168');
  } else if(type == "securepc_av3m") {
    url = getaddon('symantec_169');
  } else if(type == "securepc_av1yr") {
    url = getaddon('symantec_170');
  } else if(type == "securepc_av2yr") {
    url = getaddon('symantec_171');
  } else if(type == "securepc_av3yr") {
    url = getaddon('symantec_172');
  } else if(type == "securepc_fwm") {
    url = getaddon('symantec_173');
  } else if(type == "securepc_fwyr") {
    url = getaddon('symantec_174');
  } else if(type == "securepc_ism") {
    url = getaddon('symantec_175');
  } else if(type == "securepc_isyr") {
    url = getaddon('addon_norton_599');
  } else if(type == "websitemembership") {
  	url = getregurl(84,code,mode,null,"website");
  }else if(type == "traveller") {
  	url = gettraveller(code);
  }else if(type == "nm_broadband_1") {
  	url = getnm(142,code,cli);
  }else if(type == "nm_broadband_2") {
  	url = getnm(180,code,cli);
  }else if(type == "nm_broadband_3") {
  	url = getnm(86,code,cli);
  }else if(type == "nm_broadband_4") {
  	url = getnm(164,code,cli);
  }else if(type == "nm_broadband_5") {
  	url = getnm(270,code,cli);
  }else if(type == "nm_broadband_6") {
  	url = getnm(266,code,cli);
  }else if(type == "nm_broadband_7") {
  	url = getnm(251,code,cli);			
  }else if(type == "nm_broadband_8") {
  	url = getnm(415,code,cli);
  }else if(type == "nm_broadband_9") {
  	url = getnm(152,code,cli);
  }else if(type == "nm_broadband_10") {
  	url = getnm(418,code,cli);		
  }else if(type == "nm_broadband_11") {
  	url = getnm(658,code,cli,accountsrc);
  }else if(type == "nm_broadband_12") {
  	url = getnm(588,code,cli,accountsrc);		
  }else if(type == "nm_broadband_13") {
  	url = getnm(593,code,cli,accountsrc);		
  }else if(type == "nm_broadband_14") {
  	url = getnm(596,code,cli,accountsrc);
  }else if(type == "nm_broadband_15") {
  	url = getnm(709,code,cli,accountsrc);	
  }else if(type == "nm_broadband_16") {
  	url = getnm(613,code,cli,accountsrc);	
  }else if(type == "nm_broadband_17") {
  	url = getnm(612,code,cli,accountsrc);			
  }else if(type == "nm_broadband_18") {
  	url = getnm(614,code,cli,accountsrc);	
  }else if(type == "nm_broadband_19") {
  	url = getnm(616,code,cli,accountsrc);	
  }else if(type == "nm_broadband_20") {
  	url = getnm(746,code,cli,accountsrc);
  }else if(type == "nm_broadband_21") {
  	url = getnm(672,code,cli,accountsrc);
  }else if(type == "nm_broadband_22") {
  	url = getnm(676,code,cli,accountsrc);
  }else if(type == "nm_broadband_23") {
  	url = getnm(547,code,cli,accountsrc);
  }else if(type == "nm_broadband_24") {
  	url = getnm(705,code,cli,accountsrc);
  }else if(type == "nm_broadband_25") {
  	url = getnm(658,code,cli,accountsrc);
  }else if(type == "nm_broadband_26") {
  	url = getnm(685,code,cli,accountsrc);
  }else if(type == "nm_broadband_27") {
  	url = getnm(722,code,cli,accountsrc);
  }else if(type == "nm_broadband_28") {
  	url = getnm(728,code,cli,accountsrc);
  }else if(type == "nm_broadband_29") {
  	url = getnm(707,code,cli,accountsrc);
  }else if(type == "nm_broadband_30") {
  	url = getnm(746,code,cli,accountsrc);
  }else if(type == "nm_broadband_31") {
  	url = getnm(713,code,cli,accountsrc);
  }else if(type == "nm_broadband_32") {
  	url = getnm(701,code,cli,accountsrc);
  }else if(type == "nm_broadband_33") {
  	url = getnm(711,code,cli,accountsrc);
  }else if(type == "nm_broadband_34") {
  	url = getnm(666,code,cli,accountsrc);
  }else if(type == "nm_broadband_35") {
  	url = getnm(658,code,cli,accountsrc);
  }else if(type == "nm_broadband_36") {
  	url = getnm(772,code,cli,accountsrc);
  }else if(type == "nm_broadband_37") {
  	url = getnm(782,code,cli,accountsrc);
  }else if(type == "nm_broadband_38") {
  	url = getnm(778,code,cli,accountsrc);
  }else if(type == "nm_broadband_39") {
  	url = getnm(784,code,cli,accountsrc);
  }else if(type == "nm_broadband_40") {
  	url = getnm(780,code,cli,accountsrc);
  }else if(type == "nm_broadband_41") {
  	url = getnm(776,code,cli,accountsrc);
  }else if(type == "nm_broadband_42") {
  	url = getnm(786,code,cli,accountsrc);
  }else if(type == "nm_broadband_43") {
  	url = getnm(782,code,cli,accountsrc);
  }else if(type == "nm_broadband_44") {
  	url = getnm(726,code,cli,accountsrc);
  }else if(type == "nm_broadband_45") {
  	url = getnm(793,code,cli,accountsrc);
  }else if(type == "nm_broadband_46") {
  	url = getnm(831,code,cli,accountsrc);
  }else if(type == "nm_broadband_47") {
  	url = getnm(858,code,cli,accountsrc);
  }else if(type == "nm_broadband_48") {
  	url = getnm(854,code,cli,accountsrc);
  }else if(type == "nm_anytime_1") {
  	url = getnm(24,code,cli);
  }else if(type == "nm_daytime_plus") {
  	url = getnm(94,code,cli);
  }else if(type == "nm_daytime_1") {
  	url = getnm(28,code,cli);
  }else if(type == "directsales_broadband_1") {
  	url = getdirectsales(142,code,cli,resellercode);
  }else if(type == "directsales_broadband_2") {
  	url = getdirectsales(180,code,cli,resellercode);
  }else if(type == "directsales_broadband_3") {
  	url = getdirectsales(86,code,cli,resellercode);
  }else if(type == "directsales_broadband_4") {
  	url = getdirectsales(164,code,cli,resellercode);
  }else if(type == "directsales_broadband_5") {
  	url = getdirectsales(251,code,cli,resellercode);
  }else if(type == "broadband_pro_512") {
  	url = getregurl(224,code,mode,cli,"broadband");
  }else if(type == "broadband_pro_256") {
  	url = getregurl(220,code,mode,cli,"broadband");
  }else if(type == "anti-spam") {
	url = getaddon('securemail_161');
  }else if(type == "anti-virus") {
	url = getaddon('securemail_160');
  }else if(type == "extra_storage") {
	//url = getaddon('securemail_177');
	// changed 14/08/06 alex url = getaddon('addon_587');
	url = getaddon('addon_891');
  }
  
  

  if(url) {
    var targ = (target) ? target : "_self";
    var gotcli = (cli) ? cli : false;

    if((targ=="_self")&&(gotcli!=false)){
       document.location.replace(url);
     }else{
       var win = window.open(url,targ); 
     }

  }

}


function getregurl(type,code,mode,cli,atdmt) {
// http://switch.atdmt.com/action/tiscali_"+atdmt+"_productpage_click?href=
var url = "https://ecare.tiscali.co.uk/servlet/SelfProvisioningServlet?startup=PluginJolly&startnode=startup&startform=startup&DISPLAY_LANGUAGE=EN&SUBSCRIPTION_CODE_PASSWORD=tiscali&OFFER_ID="+type+"&SUBSCRIPTION_CODE="+code+"&GETMODE="+mode;
  if((cli != null) && (cli != "")) {
    url += "&CLI_1="+cli;
  }
  return url;
}

function getaddon(code,servicetype) {
  var url = "https://ecare.tiscali.co.uk/servlet/SelfProvisioningServlet?startup=PluginDirectStartup&startnode=startup&startform=startup&DISPLAY_LANGUAGE=EN&SUBSCRIPTION_CODE_PASSWORD=tiscali&SUBSCRIPTION_CODE="+code+"&brand=tiscalib2b&nation=uk&servicetype="+servicetype+"&VISP_ID=2&application=add_on_selfprovisioning";
  var win = window.open(url,"_blank");
}

function gettraveller(code) {
var url = "https://ecare.tiscali.co.uk/servlet/SyncUpgradeServlet?startup=PluginDirectStartup&startnode=startup&startform=startup&DISPLAY_LANGUAGE=EN&SUBSCRIPTION_CODE_PASSWORD=tiscali&SUBSCRIPTION_CODE="+code+"&brand=tiscalib2b&nation=uk&VISP_ID=2&application=synchronous_upgrade_gric";
  return url;
}

function getsecuremail(code) {
var url = "https://ecare.tiscali.co.uk/servlet/SelfProvisioningServlet?startup=PluginDirectStartup&startnode=startup&startform=startup&DISPLAY_LANGUAGE=EN&SUBSCRIPTION_CODE_PASSWORD=tiscali&SUBSCRIPTION_CODE=tispureaddonsecuremail_89&brand=tiscalib2b&nation=uk&servicetype=151&VISP_ID=2&application=add_on_selfprovisioning";
  return url;
}

function getsecuremailextra(code) {
var url = "https://ecare.tiscali.co.uk/servlet/SelfProvisioningServlet?startup=PluginDirectStartup&startnode=startup&startform=startup&DISPLAY_LANGUAGE=EN&SUBSCRIPTION_CODE_PASSWORD=tiscali&SUBSCRIPTION_CODE=securemail_149&brand=tiscalib2b&nation=uk&servicetype=151&VISP_ID=2&application=add_on_selfprovisioning";
  return url;
}


function lite_ecare(lefunction,target) {
var url = "https://ecare.tiscali.co.uk/servlet/LiteECareServlet?application=lite_ecare&brand=tiscalib2b&nation=uk&startup=PluginDirectStartup&startnode=startup&DISPLAY_LANGUAGE=EN&startform="+lefunction;
  if (target == null) {
     target = "_self";
  } 
  var win = window.open(url,target);
}

function lite_selfcare(target) {
var url = "https://ecare.tiscali.co.uk/servlet/LightSelfCareServlet?application=add_on_lightecare&brand=tiscalib2b&nation=uk&startup=PluginDirectStartup&startnode=startup&DISPLAY_LANGUAGE=EN&startform=startup";
  if (target == null) {
     target = "_self";
  } 
  var win = window.open(url,target);
}

function manage() {
var url = "https://ecare.tiscali.co.uk/servlet/ECareServlet?application=ecare&brand=tiscalib2b&nation=uk&startform=startup&startup=PluginECare&startnode=startup&DISPLAY_LANGUAGE=EN&VISP_ID=2";

var targ = "_self";
  if (parent != null) {
     targ = "_parent";
  }   

var win = window.open(url,targ);
}

function lite_pwd(lefunction,targ) {
var url = "https://ecare.tiscali.co.uk/servlet/LiteECareServlet?application=lite_ecare&brand=tiscalib2b&nation=uk&startup=PluginDirectStartup&startnode=startup&DISPLAY_LANGUAGE=EN&startform=startup_pwd&SERVICE="+lefunction;
  if (targ == null) {
     targ = "_new";
  } 
  var win = window.open(url,targ);
}