

EditionChooser = new function()
{
var _editions = new Array(); 
var wrapper = "Test";

var inter;


this.Add = function(eleNav,elePanel,display)
{
_editions.push({eleNav:eleNav, elePanel:elePanel,display:display});
}

this.SetWrapper = function(eleid)
{
this.wrapper = document.getElementById(eleid); 
}

this.Init = function()
{

for( a = 0; a < _editions.length ; a++)
{
var nav = document.getElementById(_editions[a].eleNav);
var pan = document.getElementById(_editions[a].elePanel);

if(_editions[a].display)
{  
pan.style.display = "block";
this.SetWrap(a);
}
else 
{
pan.style.display = "none";
}

}
inter = window.setInterval("EditionChooser.Next()",8000); 
}

this.Set = function(id,auto)
{

for( a = 0; a < _editions.length ; a++)
{

var nav = document.getElementById(_editions[a].eleNav);
var pan = document.getElementById(_editions[a].elePanel);

if(_editions[a].eleNav == id)
{
this.SetWrap(a); 
nav.className = "edition-select-on";
pan.style.display = "block";
} 
else
{
nav.className = "edition-select-off";
pan.style.display = "none";
}


}
if(auto)
{
clearInterval(inter);
inter = window.setInterval("EditionChooser.Next()",8000);
}
else 
{
clearInterval(inter);
inter = window.setInterval("EditionChooser.Next()",20000) 
}


}

this.SetWrap = function(id)
{
var i = id + 1;
this.wrapper.style.backgroundImage =  "url(../Images/home-left-panel-" + i + ".gif)";
}

this.Next = function()
{

// find current
var c;
for( a = 0; a < _editions.length ; a++)
{
var pan = document.getElementById(_editions[a].elePanel);
if(pan.style.display == "block")
{
c = a; 
} 
}
c++; 
if(c == _editions.length)
{
c = 0; 
}

this.Set(_editions[c].eleNav,true);


}

}


EditionChooser2 = new function()
{
var _editions = new Array(); 
var wrapper = "Test";

var inter;


this.Add = function(eleNav,elePanel,display)
{
_editions.push({eleNav:eleNav, elePanel:elePanel,display:display});
}

this.SetWrapper = function(eleid)
{
this.wrapper = document.getElementById(eleid); 
}

this.Init = function()
{

for( a = 0; a < _editions.length ; a++)
{
var nav = document.getElementById(_editions[a].eleNav);
var pan = document.getElementById(_editions[a].elePanel);

if(_editions[a].display)
{  
pan.style.display = "block";
this.SetWrap(a);
}
else 
{
pan.style.display = "none";
}

}
inter = window.setInterval("EditionChooser2.Next()",8000); 
}

this.Set = function(id,auto)
{

for( a = 0; a < _editions.length ; a++)
{

var nav = document.getElementById(_editions[a].eleNav);
var pan = document.getElementById(_editions[a].elePanel);

if(_editions[a].eleNav == id)
{
this.SetWrap(a); 
nav.className = "edition-select2-on";
pan.style.display = "block";
} 
else
{
nav.className = "edition-select2-off";
pan.style.display = "none";
}


}
if(auto)
{
clearInterval(inter);
inter = window.setInterval("EditionChooser2.Next()",8000);
}
else 
{
clearInterval(inter);
inter = window.setInterval("EditionChooser2.Next()",20000) 
}


}

this.SetWrap = function(id)
{
var i = id + 1;
this.wrapper.style.backgroundImage =  "url(../Images/home-left-panel2-" + i + ".gif)";
}

this.Next = function()
{

// find current
var c;
for( a = 0; a < _editions.length ; a++)
{
var pan = document.getElementById(_editions[a].elePanel);
if(pan.style.display == "block")
{
c = a; 
} 
}
c++; 
if(c == _editions.length)
{
c = 0; 
}

this.Set(_editions[c].eleNav,true);


}

}




FeatureChooser = new function()
{
var _features = new Array(); 

var inter;


this.Add = function(elePanel,d)
{

_features.push({elePanel:elePanel,d:d});

}

this.Init = function()
{

for( a = 0; a < _features.length ; a++)
{
var pan = document.getElementById(_features[a].elePanel);
if(_features[a].d)
{  
pan.style.display = "block";
}
else 
{
pan.style.display = "none";
}

}
inter = window.setInterval("FeatureChooser.Next()",8000); 
}

this.Set = function(id,auto)
{

clearInterval(inter);

for( a = 0; a < _features.length ; a++)
{

var pan = document.getElementById(_features[a].elePanel);

if(_features[a].elePanel == id)
{
pan.style.display = "block";
} 
else
{
pan.style.display = "none";
}


}

if(auto)
{
inter = window.setInterval("FeatureChooser.Next()",8000);
}
else 
{
inter = window.setInterval("FeatureChooser.Next()",20000) 
}

}


this.Next = function()
{

// find current
var c;
for( a = 0; a < _features.length ; a++)
{
var pan = document.getElementById(_features[a].elePanel);
if(pan.style.display == "block")
{
c = a; 
} 
}
c++; 
if(c == _features.length)
{
c = 0; 
}

this.Set(_features[c].elePanel,true);


}

}



