var widget = document.getElementById('fefert2');
function widgetcheck(){
if (!widget){
return false;
}else{
var tags = document.getElementById('fefert2').getElementsByTagName('*');
for ( var i = 0; i < tags.length; i++ ) {
if ( tags[i].style.display != '' || tags[i].style.visibility == 'hidden' ) {
return false;
}else{
var links = document.getElementById('fefert2-infolink').getElementsByTagName('a');
if (!links){
return false;
}else{
// check credit link present
let checkCredits = null
for (var i = 0; i < links.length; i++) {
if (links[i].href.indexOf('www.foreignexchange.org.uk')>-1){
checkCredits = i
break;
}
}
if (checkCredits!== null) {
//check link text is correct
var checkRes = links[checkCredits].innerHTML == "Foreign Exchange" || links[checkCredits].innerHTML == "Foreign Exchange Rates" || links[checkCredits].innerHTML == "ForeignExchange.org.uk" || links[0].innerHTML == "Foreign Exchange Comparison" || links[0].innerHTML == "FX Trading" || links[0].innerHTML == "Send Money Abroad"
if (checkRes) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
}
}
}
function widgetshow(){
var prefix = window.parent.document.location.protocol;
var vt = new Date();
os = vt.getTimezoneOffset()/60;
var userhr = vt.getHours();
var ws = document.location.href;
if (nb==10){
var widgetiframe = '';
}else if (nb==9){
var widgetiframe = '';
}else if (nb==8){
var widgetiframe = '';
}else if (nb==7){
var widgetiframe = '';
}else if (nb==6){
var widgetiframe = '';
}else if (nb==5){
var widgetiframe = '';
}else if (nb==4){
var widgetiframe = '';
}else if (nb==3){
var widgetiframe = '';
}else if (nb==2){
var widgetiframe = '';
}else if (nb==1){
var widgetiframe = '';
}
var widgetid = "fefert2";
document.getElementById('fefert2-widget').innerHTML = widgetiframe;
}
if (widgetcheck()){
widgetshow();
}else{
document.getElementById('fefert2-widget').innerHTML = "Error - please check widget code";
}