﻿// JScript File
var externWin;
var newWin;

function openPortfolioWindow(strContent, myHeight, myWidth, blnShowClose, blnShowPrev, blnShowNext){
	
	if (newWin != null) {
		newWin.close();
	}
	
	newWin = window.open('/compelling_creative/portfolio/portfolio_item.aspx?fldEntryID=' + strContent + '&fldHeight=' + myHeight + '&fldWidth=' + myWidth +'&fldShowClose=' + blnShowClose +'&fldShowPrev=' + blnShowPrev +'&fldShowNext=' + blnShowNext +'&fldTest', "myWindow", "HEIGHT=" + (myHeight + 65) + ", WIDTH=" + (myWidth + 75) + ",resizable=yes,top=50,left=50,scrollbars=yes");	
		
}

function openPopupName(strName, strURL, intHeight, intWidth, intTop, intLeft, blnLocation, blnMenuBar, blnResizable, blnScrollbars, blnStatus, blnToolbar) {

	if (!externWin || externWin.closed){
		externWin = window.open(strURL, strName, "height=" + intHeight +  ",width=" + intWidth + ",top=" + intTop + ",left=" + intLeft + ",location=" + blnLocation + ",menubar=" + blnMenuBar + ",resizable=" + blnResizable + ",scrollbars=" + blnScrollbars + ",status=" + blnStatus + ",toolbar=" + blnToolbar);
	}
	else{
		externWin.location = strURL;
		externWin.focus();
	}
	
}

function print_mail_to_link(lhs, strName, rhs) {
		document.write("<A HREF=\"mailto");
		document.write(":" + lhs + "@");
		document.write(rhs + "\">" + strName + "<\/a>");
}

var secs;
var timerID = null;
var timerRunning = false;
var timerPaused = false;
var delay = 1000;

function showSubNav(mySubNavID, myParentID) {
    timerRunning = false;
    timerPaused = false;
    resetNavBlocks();
    StopTheClock();
    // Set the length of the timer, in seconds
    secs = 2;
    StartTheTimer();
    document.getElementById(mySubNavID).style.display = "block";
    document.getElementById(myParentID).className = 'MainNavWSubOnChildHover';
    document.getElementById(myParentID).style.textDecoration = "none";
}

function StopTheClock() {
    if(timerRunning) {
        clearTimeout(timerID);
        timerRunning = false;
        timerPaused = false;
        resetNavBlocks();
    }
}

function StartTheTimer() {
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
    }
    else if (!timerPaused)
    {
        //self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}

function PauseTheTimer() {
    timerPaused = true;
}

function RestartTheTimer() {
    timerPaused = false;
}

function resetNavBlocks() {
    document.getElementById('dvB2BSubNav').style.display = "none";
    document.getElementById('dvCCSubNav').style.display = "none";
    document.getElementById('dvExp').style.display = "none";
    document.getElementById('dvIdeas').style.display = "none";
    
    document.getElementById('Ideas').className = "MainNavWSub";
    document.getElementById('Experience').className = "MainNavWSub";
    document.getElementById('Creative').className = "MainNavWSub";
    document.getElementById('Branding').className = "MainNavWSub";
    
}

function checkSearchTerm(searchBox) {
    if (searchBox.value == 'Search') {
        searchBox.value = '';
    }
}

/* start product related page scripts */
function showProdSection(strSectionId){
	if (document.getElementById(strSectionId) && document.getElementById(strSectionId).style.display != "block") {
		//Hide all sections first
		hideProdSection("prodDescription");
		hideProdSection("prodAccessories");
		hideProdSection("prodAppNotes");
		hideProdSection("prodControllers");
		hideProdSection("prodModes");

		document.getElementById(strSectionId).style.display = "block";
		if (document.getElementById('option_'+strSectionId)) {
			document.getElementById('option_'+strSectionId).className = "prodSectionOn";
		}
	}
}
function hideProdSection(strSectionId){
	if (document.getElementById(strSectionId)){
		document.getElementById(strSectionId).style.display = "none";
		if (document.getElementById('option_'+strSectionId)) {
			document.getElementById('option_'+strSectionId).className = "prodSectionOff";
		}
	}
}

function showProdSectionSubItem(strSectionPrefix, intAccNum, intNumAcc){
	if(document.getElementById(strSectionPrefix+'_'+intAccNum).style.display != "block"){
		for(i=0;i<intNumAcc;i++){
			if (i != intAccNum){
				document.getElementById(strSectionPrefix+'_'+i).style.display = "none";
				document.getElementById(strSectionPrefix+'Link_'+i).className = "prodUlOff";
			}
		}
		document.getElementById(strSectionPrefix+'_'+intAccNum).style.display = "block";
		document.getElementById(strSectionPrefix+'Link_'+intAccNum).className = "prodUlOn";
	}
}


    function unCheckMe(myObj) {
        myObj.selected=false;
    }



function unhide()
{
document.getElementById('moreid').style.display='block';
document.getElementById('hidemore').style.display='none';
}

function hide()
{
document.getElementById('moreid').style.display='none';
document.getElementById('hidemore').style.display='block';
}



/* end product related page scripts */




/* scripts below for user manuals */

/* general script


function popup(url){
	if (browser) {
		var floater = null
		floater = window.open('','vRemote','toolbar=no,width=1000,height=700,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=yes')
			if (floater != null)
				{
					if (floater.opener == null)
						{
							floater.opener = self
						}
					floater.location.href = url;
					floater.opener.name = 'mainwindow'
			 	}
	   		} 
		}
		
function closeWindow() {
	window.opener = 2  //we set this so that IE would not ask stupid question
	window.open('','_parent','');
	window.close();
}
 

*/