//Version 1
//Ref No: 1032/2003/3
//This javascript is for calling a servlet and recording where the link links to and from.
//
//Version 2
//Ref No: 4061/2003/8
//This javascript will popup a disclaimer before go to 3rd party web site (not include subsidiaries).
//
//last update: 22/08/2003

subsidiaries = new Array(
'http://manulife.com.ph',
'http://staging.manulife.com.ph',
'http://www.manulife.com.ph',
'https://extranet.manulife.com.ph',
'https://author.manulife.com.ph',
'');

exempted = new Array(
'/consumer/online_shopping/hotstuff.shtml',
'');

function isSubsidiaries(link){
  for(var i=0; i<subsidiaries.length; i++) {
    if(subsidiaries[i]!='') {
      var reg = new RegExp(subsidiaries[i]);
      if(reg.test(link)) {
        return true;
      }
    }
  }
  return false;
}

function isExempted(link){
  for(var i=0; i<exempted.length; i++) {
    if(exempted[i]!='') {
      var reg = new RegExp(exempted[i]); 
      if(reg.test(link)) {
        return true;
      }
    }
  }
  return false;
}

// function to be called
function externallink(linkto, linkfrom){
  //var fulllink='/thirdparty/thirdpartyreport?url='+escape(linkto)+'&object='+linkfrom; //added escape to change the parameter special character to unicode 
  var fulllink=linkto
  if(isSubsidiaries(linkto) || isExempted(linkfrom)){
  	window.open(fulllink,'_blank');
  } else {
    window.open('/_layouts/html/en/js/disclaimer.html?'+fulllink,'thirdparty','scrollbars=0,status=0,resizable=1,width=330,height=150,top=150,left=200');
  }
  return false;
}
