﻿// JavaScript Document
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


function changeLeftNavHeight(){
var boxHeight = document.getElementById('content').clientHeight;
document.getElementById('leftNavBG').style.height = boxHeight+"px";
}
// JavaScript Document
var tabImages = new Array("Create_Tab.gif", "Optimize&Promote_Tab.gif", "benefits_Tab.gif", "the-conduit-network_Tab.gif")
function changeTab(i){
document.getElementById("TheTabsImg").src = "/images/newmarketing/images/tabs/"+tabImages[i-1];
for(t=1;t<5;t++){
document.getElementById("tab0"+t+"Content").style.position = "absolute";
document.getElementById("tab0"+t+"Content").style.zIndex = "-2";
}
document.getElementById("tab0"+i+"Content").style.height = "auto";
document.getElementById("tab0"+i+"Content").style.zIndex = "1";
document.getElementById("tab0"+i+"Content").style.position = "relative";
document.getElementById("rightTabBorder").style.height = "278px";
document.getElementById("leftTabBorder").style.height = "300px";
var nodesArray=new Array();
var arrayNumber = 0;
for(t=0; t<document.getElementById("tab0"+i+"Content").childNodes.length;t++)
{
if(document.getElementById("tab0"+i+"Content").childNodes[t].nodeType == 1){
nodesArray [arrayNumber] = t;
//alert(t);
arrayNumber += 1;
}
}
for(t=2;t<(nodesArray.length);t++){
var childNodesArray=new Array();
var childArrayNumber = 0;
for(c=0; c < document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes.length; c++){
//alert(c);
if(document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[c].nodeType == 1){
childNodesArray[childArrayNumber] = c;
childArrayNumber += 1;
}
}
if(document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[0]].className == "tabBulletTitle" && document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[1]].className == "tabBulletText")
{
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[0]].childNodes[0].src = "/images/newmarketing/images/tabs/ArrowRegular.gif";
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[0]].style.color = "#5daabf";
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[1]].style.position= "absolute";
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[1]].style.zIndex = "-2";
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[1]].style.height= "0px";
document.getElementById("tab0"+i+"Content").childNodes[nodesArray[t]].childNodes[childNodesArray[1]].style.fontSize= "0px";
}
}
expandcollapseBulletTab(document.getElementById("tab0"+i+"Content").childNodes[nodesArray[2]].childNodes[childNodesArray[0]]);
//alert(document.getElementById("tab0"+i+"Content").childNodes[nodesArray[0]].childNodes[childNodesArray[0]].innerHTML);
}
function expandcollapseBulletTab(obj){
var nodesArray=new Array();
var arrayNumber = 0;
for(i=0; i<obj.parentNode.childNodes.length; i++){
if(obj.parentNode.childNodes[i].nodeType == 1){
nodesArray [arrayNumber] = i;
arrayNumber += 1;
}
}
//alert(obj.parentNode.childNodes[nodesArray[1]].innerHTML);

if(obj.parentNode.childNodes[nodesArray[1]].style.zIndex == "-2" || obj.parentNode.childNodes[nodesArray[1]].style.position == "absolute"){
obj.style.color = "#e03f05";
obj.childNodes[0].src = "/images/newmarketing/images/tabs/ArrowDown.gif";
obj.parentNode.childNodes[nodesArray[1]].style.zIndex = "1";
obj.parentNode.childNodes[nodesArray[1]].style.position = "relative";
obj.parentNode.childNodes[nodesArray[1]].style.height = "auto";
obj.parentNode.childNodes[nodesArray[1]].style.fontSize = "12px";
}
else
{
obj.style.color = "#5daabf";
obj.childNodes[0].src = "/images/newmarketing/images/tabs/ArrowRegular.gif";
obj.parentNode.childNodes[nodesArray[1]].style.zIndex = "-2";
obj.parentNode.childNodes[nodesArray[1]].style.position = "absolute";
obj.parentNode.childNodes[nodesArray[1]].style.height = "0px";
obj.parentNode.childNodes[nodesArray[1]].style.fontSize = "0px";
}
var BoxHeight = document.getElementById("tab02Content").clientHeight;
if(obj.parentNode.parentNode.clientHeight > 251){
document.getElementById("rightTabBorder").style.height = (obj.parentNode.parentNode.clientHeight + 10) + "px";
document.getElementById("leftTabBorder").style.height = (obj.parentNode.parentNode.clientHeight + 32) + "px";
}
else
{
document.getElementById("rightTabBorder").style.height = "278px";
document.getElementById("leftTabBorder").style.height = "300px";
}
}
function mainMenuOver(obj, chgColor){
obj.style.color = chgColor;
//alert(chgColor);
}

