﻿/************************************************************************************
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/|&#1060;&#1080;&#1085;&#1072;&#1085;&#1089;&#1086;&#1074;&#1072;&#1103;&#32;&#1089;&#1074;&#1086;&#1073;&#1086;&#1076;&#1072;",
"http://www2.americanexpress.lv/ru/private/|&#1043;&#1076;&#1077;&#32;&#1084;&#1086;&#1078;&#1085;&#1086;&#32;&#1088;&#1072;&#1089;&#1089;&#1095;&#1080;&#1090;&#1072;&#1090;&#1100;&#1089;&#1103;",
"http://www2.americanexpress.lv/ru/private/gold/|&#1054;&#1092;&#1086;&#1088;&#1084;&#1080;&#32;&#71;&#111;&#108;&#100;",
"http://www2.americanexpress.lv/ru/private/gold/protection/|&#1073;&#1077;&#1079;&#1086;&#1087;&#1072;&#1089;&#1085;&#1086;&#1089;&#1090;&#1100;",
"http://www2.americanexpress.lv/ru/offers/|&#1054;&#1089;&#1086;&#1073;&#1099;&#1077;&#32;&#1087;&#1088;&#1077;&#1076;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1103;"
);

/************************************************************************************
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/ru/offers/akcijas.html|austria_ru|American Express",
"http://www2.americanexpress.lv/ru/offers/akcijas.html|sa_ru|American Express",
"swf|images/AMEX_augusts_540x210_RUS|",
"swf|images/amex_blue_540x210_ru|",
"http://offers.amexnetwork.com/selects/lv?locale=ru-ru|selectsbanner-russian|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); 	
$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-2-ru.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-2-ru.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/ru/private/blue/apply/" class="bannerlink'+(whichLink)+'">&#1054;&#1060;&#1054;&#1056;&#1052;&#1048;&#1058;&#1045; Blue</a>');
		}

	if(whichLink==2)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/gold/freedom/" class="bannerlink'+(whichLink)+'">&#1060;&#1080;&#1085;&#1072;&#1085;&#1089;&#1086;&#1074;&#1072;&#1103; &#1089;&#1074;&#1086;&#1073;&#1086;&#1076;&#1072; </a>');
		}

	if(whichLink==3)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/accept/" class="bannerlink'+(whichLink)+'">&#1043;&#1076;&#1077; &#1084;&#1086;&#1078;&#1085;&#1086; &#1088;&#1072;&#1089;&#1089;&#1095;&#1080;&#1090;&#1072;&#1090;&#1100;&#1089;&#1103; </a>');
		}
}
else if(banner	==1)	{
	if(whichLink==1)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/gold/apply/" class="bannerlink'+(whichLink)+'">&#1054;&#1092;&#1086;&#1088;&#1084;&#1080; Gold</a>');
		}

	if(whichLink==2)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/gold/protection/" class="bannerlink'+(whichLink)+'">&#1042;&#1099;&#1076;&#1072;&#1102;&#1097;&#1072;&#1103;&#1089;&#1103; &#1073;&#1077;&#1079;&#1086;&#1087;&#1072;&#1089;&#1085;&#1086;&#1089;&#1090;&#1100; </a>');
		}

	if(whichLink==3)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/offers/" class="bannerlink'+(whichLink)+'">&#1054;&#1089;&#1086;&#1073;&#1099;&#1077; &#1087;&#1088;&#1077;&#1076;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1103; </a>');
		}

	}
else if(banner==2){
  if(whichLink==1)
  	{
  	document.write('<a href="http://www2.americanexpress.lv/ru/private/blue/apply/" class="bannerlink'+(whichLink)+'">&#1054;&#1060;&#1054;&#1056;&#1052;&#1048;&#1058;&#1045; Blue</a>');
  	}

  if(whichLink==2)
  		{
  		document.write('<a href="http://www2.americanexpress.lv/ru/private/gold/protection/" class="bannerlink'+(whichLink)+'">&#1042;&#1099;&#1076;&#1072;&#1102;&#1097;&#1072;&#1103;&#1089;&#1103; &#1073;&#1077;&#1079;&#1086;&#1087;&#1072;&#1089;&#1085;&#1086;&#1089;&#1090;&#1100;</a>');
  		}

  if(whichLink==3)
  	{
  	document.write('<a href="http://www2.americanexpress.lv/ru/offers/" class="bannerlink'+(whichLink)+'">&#1054;&#1089;&#1086;&#1073;&#1099;&#1077; &#1087;&#1088;&#1077;&#1076;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1103;</a>');
  	}
}
else{
	if(whichLink==1)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/blue/apply/" class="bannerlink'+(whichLink)+'">&#1054;&#1060;&#1054;&#1056;&#1052;&#1048;&#1058;&#1045; Blue</a>');
		}

	if(whichLink==2)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/gold/freedom/" class="bannerlink'+(whichLink)+'">&#1060;&#1080;&#1085;&#1072;&#1085;&#1089;&#1086;&#1074;&#1072;&#1103; &#1089;&#1074;&#1086;&#1073;&#1086;&#1076;&#1072; </a>');
		}

	if(whichLink==3)
		{
		document.write('<a href="http://www2.americanexpress.lv/ru/private/accept/" class="bannerlink'+(whichLink)+'">&#1043;&#1076;&#1077; &#1084;&#1086;&#1078;&#1085;&#1086; &#1088;&#1072;&#1089;&#1089;&#1095;&#1080;&#1090;&#1072;&#1090;&#1100;&#1089;&#1103; </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;
}

