﻿//CUSTOM SCRIPTS FOR PREPAY TECHNOLOGIES
// COPYRIGHT HEADCHANNEL LTD


//Functions to create popUp windows to link to secure site

var splashLinkApply = "https://portal.prepaytec.com/chopinweb/scareStart.do?customerCode=1618516125&pcgCode=PREPAY_SPLASHV2&start=WL&style=application&loc=en"
var premLinkApply = "http://portal.prepaytec.com/chopinweb/start.do?customerCode=1618516125&pcgCode=PREPAY_PREMIUM";
var quidLinkApply = "https://portal.prepaytec.com/chopinweb/scareStart.do?customerCode=1618516125&pcgCode=PREPAY_QUIDITY&start=PD&style=application&loc=en"
var splashLinkAccount = "https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125&loc=en";
var premLinkAccount = "https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125&loc=en";
var quidLinkAccount = "https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125&loc=en";
var allLinkAccount = "https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125&loc=en";


function applyNow(card) {

if (card == "splash") {
myLink = splashLinkApply;
}
if (card == "prem") {
myLink = premLinkApply;
}
if (card == "quidity") {
myLink = quidLinkApply;
}

testwindow = window.open(myLink,"image","location=0,status=0,toolbar=0,menubar=0,directories=0,scrollbars=1,resizable=1,width=900,height=800");
testwindow.moveTo(0,0);
}

function myAccount(card) {


if (card == "all") {
openWindow(allLinkAccount);
}

if (card == "splash") {
openWindow(splashLinkAccount);
}
if (card == "prem") {
openWindow(premLinkAccount);
}

if (card == "quidity") {
openWindow(quidLinkAccount);
}

}

function barCode(card) {
var myBarCode;
myBarCode = "barcode.html"
testwindow = window.open(myBarCode, "image", "location=0,status=0,toolbar=0,menubar=0,directories=0,scrollbars=1,resizable=1,width=575,height=525");
testwindow.moveTo(0,0);
}


//test!
function messagebox(message) {
alert (message)
}

//create non-crawlable email addresses
var bongle = "mail";
var this_site = "360money.com";
function sendmail(myVariable) {
var myLink = myVariable + '@' + this_site;
document.write('<a href=\"' + bongle + 'to:' + myLink + '\">' + myLink + '</a>');
}
function sendmail_fullstop(myVariable) {
var myLink = myVariable + '@' + this_site;
document.write('<a href=\"' + bongle + 'to:' + myLink + '\">' + myLink + '</a>.');
}

function sendExternalMail(myVariable, domain) {
var myLink = myVariable + '@' + domain;
document.write('<a href=\"' + bongle + 'to:' + myLink + '\">' + myLink + '</a>');
}


//call javascript commands from within Flash

function applynowmovie_DoFScommand (command, args) {
	alert (args);
}

function openWindow(url) {
        exampleWin = window.open(url, 'MyAccount', 'width=830, height=500, resizable=yes, scrollbars=yes, location=no, directories=no, status=no, menubar=no, toolbar=no, copyhistory=no');

    }

/**
* @author Szymon Wilczynski szymon(at)headchannel.net
* SubmitDependsOnAccount,SubmitDependsOnAccountTUP:
* Submit button in My Account page depends on first two digits of account number.
*/
function SubmitDependsOnAccount() {
	account = document.getElementById('account-number').value;
	twodigits = account.substring(0,2);
	if (twodigits == '14') {
		document.getElementById('account-submit').onclick = function(){window.location='https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125'};
	} else if (twodigits == '17') {
		document.getElementById('account-submit').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=31225451941125'};
	} else if (twodigits == '18') {
		document.getElementById('account-submit').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=251518111989185'};
	} else if (twodigits == '22') {
		document.getElementById('account-submit').onclick = function(){window.location='https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=229187914'};
	} else if (twodigits == '33') {
		document.getElementById('account-submit').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=23211491514'};
	} else {
		document.getElementById('account-submit').onclick = '';
	}
	
}
function SubmitDependsOnAccountTUP() {
	account = document.getElementById('tup-number').value;
	twodigits = account.substring(0,2);
	if (twodigits == '14') {
		document.getElementById('tup-button').onclick = function(){window.location='https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=1618516125'};
	} else if (twodigits == '17') {
		document.getElementById('tup-button').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=31225451941125'};
	} else if (twodigits == '18') {
		document.getElementById('tup-button').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=251518111989185'};
	} else if (twodigits == '22') {
		document.getElementById('tup-button').onclick = function(){window.location='https://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=229187914'};
	} else if (twodigits == '33') {
		document.getElementById('tup-button').onclick = function(){window.location='http://portal.prepaytec.com/chopinweb/scareMyLogin.do?customerCode=23211491514'};
	} else {
		document.getElementById('tup-button').onclick = '';
	}
	
}
