/************************************************************************************
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/akcijas.html|austria_lv|American Express",
"http://www2.americanexpress.lv/lv/offers/akcijas.html|sa_lv|American Express",
"swf|images/AMEX_augusts_540x210_LAT|",
"swf|images/amex_blue_540x210_lv|",
"http://offers.amexnetwork.com/selects/lv|selectsbanner-latvian|Selects"
);
/************************************************************************************
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()*imgArray.length); 	

// var randomnumber=3

$bannerLink=imgArray[randomnumber].split("|")

	    document.write( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n" );

    document.write( "  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0\"\n" );

    document.write( "  id=\"Movie1\" width=\"540\" height=\"210\">\n" );

    document.write( "  <param name=\"movie\" value=\"images/amex-blue-gold-540x210.swf\">\n" );

    document.write( "  <param name=\"menu\" value=\"false\">\n" );

    document.write( "  <param name=\"quality\" value=\"best\">\n" );

    document.write( "  <param name=\"wmode\" value=\"transparent\">\n" );

    document.write( "  <param name=\"bgcolor\" value=\"#CCCCCC\">\n" );

    document.write( "    <embed name=\"Movie1\" src=\"images/amex-blue-gold-540x210.swf\"\n" );

    document.write( "     menu=\"false\" quality=\"best\" wmode=\"transparent\" bgcolor=\"#CCCCCC\" swLiveConnect=\"true\"\n" );

    document.write( "     width=\"540\" height=\"210\"\n" );

    document.write( "     type=\"application/x-shockwave-flash\"\n" );

    document.write( "     pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n" );

    document.write( "</object>\n" );

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)+'">PIESAKIETIES 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>');
  	}

}
else 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>');
  	}

}
else if(banner==2){
  if(whichLink==1)
  	{
  	document.write('<a href="http://www2.americanexpress.lv/lv/private/blue/apply/" class="bannerlink'+(whichLink)+'">PIESAKIETIES 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>');
  	}
}
else{
  if(whichLink==1)
  	{
  	document.write('<a href="http://www2.americanexpress.lv/lv/private/blue/apply/" class="bannerlink'+(whichLink)+'">PIESAKIETIES 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>');
  	}
}


}

/************************************************************************************
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;
}

