var divid;
var flag = 0;
// JavaScript Document
//******************************************//
// Start of Adaptive CSS related Javascript //
//******************************************//
function checkRes(func) {
    var initRes = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (initRes) {
                initRes();
            }
            func();
        }
    }
}

/****** Browser Check for IE/Netscape/Others ******/
function chkBrowserWidth() {
    if (document.body) {
        return document.body.clientWidth;
    } else if (document.documentElement && document.documentElement.clientWidth != 0) {
        return document.documentElement.clientWidth;
    } else if (window.innerWidth) {
        return window.innerWidth;
    }
    return 0;
}

checkRes(newRes);
checkRes(equalColumns);
/* to equalize the the column height in eBP 1.5 */
window.onresize = newRes;

function newRes() {
    var fmt = chkBrowserWidth();
    var css = (fmt > 0 && fmt <= 980) ? 'aig800': (fmt > 980 && fmt <= 3000) ? 'aig1024': '';
    document.getElementById("body_wrapper").className = css;
}

function homeLink(p_url) {
    eraseCookie('tabSelect');
    location.href = p_url;
    return false;
}

// End of Adaptive CSS related Javascript //

//**************************************************//
// Start of Show Tab / List View Related Javascript //
//**************************************************//
var gblPrevLi = "";
/* Global variable defined for the Product Details tab view, which carried selected tab object */

function showDtls(obj) {
    /* Function to Show the details on mouse trigger */
    var parentClass = document.getElementById('divTab').className;
    var objLi = document.getElementById(obj);
    if (parentClass == "tabView") {
        hideDtls();
        /* Hides details of the previously selected tab */
        			
		if(obj=="tabLast")
		{
	        document.getElementById("tabLDtls").style.display = "block";
		}
		else
		{
			document.getElementById(obj+"Dtls").style.display = "block";

		}
        if (objLi.className == "tabLast") {
            /* Checks for the special tab */
            objLi.className = "tabLastOn";
        } else {
            objLi.className = "tabOn";
        }
        gblPrevLi = objLi;
    } else {
    	var hrefVal =  "#" + objLi.id+"Dtls";          
        if(objLi.id == "tabLast"){
        	hrefVal = "#tabLDtls";
            }
        location.href = hrefVal;	
    }
}
function hideDtls() {
    /* Hides details of the previously selected tab */
    if (gblPrevLi && gblPrevLi != "") {
 		var preLiId = gblPrevLi.id+"Dtls";
 		if(gblPrevLi.className == "tabLastOn"){
 			preLiId = "tabLDtls";
 			}
        document.getElementById(preLiId).style.display = "none";
        if (gblPrevLi.className == "tabLastOn") {
            gblPrevLi.className = "tabLast";
        } else {
            gblPrevLi.className = "tab";
        }
    }
}

/* For changing TabView to ListView.*/
function tabs(mode, theClass, obj, listTab, listView) {
    if (mode == "listView") {
        document.getElementById('divTab').className = "listView";
        obj.parentNode.innerHTML = '<a href="javascript:void(0)" onclick="tabs(\'tabView\', \'tabDataContainer\',this,\'' + listTab + '\',\'' + listView + '\')">' + listTab + '</a> | ' + listView;
        showHideAllDtls(theClass, 'block');
    }
    if (mode == "tabView") {
        document.getElementById('divTab').className = "tabView";
        obj.parentNode.innerHTML = listTab + ' | <a href="javascript:void(0)" onclick="tabs(\'listView\', \'tabDataContainer\', this,\'' + listTab + '\',\'' + listView + '\')">' + listView + '</a>';
        showHideAllDtls(theClass, 'none');
        setTab();
        /* To Show the Tab One Active*/
    }
}

    
						
// This Function Describes the pages with deafault list View 	
function listItems() {
    document.getElementById('divTab').className = "listView";
    var obj1 = document.getElementById('jumpLink');
    obj1.style.display = 'none';
}

/* To Show all the Detail DIV in List View*/
function showHideAllDtls(theClass, mode) {
    var allPageTags = document.getElementsByTagName("div");
    for (i = 0; i < allPageTags.length; i++) {
        if (allPageTags[i].className == theClass) {
            allPageTags[i].style.display = mode;
        }
    }
}

/* For Country Page - Start of code for tab structure*/
var gblPrevLi1 = "";
/* Global variable defined for the Product Details tab view, which carried selected tab object */

function showDtls1(obj) {
    /* Function to Show the details on mouse trigger */
    var parentClass = document.getElementById('divTab1').className;
    var objLi = document.getElementById(obj);

    if (parentClass == "tabView1") {
        hideDtls1();
        /* Hides details of the previously selected tab */
        document.getElementById(objLi.title).style.display = "block";
        if (objLi.className == "tabLast1") {
            /* Checks for the special tab */
            objLi.className = "tabLastOn1";
        } else {
            objLi.className = "tabOn1";
        }
        gblPrevLi1 = objLi;
    } else {
        location.href = "#" + objLi.title;
    }
}

