//sub imperative buttons
var imgRoot = "/pages/docs/exp/images/dbd/btn_";
impImageArray=new Array();
impImageArray[0]=imgRoot+'btn_lead_0.gif';
impImageArray[1]=imgRoot+'btn_lead_1.gif';
impImageArray[2]=imgRoot+'btn_anticipate_0.gif';
impImageArray[3]=imgRoot+'btn_anticipate_1.gif';
impImageArray[4]=imgRoot+'btn_strategize_0.gif';
impImageArray[5]=imgRoot+'btn_strategize_1.gif';
impImageArray[6]=imgRoot+'btn_organize_0.gif';
impImageArray[7]=imgRoot+'btn_organize_1.gif';
impImageArray[8]=imgRoot+'btn_deliver_0.gif';
impImageArray[9]=imgRoot+'btn_deliver_1.gif';
impImageArray[10]=imgRoot+'btn_measure_0.gif';
impImageArray[11]=imgRoot+'btn_measure_1.gif';
preloadImages(impImageArray);

function exp_imgSwap(nav, mode, newImgRoot){
    tempImgRoot = newImgRoot ? newImgRoot : imgRoot;    
	imgSrc=tempImgRoot + nav + '_' + mode + '.gif';
	imgSwap(nav,imgSrc);
}

//used for random qoute generation
var qDirectory='/pages/docs/exp/images/promos/qoute/';
var qFilePrefix='q';

function getQouteImg(){
	var randNum = randomNumber(1, qArray.length);
	document.write('<a href="javascript:void(0);" onclick="swapQoute();return false;"><img name="qoute_image" src="' + qDirectory + qFilePrefix + randNum + '.gif" width="132" height="134" border="0"></a>');
}

function swapQoute(){
	var newNum=0;
	var currentFileSource = document.images['qoute_image'].src;
	var currentImageIndex = currentFileSource.charAt(currentFileSource.length-5);  
	
	//verify that the new file index is not out of bounds
	if(currentImageIndex == qArray.length){
		newNum = 1; 
	//otherwise increment nuewNum
	} else {
		newNum = Math.round(currentImageIndex) + 1;
	}
	
	//assign new image
	document.images['qoute_image'].src = qDirectory + qFilePrefix + newNum + '.gif';
}

function exp_dbd_loadtheCookies(){
	theCookies=0;
	if(!theCookies) theCookies = new Array();	
	var cookieArray = document.cookie.split(';');

	for(i=0;i<cookieArray.length;i++){
		var nameValue = cookieArray[i].split('=');
		if(nameValue[0].substring(0,1)==" ") nameValue[0] = nameValue[0].substring(1);
		theCookies[nameValue[0]]=nameValue[1];
	}
	return theCookies;
}
function exp_dbd_checkInputs(searchForm){
	Cookies = exp_dbd_loadtheCookies();
	var theDomain = Cookies['trackDomain'] ? Cookies['trackDomain'] : "www3.gartner.com";
	var theCollection = (theDomain == "www3.gartner.com") ? 'gexp' : 'gexp2';
	var newLocation = '';
	var h = 540;
	var title='EXP Search';
	var target='_blank';
	
	if(searchForm.radiogroup[0].checked) {
		var url="http://expsearch.gartner.com/query.html?col="+theCollection+"&charset=iso-8859-1&ht=0&qp=&qt="+escape(searchForm.qt.value)+"&qs=&qc=&pw=100%25&ws=0&la=en&qm=0&st=1&nh=25&lk=1&rf=0&oq=&rq=0&si=0";
		gPopUp(url, 755, h, 'EXP Website', 'location=no,scrollbars=yes,status=no,toolbar=no,resizable=yes', target);
	} else if (searchForm.radiogroup[1].checked) {
		var url="http://"+theDomain+"/7_search/Search2Frame.jsp?keywords="+escape(searchForm.qt.value);
		gPopUp(url, 750, h, 'Gartner Research', 'location=no,scrollbars=yes,status=no,toolbar=no,resizable=yes', target);
		//(url, w, h, title, features, target)
	}
	return false;
}