
function ChangeImage( strImageName, strNewImage )
{
	if ( bLoaded == true )
		document.images[strImageName].src = eval(strNewImage + ".src");
}

function CreateImage( strPath )
{
	var theImage = new Image();
	theImage.src = strPath;
	return theImage;
}

function DocumentObject( strObjectID, bWithStyle )
{
	if (bWithStyle)
	{
		if (document.getElementById) return (document.getElementById(strObjectID).style); 
		else if (document.all) return (document.all[strObjectID].style); 
		else if ((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) == 4)) return (document.layers[strObjectID]); 
	}
	else
	{
		if (document.getElementById) return (document.getElementById(strObjectID)) ; 
		else if (document.all) return (document.all[strObjectID]); 
		else if ((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) == 4)) return (document.layers[strObjectID]); 
	}
}

var iSelectedPage = String("");	
var iSelectedLeft = String("");
var strSelectedLabel = String("");
var strSelectedLabel2 = String("");
function showPage( iPage,iLeft,strLabel,strLabel2 )
{	
	// Show Layer
	DocumentObject( 'view_div', true ).display = "inline";
	
	if ( strSection == "viewpoints" || strSection == "in the news" || strSection == "press releases"  )
	{		
		// Display Contents
		if ( iSelectedPage != "" )
		{
			DocumentObject( 'copy_' + iSelectedPage + '_div', true ).display = "none";
		}
		DocumentObject( 'copy_' + iPage + '_div', true ).display = "inline";
	}
	else if ( strSection == "identities" || strSection == "packaging" )
	{
		// Display Photos
		ChangeImage('photo1','page_left[' + iPage + ']');
		if ( iSelectedPage != "" ) {
			DocumentObject( 'identity-' + iSelectedPage + '-copy', true ).display = 'none';
		}
		DocumentObject( 'identity-' + iPage + '-copy', true ).display = 'block';
	} else {
		// Display Photos
		ChangeImage('photo1','page_left[' + iPage + ']');
		ChangeImage('photo2','page_right[' + iPage + ']');
	}
	
	// Mark Page Selected
	DocumentObject( 'page' + iPage, false ).innerHTML = "<font color=\"#EE1C24\">" + iPage + "</font>";
		if ( iSelectedPage != "" && iSelectedPage != iPage )
		{
			strRebuildLink = String("");
			strRebuildLink += "<a href=\"Javascript:showPage('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
			strRebuildLink += ");\" ";
			strRebuildLink += "onmouseover=\"showLabel('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
			strRebuildLink += ");\" ";
			strRebuildLink += "onmouseout=\"hideLabel();\" "; 
			strRebuildLink += "class=\"white\">" + iSelectedPage + "</a>";

			DocumentObject( 'page' + iSelectedPage, false ).innerHTML = strRebuildLink;
		}
		
	iSelectedPage = iPage;
	iSelectedLeft = iLeft;
	strSelectedLabel = strLabel;
	// if ( strSection == "identities" )
	// 	strSelectedLabel2 = strLabel2;	
	
	// Display Label
	showLabel(iPage,iLeft,strLabel,strLabel2);
}

function showLabel( iPage,iLeft,strLabel,strLabel2 )
{
	DocumentObject( 'view_label_div', true ).left = iLeft + "px";
	DocumentObject( 'view-label', false ).innerHTML = "<font color=\"#EE1C24\">" + strLabel + "</font>";
	// Display Label 2 if Identities section
	// if ( strSection == "identities" )
	// 	DocumentObject( 'view-label2', false ).innerHTML = "<font color=\"#EE1C24\">" + strLabel2 + "</font>";
}

function hideLabel()
{
	DocumentObject( 'view-label', false ).innerHTML = "";
	
	// if ( strSection == "identities" )
	// 	DocumentObject( 'view-label2', false ).innerHTML = "";

	// Show Selected Label if necessary
	if ( iSelectedPage != "" ){
		showLabel( iSelectedPage,iSelectedLeft,strSelectedLabel,strSelectedLabel2 );
		}
}

