ne' || item.type=='select-multiple') snapAddEvent(item, 'change', snapChangeMade); else if (item.type=='text' || item.type=='textarea') { snapAddEvent(item, 'blur', snapChangeMade); snapAddEvent(item, 'keypress', snapTimedChange); if (item.type=='text') { snapAddEvent(item, "keydown", stopEnter); } } } } } function snapAddEvent(obj, evType, fn) { var result=false; if (obj) { if (obj.attachEvent) { result=obj.attachEvent("on"+evType, fn); } else if (obj.addEventListener) { obj.addEventListener(evType, fn, true); result=true; } } return result; } function snapGlobalDoc() { return document.forms["SnapForm"].elements; } function snapObject(id) { var ret = objectsById[id]; if (ret == null) { if (missingObjects[id] == null) { ret = document.getElementById(id); if (ret == null) { missingObjects[id] = true; } objectsById[id] = ret; } } return ret; } function snapObjectsByName(name) { return document.getElementsByName(name); } function snapObjectsByTagName(tagName) { return document.getElementsByTagName(tagName); } function killEvent(eventOb) { if (eventOb) { if (null != eventOb.cancelBubble) eventOb.cancelBubble = true; if (eventOb.stopPropagation) eventOb.stopPropagation(); if (null != eventOb.returnValue) eventOb.returnValue = false; if (eventOb.preventDefault) eventOb.preventDefault(); } } function snapEventOrigin(arg) { if (arg.srcElement) return arg.srcElement; else if (arg.target) return arg.target; return null; } function TextToHtml(txtValue) { var htmlValue = txtValue.replace(/&/g, "&"); htmlValue = htmlValue.replace(/[<]/g, "<"); htmlValue = htmlValue.replace(/>/g, ">"); htmlValue = htmlValue.replace(/\r\n/g,"
"); htmlValue = htmlValue.replace(/\n/g, "
"); htmlValue = htmlValue.replace(/\r/g,"
"); htmlValue = htmlValue.replace(/\t/g, " "); return htmlValue; } function snapFocusObject(object) { var done = false; if (object) { try { object.focus(); done = true; } catch (e)//hidden control { done = false; } } return done; } function snapFirstControl(vName) { var control = snapObject(vName + "_1"); if (!control) { if (snapIsClosed(vName) && !snapIsDropdown(vName)) { var numCodes=snapNumCodes(vName); for (var c=2;(c <= numCodes)&&(!control); c++) { control=snapObject(vName+'_'+c); } } } return control; } function snapShowQuestion(vName) { var control = snapFirstControl(vName); snapFocusObject(control); var tab = snapObject(vName); if (tab) { var offset = findObjY(tab); if (window.scrollTo) { window.scrollTo(0,offset); }else if (window.scroll) { window.scroll(0,offset); } } } function findObjY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop; obj = obj.offsetParent; } }else if (obj.y) curtop = obj.y; return curtop; } //recursivley Invalidate Routing cache for dependents of 'question' function snapUndoRoutingFor(vName) { if (vName && dependents[vName]) { var undo=dependents[vName]; for (var i=0; i option.value || (selOb.options[j].value ==0 && selOb.options[j].text=="")) { pos = selOb.options[j]; } } selOb.insertBefore(option, pos ); } } } } }else { for (var i =0; i < selOb.options.length && !found; i++) { if (selOb.options[i].value == code) { found = true; if (selOb.options[i].selected) { changed = true; try {b.options[i].selected = false; }catch(e) {//ie 6 bug? } } if (postponedItems) { postponedItems[vName] = true; }else { var option = selOb.options[i]; selOb.removeChild(option); if (!cacheSelectOptions[vName]) cacheSelectOptions[vName] = new Array(); var arr = cacheSelectOptions[vName]; arr[arr.length] = option; } } } } } return changed; } //////////////////////////////////////////////////////////////////////////////// // Variable exclusive function snapCheckExclusiveOf(sVar, object) { if ((sVar.checkImage != null) && object.type && (object.type == 'image')) { object = resolveCheckImg(sVar, object); } if (object.checked) { var changed = false; var c; var excl=sVar.exclusive; var code=parseInt(object.id.substr(object.id.indexOf('_')+1), 10); var isExclusive=false; for (c=0; c0) { if(result.length>0) result+=';'; result+=thisOption.value; } } } } else { var c=snapNumCodes(vName); while(c > 0) { code=snapObject(vName+'_'+c); if (code) { if((code.checked==null || code.checked) && code.value!=null && code.value.length>0) { if(result.length>0) result+=';'; result+=code.value; } else if (code.type&&(code.type.toLowerCase()=='hidden')&&(c==1)) { result = code.value; } } c--; } } return result; } function snapClosedAns(vName) { var result=null; if(asked(vName)) { result=snapVarValue(vName); } if(result==null) result=""; return result; } function snapClosedReply(vName) { var result=g_NoReply; var response=snapVarValue(vName); if(response.length>0) { var responses=response.split(";"); var i; result=""; for(i=0;i0) { if(i1 && !isNaN(nota_firstCode) && nota_firstCode!=null && !isNaN(nota_lastCode) && nota_lastCode!=null) { isLastSingle=nota_isInNumArray(codes, selectOb.options[nota_lastCode].value, 0); var i=nota_firstCode; endCode=(nota_firstCode nota_lastCode { if ((isLastSingle && i!=lastClickedCode) || (nota_isInNumArray(codes, selectOb.options[i].value, 0) && selectOb.options[i].selected==true)) { selectOb.options[i].selected=false; unSelected=true; } nota_firstCodelastJ) { nota_lastCode=i; lastJ=j } cList[j]=i; j++; } } return cList; } function nota_getLastClickedCode(currList,newList) { //If user has clicked up the list return the first code from newList //nota_lastSingleClicked is needed for Ctrl_0(M), Ctrl_5(M), Shift_1 over a single if (newList.length==1 || newList[0] 0) sVar.doAutoAns = true; } } } return isAsked; } function asked(vName) { if (null == askedCache[vName]) { askedCache[vName]=getAsked(vName); if (null == askedCache[vName]) { askedCache[vName]= true; } } return askedCache[vName]; } function noreply(vName) { var isNR = false; if (asked(vName)) { if (ans(vName) == "") { isNR = true; } } return isNR; } function ans(vName) { var answer=""; if(snapIsOpen(vName)) answer=snapOpenAns(vName); else if(snapIsClosed(vName)) answer=snapClosedAns(vName); return answer; } function ansAsNum(vName) { return parseFloat(ans(vName)); } function numReplies(vName) { var count = 0; if (asked(vName) && !noreply(vName)) { if(snapIsOpen(vName)) { count = 1; } else { var answer=snapVarValue(vName); if(answer.length>0) { answer=answer.split(";"); count = answer.length; } } } return count; } function cVR(vName,value) { var result=false; if (asked(vName)) { var glovar=snapFirstControl(vName); if(glovar != null) { var testValue=snapVarValue(vName); if((";"+testValue+";").indexOf(";"+value+";")>=0) { result=true; } } } return result; } function cVV(name1,name2) { var result=false; if (asked(name1) && asked(name2) && !noreply(name1) && !noreply(name2)) { var r1=";"+ans(name1)+";"; var r2=";"+ans(name2)+";"; while(r2.length>2&&!result) { var i=r2.substring(1).indexOf(";")+1; if(r1.indexOf(r2.substring(0,i+1))>=0) result=true; else r2=r2.substring(i); } } return result; } function cVM(vName)//(, ...) { var result=false; var numArgs = arguments.length; if ((1 < numArgs) && asked(vName)) { if (snapIsClosed(vName)) { if (snapIsDropdown(vName)) { var control = snapObject(vName + '_1'); if (control && (control.options != null)) { if (control.type.toLowerCase()=='select-one') { if (control.options[control.selectedIndex] != null) { var val = control.options[control.selectedIndex].value; if (val > 0) { for (var i = 1; (i < numArgs) && !result; i++) { result = (val == arguments[i]); } } } }else { for (var opt = 0; !result && (opt < control.options.length); opt++) { if (control.options[opt].selected && (control.options[opt].value>0)) { var val = control.options[opt].value; for (var i = 1; (i < numArgs) && !result; i++) { result = (val == arguments[i]); } } } } } }else { for (var i = 1; (i < numArgs) && !result; i++) { var requiredCode = snapObject(vName + '_' + arguments[i]); if ((null != requiredCode) && (null != requiredCode.checked)) { result = (requiredCode.checked == true); } } } }else { var answer = ans(vName); if (answer!="") { answer = ";"+answer+";"; for (var i = 1; (i < numArgs) && !result; i++) { if (0 <= answer.indexOf(";"+arguments[i]+";")) { result = true; } } } } } return result; } function cInRange(value, minValue, maxValue) { var result=(value!=null && (maxValue!=NaN) && (minValue!=NaN) && (value>=minValue && value<=maxValue)||(value>=maxValue && value<=minValue)); return result; } function cVarRange(vName,realName,min,max,UiCode) { var inRange=false; var locVar=snapObject(vName+ "_1"); if (locVar != null) { var numstr=snapOpenValue(vName); if (0 < numstr.length) { var number = parseFloat(numstr); if (!isNaN(number) && (number>=min) && (number<=max)) { inRange = true; } } } return inRange; } //////////////////////////////////////////////////////////////////////////////// function codeReply(vName,nameCodes) { var reply=""; var glovar=snapObject(vName); if(glovar != null) { var first=true; var mValue=glovar.value+";"; while(mValue.length>1) { var cPos=mValue.indexOf(";"); if(!first) { if(cPos==mValue.length-1) reply+=g_And; else reply+=", "; } reply+=nameCodes[parseInt(mValue.substring(0,cPos), 10)-1]; first=false; mValue=mValue.substring(cPos+1); } } if(reply.length==0) reply=g_NoReply; return reply; } //masking function VarToNum(vName) { var result = 0; if (snapIsOpen(vName)) { var control = snapObject(vName + '_1'); if (control) { result = parseInt(snapOpenValue(vName), 10); } }else if (snapIsDropdown(vName)) { var control = snapObject(vName + '_1'); if (control && (control.options != null)) { var ok = true; for (var x = 0; (x < control.options.length) && ok; x++) { if (control.options[x].selected) { if (0 == result) { result = control.options[x].value; }else { result = 0; ok = false; } } } } }else if (snapIsClosed(vName)) { var numCodes = snapNumCodes(vName); var ok = true; for (var x = 1; (x <= numCodes) && ok; x++) { var control = snapObject(vName + '_' + x); if (control && control.checked) { if (0 == result) { result = control.value; }else { result = 0; ok = false; } } } } if (0 == result) { result = NaN; } return result; } //////////////////////////////////////////////////////////////////////////////// // Date and Time function FormatDate(Date) { var dateString = ""; if (snapIsUk()) { dateString += Date.getDate()+"/"; dateString += (1 + Date.getMonth()); } else { dateString += (1 + Date.getMonth())+"/"; dateString += Date.getDate(); } dateString += "/" + Date.getYear(); return dateString; } function FormatTime(Time) { var timeString = ""; var tempStr = Time.getHours().toString(); if (tempStr.length == 1) tempStr = "0" + tempStr; timeString += tempStr + ":"; tempStr = Time.getMinutes().toString(); if (tempStr.length == 1) tempStr = "0" + tempStr; timeString += tempStr + ":"; tempStr = Time.getSeconds().toString(); if (tempStr.length == 1) tempStr = "0" + tempStr; timeString += tempStr; return timeString; } function GetToday() { var Now = new Date(); var Today = new Date(Now.getFullYear(), Now.getMonth(), Now.getDate(), 0, 0, 0, 0); return Today; } function getMonthName(i) { var month = ""; switch (i) { case 0: month="January";break; case 1: month="February";break; case 2: month="March";break; case 3: month="April";break; case 4: month="May";break; case 5: month="June";break; case 6: month="July";break; case 7: month="August";break; case 8: month="September";break; case 9: month="October";break; case 10: month="November";break; case 11: month="December";break; } return month; } function GetNow() { var Now = new Date(); Now.setFullYear(1970, 0, 1); return Now; } //////////////////////////////////////////////////////////////////////////////// function getLabel(labelArray, orderArray, code) { return labelArray[orderArray[code]]; } function getValue(orderArray, code) { var val = orderArray[code] + 1; var str = "" + val; return str; } function PlayMedia(mediaId) { var mediOb=document.getElementById(mediaId); if (mediOb) { try { if (mediOb.controls) { mediOb.controls.play(); } else if (typeof(mediOb.Play) != 'undefined') { mediOb.Play(); } else if (typeof(mediOb.play) != 'undefined') { mediOb.play(); }// else{ alert("media plugin not available");} } catch (err) { if (err.description) alert("Unexpected error " + err.description); else alert("Unexpected error"); } } } function V5asked(){return (ans("V4")==5);} function V9asked(){return (cVR("V7",11));} function V121asked(){return (cVR("V11",17));} function V12asked(){return (cVR("V11",1));} function V22asked(){return (cVR("V11",1));} function V85asked(){return (cVR("V11",1)&&ans("V4")!=4);} function V86asked(){return (cVR("V11",1)&&ans("V4")==4);} function V68asked(){return (cVR("V11",1));} function V123asked(){return (cVR("V11",1));} function V24asked(){return (cVR("V11",2));} function V52asked(){return (cVR("V11",2));} function V87asked(){return (cVR("V11",2)&&ans("V4")!=4);} function V104asked(){return (cVR("V11",2)&&ans("V4")==4);} function V69asked(){return (cVR("V11",2));} function V126asked(){return (cVR("V11",2));} function V25asked(){return (cVR("V11",3));} function V60asked(){return (cVR("V11",3));} function V88asked(){return (cVR("V11",3)&&ans("V4")!=4);} function V105asked(){return (cVR("V11",3)&&ans("V4")==4);} function V70asked(){return (cVR("V11",3));} function V141asked(){return (cVR("V11",3));} function V26asked(){return (cVR("V11",4));} function V59asked(){return (cVR("V11",4));} function V89asked(){return (cVR("V11",4)&&ans("V4")!=4);} function V106asked(){return (cVR("V11",4)&&ans("V4")==4);} function V71asked(){return (cVR("V11",4));} function V127asked(){return (cVR("V11",4));} function V27asked(){return (cVR("V11",5));} function V58asked(){return (cVR("V11",5));} function V90asked(){return (cVR("V11",5)&&ans("V4")!=4);} function V107asked(){return (cVR("V11",5)&&ans("V4")==4);} function V72asked(){return (cVR("V11",5));} function V128asked(){return (cVR("V11",5));} function V28asked(){return (cVR("V11",6));} function V56asked(){return (cVR("V11",6));} function V91asked(){return (cVR("V11",6)&&ans("V4")!=4);} function V108asked(){return (cVR("V11",6)&&ans("V4")==4);} function V73asked(){return (cVR("V11",6));} function V140asked(){return (cVR("V11",6));} function V29asked(){return (cVR("V11",7));} function V53asked(){return (cVR("V11",7));} function V92asked(){return (cVR("V11",7)&&ans("V4")!=4);} function V109asked(){return (cVR("V11",7)&&ans("V4")==4);} function V74asked(){return (cVR("V11",7));} function V129asked(){return (cVR("V11",7));} function V30asked(){return (cVR("V11",8));} function V55asked(){return (cVR("V11",8));} function V93asked(){return (cVR("V11",8)&&ans("V4")!=4);} function V110asked(){return (cVR("V11",8)&&ans("V4")==4);} function V75asked(){return (cVR("V11",8));} function V130asked(){return (cVR("V11",8));} function V31asked(){return (cVR("V11",9));} function V54asked(){return (cVR("V11",9));} function V94asked(){return (cVR("V11",9)&&ans("V4")!=4);} function V111asked(){return (cVR("V11",9)&&ans("V4")==4);} function V76asked(){return (cVR("V11",9));} function V139asked(){return (cVR("V11",9));} function V32asked(){return (cVR("V11",10));} function V61asked(){return (cVR("V11",10));} function V95asked(){return (cVR("V11",10)&&ans("V4")!=4);} function V112asked(){return (cVR("V11",10)&&ans("V4")==4);} function V77asked(){return (cVR("V11",10));} function V131asked(){return (cVR("V11",10));} function V33asked(){return (cVR("V11",11));} function V65asked(){return (cVR("V11",11));} function V96asked(){return (cVR("V11",11)&&ans("V4")!=4);} function V113asked(){return (cVR("V11",11)&&ans("V4")==4);} function V78asked(){return (cVR("V11",11));} function V132asked(){return (cVR("V11",11));} function V34asked(){return (cVR("V11",12));} function V67asked(){return (cVR("V11",12));} function V97asked(){return (cVR("V11",12)&&ans("V4")!=4);} function V114asked(){return (cVR("V11",12)&&ans("V4")==4);} function V79asked(){return (cVR("V11",12));} function V138asked(){return (cVR("V11",12));} function V35asked(){return (cVR("V11",13));} function V66asked(){return (cVR("V11",13));} function V98asked(){return (cVR("V11",13)&&ans("V4")!=4);} function V115asked(){return (cVR("V11",13)&&ans("V4")==4);} function V80asked(){return (cVR("V11",13));} function V133asked(){return (cVR("V11",13));} function V36asked(){return (cVR("V11",14));} function V62asked(){return (cVR("V11",14));} function V99asked(){return (cVR("V11",14)&&ans("V4")!=4);} function V116asked(){return (cVR("V11",14)&&ans("V4")==4);} function V81asked(){return (cVR("V11",14));} function V134asked(){return (cVR("V11",14));} function V37asked(){return (cVR("V11",15));} function V63asked(){return (cVR("V11",15));} function V100asked(){return (cVR("V11",15)&&ans("V4")!=4);} function V117asked(){return (cVR("V11",15)&&ans("V4")==4);} function V82asked(){return (cVR("V11",15));} function V135asked(){return (cVR("V11",15));} function V38asked(){return (cVR("V11",16));} function V64asked(){return (cVR("V11",16));} function V101asked(){return (cVR("V11",16)&&ans("V4")!=4);} function V118asked(){return (cVR("V11",16)&&ans("V4")==4);} function V83asked(){return (cVR("V11",16));} function V136asked(){return (cVR("V11",16));} function V143asked(){return (cVR("V11",17));} function V145asked(){return (cVR("V11",17));} function V146asked(){return (cVR("V11",17)&&ans("V4")!=4);} function V147asked(){return (cVR("V11",17)&&ans("V4")==4);} function V148asked(){return (cVR("V11",17));} function V149asked(){return (cVR("V11",17));} function V144asked(){return (cVR("V11",18));} function V154asked(){return (cVR("V11",18));} function V153asked(){return (cVR("V11",18)&&ans("V4")!=4);} function V152asked(){return (cVR("V11",18)&&ans("V4")==4);} function V151asked(){return (cVR("V11",18));} function V150asked(){return (cVR("V11",18));} function V39asked(){return (cVR("V11",19));} function V57asked(){return (cVR("V11",19));} function V102asked(){return (cVR("V11",19)&&ans("V4")!=4);} function V119asked(){return (cVR("V11",19)&&ans("V4")==4);} function V84asked(){return (cVR("V11",19));} function V137asked(){return (cVR("V11",19));} function V121reply(){return openReply("V121");} function onLabel(ctlId) { var retVal = true; if (ctlId && document.getElementById) { var ctl = document.getElementById(ctlId); if (ctl && ctl.type) { retVal = false; var type = ctl.type.toLowerCase(); if ((type == "radio") || (type == "checkbox")) ctl.click(); if (type != "hidden") ctl.focus(); } } return retVal; } function snapVarRotation(vName, type, method, count) { var sVar = snapVars[vName]; if (sVar) { sVar.rotType = type; //code or grid sVar.rotMethod = method; sVar.rotCount = count; } } function snapRemoveNode(nodeId) { var oldNode = snapObject(nodeId); if (oldNode != null) { var aParent=oldNode.parentNode; if (aParent != null) { aParent.removeChild(oldNode); objectsById[nodeId] = null; } } } //////////////////////////////////////////////////////////////////////////////// /***SNAP INIT START***/ function snapInit() { var query=unescape(location.search.substring(1)); for (var p=1; p<=lastPageNumber; p++) { snapInclude(snapObject('p_p'+p), false); } linkButton('b_next', snapNextPage); linkButton('b_back', snapBackPage); linkButton('b_submit', snapSubmitPage); linkButton('b_reset', snapResetPage); linkButton('b_restart', snapResetAll); linkButton('b_print', snapPrint); showButtonOptions['b_back']='pageNumber>=2&&pageNumber<=lastPageNumber'; showButtonOptions['b_reset']='pageNumber>=1&&pageNumber<=lastPageNumber'; showButtonOptions['b_next']='pageNumber>=1&&pageNumber<=lastPageNumber-1'; showButtonOptions['b_submit']='pageNumber>=lastPageNumber&&pageNumber<=lastPageNumber'; // List of variables that have one or more dependents dependents['V4']=new Array("V97","V98","V99","V100","V101","V102","V5","V104","V105","V106","V107","V108","V109","V110","V111","V112","V113","V114","V115","V116","V117","V118","V119","V152","V153","V146","V147","V85","V86","V87","V88","V89","V90","V91","V92","V93","V94","V95","V96"); dependents['V7']=new Array("V9"); dependents['V11']=new Array("V97","V98","V99","V100","V101","V102","V126","V127","V128","V129","V130","V131","V132","V133","V134","V135","V136","V137","V138","V139","V140","V141","V12","V104","V105","V106","V143","V107","V108","V109","V144","V110","V111","V112","V113","V114","V115","V116","V117","V118","V119","V60","V61","V62","V150","V63","V151","V64","V152","V65","V153","V66","V154","V67","V22","V121","V25","V24","V145","V26","V146","V27","V147","V28","V148","V29","V149","V30","V31","V32","V33","V34","V35","V36","V37","V38","V39","V52","V53","V54","V55","V56","V57","V58","V59","V68","V69","V70","V71","V72","V73","V74","V75","V76","V77","V78","V79","V80","V81","V82","V83","V123","V84","V85","V86","V87","V88","V89","V90","V91","V92","V93","V94","V95","V96"); dependents['V121']=new Array("V39","V57"); // identify which questions are on each page pageContents[1]=new Array("V2","V3","V142","V124","V4","V5","V6","V8"); pageContents[2]=new Array("V7","V9","V10","V13","V14","V15","V16","V17","V18","V19","V20","V21"); pageContents[3]=new Array("V125","V11","V121"); pageContents[4]=new Array("V12","V22","V85","V86","V68","V123"); pageContents[5]=new Array("V24","V52","V87","V104","V69","V126"); pageContents[6]=new Array("V25","V60","V88","V105","V70","V141"); pageContents[7]=new Array("V26","V59","V89","V106","V71","V127"); pageContents[8]=new Array("V27","V58","V90","V107","V72","V128"); pageContents[9]=new Array("V28","V56","V91","V108","V73","V140"); pageContents[10]=new Array("V29","V53","V92","V109","V74","V129"); pageContents[11]=new Array("V30","V55","V93","V110","V75","V130"); pageContents[12]=new Array("V31","V54","V94","V111","V76","V139"); pageContents[13]=new Array("V32","V61","V95","V112","V77","V131"); pageContents[14]=new Array("V33","V65","V96","V113","V78","V132"); pageContents[15]=new Array("V34","V67","V97","V114","V79","V138"); pageContents[16]=new Array("V35","V66","V98","V115","V80","V133"); pageContents[17]=new Array("V36","V62","V99","V116","V81","V134"); pageContents[18]=new Array("V37","V63","V100","V117","V82","V135"); pageContents[19]=new Array("V38","V64","V101","V118","V83","V136"); pageContents[20]=new Array("V143","V145","V146","V147","V148","V149"); pageContents[21]=new Array("V144","V154","V153","V152","V151","V150"); pageContents[22]=new Array("V39","V57","V102","V119","V84","V137"); pageContents[23]=new Array("V120"); new snapVariable("V2", "N1", null, "none", "N", 0, 1, null, null, false, null, null, null); new snapVariable("V3", "N2", null, "none", "N", 0, 1, null, null, false, null, null, null); new snapVariable("V142", "N3", null, "none", "N", 0, 1, null, null, false, null, null, null); new snapVariable("V124", "N4", null, "none", "N", 0, 1, null, null, false, null, null, null); new snapVariable("V4", "Q1", null, "radio", "S", 5, 1, null, null, true, null, null, dependents['V4']); new snapVariable("V5", "Q1.a", null, "text", "L", 1, 1, V5asked, null, false, null, null, null); new snapVariable("V6", "Q2", null, "radio", "S", 3, 1, null, null, true, null, null, null); new snapVariable("V8", "Q2.a", null, "text", "L", 1, 1, null, null, false, null, null, null); new snapVariable("V7", "Q3", null, "checkbox", "M", 11, 2, null, null, false, null, null, dependents['V7']); snapVarRotation("V7", "code", "random", 10); new snapVariable("V9", "Q3.a", null, "text", "L", 1, 2, V9asked, null, false, null, null, null); new snapVariable("V10", "Q4.a", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V13", "Q4.b", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V14", "Q4.c", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V15", "Q4.d", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V16", "Q4.e", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V17", "Q4.f", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V18", "Q4.g", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V19", "Q4.h", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V20", "Q4.i", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V21", "Q4.j", "V10", "radio", "S", 10, 2, null, null, false, null, null, null); new snapVariable("V125", "N5", null, "none", "N", 0, 3, null, null, false, null, null, null); new snapVariable("V11", "Q5", null, "checkbox", "M", 19, 3, null, null, false, null, null, dependents['V11']); new snapVariable("V121", "Q5.a", null, "text", "L", 1, 3, V121asked, null, false, null, null, dependents['V121']); new snapVariable("V12", "N6", null, "none", "N", 0, 4, V12asked, null, false, null, null, null); new snapVariable("V22", "Q6", null, "text", "L", 1, 4, V22asked, null, false, null, null, null); new snapVariable("V85", "N7", null, "none", "N", 0, 4, V85asked, null, false, null, null, null); new snapVariable("V86", "N8", null, "none", "N", 0, 4, V86asked, null, false, null, null, null); new snapVariable("V68", "Q6.a", null, "text", "L", 1, 4, V68asked, null, false, null, null, null); new snapVariable("V123", "N9", null, "none", "N", 0, 4, V123asked, null, false, null, null, null); new snapVariable("V24", "N10", null, "none", "N", 0, 5, V24asked, null, false, null, null, null); new snapVariable("V52", "Q7", null, "text", "L", 1, 5, V52asked, null, false, null, null, null); new snapVariable("V87", "N11", null, "none", "N", 0, 5, V87asked, null, false, null, null, null); new snapVariable("V104", "N12", null, "none", "N", 0, 5, V104asked, null, false, null, null, null); new snapVariable("V69", "Q7.a", null, "text", "L", 1, 5, V69asked, null, false, null, null, null); new snapVariable("V126", "N13", null, "none", "N", 0, 5, V126asked, null, false, null, null, null); new snapVariable("V25", "N14", null, "none", "N", 0, 6, V25asked, null, false, null, null, null); new snapVariable("V60", "Q8", null, "text", "L", 1, 6, V60asked, null, false, null, null, null); new snapVariable("V88", "N15", null, "none", "N", 0, 6, V88asked, null, false, null, null, null); new snapVariable("V105", "N16", null, "none", "N", 0, 6, V105asked, null, false, null, null, null); new snapVariable("V70", "Q8.a", null, "text", "L", 1, 6, V70asked, null, false, null, null, null); new snapVariable("V141", "N17", null, "none", "N", 0, 6, V141asked, null, false, null, null, null); new snapVariable("V26", "N18", null, "none", "N", 0, 7, V26asked, null, false, null, null, null); new snapVariable("V59", "Q9", null, "text", "L", 1, 7, V59asked, null, false, null, null, null); new snapVariable("V89", "N19", null, "none", "N", 0, 7, V89asked, null, false, null, null, null); new snapVariable("V106", "N20", null, "none", "N", 0, 7, V106asked, null, false, null, null, null); new snapVariable("V71", "Q9.a", null, "text", "L", 1, 7, V71asked, null, false, null, null, null); new snapVariable("V127", "N21", null, "none", "N", 0, 7, V127asked, null, false, null, null, null); new snapVariable("V27", "N22", null, "none", "N", 0, 8, V27asked, null, false, null, null, null); new snapVariable("V58", "Q10", null, "text", "L", 1, 8, V58asked, null, false, null, null, null); new snapVariable("V90", "N23", null, "none", "N", 0, 8, V90asked, null, false, null, null, null); new snapVariable("V107", "N24", null, "none", "N", 0, 8, V107asked, null, false, null, null, null); new snapVariable("V72", "Q10.a", null, "text", "L", 1, 8, V72asked, null, false, null, null, null); new snapVariable("V128", "N25", null, "none", "N", 0, 8, V128asked, null, false, null, null, null); new snapVariable("V28", "N26", null, "none", "N", 0, 9, V28asked, null, false, null, null, null); new snapVariable("V56", "Q11", null, "text", "L", 1, 9, V56asked, null, false, null, null, null); new snapVariable("V91", "N27", null, "none", "N", 0, 9, V91asked, null, false, null, null, null); new snapVariable("V108", "N28", null, "none", "N", 0, 9, V108asked, null, false, null, null, null); new snapVariable("V73", "Q11.a", null, "text", "L", 1, 9, V73asked, null, false, null, null, null); new snapVariable("V140", "N29", null, "none", "N", 0, 9, V140asked, null, false, null, null, null); new snapVariable("V29", "N30", null, "none", "N", 0, 10, V29asked, null, false, null, null, null); new snapVariable("V53", "Q12", null, "text", "L", 1, 10, V53asked, null, false, null, null, null); new snapVariable("V92", "N31", null, "none", "N", 0, 10, V92asked, null, false, null, null, null); new snapVariable("V109", "N32", null, "none", "N", 0, 10, V109asked, null, false, null, null, null); new snapVariable("V74", "Q12.a", null, "text", "L", 1, 10, V74asked, null, false, null, null, null); new snapVariable("V129", "N33", null, "none", "N", 0, 10, V129asked, null, false, null, null, null); new snapVariable("V30", "N34", null, "none", "N", 0, 11, V30asked, null, false, null, null, null); new snapVariable("V55", "Q13", null, "text", "L", 1, 11, V55asked, null, false, null, null, null); new snapVariable("V93", "N35", null, "none", "N", 0, 11, V93asked, null, false, null, null, null); new snapVariable("V110", "N36", null, "none", "N", 0, 11, V110asked, null, false, null, null, null); new snapVariable("V75", "Q13.a", null, "text", "L", 1, 11, V75asked, null, false, null, null, null); new snapVariable("V130", "N37", null, "none", "N", 0, 11, V130asked, null, false, null, null, null); new snapVariable("V31", "N38", null, "none", "N", 0, 12, V31asked, null, false, null, null, null); new snapVariable("V54", "Q14", null, "text", "L", 1, 12, V54asked, null, false, null, null, null); new snapVariable("V94", "N39", null, "none", "N", 0, 12, V94asked, null, false, null, null, null); new snapVariable("V111", "N40", null, "none", "N", 0, 12, V111asked, null, false, null, null, null); new snapVariable("V76", "Q14.a", null, "text", "L", 1, 12, V76asked, null, false, null, null, null); new snapVariable("V139", "N41", null, "none", "N", 0, 12, V139asked, null, false, null, null, null); new snapVariable("V32", "N42", null, "none", "N", 0, 13, V32asked, null, false, null, null, null); new snapVariable("V61", "Q15", null, "text", "L", 1, 13, V61asked, null, false, null, null, null); new snapVariable("V95", "N43", null, "none", "N", 0, 13, V95asked, null, false, null, null, null); new snapVariable("V112", "N44", null, "none", "N", 0, 13, V112asked, null, false, null, null, null); new snapVariable("V77", "Q15.a", null, "text", "L", 1, 13, V77asked, null, false, null, null, null); new snapVariable("V131", "N45", null, "none", "N", 0, 13, V131asked, null, false, null, null, null); new snapVariable("V33", "N46", null, "none", "N", 0, 14, V33asked, null, false, null, null, null); new snapVariable("V65", "Q16", null, "text", "L", 1, 14, V65asked, null, false, null, null, null); new snapVariable("V96", "N47", null, "none", "N", 0, 14, V96asked, null, false, null, null, null); new snapVariable("V113", "N48", null, "none", "N", 0, 14, V113asked, null, false, null, null, null); new snapVariable("V78", "Q16.a", null, "text", "L", 1, 14, V78asked, null, false, null, null, null); new snapVariable("V132", "N49", null, "none", "N", 0, 14, V132asked, null, false, null, null, null); new snapVariable("V34", "N50", null, "none", "N", 0, 15, V34asked, null, false, null, null, null); new snapVariable("V67", "Q17", null, "text", "L", 1, 15, V67asked, null, false, null, null, null); new snapVariable("V97", "N51", null, "none", "N", 0, 15, V97asked, null, false, null, null, null); new snapVariable("V114", "N52", null, "none", "N", 0, 15, V114asked, null, false, null, null, null); new snapVariable("V79", "Q17.a", null, "text", "L", 1, 15, V79asked, null, false, null, null, null); new snapVariable("V138", "N53", null, "none", "N", 0, 15, V138asked, null, false, null, null, null); new snapVariable("V35", "N54", null, "none", "N", 0, 16, V35asked, null, false, null, null, null); new snapVariable("V66", "Q18", null, "text", "L", 1, 16, V66asked, null, false, null, null, null); new snapVariable("V98", "N55", null, "none", "N", 0, 16, V98asked, null, false, null, null, null); new snapVariable("V115", "N56", null, "none", "N", 0, 16, V115asked, null, false, null, null, null); new snapVariable("V80", "Q18.a", null, "text", "L", 1, 16, V80asked, null, false, null, null, null); new snapVariable("V133", "N57", null, "none", "N", 0, 16, V133asked, null, false, null, null, null); new snapVariable("V36", "N58", null, "none", "N", 0, 17, V36asked, null, false, null, null, null); new snapVariable("V62", "Q19", null, "text", "L", 1, 17, V62asked, null, false, null, null, null); new snapVariable("V99", "N59", null, "none", "N", 0, 17, V99asked, null, false, null, null, null); new snapVariable("V116", "N60", null, "none", "N", 0, 17, V116asked, null, false, null, null, null); new snapVariable("V81", "Q19.a", null, "text", "L", 1, 17, V81asked, null, false, null, null, null); new snapVariable("V134", "N61", null, "none", "N", 0, 17, V134asked, null, false, null, null, null); new snapVariable("V37", "N62", null, "none", "N", 0, 18, V37asked, null, false, null, null, null); new snapVariable("V63", "Q20", null, "text", "L", 1, 18, V63asked, null, false, null, null, null); new snapVariable("V100", "N63", null, "none", "N", 0, 18, V100asked, null, false, null, null, null); new snapVariable("V117", "N64", null, "none", "N", 0, 18, V117asked, null, false, null, null, null); new snapVariable("V82", "Q20.a", null, "text", "L", 1, 18, V82asked, null, false, null, null, null); new snapVariable("V135", "N65", null, "none", "N", 0, 18, V135asked, null, false, null, null, null); new snapVariable("V38", "N66", null, "none", "N", 0, 19, V38asked, null, false, null, null, null); new snapVariable("V64", "Q21", null, "text", "L", 1, 19, V64asked, null, false, null, null, null); new snapVariable("V101", "N67", null, "none", "N", 0, 19, V101asked, null, false, null, null, null); new snapVariable("V118", "N68", null, "none", "N", 0, 19, V118asked, null, false, null, null, null); new snapVariable("V83", "Q21.a", null, "text", "L", 1, 19, V83asked, null, false, null, null, null); new snapVariable("V136", "N69", null, "none", "N", 0, 19, V136asked, null, false, null, null, null); new snapVariable("V143", "N70", null, "none", "N", 0, 20, V143asked, null, false, null, null, null); new snapVariable("V145", "Q22", null, "text", "L", 1, 20, V145asked, null, false, null, null, null); new snapVariable("V146", "N71", null, "none", "N", 0, 20, V146asked, null, false, null, null, null); new snapVariable("V147", "N72", null, "none", "N", 0, 20, V147asked, null, false, null, null, null); new snapVariable("V148", "Q22.a", null, "text", "L", 1, 20, V148asked, null, false, null, null, null); new snapVariable("V149", "N73", null, "none", "N", 0, 20, V149asked, null, false, null, null, null); new snapVariable("V144", "N74", null, "none", "N", 0, 21, V144asked, null, false, null, null, null); new snapVariable("V154", "Q23", null, "text", "L", 1, 21, V154asked, null, false, null, null, null); new snapVariable("V153", "N75", null, "none", "N", 0, 21, V153asked, null, false, null, null, null); new snapVariable("V152", "N76", null, "none", "N", 0, 21, V152asked, null, false, null, null, null); new snapVariable("V151", "Q23.a", null, "text", "L", 1, 21, V151asked, null, false, null, null, null); new snapVariable("V150", "N77", null, "none", "N", 0, 21, V150asked, null, false, null, null, null); new snapVariable("V39", "N78", null, "none", "N", 0, 22, V39asked, null, false, null, null, null); new snapVariable("V57", "Q24", null, "text", "L", 1, 22, V57asked, null, false, null, null, null); new snapVariable("V102", "N79", null, "none", "N", 0, 22, V102asked, null, false, null, null, null); new snapVariable("V119", "N80", null, "none", "N", 0, 22, V119asked, null, false, null, null, null); new snapVariable("V84", "Q24.a", null, "text", "L", 1, 22, V84asked, null, false, null, null, null); new snapVariable("V137", "N81", null, "none", "N", 0, 22, V137asked, null, false, null, null, null); new snapVariable("V120", "N82", null, "none", "N", 0, 23, null, null, false, null, null, null); DoRotation(); //process query string, now variables exist snapQueryString(query); // check question responses when they change for(var i=1; i<=lastPageNumber; i++) { if (pageContents[i]) { var pageItems = pageContents[i]; for(var j=0; j 1) snapInclude(snapObject('b_progress'), true); snapNextPage(); } /***SNAP INIT END***/ function linkButton(name, func) { var button = snapObject(name); var done = false; if (button && button.parentNode) { var bParent = button.parentNode; if (bParent && bParent.tagName && ("a" == bParent.tagName.toLowerCase())) { done = true; snapAddEvent(bParent, 'keypress',func); snapAddEvent(bParent, 'click',func); } } if (!done) { snapAddEvent(button, 'click',func); } } function snapQueryString(query) { var pairs=query.split("&"); for(var i=0; i0) { var argName=pairs[i].substring(0,pos); var value=pairs[i].substring(pos+1); if ((argName=="id") || (argName=="u")) {snapSetOpenReply("0",value); }else if (argName=="p") {snapSetOpenReply("0",value); }else if (argName=="s") {snapSetOpenReply("0",value); } else //argName is question Name, not Vnumber { var sVar = FindQuestion(argName); if (sVar) { if (snapIsOpen(sVar.vName) || snapIsDropdown(sVar.vName)) { setVarValue(sVar.vName+"_1", value); } else if (snapIsClosed(sVar.vName)) { var codes=unescape(value).split(","); for(var c=0; c=1 && page<=lastPageNumber) { page=pageMapping[page]; } } return page; } //////////////////////////////////////////////////////////////////////////////// function snapSubmitPage(eventOb) { if (snapIgnoreKey(eventOb)) return false; killEvent(eventOb); var okToSubmit=false; var btn = snapObject('b_submit'); if (!hasSubmitted && snapIsIncluded(btn) && !btn.disabled) { btn.disabled=true; var somethingToShow=false; var nextPage=pageNumber; while(nextPage<=lastPageNumber && snapPageValidationOk(nextPage)) { nextPage++; if(nextPage<=lastPageNumber) { somethingToShow=snapEvalShowPage(nextPage, false); } } if(nextPage > lastPageNumber) { okToSubmit = true; hasSubmitted = true; snapShowPage(lastPageNumber); } if(nextPage<=lastPageNumber) { btn.disabled=false; snapShowPage(nextPage); okToSubmit=false; } } if (okToSubmit) { fEndTimer(); document.forms["SnapForm"].submit(); } return false; } function snapIgnoreKey(eventOb) { var ignore= false; if (eventOb && (eventOb.type.toLowerCase()=="keypress") && (eventOb.keyCode != null)) { if ((eventOb.keyCode!=32) && (eventOb.keyCode!=10)) { ignore = true; if (eventOb.charCode!=null) { if ((eventOb.charCode==32) || (eventOb.charCode==10)) ignore = false; } } } return ignore; } function snapEvalShowPage(Pagenum, force) { var postponedItems = new Array(); //lengthy fix for bug in opera9 var somethingToShow=snapEvalPageRouting(Pagenum, postponedItems); if(somethingToShow || force) { snapShowPage(Pagenum); for (var vName in postponedItems) { snapEvalAskedFor(vName); } } postponedItems = null; return somethingToShow; } function snapNextPage(eventOb) { if (snapIgnoreKey(eventOb)) return true; if (eventOb && eventOb.preventDefault) eventOb.preventDefault(); var somethingToShow=false; var nextPage=pageNumber; while(nextPage1 && !somethingToShow) { nextPage--; somethingToShow=snapEvalShowPage(nextPage, (nextPage==1)); } return false; } function snapPrint(eventOb) { if (snapIgnoreKey(eventOb)) return true; window.print(); } function snapResetPage(eventOb) { if (snapIgnoreKey(eventOb)) return true; if (eventOb && eventOb.preventDefault) eventOb.preventDefault(); var aPage=snapMappedPage(pageNumber); if (pageContents[aPage]) { var changed = false; var pageItems = pageContents[aPage]; for(var i=0; i 0) { for(var j=0; j 0 && elem.options[op].selected) { elem.options[op].selected = false; changed = true; } } } } } } } if (changed) { snapApplyInitialSubstitutions(); resetRouting(); snapEvalPageRouting(); } } return false; } function snapResetAll(eventOb) { if (snapIgnoreKey(eventOb)) return true; document.forms["SnapForm"].reset(); snapApplyInitialSubstitutions(); resetRouting(); snapEvalPageRouting(); snapShowPage(1); } function snapShowPage(target) { if (target>=1 && target<=lastPageNumber) { snapInclude(snapObject("p_p"+snapMappedPage(pageNumber)), false); snapInclude(snapObject("p_p"+snapMappedPage(target)), true, 'block'); pageNumber=target; snapFocusPage(pageNumber); } if(lastPageNumber>0) { // buttons for (var butn in showButtonOptions) { snapIncludeBtn(snapObject(butn), eval(showButtonOptions[butn])); } // progress bar progress=snapObject("b_progress"); if (progress) { var progText = "Page "+pageNumber+"/"+lastPageNumber+""; if (progress.tagName != null && progress.tagName.toLowerCase()=="span") { progress.firstChild.nodeValue = progText; }else { if(progress.src) { var file=pbRatio(pBars); progress.src=progress.src.replace(/\d{2}\.gif/, file+".gif"); } progress.alt=progText; } } } } function snapFocusObject(object) { var done = false; if (object) { try { object.focus(); done = true; } catch (e)//hidden control { done = false; } } return done; } function snapFocusPage(page) { var found = false; page=snapMappedPage(page); if(page>=1 && page<=lastPageNumber) { if (pageContents[page]) { var pageItems = pageContents[page]; for(var j=0; j=1 && aPage<=lastPageNumber && pageContents[aPage]) { var pageItems=pageContents[aPage]; for (var i=0; i 0) { var newName = all_span[i].id.substr(0, nameLen); if (textSubLookup[newName] == null) { textSubLookup[newName] = new Array(); } var subList = textSubLookup[newName]; subList[subList.length] = all_span[i]; } } } } } function snapSubstituteText(questionName) { snapIntSubst(); if (textSubLookup[questionName] != null) { var subList = textSubLookup[questionName]; var i; for(i=0;i 0 || allowNegs) varString = sum; else isZero ? varString = '0' : varString = ''; if (roundNums) varString = Math.round(sum); tarVar.value = varString; }else { tarVar.value = ''; } lastValues[i+1] = tarVar.value; if (typeof snapOnChange != 'undefined') { snapOnChange(arguments[arguments.length-4]); } } } function cleanNumber(varString, allowNegs) { var newVarString = ""; if(allowNegs) newVarString=varString.replace(/^[^+\-0-9\.]*([+\-]?\d*\.?\d*).*$/, '$1'); else newVarString=varString.replace(/^[^+0-9\.]*(\+?\d*\.?\d*).*$/, '$1'); return newVarString; } function addSurveyPlus(eTypeStr, eHandler) {//eventTypeStr, eventHandler, vName1, vName2...vNameN if (arguments != null && arguments.length > 2) { var eTypeStr = arguments[0]; //eg "blur", "click". var eHandler = arguments[1]; //splus JS function call. for (var i=2; i <= arguments.length - 1; i++) { var snapVar = snapGlobalDoc()[arguments[i]]; if (snapVar) { if (snapVar.length && !(snapVar.type && snapVar.type.indexOf("select") >= 0)) {//Assign handler to all items in collection. eg. radio buttons in list. for (var j=0; j < snapVar.length; j++) { snapAddEvent(snapVar[j], eTypeStr, eHandler); } }else {//Assign handler to single item in list. eg. text box, or single radio button. snapAddEvent(snapVar, eTypeStr, eHandler); } } } } } //////////////////////////////////////////////////////////////////////////////// function snapIncludeBtn(obj, show, val) { snapInclude(obj, show, val); if (obj && obj.parentNode) { var bParent = obj.parentNode; if (bParent && bParent.tagName && ("a" == bParent.tagName.toLowerCase())) { snapInclude(bParent, show, val); } } } //////////////////////////////////////////////////////////////////////////////// // Rotation function DoRotation() { var vName; for (vName in snapVars) { var sVar = snapVars[vName]; if (sVar && sVar.rotMethod) { if (sVar.rotType == "grid") { if (sVar.IsGrid()) { var gridName = sVar.gridFirstVname; gridName += "_GRID"; var gridVar = snapVars[gridName]; if (gridVar && gridVar.gridMembers) { snapRotateGrid(gridVar.gridMembers, sVar.rotCount, sVar.rotMethod); } } }else//"code" { snapRotateCodes(vName, sVar.rotCount, sVar.rotMethod); } } } } function snapRotateGrid(questions, numQuestions , rotationType) { var questionNodes=new Array(); var spacerNodes=new Array(); var overallParent=null; var overallOk=true; var doCount = questions.length; if (numQuestions && (doCount > numQuestions)) doCount = numQuestions; for(var i=0;i=numCodes); j=codeList[i]; codeList[i]=codeList[newCodeNum]; codeList[newCodeNum]=j; } } else if(rotationType=='inverse') { if(Math.random()>=0.5) { for(i=0;i=aCode.childNodes.length) numCodes=aCode.childNodes.length-1; var targetOrder=snapRotationOrder(numCodes, rotationType); var minCode=aCode.childNodes.length; for(var i=0; ij) minCode=j; aCode.appendChild(aCode.childNodes[j]); j=aCode.childNodes.length; } } } i+=minCode; while(i=0 && minCode>", qName); } if (num1 != null) { template = template.replace("<>", num1); template = template.replace("<>", num1); } if (num2 != null) { template = template.replace("<>", num2); template = template.replace("<>", num2); } if (qName) { template = template.replace("<>", pattern); } return template; } // Variable No Reply function snapForceReply(vName, realName) { var result=true; if(noreply(vName)) { alert(formatMessage("Please provide an answer for question <>.", realName)); result=false; snapShowQuestion(vName); } return result; } function updateHighlight(sVar, result) { if (!sVar.errOb) { var obj = snapObject(sVar.vName+'_1'); var found = false; while (obj && !found) { if (!obj.className) obj=obj.parentNode; else if (obj.className.indexOf("_class") >= 0) { found = true; sVar.errOb = obj; sVar.validStyle = obj.className; if (obj.className.indexOf("_classT") >= 0) sVar.errStyle = "Err_classT"; else sVar.errStyle = "Err_classR"; } else { obj = obj.parentNode; } } if (!found) sVar.errOb = true; } if (sVar.errOb && (sVar.errOb != true) && sVar.errOb.className) { if (result) sVar.errOb.className = sVar.validStyle; else sVar.errOb.className = sVar.errStyle; } } function snapPageValidationOk(page) { var result=true; page=snapMappedPage(page); if(page>=1 && page<=lastPageNumber && pageContents[page]) { var pageItems = pageContents[page]; for(var j=0; j= lastPageNumber) result = OutOf; else if (pageNumber <= 1) result =1; else if (OutOf <= 2) result = Math.round(OutOf*pageNumber/lastPageNumber); else result = 2 + Math.floor((OutOf-2)*(pageNumber-1)/(lastPageNumber-1)); if (1>result) result="01"; else if (10 > result) result = "0" + result; else result = "" + result; return result; } //////////////////////////////////////////////////////////////////////////////// // Validation function isValidNum(vName,allowNegatives,realName) { var isValid=true; var locVar=snapObject(vName+ "_1"); if (locVar != null) { var numstr=snapOpenValue(vName); if (allowNegatives+""=="undefined" || allowNegatives+""=="null") allowNegatives = true; numstr+=""; for(var i=0;i="0")&&(numstr.charAt(i)<="9")||((numstr.charAt(i)==".")&&(numstr.charAt(i+1)!="."))||(numstr.charAt(i)=="-"))) isValid=false; else if((numstr.charAt(i)=="-"&&i!=0)||(numstr.charAt(i)=="-"&&!allowNegatives)) isValid=false; } if(!isValid) { snapFocusObject(locVar); alert(formatMessage("Please enter a valid number for question <>.", realName)); } } return isValid; } // Validation function RangeCheck(vName,realName,min,max,UiCode) { var isValid=true; var locVar=snapObject(vName+ "_1"); if (locVar != null) { var numstr=snapOpenValue(vName); if (0 < numstr.length) { var number = parseFloat(numstr); if (isNaN(number)) { isValid = false; } else if (IsRangeOp(min)) { isValid = DoRangeOp(min, number, max); if (UiCode == 1) UiCode++; } else if(numbermax) { isValid = false; } if (!isValid) { snapFocusObject(locVar); if ((1 == UiCode) && (min!=max)) { alert(formatMessage("Please give an answer between <> and <> for question <>.", realName, ""+min, ""+max)); } else if (0 != UiCode) { alert(formatMessage("Please enter a valid number for question <>.", realName)); } } } } return isValid; } // Validation function LiteralRange(vName,realName,min,max,UiCode) { var isValid=true; var locVar=snapObject(vName+ "_1"); if (locVar != null) { var numstr=snapOpenValue(vName); if (0 < numstr.length) { var number = numstr; if (IsRangeOp(min)) { isValid = DoRangeOp(min, number, max); if (UiCode == 1) UiCode++; } else if(numbermax) { isValid = false; } if (!isValid) { snapFocusObject(locVar); if ((1 == UiCode) && (min!=max)) { alert(formatMessage("Please give an answer between <> and <> for question <>.", realName, min, max)); } else if (0 != UiCode) { alert(formatMessage("Text out of range.", realName)); } } } } return isValid; } // Validation function DateRange(vName,realName,min,max,UiCode) { var varDate = getVarDate(vName,realName); var isValid = ("invalid" != varDate); if(isValid && ("" != varDate)) { if (("" == min) || ("" == max) || ("invalid" == min) || ("invalid" == max)) { isValid = false; if (UiCode == 1) UiCode++; } else if (IsRangeOp(min)) { isValid = DoRangeOp(min, varDate.getTime(), max.getTime()); if (UiCode == 1) UiCode++; } else if((varDate.getTime() < min.getTime())||(varDate.getTime() > max.getTime())) { isValid = false; } if (!isValid) { var locVar=snapObject(vName); if (locVar != null) { snapFocusObject(locVar); } if ((1 == UiCode) && (min.getTime()!=max.getTime())) { alert(formatMessage("Please give an answer between <> and <> for question <>.", realName, FormatDate(min), FormatDate(max))); } else if (0 != UiCode) { alert(formatMessage("You've entered an invalid date or date format for question <>.", realName)); } } } return isValid; } // Validation function getVarDate(vName,realName) { var indate=""; var locVar = snapObject(vName+ "_1"); if (locVar != null) indate=snapOpenValue(vName);; if(indate==null || indate.length==0) return ""; var punct; if(indate.indexOf(".")!=-1) punct="."; else if(indate.indexOf("-")!=-1) punct="-"; else punct="/"; var day; var month; var year; var warningMessage; if (0)//true=uk,false=usa { day=indate.substring(0,indate.indexOf(punct)); month=indate.substring(indate.indexOf(punct)+1,indate.lastIndexOf(punct)); warningMessage = "Please use the DD/MM/YY format."; } else { month=indate.substring(0,indate.indexOf(punct)); day=indate.substring(indate.indexOf(punct)+1,indate.lastIndexOf(punct)); warningMessage = "Please use the MM/DD/YY format."; } year=indate.substring(indate.lastIndexOf(punct)+1,indate.length); month = getMonthName(month-1); if (year.length == 2) { if (30 > parseInt(year, 10)) { year = "20"+year; } else { year = "19"+year; } } if (month=="" || year.length != 4 || parseInt(day, 10) > 31) { if (realName) { snapFocusObject(locVar); alert(formatMessage("You've entered an invalid date or date format for question <>.\n", realName)+warningMessage); } return "invalid"; } if (day.length == 1) day = "0" + day; var varDate = new Date(Date.parse(month + " " + day + ", " + year)); var cmpDate1 = day + "/" + month + "/" + year; var month2 = getMonthName(varDate.getMonth()); day = varDate.getDate(); if (day.toString().length == 1) { day = "0" + day; } var cmpDate2 = day + "/" + month2 + "/" + varDate.getFullYear(); if (cmpDate1 != cmpDate2) { if (realName) { snapFocusObject(locVar); alert(formatMessage("You've entered an invalid date or date format for question <>.\n", realName)+warningMessage); } return "invalid"; } return varDate; } // Validation function isValidDate(vName,realName) { var varDate = getVarDate(vName,realName); return ("invalid" != varDate); } // Validation function IsRangeOp(op) { return (op && op.length && (op.length > 2) && (op.substring(0, 2) == "op")); } // Validation function DoRangeOp(op, val1, val2) { var isValid = false; switch (op) { case "op>": isValid = (val1 > val2);break; case "op>=": isValid = (val1 >= val2);break; case "op<": isValid = (val1 < val2);break; case "op<=": isValid = (val1 <= val2);break; case "op!=": isValid = (val1 != val2);break; case "op==": isValid = (val1 == val2);break; } return isValid; } // Validation function TimeRange(vName,realName,min,max,UiCode) { var varTime = getVarTime(vName,realName); var isValid = ("invalid" != varTime); if(isValid && ("" != varTime)) { if (("" == min) || ("" == max) || ("invalid" == min) || ("invalid" == max)) { isValid = false; if (UiCode == 1) UiCode++; } else if (IsRangeOp(min)) { isValid = DoRangeOp(min, varTime.getTime(), max.getTime()); if (UiCode == 1) UiCode++; } else if((varTime.getTime() < min.getTime())||(varTime.getTime() > max.getTime())) { isValid = false; } if (!isValid) { var locVar = snapObject(vName); snapFocusObject(locVar); if ((1 == UiCode) && (min.getTime()!=max.getTime())) { alert(formatMessage("Please give an answer between <> and <> for question <>.", realName, FormatTime(min), FormatTime(max))); } else if (0 != UiCode) { alert(formatMessage("You've entered an invalid time or time format for question <>.", realName)); } } } return isValid; } // Validation function getVarTime(vName,realName) { var intime=""; var locVar = snapObject(vName+ "_1"); if (locVar != null) intime=snapOpenValue(vName);; if(intime.length==0) return ""; var punct; if(intime.indexOf(".")!=-1) punct="."; else if(intime.indexOf("-")!=-1) punct="-"; else punct=":"; var hour = "00"; var minute = "00"; var second = "00"; var times = intime.split(punct); if(times.length >= 1) hour = times[0]; if(times.length >= 2) minute = times[1]; if(times.length >= 3) second = times[2]; if((times.length == 1) || parseInt(hour, 10) > 23 || parseInt(minute, 10) > 59 || parseInt(second, 10) > 59) { if (realName) { snapFocusObject(locVar); alert(formatMessage("You've entered an invalid time or time format for question <>.\n", realName)+"Please use the hh:mm:ss format."); } return "invalid"; } if (hour.length == 1) hour = "0" + hour; if (minute.length == 1) minute = "0" + minute; if (second.length == 1) second = "0" + second; var varTime = new Date(Date.parse("1/1/1970 " + hour + ":" + minute + ":" + second)); var cmpTime1 = hour + ":" + minute + ":" + second; hour = varTime.getHours(); minute = varTime.getMinutes(); second = varTime.getSeconds(); if (hour.toString().length == 1) hour = "0" + hour; if (minute.toString().length == 1) minute = "0" + minute; if (second.toString().length == 1) second = "0" + second; var cmpTime2 = hour + ":" + minute + ":" + second; if (cmpTime1 != cmpTime2) { if (realName) { snapFocusObject(locVar); alert(formatMessage("You've entered an invalid time or time format for question <>.\n", realName)+"Please use the hh:mm:ss format."); } return "invalid"; } return varTime; } // Validation function AnswerRange(vName,realName,min, max) { var valid = true; var numCodes = snapNumCodes(vName); var count = 0; if (snapIsDropdown(vName)) { var control = snapObject(vName + '_1'); if (control && (control.options != null)) { for (var x = 0; (x < control.options.length); x++) { if (control.options[x].selected && (control.options[x].value>0)) { count++; } } } }else { for (var x=1; x <= numCodes; x++) { var codeOb = snapObject(vName + '_' + x); if (codeOb && (codeOb.checked)) { count++; } } } if (count < min) { valid = false; }else if (count > max) { valid = false; } if (!valid) { alert(formatMessage("Question <> requires between <> and <> replies.", realName, min, max)); } return valid; } // Validation function isValidTime(vName,realName) { var varTime = getVarTime(vName,realName); return ("invalid" != varTime); } // Validation function ValidationPattern(vName,patternIndex) { var Result=true; var locVar = snapObject(vName + "_1"); var sVar = snapVars[vName]; var PatternOb = snapGetPattern(patternIndex); if (sVar && locVar && PatternOb) { var realName = sVar.qName ? sVar.qName : vName; var indate=snapOpenValue(vName); if(indate!=null && indate.length>0 && indate.search) { Result=(0<=indate.search(PatternOb.pattern)); if(!Result) { alert(formatMessage("You've entered an invalid <> for question <>.", realName, null, null, PatternOb.patternName)); } } } return Result; } function snapGetPattern(patternIndex) { if (!usedPatterns) { usedPatterns = new Object(); } return usedPatterns[patternIndex]; } function SnapPattern(index, pattern, patternName) { this.pattern = pattern; this.patternName = patternName; usedPatterns[index] = this; } //////////////////////////////////////////////////////////////////////////////// // Date and Time function snapIsUk(){return (0 != 0);} function setVarValue(qName, qValue) { var elem = snapObject(qName); if (elem && elem.tagName != null) { var lTagName = elem.tagName.toLowerCase(); if (lTagName=="input") { if ((elem.type!= null) && (elem.type.toLowerCase() == 'text' || elem.type.toLowerCase() == 'hidden')) { elem.value = unescape(qValue); if (elem.type.toLowerCase() == 'hidden') elem.value = elem.value.replace(',',';'); }else if (elem.checked != null) { elem.checked = (qValue == "1") ? true : false; } }else if (lTagName=="textarea") { elem.value = unescape(qValue); }else if (lTagName=="select" && (null != elem.options)) { qValue = unescape(qValue); var sels = qValue.split(','); for (var x = 0; x < elem.options.length; x++) { if (elem.options[x].value != "") { elem.options[x].selected = false; for (var op =0; op < sels.length; op++) { if (elem.options[x].value==sels[op]) elem.options[x].selected=true; } } } } } } //////////////////////////////////////////////////////////////////////////////// //hide everything for load document.write("
 
