/************************************************************************************
Nigel Francois
Front-End Interface developer 2007
http://www.intro-net.co.uk
*************************************************************************************/

/************************************************************************************
DETECT BROWSER
*************************************************************************************/
// Check the browser...we're looking for ie/win, but not aol
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.0') != -1) ? true : false;
var isIE7         =         (document.getElementById && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('MSIE 7.0') != -1) ? true : false;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
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.toLowerCase().indexOf('win')!=-1) ? true : false;
var isMac=(navigator.userAgent.toLowerCase().indexOf('mac')!=-1) ? true : false;

var thisbrowser = 'unknown';

//FireFox PC AND MAC
if (isGecko)
{
        if(isMac)
        {
                document.write('<link rel="stylesheet" href="lib/css/MacGeckostyle.css" type="text/css">');
//                alert('MacGeckostyle.css');
                thisbrowser = "MacGecko";
        }
        else
        {
                document.write('<link rel="stylesheet" href="lib/css/Geckostyle.css" type="text/css">');
//                alert('Geckostyle.css');
                thisbrowser = "PCGecko";
        }
}

//IE 5 WINDOWS
if (isIE)
{
        thisbrowser = "IE";
        if(isIE5 && isWindows)
        {
                document.write('<link rel="stylesheet" href="lib/css/IE5style.css" type="text/css">');
//                alert('IE5style.css');
                thisbrowser = "IE5 Windows";
        }

        //IE 5.5 WINDOWS
        if (isIE55)
        {
                thisbrowser = "IE";
                if(isIE55 && isWindows)
                {
                        document.write('<link rel="stylesheet" href="lib/css/IE55style.css" type="text/css">');
//                        alert('IE55style.css');
                        thisbrowser = "IE55 Windows";
                }
        }

        //IE 6 WINDOWS
        if (isIE6)
        {
                thisbrowser = "IE";
                if(isIE6 && isWindows)
                {
                        document.write('<link rel="stylesheet" href="lib/css/IE6style.css" type="text/css">');
//                        alert('style.css');
                        thisbrowser = "IE6 Windows";
                }
        }
        //MAC IE
                if(isMac)
                {
                        document.write('<link rel="stylesheet" href="lib/css/IEMacstyle.css" type="text/css">');
//                        alert('IEMacstyle.css');
                        thisbrowser = "IE Mac";
                }

}


//MAC SAFARI
if(isSafari)
{
        thisbrowser = "Safari";
        document.write('<link rel="stylesheet" href="lib/css/safari.css" type="text/css">');
//                alert('safari.css');
}

/************************************************************************************
STORE CLINT VARIABLES
*************************************************************************************/
var displayText="";
var randomnumber1=0;
var randomnumber2=0;

/************************************************************************************
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://www.americanexpress-albania.com/Compare_Cards.html|ZEVENDESIM KARTE",
"http://www.americanexpress-albania.com/Gold_Charge_Card.html|KARTA GOLD",
"http://www.americanexpress-albania.com/Green_Charge_Card.html|KARTA AMERICAN EXPRESS",
"http://www.americanexpress-albania.com/Cardmember_Offers.html|PROGRAMI SELECTS"
);
/************************************************************************************
IMAGE BANNER LINKS DATA ARRAY
syntax : URL|IMAGE_URL|IMAGE_ALT_TEXT
The values are separated 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(
"#|img1|BANNER ONE TEXT",
"#|img3|BANNER THREE TEXT",
"#|img4|BANNER FOUR TEXT",
"#|img5|BANNER FIVE TEXT",
"#|img6|BANNER SIX TEXT",
"#|img7|BANNER SEVEN TEXT"
);
/************************************************************************************
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

-- 8 mar 2007 - changed the below to reflect an addition to the text array,
changed imgArray.length to textArray.length -- Jbuckley
*************************************************************************************/
if(imgArray.length > 1)
{
        while(randomnumber1==randomnumber2)
        {
                randomnumber1=Math.floor(Math.random()*textArray.length);         //
                randomnumber2=Math.floor(Math.random()*textArray.length);         //
        }
}

/************************************************************************************
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('<a href="'+($bannerLink[0])+'"><img src="lib/images/banners/'+($bannerLink[1])+'.jpg" width="540" height="210" alt="'+($bannerLink[2])+'" title="'+($bannerLink[2])+'"></a>');
displayText+='<a href="'+($bannerLink[0])+'"><img src="lib/images/banners/'+($bannerLink[1])+'.jpg" width="540" height="210" alt="'+($bannerLink[2])+'" title="'+($bannerLink[2])+'"></a>\n\n';
}
/************************************************************************************
DOCUMENT WRITE TEXT BANNER LINKS
*************************************************************************************/
function doTextLink(whichLink)
{
ie5Adjust="";
if(isIE5) ie5Adjust="style=\"display:block;padding:3px 0px 3px 0px;text-align:center\"";
if(whichLink==2)
        {
        $textLink=textArray[randomnumber1].split("|")
        document.write('<a href="'+($textLink[0])+'" class="bannerlink" '+(ie5Adjust)+'>'+($textLink[1])+'</a><span class="fixAccessLink"> | </span>');
        displayText+='<a href="'+($textLink[0])+'" class="bannerlink">'+($textLink[1])+'</a>\n\n';
        }
if(whichLink==3)
        {
        $textLink=textArray[randomnumber2].split("|")
        document.write('<a href="'+($textLink[0])+'" class="bannerlink" '+(ie5Adjust)+'>'+($textLink[1])+'</a><span class="fixAccessLink"> | </span>');
        displayText+='<a href="'+($textLink[0])+'" class="bannerlink">'+($textLink[1])+'</a>\n\n';
        }
}