function hidePage()
{
	// Hide Layers
	DocumentObject( 'view_div', true ).display = "none";

	// Hide Stories if necessary
	if ( strSection == "viewpoints" || strSection == "in the news" || strSection == "press releases"  )
	{	
		if ( iSelectedPage != "" )
		{
			DocumentObject( 'copy_' + iSelectedPage + '_div', true ).display = "none";
		}
	}
	else if ( strSection != "identities" && strSection != "packaging" )
	{
		DocumentObject( 'cs_press', true ).display = 'none';
		DocumentObject( 'cs_awards', true ).display = 'none';
		DocumentObject( 'cs_testimonial', true ).display = 'none';
		DocumentObject( 'cs_text', true ).display = 'inline';
	}
	else if ( strSection == "identities"  &&  iSelectedPage != ""  ||  strSection == "packaging"  &&  iSelectedPage != "" ) {
		DocumentObject( 'identity-' + iSelectedPage + '-copy', true ).display = 'none';
	}
				
	if ( iSelectedPage != "" )
	{
		strRebuildLink = String("");
		strRebuildLink += "<a href=\"Javascript:showPage('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseover=\"showLabel('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseout=\"hideLabel();\" "; 
		strRebuildLink += "class=\"white\">" + iSelectedPage + "</a>";

		DocumentObject( 'page' + iSelectedPage, false ).innerHTML = strRebuildLink;
	}
	
	iSelectedPage = "";
		
	// Hide Label
	hideLabel();

}

	

// Declare Case Study Order
var ClientName = new Array();
ClientName[0] = "cnd";
ClientName[1] = "gateway";
ClientName[2] = "gordon";
ClientName[3] = "invitrogen";
ClientName[4] = "jabra";
ClientName[5] = "mediaflo";
ClientName[6] = "sega";
ClientName[7] = "shure";
ClientName[8] = "starbucks";
ClientName[9] = "taylor";
ClientName[10] = "taylorT5";
ClientName[11] = "vulcan";
ClientName[12] = "walmart";
ClientName[13] = "arena";
ClientName[14] = "lux";



		
function NextClient(strClient,bForward)
{
	for (var i = 0; i < ClientName.length; i++) {
		
		if ( ClientName[i] == strClient )
		{
			iTemp = i;
		}
	}
	if ( bForward )
	{
		iCurrentClient = ( iTemp == "14" ? "0" : ( Number(iTemp) + 1 ) );
	}
	else
	{
		iCurrentClient = ( iTemp == "0" ? "14" : ( Number(iTemp) - 1 ) );
	}
	
	// Go to next client
	document.location = "/view/case-studies/" + ClientName[iCurrentClient] + "/";
	
}
		
function previousPage()
{
	if ( strSection == "case-studies"  )
	{
		iTempPages = "0"
	}
	else
	{
		iTempPages = iPages
	}	
	
		i = ( iSelectedPage == "" ? iTempPages : Number(iSelectedPage) - 1 );

	if ( i <= 0 )
	{
		if ( strSection == "case-studies"  )
		{	
			// go to next section, first, get location
			NextClient(strClient,false);
		}
		else
		{
			hidePage();
		}

	}
	else
	{
		showPage( aPage[i][0],aPage[i][1],aPage[i][2],aPage[i][3] );
	}

}
	
function nextPage()
{
	
	i = ( iSelectedPage == "" ? "1" : Number(iSelectedPage) + 1 );
	
	if ( i > iPages )
	{
		if ( strSection == "case-studies"  )
		{	
			// go to next section, first, get location
			NextClient(strClient,true);
		}
		else
		{
			hidePage();
		}
	}
	else
	{
		showPage( aPage[i][0],aPage[i][1],aPage[i][2],aPage[i][3] );
	}

}