function hideDtls1() {
    /* Hides details of the previously selected tab */
    if (gblPrevLi1 && gblPrevLi1 != "") {
        document.getElementById(gblPrevLi1.title).style.display = "none";
        if (gblPrevLi1.className == "tabLastOn1") {
            gblPrevLi1.className = "tabLast1";
        } else {
            gblPrevLi1.className = "tab1";
        }
    }
}
/* For Country Page - End of code for tab structure*/

// End of Show Tab / List View Related Javascript //
//*************************************************//
// Start of Flyout Menu section Related Javascript //
//*************************************************//
var hideDivTimer = null;
var browserName = navigator.appName;

// Generalised Function to show a layer
function showSection(x) {
    var bcID = 'section' + x;
    document.getElementById(bcID).style.display = 'block';
    if (document.getElementById('DivShim')) DivSetVisible(true, document.getElementById(bcID));
}

// Generalised Function to hide a layer	
function hideSection(x) {
    var bcID = 'section' + x;
    document.getElementById(bcID).style.display = 'none';
    if (document.getElementById('DivShim')) document.getElementById('DivShim').style.display = "none"
}

// this function determines whether the event is the equivalent of the microsoft
// mouseleave or mouseenter events.
function isMouseLeaveOrEnter(e, handler) {
    if (e.type != 'mouseout' && e.type != 'mouseover') return false;
    var reltg = e.relatedTarget ? e.relatedTarget: e.type == 'mouseout' ? e.toElement: e.fromElement;
    while (reltg && reltg != handler) reltg = reltg.parentNode;
    return (reltg != handler);
}

function createIframe() {
    var ifrm = document.createElement("IFRAME");
    ifrm.setAttribute("ID", "DivShim");
    document.body.appendChild(ifrm);
}
//This function select the tab to show the Flyout
function globalTbMenu(val) {
    clearTimeout(hideDivTimer);
    var objLi = document.getElementById('li' + val);
    if (objLi.className != "tabOn") {
        objLi.className = "tabOnLink";
    }
    objDiv = document.getElementsByTagName('div');
    objDivLen = objDiv.length;
    for (x = 0; x < objDivLen; x++) {
        if ((String(objDiv[x].id)).substring(0, 10) == "flyoutMenu") {
            if ((String(objDiv[x].id)).substring(0, 10) != "flyoutMenu" + val) {
                objDiv[x].style.display = 'none';
            }
        }
    }
    if (document.getElementById('flyoutMenu' + val).style.display != 'block') {
        document.getElementById('flyoutMenu' + val).style.display = 'block';
        if (document.getElementById('DivShim')) {
            if (document.getElementById('sectionCompany')) {
                document.getElementById('sectionCompany').style.display = "none";
            }
            DivSetVisible(true, document.getElementById('flyoutMenu' + val));
        }

    } else {
        document.getElementById('flyoutMenu' + val).style.display = 'none';
    }
    searchCountry(); //Check the availability of dropdown box
}

//This function change the class name of the tab	
function hideGlbTabMenu(listclass) {

    var objLi = document.getElementById('li' + listclass);
    if (objLi.className != "tabOn") {
        objLi.className = "none";
    }
    searchCountryA();
    hideDivTimer = setTimeout("removeAll()", 200);
    if (document.getElementById('DivShim')) {
        document.getElementById('DivShim').style.display = "none";
    }
}

//This function hides all the flyout tabs	
function removeAll() {
    objDiv = document.getElementsByTagName('div');
    objDivLen = objDiv.length;
    for (x = 0; x < objDivLen; x++) {
        if ((String(objDiv[x].id)).substring(0, 10) == "flyoutMenu") {
            objDiv[x].style.display = 'none';
        }
    }
}

//This function overlaps select box with the menu
function DivSetVisible(state, DivRef) {
    var IfrRef = document.getElementById('DivShim');
    if (state) {
        DivRef.style.display = "block";
        DivRef.style.zIndex = 100;
        IfrRef.style.width = DivRef.offsetWidth;
        IfrRef.style.height = DivRef.offsetHeight;
        IfrRef.style.top = DivRef.offsetTop;
        IfrRef.style.left = DivRef.offsetLeft;
        IfrRef.style.zIndex = DivRef.style.zIndex - 1;
        IfrRef.style.display = "block";
    }
}

