/************************************************************************************
Nigel Francois
Front-End Interface developer 2005
http://www.intro-net.net
*************************************************************************************/



/************************************************************************************
DETECT BROWSER
*************************************************************************************/
var isIE4 	= 	(document.all && !document.getElementById && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('MSIE 4.0') != -1) ? true : false;
var isIE5 	= 	(document.all && document.getElementById && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('MSIE 5.0') != -1) ? true : false;
var isIE55 	= 	(document.getElementById && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('MSIE 5.5') != -1) ? true : false;
var isIE6 	= 	(document.getElementById && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('MSIE 6.') != -1) ? true : false;
var isIE	=	(isIE4 || isIE5 || isIE55 || isIE6)
var isSafari=	(navigator.userAgent.indexOf('Safari')!=-1) ? true : false;
var isMacIE =	(navigator.userAgent.indexOf('MSIE')!=-1 && navigator.userAgent.indexOf('Mac')!=-1) ? true : false;
var isGecko = 	(!document.all && document.getElementById) ? true : false;
var isOP=(
		  (navigator.appName.indexOf('Opera') != -1)
		  ||(navigator.plugins.length>0 && navigator.appName.indexOf('Microsoft') != -1)
		  ||(!navigator.product && navigator.appName.indexOf('Netscape') != -1)
		  )
var isWindows=(navigator.userAgent.indexOf('Windows')!=-1) ? true : false;
var isMac=(navigator.userAgent.indexOf('Mac')!=-1) ? true : false;

if (isGecko)
	{
	var thisbrowser = "Gecko";
	if(isWindows)
		{
		window.onload=function()
			{
			navcontainer1=document.getElementById("navcontainer1");
			navcontainer1.style.height="18px";
			}
		}
	}
if (isIE)
	{
	var thisbrowser = 'IE';
	if(isIE5 && isWindows)document.write('<link rel="stylesheet" href="css/IE5style.css" type="text/css">');
	if(isIE55 && isWindows)document.write('<link rel="stylesheet" href="css/IE55style.css" type="text/css">');
	if(isMac)document.write('<link rel="stylesheet" href="css/IEMacstyle.css" type="text/css">');
}

/* if tou want to support OPERA browser
if (isOP)
	{
	if(isWindows){
	var thisbrowser = 'Opera'; 
	isIE4=false;isIE5=false;isGecko=false;isIE=false; 
	}
}
*/

/************************************************************************************
STORE CLINT VARIABLES
*************************************************************************************/
var displayText="";
var randomnumber1=0;
var randomnumber2=0;

/************************************************************************************
ENSURES THAT THE LINK2 AND LINK3 RANDOM LINKS ARE NOT IDENTICAL
*10 = generate a random number between 1 and 10.
Change the value to reflect the quantity of items in the TEXT BANNER LINKS DATA ARRAY
*************************************************************************************/
while(randomnumber1==randomnumber2)
	{
	randomnumber1=Math.floor(Math.random()*5); 	//
	randomnumber2=Math.floor(Math.random()*5); 	//
	}

/************************************************************************************
TEXT BANNER LINKS DATA ARRAY
syntax : URL|LINK_TEXT
The values are seperated by the | vertical line
URL is placed on the left and LINK_TEXT is placed on the right
*************************************************************************************/
var textArray= new Array(
"http://www2.americanexpress.lv/lv/private/gold/freedom/|&#70;&#105;&#110;&#97;&#110;&#115;&#105;&#257;&#108;&#257;&#32;&#98;&#114;&#299;&#118;&#299;&#98;&#97;",
"http://www2.americanexpress.lv/lv/private/|&#75;&#117;&#114;&#32;&#118;&#97;&#114;&#32;&#110;&#111;&#114;&#275;&#311;&#105;&#110;&#257;&#116;&#105;&#101;&#115;",
"http://www2.americanexpress.lv/lv/private/gold/|&#80;&#105;&#101;&#115;&#97;&#107;&#105;&#101;&#115;&#32;&#71;&#111;&#108;&#100;",
"http://www2.americanexpress.lv/lv/private/gold/protection/|&#73;&#122;&#99;&#105;&#108;&#97;&#32;&#100;&#114;&#111;&#353;&#299;&#98;&#97;",
"http://www2.americanexpress.lv/lv/offers/|&#298;&#112;&#97;&#353;&#105;&#32;&#112;&#105;&#101;&#100;&#257;&#118;&#257;&#106;&#117;&#109;&#105;"
);

