
/* --------------------------------------------------- */
/* DW ROLLOVERS */
/* --------------------------------------------------- */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function pl() {
	MM_preloadImages('images02/intbrand/1_on.jpg','images02/intbrand/2_on.jpg','images02/intbrand/3_on.jpg','images02/intbrand/4_on.jpg','images02/intbrand/5_on.jpg','images02/intbrand/6_on.jpg','images02/intbrand/7_on.jpg');
}


/* --------------------------------------------------- */
/* SHOW COPY FOR INTERNAL BRANDING */
/* --------------------------------------------------- */
function showcopy(which) {
	var toFill = document.getElementById('ib-text');
	if (which == "Image1") {
		toFill.innerHTML = 'Good internal branding involves more than a "top down" approach. It involves a co-creative effort between management and employees. It should be a highly collaborative process. If companies expect employees to live the brand, employees should play a major role in building it.';
	} else if (which == "Image2") {
		toFill.innerHTML = 'Defining your business and brand around a larger "purpose" can inspire and motivate employees and other key stakeholders. It demonstrates that your organization is about more than just making money, or winning. Having a purpose is ultimately about making a difference in and improving people’s lives. For example, P&G’s billion dollar-plus brand Pampers decided its purpose was really about "healthy babies," not just the fact that it is the category leader and absorbs better than Huggies. And, unlike a philanthropic or charitable cause that a company might get behind, a purpose springs directly from the strategic positioning of the company/brand. As such, it can have a profound, and very positive, effect on that most important audience – employees.';
	} else if (which == "Image3") {
		toFill.innerHTML = 'This is central to an effective internal branding effort. Companies need to “empower” their people with the proper tools, information and support for consistent brand representation. No empowerment leads to zero employee brand advocacy.';
	} else if (which == "Image4") {
		toFill.innerHTML = 'If employees are to be held accountable for performance and results, companies need to provide incentives that are appropriate for, and commensurate with, its branding efforts. Of course, incentives are a cornerstone of organizational management, cohesion and success, but they are especially important when employees become active evangelists of the brand. ';
	} else if (which == "Image5") {
		toFill.innerHTML = 'Internal Branding requires giving employees greater responsibility for creating and delivering the brand experience. In doing so, companies need to hold employees and management accountable to the goals of the internal branding program. As part of this, the internal branding objectives and key metrics need to be built into the performance goals of both employees and management.';
	} else if (which == "Image6") {
		toFill.innerHTML = 'Good internal branding programs depend on focused and inspiring education. This involves more than a high level knowledge of key messages and corporate color palettes. It involves a sound understanding of how your brand affects every area of your company&mdash;from the people you hire to your bottom line.';
	} else if (which == "Image7") {
		toFill.innerHTML = 'Measurement is just as important to an internal branding program as it is to an external marketing campaign. There is significant potential for companies to improve performance, strengthen and improve corporate culture and increase results through internal branding.';
	} else if (which == "none") {
		toFill.innerHTML = '&nbsp;';
	}
}



/* --------------------------------------------------- */
/* POP-UP WINDOW */
/* --------------------------------------------------- */
function openwin(URL,theHeight,theWidth,addScroll) {
	var nXpos = (screen.availWidth - theWidth) / 2; 
	var nYpos = (screen.availHeight - theHeight) / 2; 
	var win = window.open(URL, 'popupWin', 'top=' + nYpos + ',left=' + nXpos + ',screenY=' + nYpos + ',screenX=' + nXpos + ',height=' + theHeight + ',width=' + theWidth + 'toolbar=0,scrollbars=' + addScroll + ',location=0,statusbar=0,menubar=0');
	win.focus();
}


/* --------------------------------------- */
/* SHOW LAYERS */
/* --------------------------------------- */
function showMenu(divId,linkId) {
	var subMenu = document.getElementById(divId);
	var linkActive = document.getElementById(linkId);
	
	subMenu.style.visibility = 'visible';
	linkActive.className = 'mainOn';
	
}

/* --------------------------------------- */
/* HIDE LAYERS */
/* --------------------------------------- */
function hideMenu(divId,linkId) {
	var subMenu = document.getElementById(divId);
	var linkActive = document.getElementById(linkId);
	
	subMenu.style.visibility = 'hidden';
	linkActive.className = 'main';
}