maxOpacity = 100;
/* Fade menu effect starts */
function fadeMenu(divId) {
    if (fadeType == 1)
    /*fade in */
    {
        if (document.all) {
            document.getElementById(divId).style.filter = 'alpha(opacity=' + variableOpacity + ')';
            /*sets opacity for IE */
        } else {
            document.getElementById(divId).style.MozOpacity = variableOpacity / 101;
            /*sets opacity for Mozilla */
        }
        variableOpacity = variableOpacity + 10;
        /*increments 'variableOpacity' by 10 milliseconds */
        if ((maxOpacity - variableOpacity) < 0)
        /* sets 'variableOpacity' equal to 100 when 'variableOpacity' exceeds 100 */
        {
            variableOpacity = maxOpacity;
            return;
        }
        setTimeout('fadeMenu(flyid)', 20);
        /* executes function fadeMenu after 20 milliseconds */
    }

    else if (fadeType == 2)
    /*fade out */
    {
        if (document.all) {
            document.getElementById(divId).style.filter = 'alpha(opacity=' + variableOpacity + ')';
            /*sets opacity for IE */
        } else {
            document.getElementById(divId).style.MozOpacity = variableOpacity / 101;
            /*sets opacity for Mozilla */
        }
        variableOpacity = variableOpacity - 10;
        /* decreases 'variableOpacity' by 10 milliseconds */
        if (variableOpacity < 0) {
            variableOpacity = 0;
            return;
        }
        setTimeout('fadeMenu(flyid)', 20);
        /* executes function fadeMenu after 20 milliseconds */
    }
}

/* Fade menu effect end */

//Check the availability of the dropdown box
function searchCountry() {
    if (browserName == "Microsoft Internet Explorer") {
        if (document.getElementById('searchCountry')) {
            document.getElementById('searchCountry').style.visibility = 'hidden'
        }
    }
}

//Shows the dropdown box if the select country box is available
function searchCountryA() {
    if (browserName == "Microsoft Internet Explorer") {
        if (document.getElementById('searchCountry')) {
            document.getElementById('searchCountry').style.visibility = 'visible';
        }
    }
}

// End of Flyout Menu section Related Javascript //	
// Start of Contect Form Related Javascript //	
function validate() {
    var a = document.contact.email.value;
    var b = document.contact.telNum.value;
    var c = document.contact.comments.value;

    if (echeck(a) && isInteger(b) && c != '') return true;
    else {
        if (!echeck(a) || a == '') {
            document.getElementById('em1').style.display = 'block';
        } else document.getElementById('em1').style.display = 'none';
        if (!isInteger(b) || b == '') {
            document.getElementById('em2').style.display = 'block';
        } else document.getElementById('em2').style.display = 'none';
        if (c == '') {
            document.getElementById('em3').style.display = 'block';
        } else document.getElementById('em3').style.display = 'none';
        return false;
    }
}

function isInteger(s) {
    var i;
    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}

function echeck(str) {
    var at = "@";
    var dot = ".";
    var lat = str.indexOf(at);
    var lstr = str.length;
    var ldot = str.indexOf(dot);
    if (str.indexOf(at) == -1) {
        return false;
    }
    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
        return false;
    }
    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
        return false;
    }
    if (str.indexOf(at, (lat + 1)) != -1) {
        return false;
    }
    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
        return false;
    }
    if (str.indexOf(dot, (lat + 2)) == -1) {
        return false;
    }
    if (str.indexOf(" ") != -1) {
        return false;
    }
    return true;
}
// End of Contect Form Related Javascript //		
/* Cookie function starts */
// JavaScript Document
function writeCookie(name, value, hours, path) {
    var expire = "";
    var pathUrl = "";
    if (hours != null) {
        expire = new Date((new Date()).getTime() + hours * 3600000);
        expire = "; expires=" + expire.toGMTString();
    }
    if (path != null) {
        pathUrl = "; path=" + path;
    } else {
        pathUrl = "; path=/";
    }
    document.cookie = name + "=" + escape(value) + expire + pathUrl;
}

function readCookie(name) {
    var cookieValue = "";
    var search = name + "=";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
            cookieValue = unescape(document.cookie.substring(offset, end));
        }
    }
    return cookieValue;
}

function eraseCookie(name) {
    writeCookie(name, "", -1);
}

/* functionality to set the cookies */
function showFlySel() {
    a = readCookie('tabSelect');
    if (a) {
        showFly(a);
        if (typeof showTab == "function") {
            showTab(a);
        }
    }
}

/* Function to hightlight the tab based on the cookie */
function showFly(val) {
    objLi = document.getElementsByTagName('li');
    objLiLen = objLi.length;
    for (i = 0; i < objLiLen; i++) {
        if ((String(objLi[i].id)).substring(0, 2) == "li") objLi[i].className = "none";
    }
    document.getElementById("li" + val).className = "tabOn";
}

/* Function to resset cookie for country page  starts*/
function resetCookieAndRedirect(p_name, p_value, p_hours, p_url) {
    writeCookie(p_name, p_value, p_hours);
    location.href = p_url;
    return false;
}
/* Function to resset cookie for country page  endss*/
/* Cookies function end */

