﻿var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion); 
var is_ie = ((agt.indexOf("msie") != -1));
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.") != -1));
var is_ie7 = (is_ie && (is_major == 4) && (agt.indexOf("msie 7.") != -1));
var is_ie8 = (is_ie && (is_major == 4) && (agt.indexOf("msie 8.") != -1));


function BreakoutOfFrames()
{
    if (top.location != self.location)
        top.location = self.location;
}
function openPrivacyFeedback()
{
   openNoMenuWindow('http://home.mcafee.com/supportpages/privacyFeedback.aspx', '', '700', '652') 
}
function openMenuWindow(url, title, width, height) {
    // read resolution and set variables
    var x = screen.width;
    var y = screen.height;
    var top = parseInt((y - height) / 2);
    var left = parseInt((x - width) / 2);
    // open new window and use the variables to position it
    window.open(url, title, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resize=yes,resizable=yes,menubar=yes,toolbar=yes,directories=no');
}

// for Sales Pitch. In Upsell/CrossSell contents users are providing links which should use this function.
function openNoMenuWindow(url, title, width, height) {
    // read resolution and set variables
    var x = screen.width;
    var y = screen.height;
    var top = parseInt((y - height) / 2);
    var left = parseInt((x - width) / 2);
    // open new window and use the variables to position it
    //window.open(url, title, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');
    window.open(url, title, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');
}

function openNoScrollWindow(url,title,width,height) {
	// read resolution and set variables
	var      x = screen.width;
	var      y = screen.height;
	var    top = parseInt((y-height)/2);
	var   left = parseInt((x-width)/2);
	// open new window and use the variables to position it
	window.open(url,title,'width='+width+',height='+height+',left='+left+',top='+top+',scrollbars=no,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');
}
//utility Custom Dropdown
startList = function() {
    var iFrame;
    var objList = document.getElementById('global_country');
    
    // if (document.all && document.getElementById);
    globalSites = document.getElementById("globalNav");

    if (globalSites == null)
        return;

    if (is_ie6 && objList != null) {
        var o_CountryList = document.getElementById("ulCountry");
        
        iFrame = document.createElement('iframe');
        iFrame.id = 'ieIframe';
        iFrame.src = 'https://secureimages.mcafee.com/brand/images/spacer.gif';

        objList.appendChild(iFrame);
        objList.insertBefore(iFrame, o_CountryList);
    }

    for (x = 0; x < globalSites.childNodes.length; x++) {
        node = globalSites.childNodes[x];

        if (node.nodeName == "LI") {
            if (node.id == "global_country" || node.id == "global_currency" || node.id == "global_language") {
                node.onmouseover = function() {
                    if (is_ie6) {
                        for (y = 0; y < this.childNodes.length; y++) {
                            oSubNode = this.childNodes[y];
                            if (oSubNode.nodeName == "UL") {
                                oSubNode.style.display = "block";
                                if (this.id == "global_country")
                                    iFrame.style.display = "block";
                            }
                        }
                    } else {
                        this.className += " over";
                    }
                }
            }
        }
        node.onmouseout = function() {
            if (is_ie6) {
                for (y = 0; y < this.childNodes.length; y++) {
                    oSubNode = this.childNodes[y];
                    if (oSubNode.nodeName == "UL") {
                        oSubNode.style.display = "none";
                        iFrame.style.display = "none";
                    }
                }
            } else {

                this.className = this.className.replace(" over", "");
            }
        }
    }
    //}
}

if (window.attachEvent)
    window.attachEvent("onload", startList)
else
    window.onload = startList;

function pageLoad() {
    Ie6LastChildCSSFix();
    AddClientSideErrorHandling();
}

function Ie6LastChildCSSFix() {
    //var isIE6 = false/*@cc_on || @_jscript_version < 5.7@*/;
    if (is_ie) 
    {
        var footerMenu = document.getElementById("ctl00_ucFooterMenu_m_Menu");
        if (footerMenu == null)
            return;
        var listItems = footerMenu.getElementsByTagName("li");

        if (listItems != null) 
        {            
            var lastListItem = listItems[listItems.length - 1];

            if (lastListItem != null) {
                if (is_ie6 || is_ie7) {
                    lastListItem.setAttribute('className', 'last-child_ie');
                } else {
                    lastListItem.setAttribute('class', 'last-child_ie'); 
                }
            }            
        }
    }
}

function AddClientSideErrorHandling()
{
    Sys.Net.WebRequestExecutor.prototype.checkError = function() {

        var e = null;

        if (this.get_aborted())
            e = Error.create('Request Aborted.', { name: 'RequestAbortedError' });
        else if (this.get_timedOut())
            e = Error.create('Request Timed Out.', { name: 'RequestTimeoutError' });
        else {
            var statusCode;
            try {
                statusCode = this.get_statusCode();
            }
            catch (e) {
                statusCode = 0;
            }

            if (statusCode < 100 || statusCode >= 600)
                e = Error.create('Connection Error.', { name: 'ConnectionError' });
            else if ((statusCode < 200) || (statusCode >= 300))
                e = Error.create('HTTP Error.', { name: 'HTTPError', "statusCode": statusCode, statusText: this.get_statusText() });
        }

        return e;
    }
}

////utility Custom Dropdown for Global Currency in subnav
startTheList = function() {
    var agt = navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_ie = ((agt.indexOf("msie") != -1));
    var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.") != -1));

    // if (document.all && document.getElementById);
    globalCurrency = document.getElementById("currencyNav");

    if (globalCurrency == null)
        return;

    for (x = 0; x < globalCurrency.childNodes.length; x++) {
        node = globalCurrency.childNodes[x];
        if (node.nodeName == "LI") {
            if (node.id == "global_currency") {
                node.onmouseover = function() {
                    if (is_ie6) {
                        for (y = 0; y < this.childNodes.length; y++) {
                            oSubNode = this.childNodes[y];
                            if (oSubNode.nodeName == "UL") {
                                oSubNode.style.display = "block";
                            }
                        }
                    } else {
                        this.className += " over";
                    }
                }
            }
        }
        node.onmouseout = function() {
            if (is_ie6) {
                for (y = 0; y < this.childNodes.length; y++) {
                    oSubNode = this.childNodes[y];
                    if (oSubNode.nodeName == "UL") {
                        oSubNode.style.display = "none";
                    }
                }
            } else {
                this.className = this.className.replace(" over", "");
            }
        }
    }
    //}
}

if (window.attachEvent)
    window.attachEvent("onload", startTheList)
else
    window.onload = startTheList;

function fnAutoPostback(ctl) 
{
    var id, loc;
    id = ctl.options[ctl.selectedIndex].id;
    loc = ctl.options[ctl.selectedIndex].value;
    if (id == "autopostback") {
        location.href = loc;
        return;
    }
}

//This FN is to submit single form
function submitSingleForm(ctl) 
{
    var id, loc;
    
    id = ctl.options[ctl.selectedIndex].id;
    loc = ctl.options[ctl.selectedIndex].value;
        
    if (id == "redirect") {
        location.href = loc;
        return false;
    }
    if (id == "newWindow") {
        window.open(loc, "newWindow");
        return false;
    }
}

// For tabbing
function navOn(elm) {
    if (elm.className == "tab-link")
        elm.className = "tab-link on";
    if (elm.className == "nav-off") {
        elm.className = "nav-on";
    }
}

function navOff(elm) {
    if (elm.className == "tab-link on")
        elm.className = "tab-link";

    if (elm.className == "nav-on")
        elm.className = "nav-off";
}
var prevTab;
var prevTabContent;

function tabSelect(objLI, objID) {
    var selectedTab = document.getElementById(objLI);
    var selectedTabContent = document.getElementById(objID);

    if (prevTab != null && prevTab !== objLI) {
        document.getElementById(prevTab).className = "tab-link";
        document.getElementById(prevTabContent).style.display = "none";
    }
    selectedTab.className = "tab-link selected";

    selectedTabContent.style.display = "block";
    prevTab = objLI;
    prevTabContent = objID;
}

function _StringFormatInline() {
    var txt = this;
    for (var i = 0; i < arguments.length; i++) {
        var exp = new RegExp('\\{' + (i) + '\\}', 'gm');
        txt = txt.replace(exp, arguments[i]);
    }
    return txt;
}

function _StringFormatStatic() {
    for (var i = 1; i < arguments.length; i++) {
        var exp = new RegExp('\\{' + (i - 1) + '\\}', 'gm');
        arguments[0] = arguments[0].replace(exp, arguments[i]);
    }
    return arguments[0];
}

if (!String.prototype.format) {
    String.prototype.format = _StringFormatInline;
}

if (!String.format) {
    String.format = _StringFormatStatic;
}

function PrintPreview(printLink, Content, Culture) {
    var elmContent = document.getElementById(Content);
    var elmPrintLink = document.getElementById(printLink);
    if (!elmContent && !elmPrintLink) {
        return;
    } 
    var winOpen = window.open("about:blank", "_blank", "width=640,height=640,toolbar=no,scrollbars=yes,menubar=no,resizable=yes");
    var doc = winOpen.document;

    doc.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
    if ((Culture == "ar-AE") || (Culture == "he-IL") || (Culture == "ar") || (Culture == "he")) {
        doc.write("<html xmlns='http://www.w3.org/1999/xhtml' dir='rtl'><head>");
        doc.write("<title>" + window.document.title + "</title>");
        doc.write("<link rel='Stylesheet' type='text/css' href='/UIDesign/LegacySite/Styles/PGStyles/printpreview.css'></link>");
        doc.write("<script type='text/javascript'> function openPrivacyFeedback(){ openNoMenuWindow('http://home.mcafee.com/supportpages/privacyFeedback.aspx', '', '700', '652')} function openNoMenuWindow(url, title, width, height) {var x = screen.width;var y = screen.height;var top = parseInt((y - height) / 2);var left = parseInt((x - width) / 2);window.open(url, title, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');}</script>");
        doc.write("</head><body id='Eula_RTL'>");
    }
    else {
        doc.write("<html xmlns='http://www.w3.org/1999/xhtml' dir='ltr'><head>");
        doc.write("<title>" + window.document.title + "</title>");
        doc.write("<link rel='Stylesheet' type='text/css' href='/UIDesign/LegacySite/Styles/PGStyles/printpreview.css'></link>");
        doc.write("<script type='text/javascript'> function openPrivacyFeedback(){ openNoMenuWindow('http://home.mcafee.com/supportpages/privacyFeedback.aspx', '', '700', '652')} function openNoMenuWindow(url, title, width, height) {var x = screen.width;var y = screen.height;var top = parseInt((y - height) / 2);var left = parseInt((x - width) / 2);window.open(url, title, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');}</script>");
        doc.write("</head><body id='Eula'>");
    }

    doc.write("<a id='lnkPrint' class='print-icon' href='javascript:window.print();'>" + elmPrintLink.innerHTML + "</a>" + elmContent.innerHTML);
    doc.write("</body></html>");
    doc.close();
}


// for pkg page redesign -- crao

// Set ID's for all LIs
function setDemoID() {
    ContainerElement = document.getElementById('vcd-carousel')
    if (ContainerElement == null)
        return;
    LICol = ContainerElement.getElementsByTagName('LI');
    LICol.item(0).attributes.getNamedItem("class").value = "sel-vdo";
     
    if (LICol != null) 
    {
        for (i = 0; i < LICol.length; i++) 
        {
           LICol.item(i).setAttribute('id', "image_" + eval(i));
                      
          //to focus selected image - begin
           var strTitle1,strTitle2,strHiddenVal ; 
           strTitle = LICol.item(i).getElementsByTagName('A')[0].title;  
           strHiddenVal = document.getElementById ('ctl00_MainContent_m_ViewDemo_hiddenSelectedCaption').value;
           if(strTitle == strHiddenVal ) 
           {
               LICol.item(0).attributes.getNamedItem("class").value = "";
               LICol.item(i).attributes.getNamedItem("class").value = "sel-vdo";
           }
          //to focus selected image - end  
            
         }
        }
    //GTM Product Detail Page - Hide scroll in case of 1 video - 
    if (LICol.length == 1 && document.getElementById('dvScroll')!=null) 
    document.getElementById ('dvScroll').style.display = 'none';
    
    if (document.getElementById('ctl00_MainContent_hiddenCanFlash'))
    {
      if (document.getElementById('ctl00_MainContent_hiddenCanFlash').value == 'false') 
      {
          document.getElementById('dvNoFlash').style.display = 'block';
          document.getElementById('dvDemos').style.display = 'none';
      }
      else
      {
          document.getElementById('dvNoFlash').style.display = 'none';
          document.getElementById('dvDemos').style.display = 'block';
      }
    }

	//hi-light demos tab
	if (document.getElementById ('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewDemo') != null)
        document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewDemo').setAttribute("class","demo-sel-lnk");
        
    if (document.getElementById ('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewScreenShots') != null)
       document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewScreenShots').setAttribute("class","");
   
}
function DisplayDemo()
{

        if(document.getElementById('popups') != null)
            document.getElementById('popups').style.display = 'none';
            
var demoDiv = document.getElementById('dvDemos');
var sShotDiv = document.getElementById('sShots');
var noflash = document.getElementById('dvNoFlash');
    if(demoDiv != null){
            document.getElementById('popups').style.display = 'block';
        }
    else if(sShotDiv != null){
        document.getElementById('popups').style.bottom = '-40px';
        document.getElementById('popups').style.display = 'block';
    }
    else if((noflash != null) && (noflash.style.display == 'block')){
        document.getElementById('popups').style.bottom = '-40px';
        document.getElementById('popups').style.display = 'block';
    } 
    else{

        }
}
function popClose(){
    document.getElementById('popups').style.display = 'none';
}
function initSlideshow() {
    setDemoID();
    setScreenshotsID();
    
}
function moveLeft() {
 
    ContainerElement = document.getElementById("vcd-carousel");
    firstLI = document.getElementById("image_0");
    dupfirstLI = firstLI.cloneNode(false)
    dupfirstLI.innerHTML = firstLI.innerHTML
    ContainerElement.removeChild(firstLI);
    ContainerElement.appendChild(dupfirstLI);
    setDemoID();
  
}

function moveRight() {
    lastLI = document.getElementById("image_" + eval(LICol.length - 1));
    duplastLI = lastLI.cloneNode(false)
    duplastLI.innerHTML = lastLI.innerHTML
    firstLI = document.getElementById("image_0");
    ContainerElement = document.getElementById("vcd-carousel");
    ContainerElement.insertBefore(duplastLI, firstLI);
    ContainerElement.removeChild(lastLI);
    setDemoID();
   
}
 function ToggleUpsell(type, flag)
{
    if (type == 'PopUp')
    {
        if (flag == true)
         {
            document.getElementById ('dvUpsellPopup').style.display = 'block';
         }
         else
         {
            document.getElementById ('dvUpsellPopup').style.display = 'none';
            return false;
         }
    }
    else
    {
         if (flag == true)
         {
            document.getElementById ('dvUpsell').style.display = 'block';
         }
         else
         {
            document.getElementById ('dvUpsell').style.display = 'none';
            return false;
         }
    }
} 
 
//GTM Product Detail Page - product demos
function fnShowHide(obj)
{
 
 if (obj.id == 'lnkViewDemo')
 {
  
    if (document.getElementById('dvDemos')!= null)
        document.getElementById('dvDemos').style.display = 'block';
    
    if (document.getElementById('dvScreenShots')!= null)
        document.getElementById('dvScreenShots').style.display = 'none';
 }
 else if (obj.id == 'lnkViewScreenShots')
 {
     if (document.getElementById('dvDemos')!= null)
         document.getElementById('dvDemos').style.display = 'none';
      
     if (document.getElementById('dvScreenShots')!= null)
         document.getElementById('dvScreenShots').style.display = 'block';
 }
 
}
 
function ToggleLink(obj)
{ 

 if(obj.id =='linkViewDetails')
 {
    document.getElementById('dvMoreDetails').style.display = 'block';
    document.getElementById('linkHideDetails').style.display = 'block';
    document.getElementById('linkViewDetails').style.display = 'none';
    if(document.getElementById('price-sec')!= null)
        document.getElementById('price-sec').className= 'price-sec pkg2price';
 }
 else
 {
    document.getElementById('dvMoreDetails').style.display = 'none';
    document.getElementById('linkHideDetails').style.display = 'none';
    document.getElementById('linkViewDetails').style.display = 'block';
    if(document.getElementById('price-sec')!= null)
        document.getElementById('price-sec').className= 'price-sec';
 }
}
function setAwardsDisplay(award) {
    ContainerElement = document.getElementById(award);
   if (ContainerElement == null)
        return;

    arrImg = ContainerElement.getElementsByTagName('A');
    awdCntr = document.getElementById('dvAllAwards');

    if(arrImg.length > 6){
       awdCntr.className='awd-scroll';
    }

    if (arrImg != null) 
    {
        for (i = 0; i < arrImg.length; i++) 
        {
             arrImg[i].style.display = (i < 4) ? 'block' : 'none' ;
        }
		    if (document.getElementById('ctl00_MainContent_m_ProductAwards_m_AwardsStrip_viewall') != null)
			document.getElementById('ctl00_MainContent_m_ProductAwards_m_AwardsStrip_viewall').style.display = (arrImg.length > 6)?'block':'none';
            if (document.getElementById('ctl00_MainContent_m_UcSingleProduct_m_ProductAwards_m_AwardsStrip_viewall') != null)
			        document.getElementById('ctl00_MainContent_m_UcSingleProduct_m_ProductAwards_m_AwardsStrip_viewall').style.display = 'block';
		    if (document.getElementById('ctl00_MainContent_ucSingleProductWithFeatures_m_SingleProductViewPearl_ctl01_m_AwardsStrip_viewall') != null)
			        document.getElementById('ctl00_MainContent_ucSingleProductWithFeatures_m_SingleProductViewPearl_ctl01_m_AwardsStrip_viewall').style.display = 'block';
		    if (document.getElementById('ctl00_MainContent_ctl00_m_ProductAwards_m_AwardsStrip_viewall') != null)
			        document.getElementById('ctl00_MainContent_ctl00_m_ProductAwards_m_AwardsStrip_viewall').style.display = 'block';
		    if (document.getElementById('viewall') != null)
			        document.getElementById('viewall').style.display = 'block';
		    if (document.getElementById('dvClose') != null)
		            document.getElementById('dvClose').style.display = 'block';
		
     }
}
function pngDimFix(){
var imgList,arrList;
imgList = document.getElementById('dvAllAwards');
arrList = (imgList != null)? imgList.getElementsByTagName('img') : null ;
    
    if (arrList != null) 
    {
        for (a = 0; a < arrList.length; a++) 
        {
             var imgHgt = arrList[a].height;
             var imgWdt = arrList[a].width;
             arrList[a].setAttribute("style", "height:" + imgHgt + "px; display:block; float:left; width:" + imgWdt + "px");
        }
    }
    
}
//Award Yellow Tooltip
function ttip(awd){
    var awdTip = document.getElementById(awd);
    var awdElm = document.getElementById('awdList');
    var awdTag = awdElm.getElementsByTagName('span');
    var awdSpan = awdTip.getElementsByTagName('span');
    for (i = 0; i < awdTag.length; i++) 
    {
       awdTag[i].style.display = 'none';
        for (j = 0; j < awdSpan.length; j++) 
            {
                 awdSpan[j].style.display = 'block';
            }
    }
    awdTip.style.display = 'block';

    awdElm.onmouseout = function() {
        for (y = 0; y < awdTag.length; y++) 
        {
           awdTag[y].style.display = 'none';
        }
    }
}

//Buy with confidence hover Popup
function ttipbwc(elm,parElm){
    var bwcTip = document.getElementById(elm);
    var bwcElm = document.getElementById(parElm);
    bwcTip.style.display = 'block';
    
    bwcElm.onmouseout = function() {
           bwcTip.style.display = 'none';
    }
}

    function hidepopup(me) {
        var shdiv = document.getElementById(me);
        shdiv.style.display = 'none';
    }
    function showpopup(me, div) {
        var shdiv = document.getElementById(me);
        if (div == 'allawards') {
            shdiv.setAttribute("class", "awards-pop");
            document.getElementById('dvAllAwards').style.display = 'block';
        }
    }
   
 

/*
function EndRequestHandler()
{
 
}
 */
 
/* Top Promo - Start */
var crossobj;
var contentwidth;
var arrStr = new Array;
var BttnsClass;

function initPromos() {
//Modified the actual demo script, chala needs to rework on this & ChangePromo FNs
    if (document.getElementById("PromoTabs") != null) {
        crossobj = document.getElementById("PromoTabs");
        Elms = crossobj.getElementsByTagName("a");
        selectedBttnCount = 0;
        selectedBttnId = Elms[0].id;
        LoopCount = (Elms.length - 1);
        contentwidth = crossobj.offsetWidth;
        ElmsCount = Elms.length;

        if (ElmsCount == 2)
            BttnsClass = "TwoBttns";
        if (ElmsCount == 3)
            BttnsClass = "ThreeBttns";
        if (ElmsCount == 4)
            BttnsClass = "FourBttns";

        for (var arr = 0; arr < ElmsCount; arr++) {
            arrStr[arr] = Elms[arr].href;
            arrStr[arr] = arrStr[arr].replace(")", "");
            arrStr[arr] = arrStr[arr].replace("javascript", "");
            //arrStr[arr] = arrStr[arr].replace(":toppromo(", "");
            arrStr[arr] = arrStr[arr].replace(":selPromo(", "");
        }
        ChangePromo(0);
    }
   // if ( (document.getElementById ('dvScreenShots'))!= null)
    //document.getElementById ('dvScreenShots').style.display = 'none';
}

function GetSelcetedTabCount(id) {
    id = "tab" + id;
    for (var s = 0; s < Elms.length; s++) {
        if (id == Elms[s].id)
            selectedBttnCount = s;
    }
}

function selectRight() {
 
    if (crossobj != null) {
        Elms[selectedBttnCount].className = BttnsClass;
        
        if (selectedBttnCount >= LoopCount) {
            selectedBttnCount = 0;
        } else {
            selectedBttnCount++;
        }

        if (is_ie6) {
            setTimeout(function(){ChangePromo(selectedBttnCount)}, 10);
        } else {
            ChangePromo(selectedBttnCount);
        }
    }
}

function selectLeft() {
 
    if (crossobj != null) {
        Elms[selectedBttnCount].className = BttnsClass;
        
        if (selectedBttnCount == 0) {
            selectedBttnCount = LoopCount;
        } else {
            selectedBttnCount--;
        }

        if (is_ie6) {
            setTimeout(function() { ChangePromo(selectedBttnCount) }, 10);
        } else {
            ChangePromo(selectedBttnCount);
        }
    }
}

function toppromo(imagefile, contentID) {
    var timer = 0;
    var divid = "acpromo";
    var millisec = 50;
    var speed = Math.round(millisec / 100);
    
    selectedBttnId = "tab" + contentID;
    document.getElementById(divid).style.background = "url(" + imagefile + ") no-repeat center center";
    
    var TabItems = crossobj.getElementsByTagName("a");
    for (j = 0; j < TabItems.length; j++) {
        TabItems[j].className = BttnsClass;
    }
    
    GetSelcetedTabCount(contentID);
    if (document.getElementById("tab" +	contentID)) {
        document.getElementById("tab" + contentID).className = "selected " + BttnsClass;
    }
    var dontentDiv = document.getElementById(divid).getElementsByTagName("div");
    for (j = 0; j < dontentDiv.length; j++) {
        if (dontentDiv[j].className = "promodiv") {
            dontentDiv[j].style.display = "none";
        }
    }
    document.getElementById(contentID).style.display = "block";

	//hi-light screenshots tab
	if (document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewDemo') != null)
		document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewDemo').style.color = "#166494";
	
	if (document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewScreenShots')!=null)
	    document.getElementById('ctl00_MainContent_m_ViewDemo_m_ViewLinks_linkViewScreenShots').style.color = "#000";
	
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.filter = "alpha(opacity=" + opacity + ")";
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
}

function ChangePromo(BttnCount) {
 
    Elms[BttnCount].className = "selected " + BttnsClass;
    var arrString = arrStr[BttnCount];
    arrString = arrString.replace(/['"]/g, '');
    var arrSplit = arrString.split(",");

    //toppromo(arrSplit[0], arrSplit[1]);
    selPromo(arrSplit[0], arrSplit[1]);
}
/* Top Promo - End */

var elmsArr = new Array();

    function switchMenu(obj, getEl, tmpl, tglHolder) {
    if (tmpl == '-blist' || tmpl == '-3party' || tmpl == '-tbl' || tmpl == '-tblsml' || tmpl == '-blist no-head')
    {
       return;
    }
        var getElm = getEl;
        var el = document.getElementById(obj);
        var ParentElm = getElm.parentNode;
        var ChildElm = getElm.getElementsByTagName('th')[0];
//        var parHldr = document.getElementById(tglHolder);
//        var parTbl = parHldr.getElementsByTagName("div");

    if((tmpl == 'cmprTbd') || (tmpl == 'pcTblBdy')){getElm = ChildElm;}

        if (el.style.display != "block") {
            el.style.display = 'block';

            if (is_ie6) {
                setTimeout(function() { ToggleIcons(getElm, "ExpandIcon") }, 10);
            } else { getElm.className = "ExpandIcon"; }
//                for (u = 0; u < parTbl.length; u++) {
//                   if (parTbl[u].className = "expCntr") {
//                        this.className = 'expCntr disable';
//                    }
//                    if (parTbl[u].className = "colCntr disable") {
//                        this.className = 'colCntr';
//                    }
//                }
        }
        else {
            
            el.style.display = 'none';

            if (is_ie6) {
                setTimeout(function() { ToggleIcons(getElm, "CollapseIcon") }, 10);
            } else { getElm.className = "CollapseIcon"; }
        }
    }
    function ToggleIcons(obj, styleName) { obj.className = styleName; }
    function descElms(el) {
        var TBody = document.getElementById(el);
        var TDesc = TBody.getElementsByTagName('div');
        var THead = TBody.getElementsByTagName('th');

        var e;
        for (e = 0; e < TDesc.length; e++) {
            var str = TDesc[e].id;

            if (str.match("proddesc"))
                elmsArr[e] = str;
        }
    }
    var disablElm;
    var disablElm1;
    
    function expandAll(elem, o, disID) {
        var selTbd = o;
		var divId = disID;
        descElms(selTbd);
        var i;

        for (i = 0; i < elmsArr.length; i++) {

            var obj = document.getElementById(elmsArr[i]);
            var PrevSib = obj.parentNode;

            if (obj != null) {
                obj.style.display = 'block';
                PrevSib.className = "ExpandIcon";
            }
        }
            disablElm = document.getElementById(divId);
            var disElm = divId+'1';
            disablElm1 = document.getElementById(disElm);
            disablElm.parentNode.setAttribute('class', 'expCntr disable-exp');
			disablElm1.parentNode.setAttribute('class', 'colCntr');
			/*IE reject the above code, so adding className*/
            disablElm.parentNode.setAttribute('className', 'expCntr disable-exp');
			disablElm1.parentNode.setAttribute('className', 'colCntr');
    }
    function collapseAll(elem, o, disID) {
        var selTbd = o;
		var divId = disID;
        descElms(selTbd);
        var i;
        for (i = 0; i < elmsArr.length; i++) {
            var obj = document.getElementById(elmsArr[i]);
            var PrevSib = obj.parentNode;

            if (obj != null) {
                obj.style.display = 'none';
                PrevSib.className = "CollapseIcon";
            }
        }
           disablElm = document.getElementById(divId);
           var disElm = divId+'1';
           disablElm1 = document.getElementById(disElm);
           disablElm.parentNode.setAttribute('class', 'expCntr');
           disablElm1.parentNode.setAttribute('class', 'colCntr disable-col');
		   /*IE reject the above code, so adding className*/
           disablElm.parentNode.setAttribute('className', 'expCntr');
           disablElm1.parentNode.setAttribute('className', 'colCntr disable-col');
    }
function toggleVdl(togLnk, togDiv, togImg) {
               var e = document.getElementById(togDiv);
                   var el = document.getElementById(togLnk);
                   var img = document.getElementById('upsel-box');
               if(e.style.display == 'block'){
                  e.style.display = 'none';
                         el.className = "hid-dtl";
                                 if(togImg == true)
                                       img.className = "upsel-box";
                       }else{
                  e.style.display = 'block';
                         el.className = "vew-dtl";
                                 if(togImg == true)
                                       img.className = "upsel-box usbig";
                       }
            }
            
//compare hover fn
comparebg = function(tbody) {
var tb = document.getElementById(tbody);
if (tb == null) return;
var tbid = tb.getElementsByTagName("tr");
if (tbid != null){for (var e = 0; e < tbid.length; e++){if(tbid[e].className == 'altrow'){
    tbid[e].onmouseover = function() {this.className = 'altrow compareon';}
    tbid[e].onmouseout = function() {this.className = 'altrow';}
}else{
    tbid[e].onmouseover = function() {this.className = 'compareon';}
    tbid[e].onmouseout = function() {this.className = '';}
}}}}
 
 
 
function setScreenshotsID() {
    ContainerElement = document.getElementById('PromoTabs');
    if (ContainerElement == null)
        return;
    LICol = ContainerElement.getElementsByTagName('a');
     
        if (LICol != null) 
        {
            for (i = 0; i < LICol.length; i++) 
            {
               LICol.item(i).setAttribute('id', "tab" + eval(i+1));
             }
        }
//        document.getElementById("tab1").setAttribute("class", "selected");
 }

//function moveUp() {
// 
//    ContainerElement = document.getElementById("PromoTabs");
//	firstLI = document.getElementById("tab1");
//    dupfirstLI = firstLI.cloneNode(false);
//	dupfirstLI.innerHTML = firstLI.innerHTML;
//	ContainerElement.removeChild(firstLI);
//    ContainerElement.appendChild(dupfirstLI);
//    setScreenshotsID();
//}
//function moveDown() {
//    lastLI = document.getElementById("tab" + eval(LICol.length - 1));
//    duplastLI = lastLI.cloneNode(false);
//    duplastLI.innerHTML = lastLI.innerHTML;
//    firstLI = document.getElementById("tab1");
//    ContainerElement = document.getElementById("PromoTabs");
//    ContainerElement.insertBefore(duplastLI, firstLI);
//	ContainerElement.removeChild(lastLI);
//    setScreenshotsID();
//   
//}

 

/*Screenshots Javascript - Works only with jQuery*/
var Sstep = 2; 
var Scurrent = 0;
var Svisible = 0; 
var Sspeed = 200;
var SliSize = 200;
var SliHeight = 54;
var Scarousel_height = 337;
var Smaximum;
function sShot(){
        Smaximum = $('#PromoTabs a').size();
		var ulSize = SliHeight * Smaximum;
		var divSize = SliHeight * Svisible;
		$('#PromoTabs').css("height", ulSize+"px").css("top", -(Scurrent * SliHeight)).css("position", "absolute");
 		$('#sShots').css("height", divSize+"px").css("height", Scarousel_height+"px").css("visibility", "visible").css("overflow", "hidden").css("position", "relative"); 
	}
function moveUp(){
 		sShot();
		
			if(Scurrent - Sstep < 0 || Scurrent - Sstep > Smaximum - Svisible) {
			    $('.sShot-prev').addClass('sSprev-dis');
			    $('.sShot-nxt').removeClass('sSnxt-dis');
			}
			else {
				Scurrent = Scurrent - Sstep;
				$('.sShot-prev').removeClass('sSprev-dis');
				$('#PromoTabs').animate({top: -(SliHeight * Scurrent)}, Sspeed, null);
			}
			return false;
}

function moveDown(){
		sShot();
		if(Scurrent + Sstep < 0 || Scurrent + Sstep > Smaximum - Svisible) {
		    $('.sShot-nxt').addClass('sSnxt-dis');
		    $('.sShot-prev').removeClass('sSprev-dis');
		 }
			else {
				Scurrent = Scurrent + Sstep;
				$('.sShot-nxt').removeClass('sSnxt-dis');
				$('#PromoTabs').animate({top: -(SliHeight * Scurrent)}, Sspeed, null);
			}
			return false;
}
function selPromo(imagefile, contentID){
    $('#PromoTabs').find('a.selected').removeClass('selected');
    //selectedBttnId = "tab" + contentID;
    if ($("#tab"+contentID)) {
        $("#tab"+contentID).addClass("selected ");
        $('#acpromo').css('background','url(' + imagefile + ') no-repeat center center');        
    }
}

function MLpopupClose(cid) {
    document.getElementById(cid).style.display = "none";
    return false;
}

function MlpopupOpen(cid) {
    $('.Mlpopup').hide();
    var mllink = $("#" + cid).closest('td');
    $(mllink).find('.Mlpopup').css('display', 'block');
    return false;
}   

/*Loading PC Tune up Popup content*/
function loadPCTuneupPopup()
    {
	$(".pkg-sec").css("position","static");	
	$('#PCtuneupPopup').css('display','block');
	$('.dimmed').css('display','block');
	
    }
/*Closing PC Tune up Popup content*/
function closePCTuneupPopup()
    {
	$(".pkg-sec").css("position","relative");
	$('.dimmed').css('display','none');
	$('#PCtuneupPopup').css('display','none');
}

var DefaultTabSelected="tab1-content";
function selectTab(TabID)
	{
		
		var TabSelContentID=TabID+"-content";
		var previousSelTab=DefaultTabSelected.replace("-content","");
		document.getElementById(previousSelTab).className="";
		document.getElementById(TabID).className="selected";
		
		document.getElementById(DefaultTabSelected).style.display="none";
		document.getElementById(TabSelContentID).style.display="block";
		DefaultTabSelected=TabSelContentID;
}

function dragResize() {
    $.fn.jqDrag = function(h) { return i(this, h, 'd'); };
    $.fn.jqResize = function(h) { return i(this, h, 'r'); };
    $.jqDnR = { dnr: {}, e: 0,
        drag: function(v) {
            if (M.k == 'd') E.css({ left: M.X + v.pageX - M.pX, top: M.Y + v.pageY - M.pY });
            else E.css({ width: Math.max(v.pageX - M.pX + M.W, 0), height: Math.max(v.pageY - M.pY + M.H, 0) });
            return false;
        },
        stop: function() { E.css('opacity', M.o); $().unbind('mousemove', J.drag).unbind('mouseup', J.stop); }
    };
    var J = $.jqDnR, M = J.dnr, E = J.e,
i = function(e, h, k) {
    return e.each(function() {
        h = (h) ? $(h, e) : e;
        h.bind('mousedown', { e: e, k: k }, function(v) {
            var d = v.data, p = {}; E = d.e;
            // attempt utilization of dimensions plugin to fix IE issues
            if (E.css('position') != 'relative') { try { E.position(p); } catch (e) { } }
            M = { X: p.left || f('left') || 0, Y: p.top || f('top') || 0, W: f('width') || E[0].scrollWidth || 0, H: f('height') || E[0].scrollHeight || 0, pX: v.pageX, pY: v.pageY, k: d.k, o: E.css('opacity') };
            E.css({ opacity:1 }); $().mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
            return false;
        });
    });
},
f = function(k) { return parseInt(E.css(k)) || false; };
}