/* --------------------------------------- */
/* CUSTOM SCROLLER */
/* --------------------------------------- */
//We wrap all the code in an object so that it doesn't interfere with any other code
var scroller = {
  init:   function() {
    //collect the variables
    scroller.docH = document.getElementById("news-content").offsetHeight;
    scroller.contH = document.getElementById("news-container").offsetHeight;
    scroller.scrollAreaH = document.getElementById("scrollArea").offsetHeight - 10;
      
    //calculate height of scroller and resize the scroller div
    //(however, we make sure that it isn't to small for long pages)
    scroller.scrollH = (scroller.contH * scroller.scrollAreaH) / scroller.docH;
    //if(scroller.scrollH < 15) scroller.scrollH = 15;
    document.getElementById("scroller").style.height = Math.round(scroller.scrollH) + "px";
    
    //what is the effective scroll distance once the scoller's height has been taken into account
    scroller.scrollDist = Math.round(scroller.scrollAreaH-scroller.scrollH);
    
    //make the scroller div draggable
    Drag.init(document.getElementById("scroller"),null,0,0,-1,scroller.scrollDist);
    
    //add ondrag function
    document.getElementById("scroller").onDrag = function (x,y) {
      var scrollY = parseInt(document.getElementById("scroller").style.top);
      var docY = 0 - (scrollY * (scroller.docH - scroller.contH) / scroller.scrollDist);
      document.getElementById("news-content").style.top = docY + "px";
    }
  }
}



/* --------------------------------------- */
/* OPEN EXTERNAL LINKS IN NEW WINDOW - XHTML COMPLIANT */
/* --------------------------------------- */
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
}
window.onload = externalLinks;




/* --------------------------------------- */
/* SHOW / HIDE LAYERS */
/* --------------------------------------- */
function showLayer(showId) {
	var txtId = showId + '-txt';
	var overlayId = showId + '-overlay';
	var first = document.getElementById(txtId);
	var second = document.getElementById(overlayId);
	first.style.visibility = 'visible';
	second.style.visibility = 'visible';
}

function hideLayer(showId) {
	var txtId = showId + '-txt';
	var overlayId = showId + '-overlay';
	var first = document.getElementById(txtId);
	var second = document.getElementById(overlayId);
	first.style.visibility = 'hidden';
	second.style.visibility = 'hidden';
}




/* --------------------------------------------------- */
/* DROP DOWN MENUS (MAIN NAV) */
/* --------------------------------------------------- */
function createDiv(divId) {
	var newdiv = document.createElement('div');
	var pagediv = document.getElementById('page').offsetHeight;
	var footerdiv = document.getElementById('footer').offsetHeight;
	var newHeight = (pagediv + footerdiv + 80);
	newdiv.setAttribute('id', divId);
	newdiv.style.position = 'absolute';
	newdiv.style.top = '0';
	newdiv.style.left = '0';
	newdiv.style.zIndex = '15';
	newdiv.style.width = '100%';
	newdiv.style.height = newHeight + 'px';
	newdiv.innerHTML = '';
 	newdiv.style.background = "#000000";
 	newdiv.className = "opacity50";
 	document.body.appendChild(newdiv);
}




/* --------------------------------------------------- */
/* DROP DOWN MENUS (MAIN NAV) */
/* --------------------------------------------------- */
function showDivPop(divId) {
	var subMenu = document.getElementById(divId);
	var fader = document.getElementById('fadeout');
	
	subMenu.style.left = ((window.screen.availWidth - 405) / 2) + 'px';
	subMenu.style.visibility = 'visible';
	subMenu.className = "popup";
	
	alert(window.screen.availWidth);
	
	fader.style.visibility = 'visible';
}

function hideDivPop(divId) {
	var subMenu = document.getElementById(divId);
	var fader = document.getElementById('fadeout');
	
	fader.style.visibility = 'hidden';
	subMenu.style.visibility = 'hidden';
}



/* --------------------------------------------------- */
/* ACTIVATE MAIN-LINK */
/* --------------------------------------------------- */
function showMainOn(theId) {
	var divId = document.getElementById(theId);
	divId.className = 'mainnav-on';
}


/* --------------------------------------------------- */
/* ACTIVATE SUB-LINK */
/* --------------------------------------------------- */
function showSubOn(theId) {
	var divId = document.getElementById(theId);
	divId.className = 'subnav-link-on';
}