/* Additional EBP 1.0 functions starts */
function removedrop() {
    document.getElementById('drop1').innerHTML = "<img src='images/aig_pixel.gif' alt='' width='1' height='28' border='0'></a>";
}
function putdrop() {
    document.getElementById('drop1').innerHTML = "<table width='200' border='0' cellspacing='0' cellpadding='0'><tr><td><select name='select' class='fld'><option>Select one</option></select></td><td><input name='Button' type='image' src='images/go_btn.jpg' class='Btn' value='Go'></td></tr></table>";
    document.getElementById('motioncontainer').style.display = 'block';
    document.getElementById('motiongallery').style.display = 'block';
    document.getElementById('trueContainer').style.display = 'block';
}

// JavaScript Document
//Contents for menu 1
var menu1 = new Array();
menu1[0] = '<a href="#">Menu1 Sublink One</a>';
menu1[1] = '<a href="#">Menu1 Sublink Two</a>';
menu1[2] = '<a href="#">Menu1 Sublink Three</a>';
menu1[3] = '<a href="#">Menu1 Sublink Four</a>';
menu1[4] = '<a href="#">Menu1 Sublink Five</a>';
menu1[5] = '<a href="#">Menu1 Sublink Six</a>';

//Contents for menu 2, and so on
var menu2 = new Array();
menu2[0] = '<a href="#">Menu2 Sublink One</a>';
menu2[1] = '<a href="#">Menu2 Sublink Two</a>';
menu2[2] = '<a href="#">Menu2 Sublink Three</a>';

var disappeardelay = 250; //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset = 5; //horizontal offset of menu from default location. (0-5 is a good value)
/////No further editting needed
var ie4 = document.all;
var ns6 = document.getElementById && !document.all;

if (ie4 || ns6) document.write('<div id="dropMenuDivAIG" style="visibility:hidden;width: 180px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>');

function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left") ? what.offsetLeft: what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft: totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}
function showhide(obj, e, visible, hidden, menuwidth) {
    if (ie4 || ns6) dropmenuobj.style.left = dropmenuobj.style.top = -500;
    dropmenuobj.widthobj = dropmenuobj.style;
    dropmenuobj.widthobj.width = menuwidth;
    if (e.type == "click" && obj.visibility == hidden || e.type == "mouseover") obj.visibility = visible;
    else if (e.type == "click") obj.visibility = hidden;
}

function iecompattest() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement: document.body;
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="leftedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
		edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
		}
	else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
		edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
		if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
		edgeoffset=dropmenuobj.y
		}
	}
	return edgeoffset
}


function populatemenu(what) {
    if (ie4 || ns6) dropmenuobj.innerHTML = what.join("");
}

function dropdownmenu(obj, e, menucontents, menuwidth) {
    if (window.event) event.cancelBubble = true;
    else if (e.stopPropagation) e.stopPropagation();
    clearhidemenu();
    dropmenuobj = document.getElementById ? document.getElementById("dropMenuDivAIG") : dropMenuDivAIG;
    populatemenu(menucontents);
    if (ie4 || ns6) {
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth);
        dropmenuobj.x = getposOffset(obj, "left");
        dropmenuobj.y = getposOffset(obj, "top");
        dropmenuobj.style.left = dropmenuobj.x - clearbrowseredge(obj, "leftedge") + "px";
        dropmenuobj.style.top = dropmenuobj.y - clearbrowseredge(obj, "bottomedge") + 35 + "px";
    }
    return clickreturnvalue();
}

function clickreturnvalue() {

    if (ie4 || ns6) return false;
    else return true;
}

function contains_ns6(a, b) {
    while (b.parentNode) if ((b = b.parentNode) == a) return true;
    return false;
}

function dynamichide(e) {
    if (ie4 && !dropmenuobj.contains(e.toElement)) delayhidemenu();
    else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) delayhidemenu();
}

function hidemenu(e) {
    if (typeof dropmenuobj != "undefined") {
        if (ie4 || ns6) dropmenuobj.style.visibility = "hidden";
    }
}

function delayhidemenu() {
    if (ie4 || ns6) delayhide = setTimeout("hidemenu()", disappeardelay);
}

function clearhidemenu() {
    if (typeof delayhide != "undefined") clearTimeout(delayhide);
}

/* Additional EBP 1.0 functions ends */

/* Addition EBP 1.5 functions stats */
/********************************************************/
/****** Function to equalize the the column height ******/
/********************************************************/

