addLoadEvent( resize );
window.onresize = resize;

function resize() {

var homeContent = document.getElementById('container');
var overallWidth = parseInt(homeContent.offsetWidth);
var newwidthint = parseInt(overallWidth-760);

if (overallWidth < 940) {
//alert("test1");
var i = 0;
var array = getElementsByClassName(document.getElementById("home-promos"),"h2","home-h2");

for (i=0; i<array.length; i++) {
array[i].style.height = "32px";
}
}


if (overallWidth > 940) {
//alert("test2");
var i = 0;
var array = getElementsByClassName(document.getElementById("home-promos"),"h2","home-h2");

for (i=0; i<array.length; i++) {
array[i].style.height = "auto";
}
}
}




function ReWriteTabLinks(hfToUpdate, ctrlToPost)
{
   var tabLinksArray = getElementsByClassName(document.getElementById("tabs-navigation"),"a", "tablink");

    try
    {        
        for(var i=0;i<tabLinksArray.length;i++){
            if (tabLinksArray[i].getAttribute('href') != null) {
                    tabLinksArray[i].setAttribute('href', '#x');
                    tabLinksArray[i].onclick=function() { 
                    ChangeTabs(this.rel, hfToUpdate, ctrlToPost);
                }
            }
        } 
    }
    catch(err)
    {
        //alert(err + " - This is casued by the link re-writer, there are no links to find in the paramater element");
    }
    // Add opacity to load effect overlays dynamically (otherwise CSS will be invalid)
    for(var i=0; i<UpdateLoadEffectIDs.length; i++){
        if (document.getElementById(UpdateLoadEffectIDs[i][1])){
		    var oe = document.getElementById(UpdateLoadEffectIDs[i][1]);
            // Set transparency to 50%
            oe.setAttribute("style", "opacity:0.75; display:none;")
		if (oe.style.setAttribute) //For IE
		    oe.style.setAttribute("filter", "alpha(opacity=75);")
	    }
    }
}

// Function to change tabs
function ChangeTabs(tcmid, hfToUpdate, ctrlToPost)
{
   var tabContentArray = getElementsByClassName(document.getElementById("tabs-navigation"),"div", "active");
   for (i=0; i<tabContentArray.length; i++) {
        tabContentArray[i].className = 'inactive';
   }
   var focusTab = document.getElementById(tcmid);
   var focusTabContaner = focusTab.parentNode.parentNode;
   focusTabContaner.className = 'active';
   
   var obj = document.getElementById(hfToUpdate);
   obj.value = tcmid;
   __doPostBack(ctrlToPost,"");
}