function writePages()
{
	for (i=1; i <= iPages; i++)
	{
		document.write("<td><div id=\"page" + i + "\"><a href=\"Javascript:showPage(aPage[" + i + "][0],aPage[" + i + "][1],aPage[" + i + "][2],aPage[" + i + "][3]);\" onmouseover=\"showLabel(aPage[" + i + "][0],aPage[" + i + "][1],aPage[" + i + "][2],aPage[" + i + "][3]);\" onmouseout=\"hideLabel();\" class=\"white\">" + i + "</a></div></td>");
		document.write("<td><img src=\"/global/images/spacer.gif\" width=10 height=1 border=0></td>");
	}
	document.write("<td><a href=\"Javascript:previousPage();\" onmouseover=\"if ( bLoaded ) { ChangeImage('page_arrow_left','page_arrow_left_on'); }\" onmouseout=\"if ( bLoaded ) { ChangeImage('page_arrow_left','page_arrow_left_off'); }\"><img src=\"/global/images/page_arrow-left_off.gif\" width=7 height=11 border=0 name=\"page_arrow_left\"></a></td>");
	document.write("<td><img src=\"/global/images/spacer.gif\" width=7 height=1 border=0></td>");
	document.write("<td><a href=\"Javascript:nextPage();\" onmouseover=\"if ( bLoaded ) { ChangeImage('page_arrow_right','page_arrow_right_on'); }\" onmouseout=\"if ( bLoaded ) { ChangeImage('page_arrow_right','page_arrow_right_off'); }\"><img src=\"/global/images/page_arrow-right_off.gif\" width=7 height=11 border=0 name=\"page_arrow_right\"></a></td>");
}

function write2006NewsPages(){
	for (i=1; i <= iPages; i++){
		document.write("<td><div id=\"page" + i + "\"><a href=\"/confirm/in_the_news/2006/" + i + "\" onmouseover=\"showLabel(aPage[" + i + "][0],aPage[" + i + "][1],aPage[" + i + "][2],aPage[" + i + "][3]);\" onmouseout=\"hideLabel();\" class=\"white\">" + i + "</a></div></td>");
		document.write("<td><img src=\"/global/images/spacer.gif\" width=10 height=1 border=0></td>");
	}
}

function write2005NewsPages(){
	for (i=1; i <= iPages; i++){
		document.write("<td><div id=\"page" + i + "\"><a href=\"/confirm/in_the_news/2005/" + i + "\" onmouseover=\"showLabel(aPage[" + i + "][0],aPage[" + i + "][1],aPage[" + i + "][2],aPage[" + i + "][3]);\" onmouseout=\"hideLabel();\" class=\"white\">" + i + "</a></div></td>");
		document.write("<td><img src=\"/global/images/spacer.gif\" width=10 height=1 border=0></td>");
	}
}

function write2004NewsPages(){
	for (i=1; i <= iPages; i++){
		document.write("<td><div id=\"page" + i + "\"><a href=\"/confirm/in_the_news/2004/" + i + "\" onmouseover=\"showLabel(aPage[" + i + "][0],aPage[" + i + "][1],aPage[" + i + "][2],aPage[" + i + "][3]);\" onmouseout=\"hideLabel();\" class=\"white\">" + i + "</a></div></td>");
		document.write("<td><img src=\"/global/images/spacer.gif\" width=10 height=1 border=0></td>");
	}
}