function equalColumns() {
    var c = document.getElementById('gridCenter');
    var r = document.getElementById('gridRight');
    var l = document.getElementById('gridLeft');
    var cenb = document.getElementById('pageBanner');
    var x = navigator;
    var z = x.appName;
    if (l) {
        /* Checks for availability of left grid */
        var browser = navigator.appName;

        if ((browser == "Netscape")) {
            /* if its otherthan Explorer */
            l.style.height = "auto !important";
            /* Very important => so that the extended menu pushes the left grid */

            /* Check the center height and changes the left section accordingly */
            c.offsetHeight >= l.offsetHeight ? l.style.minHeight = c.offsetHeight + "px": c.style.height = l.offsetHeight + "px";
        } else {
            c.offsetHeight >= l.offsetHeight ? l.style.height = c.offsetHeight + "px": c.style.height = l.offsetHeight + "px";
        }
    }
    if (r) {
        /* Check the center height and changes the right section accordingly */
        c.offsetHeight >= r.offsetHeight ? r.style.height = c.offsetHeight + "px": c.style.height = r.offsetHeight + "px";
    }

    if (cenb) {
        /* This condition overwrites the above the script if the page banner is available */
        var z = parseInt(c.offsetHeight + cenb.offsetHeight);
        /* Adding the page banner height with the center section */
        if (l) {
            var browser = navigator.appName;
            if ((browser == "Netscape")) {
                l.style.height = "auto !important";
                z >= l.offsetHeight ? l.style.minHeight = parseInt(c.offsetHeight + cenb.offsetHeight) + "px": c.style.height = parseInt(l.offsetHeight - cenb.offsetHeight) + "px";
            } else {
                z >= l.offsetHeight ? l.style.height = parseInt(c.offsetHeight + cenb.offsetHeight) + "px": c.style.height = parseInt(l.offsetHeight - cenb.offsetHeight) + "px";
            }
        }
        if (r) {
            z >= r.offsetHeight ? r.style.height = c.offsetHeight + "px": c.style.height = r.offsetHeight + "px";
        }
    }
}

/********************************************************/
/* Addition EBP 1.5 functions ends */

/* Addition EBP 2.0 functions stats */

/********************************************************/
/****** Function to equalize the the column height ******/
/********************************************************/

var highlightInnertab = true;
function setTabIndex(name, value, hours) {
    if (highlightInnertab) writeCookie(name, value, hours);
}

function clearTabIndex(name) {
    if (highlightInnertab) eraseCookie(name);
}