Supplier Leadership Awards Nomination
The deadline for nominations is July 26, 2013.
Before we get to the nomination process, please answer four quick questions.
1. Which of the following best describes your company?
 
2. How have relations between suppliers and retailers changed over the past year in terms of sharing data, collaborations and other interactions?
2.a
3. What are the most important initiatives for suppliers to be focusing on now? (Select all that apply.)
 
4. Up to now, how have suppliers succeeded in handling these initiatives:
  1= very poorly 2 3 4 5 6 7 8 9 10 = flawlessly  
  Sustainability  
  Product Innovation  
  Packaging Innovation  
  Community Outreach  
  Food Safety  
  Trading Partner Collaboration  
  Executive Leadership  
  Cost Efficiency  
  Shopper Insights  
  Category Management  
Now we'll begin the nomination section of the survey.
5. SN will honor suppliers in more than a dozen areas of excellence. Which of the following would you like to nominate a company(ies) for? (Select all that apply).
 
Sustainability Leadership
6.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Product Innovation
7.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Packaging Innovation
8.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Community Outreach
9.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
In-Store Execution
10.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
DSD Logistics
11.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Unsaleables Reduction
12.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Food Safety Excellence
13.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Trading Partner Collaboration
14.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Executive Leadership
15.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Cost Efficiency
16.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Shopper Insights
17.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Category Management
18.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Point-of-Sale Merchandising
19.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Digital Marketing/Social Media
20.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Traditional or Integrated Marketing
21.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Cause Marketing
22.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Support for Small Chains/Independents
23.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Other - Q5.a
24.
  Please explain why this company should be recognized for its leadership, citing details and examples from the last 12 months.
  Please explain why this company should be recognized for its leadership. Cite examples involving retailer partners and include testimonial quotes when possible.
 
  If you have more to say than fits in the field above, please email your full write-up to the Supplier Leadership Awards.
Thank you for your time and input.
Please click the submit button to complete your nomination.
 
dividing line
   
  Clear Answers from this Page