// for CND pages with before and after sections ///////////////////////////////////////
function switchView(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('section-3').className = ( (id==3) ? 'show' : 'hide');
	document.getElementById('section-4').className = ( (id==4) ? 'show' : 'hide');
	document.getElementById('section-5').className = ( (id==5) ? 'show' : 'hide');
	document.getElementById('section-6').className = ( (id==6) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////

// for Shure pages with before and after sections ///////////////////////////////////////
function switchViewShure(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('section-3').className = ( (id==3) ? 'show' : 'hide');
	document.getElementById('section-4').className = ( (id==4) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////

// for Gordon pages with before and after sections ///////////////////////////////////////
function switchViewGordon(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('section-3').className = ( (id==3) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////

// for Gateway pages with before and after sections ///////////////////////////////////////
function switchViewGateway(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////

// for Invitrogen pages with before and after sections ///////////////////////////////////////
function switchViewInvitrogen(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////

// for Lux pages with before and after sections ///////////////////////////////////////
function switchViewLux(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('section-3').className = ( (id==3) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////


// for Jabra pages with before and after sections ///////////////////////////////////////
function switchViewJabra(id){
	document.getElementById('intro').className = ( (id=='intro') ? 'show' : 'hide');
	document.getElementById('section-1').className = ( (id==1) ? 'show' : 'hide');
	document.getElementById('section-2').className = ( (id==2) ? 'show' : 'hide');
	document.getElementById('cs_press-section').className = ( (id=='cs_press') ? 'show' : 'hide');
	document.getElementById('cs_testimonials').className = ( (id=='cs_testimonials') ? 'show' : 'hide');
	document.getElementById('before-after').className = ( (id=='before-after') ? 'show' : 'hide');
}
////////////////////////////////////////////////////////////////////////////////////


function showPress()
{
	// Hide Layers
	DocumentObject( 'view_div', true ).display = "none";
				
	if ( iSelectedPage != "" )
	{
		strRebuildLink = String("");
		strRebuildLink += "<a href=\"Javascript:showPage('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseover=\"showLabel('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseout=\"hideLabel();\" "; 
		strRebuildLink += "class=\"white\">" + iSelectedPage + "</a>";

		DocumentObject( 'page' + iSelectedPage, false ).innerHTML = strRebuildLink;
	}
	
	iSelectedPage = "";
		
	// Hide Label
	hideLabel();

	DocumentObject( 'cs_awards', true ).display = 'none';
	DocumentObject( 'cs_testimonial', true ).display = 'none';
	DocumentObject( 'cs_text', true ).display = 'none';
	DocumentObject( 'cs_press', true ).display = 'inline';
}

function showTestimonials()
{
	// Hide Layers
	DocumentObject( 'view_div', true ).display = "none";
				
	if ( iSelectedPage != "" )
	{
		strRebuildLink = String("");
		strRebuildLink += "<a href=\"Javascript:showPage('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseover=\"showLabel('" + iSelectedPage + "','" + iSelectedLeft + "','" + strSelectedLabel + "'";
		strRebuildLink += ");\" ";
		strRebuildLink += "onmouseout=\"hideLabel();\" "; 
		strRebuildLink += "class=\"white\">" + iSelectedPage + "</a>";

		DocumentObject( 'page' + iSelectedPage, false ).innerHTML = strRebuildLink;
	}
	
	iSelectedPage = "";
		
	// Hide Label
	hideLabel();

	DocumentObject( 'cs_text', true ).display = 'none';
	DocumentObject( 'cs_press', true ).display = 'none';
	DocumentObject( 'cs_awards', true ).display = 'none';
	DocumentObject( 'cs_testimonial', true ).display = 'inline';
}
	
var strSelectedFeature = String( "" );
function FeatureLayer(strFeature)
{
	// Highlight the feature
	if ( strFeature != strSelectedFeature )
	{
		if ( strSelectedFeature != "" )
		{
			DocumentObject( 'feature_contents_' + strSelectedFeature, true ).display = "none";
		}
		DocumentObject( 'feature_contents_default', true ).display = "none";
		DocumentObject( 'feature_contents_' + strFeature, true ).display = "inline";
		strSelectedFeature = strFeature;
	}
	else
	{
		DocumentObject( 'feature_contents_default', true ).display = "inline";
		DocumentObject( 'feature_contents_' + strFeature, true ).display = "none";
		
		strFeature = "";
		strSelectedFeature = "";
	}

}



function printFlash(source, width, height, id, bg_color, flashVars) {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle" />');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name=flashVars value="'+flashVars+'" />');
document.write('<param name="movie" value="'+source+'" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="bgcolor" value="'+bg_color+'" />');
document.write('<embed src="'+source+'" flashVars="'+flashVars+'" menu="false" quality="high" bgcolor="'+bg_color+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}