if (typeof aigfc == "undefined") {
    var aigfc = new Object();
}
if (typeof aigfc.util == "undefined") {
    aigfc.util = new Object();
}
if (typeof aigfc.AIGFobjUtil == "undefined") {
    aigfc.AIGFobjUtil = new Object();
}
aigfc.AIGFlash = function(_1, id, w, h, _5, c, _7, _8, _9, _a) {
    if (!document.getElementById) {
        return;
    }
    this.DETECT_KEY = _a ? _a: "detectflash";
    this.skipDetect = aigfc.util.getRequestParameter(this.DETECT_KEY);
    this.params = new Object();
    this.variables = new Object();
    this.attributes = new Array();
    if (_1) {
        this.setAttribute("swf", _1);
    }
    if (id) {
        this.setAttribute("id", id);
    }
    if (w) {
        this.setAttribute("width", w);
    }
    if (h) {
        this.setAttribute("height", h);
    }
    if (_5) {
        this.setAttribute("version", new aigfc.PlayerVersion(_5.toString().split(".")));
    }
    this.installedVer = aigfc.AIGFobjUtil.getPlayerVersion();
    if (!window.opera && document.all && this.installedVer.major > 7) {
        aigfc.AIGFlash.doPrepUnload = true;
    }
    if (c) {
        this.addParam("bgcolor", c);
    }
    var q = _7 ? _7: "high";
    this.addParam("quality", q);
    this.setAttribute("useExpressInstall", false);
    this.setAttribute("doExpressInstall", false);
    var _c = (_8) ? _8: window.location;
    this.setAttribute("xiRedirectUrl", _c);
    this.setAttribute("redirectUrl", "");
    if (_9) {
        this.setAttribute("redirectUrl", _9);
    }
};
aigfc.AIGFlash.prototype = {
    useExpressInstall: function(_d) {
        this.xiSWFPath = !_d ? "expressinstall.swf": _d;
        this.setAttribute("useExpressInstall", true);
    },
    setAttribute: function(_e, _f) {
        this.attributes[_e] = _f;
    },
    getAttribute: function(_10) {
        return this.attributes[_10];
    },
    addParam: function(_11, _12) {
        this.params[_11] = _12;
    },
    getParams: function() {
        return this.params;
    },
    addVariable: function(_13, _14) {
        this.variables[_13] = _14;
    },
    getVariable: function(_15) {
        return this.variables[_15];
    },
    getVariables: function() {
        return this.variables;
    },
    getVariablePairs: function() {
        var _16 = new Array();
        var key;
        var _18 = this.getVariables();
        for (key in _18) {
            _16[_16.length] = key + "=" + _18[key];
        }
        return _16;
    },
    getSWFHTML: function() {
        var _19 = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "PlugIn");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\"";
            _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" ";
            var _1a = this.getParams();
            for (var key in _1a) {
                _19 += [key] + "=\"" + _1a[key] + "\" ";
            }
            var _1c = this.getVariablePairs().join("&");
            if (_1c.length > 0) {
                _19 += "flashvars=\"" + _1c + "\"";
            }
            _19 += "/>";
        } else {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "ActiveX");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">";
            _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />";
            var _1d = this.getParams();
            for (var key in _1d) {
                _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />";
            }
            var _1f = this.getVariablePairs().join("&");
            if (_1f.length > 0) {
                _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />";
            }
            _19 += "</object>";
        }
        return _19;
    },
    write: function(_20) {
        if (this.getAttribute("useExpressInstall")) {
            var _21 = new aigfc.PlayerVersion([6, 0, 65]);
            if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {
                this.setAttribute("doExpressInstall", true);
                this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                this.addVariable("MMdoctitle", document.title);
            }
        }
        if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {
            var n = (typeof _20 == "string") ? document.getElementById(_20) : _20;
            n.innerHTML = this.getSWFHTML();
            return true;
        } else {
            if (this.getAttribute("redirectUrl") != "") {
                document.location.replace(this.getAttribute("redirectUrl"));
            }
        }
        return false;
    }
};
aigfc.AIGFobjUtil.getPlayerVersion = function() {
    var _23 = new aigfc.PlayerVersion([0, 0, 0]);
    if (navigator.plugins && navigator.mimeTypes.length) {
        var x = navigator.plugins["Shockwave Flash"];
        if (x && x.description) {
            _23 = new aigfc.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
        }
    } else {
        if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
            var axo = 1;
            var _26 = 3;
            while (axo) {
                try {
                    _26++;
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);
                    _23 = new aigfc.PlayerVersion([_26, 0, 0]);
                } catch(e) {
                    axo = null;
                }
            }
        } else {
            try {
                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
            } catch(e) {
                try {
                    var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                    _23 = new aigfc.PlayerVersion([6, 0, 21]);
                    axo.AllowScriptAccess = "always";
                } catch(e) {
                    if (_23.major == 6) {
                        return _23;
                    }
                }
                try {
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                } catch(e) {}
            }
            if (axo != null) {
                _23 = new aigfc.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
            }
        }
    }
    return _23;
};
aigfc.PlayerVersion = function(_29) {
    this.major = _29[0] != null ? parseInt(_29[0]) : 0;
    this.minor = _29[1] != null ? parseInt(_29[1]) : 0;
    this.rev = _29[2] != null ? parseInt(_29[2]) : 0;
};
aigfc.PlayerVersion.prototype.versionIsValid = function(fv) {
    if (this.major < fv.major) {
        return false;
    }
    if (this.major > fv.major) {
        return true;
    }
    if (this.minor < fv.minor) {
        return false;
    }
    if (this.minor > fv.minor) {
        return true;
    }
    if (this.rev < fv.rev) {
        return false;
    }
    return true;
};
aigfc.util = {
    getRequestParameter: function(_2b) {
        var q = document.location.search || document.location.hash;
        if (_2b == null) {
            return q;
        }
        if (q) {
            var _2d = q.substring(1).split("&");
            for (var i = 0; i < _2d.length; i++) {
                if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) {
                    return _2d[i].substring((_2d[i].indexOf("=") + 1));
                }
            }
        }
        return "";
    }
};
aigfc.AIGFobjUtil.cleanupSWFs = function() {
    var _2f = document.getElementsByTagName("OBJECT");
    for (var i = _2f.length - 1; i >= 0; i--) {
        _2f[i].style.display = "none";
        for (var x in _2f[i]) {
            if (typeof _2f[i][x] == "function") {
                _2f[i][x] = function() {};
            }
        }
    }
};
if (aigfc.AIGFlash.doPrepUnload) {
    if (!aigfc.unloadSet) {
        aigfc.AIGFobjUtil.prepUnload = function() {
            __flash_unloadHandler = function() {};
            __flash_savedUnloadHandler = function() {};
            window.attachEvent("onunload", aigfc.AIGFobjUtil.cleanupSWFs);
        };
        window.attachEvent("onbeforeunload", aigfc.AIGFobjUtil.prepUnload);
        aigfc.unloadSet = true;
    }
}
if (!document.getElementById && document.all) {
    document.getElementById = function(id) {
        return document.all[id];
    };
}
var getQueryParamValue = aigfc.util.getRequestParameter;
var FlashObject = aigfc.AIGFlash;
var AIGFlash = aigfc.AIGFlash;


/********************************************************/
/****** Function for Country Map ******/
/********************************************************/