/* --------------------------------------------------- */
/* SUB-LINK ROLLOVERS */
/* --------------------------------------------------- */
function rollOver(theId) {
	var divId = document.getElementById(theId);
	divId.className = 'subnav-link-over';
}

function rollOff(theId, currentpage) {
	var divId = document.getElementById(theId);
	if (theId !== currentpage) {
		divId.className = 'subnav-link';
	} else {
		divId.className = 'subnav-link-on';
	}
}



/* --------------------------------------------------- */
/* SET ARRAY OF CLIENT PAGES */
/* --------------------------------------------------- */
var clientArray = new Array();
clientArray[0] = "extra-space-storage.php";
clientArray[1] = "factiva.php";
clientArray[2] = "johnson-johnson.php";
clientArray[3] = "match.php";
clientArray[4] = "maveron.php";
clientArray[5] = "mckesson.php";
clientArray[6] = "omni-id.php";
clientArray[7] = "rex-co.php";
clientArray[8] = "td-ameritrade.php";
clientArray[9] = "tcg.php";
clientArray[10] = "valleycrest.php";
clientArray[11] = "worldhealth.php";
clientArray[12] = "zantaz.php";
clientArray[13] = "lbhe.php";



function showDefault() {
	document.getElementById('project-images').innerHTML = '<img src="' + imageArray[0] + '">';
}

function next(keyValue) {
	if (currentKey < (imageArray.length - 1)) {
		keyValue = keyValue + 1;
		currentKey++;
	} else {
		
		var nextClient = clientArray[currentClientKey + 1];
		if (currentClientKey == 13) {
			window.location = clientArray[0];
		} else {
			window.location = nextClient;
		}
		
		//window.location = clientArray[currentClientKey + 1];
		//keyValue = 0;
		//currentKey = 0;
	}
	return imageArray[keyValue];
}

function previous(keyValue) {
	var openPage;
	if (currentKey <= (imageArray.length - 1) && currentKey !== 0) {
		keyValue = keyValue - 1;
		currentKey--;
	} else {
		
		var nextClient = clientArray[currentClientKey - 1];
		if (currentClientKey == 0) {
			window.location = clientArray[13];
		} else {
			window.location = nextClient;
		}
		//keyValue = (imageArray.length - 1);
		//currentKey = (imageArray.length - 1);
	}
	return imageArray[keyValue];
}




/* --------------------------------------------------- */
/* ROLL OVERS BY REPLACING TEXT - OUR WORK SECTION */
/* --------------------------------------------------- */
function rollOverWork(imageId) {
	var newString = imageId.src.replace("_off","_on");
	imageId.src = newString;
}

function rollOutWork(imageId) {
	var newString = imageId.src.replace("_on","_off");
	imageId.src = newString;
}



/* --------------------------------------------------- */
/* ROLL OVERS BY REPLACING TEXT - OUR PEOPLE SECTION */
/* --------------------------------------------------- */
function rollOverStaff(theId) {
	if (theId.id.substring(0,4) == "link") {
		var cleanId = theId.id.substring(4);
		var theImageId = document.getElementById(cleanId);
		var newImage = theImageId.src.replace("_off","_on");
		theImageId.src = newImage;
	} else {
		var newLinkString = "link" + theId.id;
		var newLink = document.getElementById(newLinkString).className = "staffOn";
		var newString = theId.src.replace("_off","_on");
		theId.src = newString;
	}
}

function rollOutStaff(theId) {
	if (theId.id.substring(0,4) == "link") {
		var cleanId = theId.id.substring(4);
		var theImageId = document.getElementById(cleanId);
		var newImage = theImageId.src.replace("_on","_off");
		theImageId.src = newImage;
	} else {
		var newLinkString = "link" + theId.id;
		var newLink = document.getElementById(newLinkString).className = "";
		var newString = theId.src.replace("_on","_off");
		theId.src = newString;
	}
}


/* --------------------------------------------------- */
/* SHOW PAGES ON TRANDWATCH */
/* --------------------------------------------------- */
function showPage(thePage) {
	var theVar = "page" + thePage;
	var page = document.getElementById(theVar);
	page.style.visibility = 'visible';
}