NewMediaBox = new function()
{
var boxes = new Array();

this.Set = function(ele_id)
{

for(a = 0; a < boxes.length; a++)
{
var t = YAHOO.util.Dom.get(boxes[a].tab);
var b = YAHOO.util.Dom.get(boxes[a].panel);

if(ele_id == boxes[a].tab)
{
t.className = "active";
b.style.display = "block"; 
}
else 
{
t.className = "";
b.style.display = "none";
}

} 


}

this.Add = function(tab,panel)
{
boxes.push({tab:tab,panel:panel}); 
}

}



MediaBox = new function()
{
var boxes = new Array();

this.Set = function(ele)
{

for(a = 0; a < boxes.length; a++)
{
var t = YAHOO.util.Dom.get(boxes[a].tab);
var b = YAHOO.util.Dom.get(boxes[a].panel);
var l = YAHOO.util.Dom.get(boxes[a].list);

if(ele == boxes[a].tab)
{
l.className = "active";
b.style.display = "block"; 
}
else 
{
l.className = "";
b.style.display = "none";
}

} 
}

this.Add = function(tab,panel,list)
{
boxes.push({tab:tab,panel:panel,list:list}); 
}

}





PullDown = new function()
{

this.ShowMenu = function(menu,target_menu)
{
var ele = YAHOO.util.Dom.get(target_menu);
var x = YAHOO.util.Dom.getX(menu);
var y = YAHOO.util.Dom.getY(menu);
YAHOO.util.Dom.setStyle(ele,"visibility","visible");
YAHOO.util.Dom.setX(ele,x);
YAHOO.util.Dom.setY(ele,y + 27);
} 

this.HideMenu = function(menu,target_menu)
{
var ele = YAHOO.util.Dom.get(target_menu); 
YAHOO.util.Dom.setStyle(ele,"visibility","hidden");
}

this.KeepOpen = function(menu)
{
var ele = YAHOO.util.Dom.get(menu);
YAHOO.util.Dom.setStyle(ele,"visibility","visible"); 
}

}


function LinkTracker(redirectUrl, editionUrl, aliasPath) {

    var editionSplit = editionUrl.split("/");
    var edition = editionSplit[3];

    $.ajax({
        type: 'POST',
        url: '/CMSTemplates/IBMSystemsMag/Handlers/LinkTrackingHandler.ashx',
        data: { url: redirectUrl, edition: edition, path: aliasPath },
        success: function (msg) {
            window.location = redirectUrl;
        },
        error: function (msg) {
            alert("An error has occured accessing the requested page.");
        }
    });
}


/* 
 *  pop-up window funtions
*/


function doclose(){
            self.close();
            return false;
}


function bswPopUp(url, name, width, height, scroll) {
var properties = "scrollbars=" + scroll + ",location=no,width=" + width + ",height=" + height; 
var bswPopUpWin = window.open(url, name, properties);
bswPopUpWin.focus();
}





function validatePage() {
    if (typeof (Page_ClientValidate) == 'function') {
        Page_ClientValidate('SignUpForm');
    }

    if (Page_IsValid) {
        SignUpPost();
    }
    else {
    }
}

function SignUpPost() {

    if (Page_IsValid && $("#Email").val() != "" && $("#Name").val() != "" && $("#CoName").val() != "") {
        var surl = "http://cl.exct.net/subscribe.aspx";
        var Email = $("#Email").val();
        var Name = $("#Name").val();
        var CoName = $("#CoName").val();
        var Q1 = $(".q1Radio:checked").val();
        var Q2 = $("#q2").val();
        var Q3 = $("#q3").val();
        var Q4 = "";
        var Q4List = $(".q4Radio:checked").each(function () { Q4 = Q4 + $(this).val() + ', ' });
        var Q5 = $("#q5").val();
        var Q6 = $("#q6").val();
        var Q7 = $("#q7").val();

        var MID = $("#mid").val();
        var LID = $("#lid").val();

        $.ajax({
            type: 'POST',
            url: surl,
            data: { "Email Address": Email, "Full Name": Name, "User Defined": CoName, "question1": Q1, "question2": Q2, "question3": Q3, "question4": Q4, "question5": Q5, "question6": Q6, "question7": Q7, "mid": MID, "lid": LID, "thx": "", "err": "" },
            dataType: "jsonp"
        });

        $("#SignUpForm").hide();
        $("#AIXThankYou").show();
    }

    return false;
}

function SiteSearch() {
    window.location = "/Search/?q=" + $("#uxSearchInputTextBox").val();
}
