﻿// JScript File

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
 

function fixBGPNG(myElement,PNG)
 
{
 
    if ((version >= 5.5) && (version <= 7) && (document.body.filters)) 
    {

 document.getElementById(myElement).style.background = '';
 document.getElementById(myElement).style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\''+PNG+'\', sizingMethod=scale)';
 
    }
 
}


function doOverlayAlert()

{

//THIS CHECKS THAT THE ASP.NET VALIDATOR IS HAPPY WITH THE INPUTS

var Page_IsValid;

if (Page_IsValid || Page_IsValid == undefined) {

//THIS CALLS SWFOBJECT TO REPLACE THE ANIMATED GIF WITH THE FLASH VERSION IF FLASH IS INSTALLED	
	
	var progressindicator = new SWFObject("/flash/progress.swf", "overalertprogress", "200", "19", "5", "");
	progressindicator.write("overalertprogress");

//SCROLL THE WINDOW TO THE TOP

	scroll(0,0);

//HIDE SELECTS (ISSUE IN IE6 - THE SHOW THROUGH THE TRANSPARENT DIV)


 	selects = document.getElementsByTagName('select');
    	for(i = 0; i < selects.length; i++) {
        selects[i].style.visibility = 'hidden';
   	}


//REMOVE ANY SCROLL ON THE PAGE SO WE CANT SCROLL PAST THE OVERLAY

	bod = document.getElementsByTagName('body')[0];
	bod.style.height = '100%';
	bod.style.overflow = 'hidden';
	htm = document.getElementsByTagName('html')[0];
	htm.style.height = '100%';
	htm.style.overflow = 'hidden';

//FIX THE OVERLAY PNG FOR BROWSERS THAT DONT SUPPORT PNG IMAGES

	fixBGPNG('overalertoverlay','/images/transparent.png');

//UNHIDE THE OVERLAY LAYER

	document.getElementById('overalertoverlay').style.visibility = 'visible'; 
			
}

}



function closeOverlayAlert()

{

document.getElementById('overalertoverlay').style.visibility = 'hidden';

}




function ePayValidator(){
if (document.getElementById('voucher').value.length != 12){

	mesg = "E-Pay PIN Error\n\n"
	mesg = mesg + "You have entered a " + document.getElementById('voucher').value.length + " digit PIN.\n"
	mesg = mesg + "Valid PINs should consist of a 12 digit number.\n"
	mesg = mesg + "Please check your voucher and try again."

	alert(mesg);
	document.getElementById('voucher').focus();

	} else {

		var ValidChars = "0123456789.";
		var IsNumber=true;
		var Char;

 		for (i = 0; i < document.getElementById('voucher').value.length && IsNumber == true; i++){ 
      			Char = document.getElementById('voucher').value.charAt(i); 
      			if (ValidChars.indexOf(Char) == -1){
         			IsNumber = false;
         			}
      		}


		if (IsNumber != true){

			mesg = "E-Pay PIN Error\n"
			mesg = mesg + "You have entered a non-numeric PIN.\n\n"
			mesg = mesg + "Valid PINs should consist of a 12 digit number.\n"
			mesg = mesg + "Please check your voucher and try again."

			alert(mesg);
			document.getElementById('voucher').focus();
		
		} else {
	
		document.location.href='epay.aspx?Msisdn='+document.getElementById('msisdn').value+'&Voucher='+document.getElementById('voucher').value;

		}

	}
}


var myquotes	= new Array()
var myauthor	= new Array()

myquotes[0] = '<p>"It is a good service that provides peace of mind to travellers that they have access to a phone wherever they are."</p>';
myauthor[0] = 'Paul, UK/Canada';
myquotes[1] = '<p style="padding-top:10px;">"It\'s simple, it\'s cheaper than UK networks and you\'re not tied in to any contracts."</p>';
myauthor[1] = 'Bob, UK (Wales)';
myquotes[2] = '<p style="padding-top:10px;">"Economical and great having the same number everytime one goes abroad."</p>';
myauthor[2] = 'Sophie, UK';
myquotes[3] = '<p style="padding-top:20px;">"Good value for money and reliable. Also easy to use."</p>';
myauthor[3] = 'David, UK';
myquotes[4] = '<p style="padding-top:20px;">"A reliable service & easy to use worldwide."</p>';
myauthor[4] = 'Mark, UK';
myquotes[5] = '<p style="padding-top:20px;">"It\'s simple to use and it\'s extremely reliable"</p>';
myauthor[5] = 'Melanie, UK';


function rotatequote()

{
        thequote = myquotes.shift();
        myquotes.push(thequote);
        theauthor = myauthor.shift();
        myauthor.push(theauthor);
	document.getElementById('testimonial').innerHTML = thequote;
	document.getElementById('author').innerHTML = theauthor;
        t=setTimeout("rotatequote()",5000);

}