function mainMenuOut(obj, chgColor){
obj.style.color = chgColor;
//alert(chgColor);
}

function headerOver(obj, chgColor){
obj.style.color = chgColor;
obj.childNodes[1].src = "/images/newmarketing/images/Header/ArrowRoll-Over.gif";
//alert(chgColor);
}

function headerOut(obj, chgColor){
obj.style.color = chgColor;
obj.childNodes[1].src = "/images/newmarketing/images/Header/Arrow.gif";
//alert(chgColor);
}
function buttonOut(obj, img)
{
	obj.src = img;	
}

function buttonOver(obj, img)
{
	obj.src = img;	
}

function openOverlay()
{
	document.getElementById("overlay").style.display = "inline";
	document.getElementById("overlayBox").style.display = "inline";
	document.getElementById("overlayBox").innerHTML = '<div style="width:532px;height:18px;border:none;"><div style="width:514px;height:18px;float:left;background:url(/images/newmarketing/images/MainPart/closeNEWleft.gif);background-repeat:no-repeat;"></div><div style="width:18px;height:18px;float:left;"><input type="button" onclick="closeOverlay();pageTracker._trackPageview(\'/homepage/video/close-video/virtual/\');" style="background:url(/images/newmarketing/images/MainPart/closeNEWright.gif);background-repeat:no-repeat;width:18px;height:18px;border:none;" /></div></div><div style="width:532px;height:355px;border:none;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="532" height="334"><param name="movie" value="/images/newmarketing/flash/homepagemov.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/images/newmarketing/flash/homepagemov.swf" quality="high" wmode="transparent" bgcolor="#ffffff" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="532" height="334"></embed></object></div>';
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
 var ieversion=new Number(RegExp.$1) 
if (ieversion<=6 && navigator.appName == "Microsoft Internet Explorer")
  {
                                document.getElementById("overlayBox").style.position = "absolute";
  }
                }

}

function closeOverlay()
{
	document.getElementById("overlay").style.display = "none";
	document.getElementById("overlayBox").style.display = "none";
	document.getElementById("overlayBox").innerHTML = "";
}

// search functions

function newSearch(){
var searchValue
searchValue = document.getElementById('searchbox').value;
if(searchValue == "  search...")
{
}
else
{
window.location = "http://www.conduit.com/resource-center/search.aspx?cx=010301873083402539744%3Anxaq5wgrtuo&cof=FORID%3A11&ie=UTF-8&q="+searchValue+"&sa=Search#204";
}
//alert(searchValue);
}
function detectEnter(ev) {
  arrows=((ev.which)||(ev.keyCode));
switch(arrows) {
 case 13:
  // alert('enter');
  //hide_submit( "submit_button" , "please wait for the page to refresh" );
  newSearch();
   break;
  }
 }

  function hide_submit( elementId, content ){
  		if( document.all ){
			document.all( elementId ).innerHTML = content;
		}else	if( document.getElementById ){
			rng = document.createRange();
			el = document.getElementById( elementId );
			rng.setStartBefore( el );
			htmlFrag = rng.createContextualFragment( content );
			while( el.hasChildNodes() ){
				el.removeChild( el.lastChild );
			}
			el.appendChild( htmlFrag );
		}
return false;
		document.form.submit();
  }
function noenter() {
  return !(window.event && window.event.keyCode == 13);
}

function ClearText(){
if (document.getElementById('searchbox').value == "  search..."){
document.getElementById('searchbox').value = "";
document.getElementById('searchbox').style.color = "#000000";
}
}
function addSearch(){
if (document.getElementById('searchbox').value == ""){
document.getElementById('searchbox').style.color = "#909090";
document.getElementById('searchbox').value = "  search...";
}
}