function over(x, y) {
    if (y == 0) {
        var a = document.getElementById('map').src;
        document.getElementById('txtWP').title = a;
    }
    if (x == 0 && y == 1) {
        document.getElementById('map').src = document.getElementById('txtWP').title;
    }
    if (x == 1) document.getElementById('map').src = 'images/wm_rt_america.gif';
    if (x == 2) document.getElementById('map').src = 'images/wm_rt_europe.gif';
    if (x == 3) document.getElementById('map').src = 'images/wm_rt_a_pacific.gif';
    if (x == 4) document.getElementById('map').src = 'images/wm_rt_m_east.gif';
    if (x == 5) document.getElementById('map').src = 'images/wm_rt_africa.gif';
}



/********************************************************/
/*********** Function for Left Menu Triggering **********/
/********************************************************/
function toggle(id) {
    var ul = id;
    var ulElement = document.getElementById(ul);
    if (ulElement) {
        if (ulElement.className == "closed") {
            ulElement.className = "open";
        } else {
            ulElement.className = "closed";
        }
    }
}
/********************************************************/
/* Addition EBP 2.0 functions ends */


/********************************************************/
/*********** Script for Printpage **********/
/********************************************************/
function backFunc() {
    var backUrl = document.location.href;
    if (backUrl.lastIndexOf("#") > -1) {
        backUrl = backUrl.substring(0, backUrl.lastIndexOf("#"));
    }
    window.self.location = backUrl;
}


/********************************************************/
/*********** Script for Email/share popup **********/
/********************************************************/

function popup(pageURL, page_id, pub_id) {
    window.open(pageURL + '?email_pub_id=' + pub_id + '&email_page_id=' + page_id, 'mywindow' + pub_id + page_id, 'width=500,height=500,left=150,top=150,screenX=150,screenY=150,scrollbars=1');
}


/********************************************************/
/*********** Script for Home page bottom tab **********/
/********************************************************/

// JavaScript Document
function selTab(currIndex, tabLen, tabPrefix) {
    for (i = 1; i <= tabLen; i++) {
        document.getElementById(tabPrefix + i).className = "inactive";
    }
    document.getElementById(tabPrefix+currIndex).className = "active";
	document.getElementById(tabPrefix+"btm" + currIndex).style.display = "block";
	
	
    for (i = 1; i <= tabLen; i++) {
        document.getElementById(tabPrefix+"btm" + i).className=document.getElementById(tabPrefix+"btm" + i).className.replace("tabDispOn", "tabDispOff");
		
		if(document.getElementById(tabPrefix+"btm" + i).className = "tabDispOff"){
			document.getElementById(tabPrefix+"btm" + i).style.display = "none";
		}		
		
    }
	
	document.getElementById(tabPrefix+"btm" + currIndex).className=document.getElementById(tabPrefix+"btm" + currIndex).className.replace("tabDispOff", "tabDispOn");
	
	if(document.getElementById(tabPrefix+"btm" + currIndex).className = "tabDispOn"){
		document.getElementById(tabPrefix+"btm" + currIndex).style.display = "block";
	}
}


/* ////// End - Script for Home page bottom tab /////// */


/********************************************************/
/*********** Script for Top-top navigation **********/
/********************************************************/

function closeDiv(id,currInd){
	document.getElementById(id).style.display="none";
	document.getElementById(currInd).className = "none"
}

function startList() {
	//START ==> script added to show the top menu when JS is disabled
	var getID = document.getElementById('topMenu_nonjs');	
	getID.removeAttribute('id');	
	var newAttribute = document.createAttribute("id");
	newAttribute.nodeValue = "topMenu";
	getID.setAttributeNode(newAttribute);
	//END ==> script added to show the top menu when JS is disabled
	
  	if (document.all&&document.getElementById) {
  		navRoot = document.getElementById("navList");
  		for (i=0; i<navRoot.childNodes.length; i++) {
  			node = navRoot.childNodes[i];
  			if (node.nodeName=="LI") {
  				node.onmouseover=function() {
  					this.className+=" hover";
  				}
  				node.onmouseout=function() {
  					this.className=this.className.replace(" hover", "");
  				}
  			}
  		}
  	}
  }


/********************************************************/
/*********** START Script for Font Resize **********/
/********************************************************/
var divs=document.getElementsByTagName('body');
var currURL =  window.location+''; 
var pageName = currURL.substring((currURL.lastIndexOf('/')+1),currURL.length); 
var siteID = pageName.substring((pageName.indexOf('_')+1),pageName.lastIndexOf('_'));
var cookieName = siteID+'textSize';

$(document).ready(function() {
   checkFontSize();   
 });

function fontSize(obj,chk){
	for(i=1; i<4; i++)
		{
			document.getElementById('link'+i).href='#';
		}
	divs[0].className = obj.className; obj.removeAttribute('href');	$("#textResizer a").removeClass('active');
	if(chk=='Y')writeCookie(cookieName, obj.className, 72, '');
	obj.className=obj.className+ " active";
}