/************************************************************************************
IMAGE BANNER LINKS DATA ARRAY
syntax : URL|IMAGE_URL|IMAGE_ALT_TEXT
The values are seperated by the | vertical line
URL is placed on the left, IMAGE_URL is placed in the middle ( excluding [.jpg] ) and IMAGE_ALT_TEXT is placed on the right
*************************************************************************************/
var imgArray= new Array(
"http://www2.americanexpress.lv/lv/offers/|selects_lv_1|American Express® Selects",
"http://www2.americanexpress.lv/lv/private/gold/|gold_lv|&#65;&#109;&#101;&#114;&#105;&#99;&#97;&#110;&#32;&#69;&#120;&#112;&#114;&#101;&#115;&#115;&#174;&#32;&#71;&#111;&#108;&#100;&#32;&#107;&#114;&#101;&#100;&#299;&#116;&#107;&#97;&#114;&#116;&#101;",
"http://www2.americanexpress.lv/lv/private/blue/|blue_lv|American Express® Blue"
);


/************************************************************************************
DOCUMENT WRITE IMAGE BANNER LINK
*2 = generate a random number between 1 and 2.
Change the value to reflect the quantity of items in the IMAGE BANNER LINKS DATA ARRAY
*************************************************************************************/
function doBannerLink()
{
var randomnumber=Math.floor(Math.random()*3); 	//
$bannerLink=imgArray[randomnumber].split("|")
document.write('<a href="'+($bannerLink[0])+'"><img src="images/'+($bannerLink[1])+'.jpg" width="540" height="210" alt="'+($bannerLink[2])+'" title="'+($bannerLink[2])+'"></a>');
return randomnumber;
}


/************************************************************************************
DOCUMENT WRITE TEXT BANNER LINKS
*************************************************************************************/
function doTextLink(banner,whichLink)
{
if(banner==0)
{
if(whichLink==1)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/blue/apply/" class="bannerlink'+(whichLink)+'">Piesakies Blue</a>');
	}

if(whichLink==2)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/gold/freedom/" class="bannerlink'+(whichLink)+'">&#70;&#105;&#110;&#97;&#110;&#115;&#105;&#257;&#108;&#257;&#32;&#98;&#114;&#299;&#118;&#299;&#98;&#97;</a>');
	}

if(whichLink==3)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/accept/" class="bannerlink'+(whichLink)+'">&#75;&#117;&#114;&#32;&#118;&#97;&#114;&#32;&#110;&#111;&#114;&#275;&#311;&#105;&#110;&#257;&#116;&#105;&#101;&#115;</a>');
	}

}
if(banner==1)
{
if(whichLink==1)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/gold/apply/" class="bannerlink'+(whichLink)+'">Piesakies Gold</a>');
	}

if(whichLink==2)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/gold/protection/" class="bannerlink'+(whichLink)+'">&#73;&#122;&#99;&#105;&#108;&#97;&#32;&#100;&#114;&#111;&#353;&#299;&#98;&#97;</a>');
	}

if(whichLink==3)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/offers/" class="bannerlink'+(whichLink)+'">&#298;&#112;&#97;&#353;&#105;&#32;&#112;&#105;&#101;&#100;&#257;&#118;&#257;&#106;&#117;&#109;&#105;</a>');
	}

}
if(banner==2)
{
if(whichLink==1)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/blue/apply/" class="bannerlink'+(whichLink)+'">Piesakies Blue</a>');
	}

if(whichLink==2)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/private/gold/protection/" class="bannerlink'+(whichLink)+'">&#73;&#122;&#99;&#105;&#108;&#97;&#32;&#100;&#114;&#111;&#353;&#299;&#98;&#97;</a>');
	}

if(whichLink==3)
	{
	document.write('<a href="http://www2.americanexpress.lv/lv/offers/" class="bannerlink'+(whichLink)+'">&#298;&#112;&#97;&#353;&#105;&#32;&#112;&#105;&#101;&#100;&#257;&#118;&#257;&#106;&#117;&#109;&#105;</a>');
	}
}

}

/************************************************************************************
MAC FIX
Not used
The Mac was not loading the banner links so I gathered the HTML that the javascript 
created for the BANNER LINKS into a variable called displayText. 
A link was placed on the HTML page with a link to the below function to display the HTML.
*************************************************************************************/
function getLinks()
{
Mycc=document.getElementById("cc");
Mycc.innerText=displayText;
}