function checkFontSize() {
	var fontCookie = readCookie(cookieName);	
	var linkAttr = $("#textResizer a").attr("onclick")+'';	
	if(fontCookie && linkAttr.indexOf('Y')!= -1)
	{
		divs[0].className = fontCookie;
	}
}

/********************************************************/
/*********** END Script for Font Resize **********/
/********************************************************/


/*URL Encoding Functionality Starts Here*/
var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
var reserved = "!*'();:@&=+$,/?%#[]";
var allowed = unreserved + reserved;
var hexchars = "0123456789ABCDEFabcdef";


function gethex(decimal) {
  return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
  }

function encode(decodedString) {
    if(decodedString == null || decodedString == ''){
        return "";
    }
    var encodeValue  = "";
    var decoded = decodedString;
    var encoded = "";

    for (var i = 0; i < decoded.length; i++ ) {
      var ch = decoded.charAt(i);
      // Check if character is an unreserved character:
      if (unreserved.indexOf(ch) != -1) {
        encoded = encoded + ch;
      } else {

               var charcode = decoded.charCodeAt(i);
        // Position 0 - 127 is equal to percent-encoding with an ASCII character encoding:
        if (charcode < 128) {
          encoded = encoded + gethex(charcode);
        }

        // Position 128 - 2047: two bytes for UTF-8 character encoding.
        if (charcode > 127 && charcode < 2048) {
          // First UTF byte: Mask the first five bits of charcode with binary 110X.XXXX:
          encoded = encoded + gethex((charcode >> 6) | 0xC0);
          // Second UTF byte: Get last six bits of charcode and mask them with binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 2048 - 65535: three bytes for UTF-8 character encoding.
        if (charcode > 2047 && charcode < 65536) {
          // First UTF byte: Mask the first four bits of charcode with binary 1110.XXXX:
          encoded = encoded + gethex((charcode >> 12) | 0xE0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 65536 - : four bytes for UTF-8 character encoding.
        if (charcode > 65535) {
          // First UTF byte: Mask the first three bits of charcode with binary 1111.0XXX:
          encoded = encoded + gethex((charcode >> 18) | 0xF0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 12) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Fourth UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

      }

    }  // end of for ...

    // Write result:
    return encoded;
}
/*URL Encoding ends here*/
/* Printer friendly functionality starts here*/
    function printPreview(){
        document.hiddenPrintForm.action = document.location.href;
        document.hiddenPrintForm.submit();     
    }
/* Printer friendly functionality ends here*/


/*Building the pdf page url starts here*/
/* updated hbxPageName with  hbxPdfTitleSuffix */

function pdfPreview(hbxPdfTitlePrefix, varIsHbxEnabled, pdfServiceUrl, htmlUrl, hbxPdfTitleSuffix){
        var fileName = getPDFFileName(htmlUrl);
        var actionUrl = pdfServiceUrl + "/" + fileName;
        if( varIsHbxEnabled == 'true'){
            if(hbxPdfTitlePrefix == 'null' || hbxPdfTitlePrefix == ""){
                hbxPdfTitlePrefix = "PDF";   
             }
              var hbxPageName = hbxPdfTitlePrefix +' '+ document.title + hbxPdfTitleSuffix;
             _hbPageView(hbxPageName, "");
        }
        document.hiddenPdfForm.action = actionUrl;
        document.hiddenPdfForm.submit();
}

function getPDFFileName(htmlURL) {
       var pdfFileName = "";
       lastSlashIndex = htmlURL.lastIndexOf("/");
       if(lastSlashIndex != -1) {
             htmlFileName = htmlURL.substr(lastSlashIndex+1);
              if(htmlFileName.split(".").length == 2) {
                     pdfFileName = htmlFileName.split(".")[0] + ".pdf";
              }
       }
       return pdfFileName;
 }

function setTab() {
	//	var queryString = window.location.href;
	var tabVal = window.location.hash;
    	tabVal = tabVal != null && tabVal != ""?tabVal.substring(1,tabVal.indexOf("Dtls")):"tab1";

	try
	{
		  if((!document.getElementById(tabVal+"Dtls")))
		 {
		  tabVal="tabLast";
		 }
			showDtls(tabVal);
	 }
    	catch(err)
	{
		   showDtls('tabLast');
		} 
}


/********************************************************/
/*********** Script for DHTML Flyout navigation **********/
/********************************************************/
$(document).ready(function(){
	$('.topNavClass').attr('id','topMenu');					   
	$('ul#navList').find("li:has(div)").addClass("arrow");
	$('ul#navList li').hover(function() {$('div:eq(0)', this).css('display', 'block');},
							function() {$('div:eq(0)', this).css('display', 'none'); });});

/********************************************************/