var helpWindow;function showHelp(helpUrl){if(helpWindow&&!helpWindow.closed){helpWindow.close();}helpWindow=window.open(helpUrl,"SFDCWSH","width=800,height=600,dependent=yes,scrollbars=yes,resizable=yes",true);helpWindow.focus();return false;}function showAlert(msg){window.alert(msg);}function keywordSearch(textId,searchType,labelTitle,keywordMoreThan1Char,searchDefaultText,target,showLoadingMask){if(showLoadingMask){applyMask(99);
}var searchTypeStr="Apps";if(searchType&&document.getElementsByName(searchType)){var searchRadios=document.getElementsByName(searchType);for(var i=0;i<searchRadios.length;i++){if(document.getElementsByName(searchType)[i].checked){searchTypeStr=document.getElementsByName(searchType)[i].value;}}}if(document.getElementById("appsfield")&&document.getElementById("appsfield").checked){searchTypeStr="Apps";
}if(document.getElementById("servicesfield")&&document.getElementById("servicesfield").checked){searchTypeStr="Services";}if(validateKeyword(textId,labelTitle,keywordMoreThan1Char)){var str="results?type="+searchTypeStr;var keywordVal=document.getElementById(textId).value;if(keywordVal!=null){keywordVal=keywordVal.trim();
if(keywordVal!=""){if(!searchDefaultText||(searchDefaultText==null||searchDefaultText==""||keywordVal!=searchDefaultText)){str+="&keywords="+escape(keywordVal);}}}if(searchTypeStr=="Job"){str+="&filter="+escape("ss=Open");}if(!target||target==""){window.location=str;}else{if(target=="_blank"){window.open(str);
}}}else{document.getElementById(textId).value="";hideMask();}}function validateKeyword(textId,labelTitle,keywordMoreThan1Char){var keywordVal=document.getElementById(textId).value;var errorArray=new Array();if(keywordVal==null){return true;}keywordVal=keywordVal.trim();if(keywordVal.length==1){i=errorArray.length;
errorArray[i]=new Array();errorArray[i][0]=textId;errorArray[i][1]=keywordMoreThan1Char;}else{if(keywordVal.length==2&&keywordVal.charAt(1)=="*"){i=errorArray.length;errorArray[i]=new Array();errorArray[i][0]=textId;errorArray[i][1]=keywordMoreThan1Char;}}if(errorArray.length>0){showErrors(errorArray,"error-msg-main",labelTitle);
return false;}return true;}function displayTabs(ispublic,tabPubId,tabPriId,liPubId,liPriId){if(ispublic==false&&document.getElementById(liPriId)!=null){document.getElementById(liPriId).className="active";document.getElementById(liPubId).className="";if(document.getElementById(tabPriId)!=null){document.getElementById(tabPriId).style.display="";
}document.getElementById(tabPubId).style.display="none";}else{if(ispublic==true){if(document.getElementById(liPriId)!=null){document.getElementById(liPriId).className="";}document.getElementById(liPubId).className="active";if(document.getElementById(tabPubId)!=null){document.getElementById(tabPubId).style.display="";
}document.getElementById(tabPriId).style.display="none";}}return false;}function activateTab(){if(document.getElementById("lipri")!=null){if(document.getElementById("lipri").className=="active"){document.getElementById("lipri").className="active";}}if(document.getElementById("lipub")!=null){if(document.getElementById("lipub").className=="active"){document.getElementById("lipub").className="active";
}}}function disOrEnableFormField(formFieldId,checkedId){if(document.getElementById(checkedId)!=null&&document.getElementById(checkedId).checked==false){document.getElementById(formFieldId).disabled=true;}else{if(document.getElementById(formFieldId)!=null){document.getElementById(formFieldId).disabled=false;
}}}function goToPrevAction(){validateForSearchAction();applyMask(99);prevPagePubList();}function goToNextAction(){validateForSearchAction();applyMask(99);nextPagePubList();}function goToPrivPrevAction(){validateForSearchAction();applyMask(99);prevPrivList();}function goToTempNextAction(){validateForSearchAction();
applyMask(99);nextPageTempList();}function goToTempPrevAction(){validateForSearchAction();applyMask(99);prevPageTempList();}function goToPrivNextAction(){validateForSearchAction();applyMask(99);nextPrivList();}function goToPrivPrevPackage(){validateForSearchAction();applyMask(99);prevPagePackageList();
}function initPrivListing(){applyMask(99);initPrivateListing();}function initPubListing(){applyMask(99);initPublicListing();}function goToPrivNextPackage(){validateForSearchAction();applyMask(99);nextPagePackageList();}function initPackages(){applyMask(99);initPackage();}function initTrial(){applyMask(99);
initTrials();}function uploadedPackages(){applyMask(99);submitChkBoxAction();}function delistedListings(){applyMask(99);submitDeListedChkBoxAction();}function unlistedTemplates(){applyMask(99);submitChkBoxActionForTemplate();}function enterKeyHit(e){if(window.event){keynum=e.keyCode;}else{if(e.which){keynum=e.which;
}}return(keynum==13);}function onSearchKeyDown(textId,e,searchType,labelTitle,keywordMoreThan1Char,searchDefaultText,target,showLoadingMask){if(enterKeyHit(e)){if(document.getElementById("hitEnter")){document.getElementById("hitEnter").value="y";}keywordSearch(textId,searchType,labelTitle,keywordMoreThan1Char,searchDefaultText,target,showLoadingMask);
return false;}return true;}function validate(fieldArray,errorArray,labelProvideValue,labelFieldTooLong){for(var i=0;i<fieldArray.length;i++){var fieldId=fieldArray[i][0];if(document.getElementById(fieldId)){var whatToValidate=fieldArray[i][3];if(!whatToValidate||whatToValidate.length==0){continue;}var maxFieldLen=fieldArray[i][1];
var fieldLabel=fieldArray[i][2];var fieldObj=document.getElementById(fieldId);if((fieldObj.value==null||fieldObj.value=="")&&whatToValidate.indexOf("REQ")!=-1){eLen=errorArray.length;errorArray[eLen]=new Array();errorArray[eLen][0]=fieldId;if(fieldArray[i][4]){errorArray[eLen][1]=fieldArray[i][4];}else{errorArray[eLen][1]=labelProvideValue.replace("{0}",fieldLabel);
}}else{var fieldLen=StringCounter(fieldObj.value);if(fieldLen>maxFieldLen&&whatToValidate.indexOf("MAXLEN")!=-1){eLen=errorArray.length;errorArray[eLen]=new Array();errorArray[eLen][0]=fieldId;var p="is";if(fieldLabel!=null&&fieldLabel.length>0&&fieldLabel.charAt(fieldLabel.length-1)=="s"){p="are";}errorArray[eLen][1]=labelFieldTooLong.replace("{0}",fieldLabel).replace("{1}",p).replace("{2}",maxFieldLen);
}}}}}function confirmation(msg){if(confirm(msg)){return true;}return false;}var initHelpPopups=function(){var currentPage=document.getElementById("page");if(currentPage){img=currentPage.getElementsByTagName("img");for(var i=0;i<img.length;i++){if(img[i].className.indexOf("label-help")!=-1){img[i].onmouseover=function(){showHelpBalloon(this);
};img[i].onmouseout=function(){startHideHelpBalloon();};}}txtfield=currentPage.getElementsByTagName("input");for(var i=0;i<txtfield.length;i++){if(txtfield[i].className.indexOf("form-text-help")!=-1){txtfield[i].onfocus=function(){showHelpBalloon(this);};txtfield[i].onclick=function(){showHelpBalloon(this);
};txtfield[i].onblur=function(){startHideHelpBalloon();};}}}};var timeHideHelpBalloon;var theCurrentHelpImage;function showHelpBalloon(thisImg){jQuery("#help-div").appendTo("body");if(theCurrentHelpImage&&theCurrentHelpImage.alt===""&&document.getElementById("help-div-p").innerHTML!==""){theCurrentHelpImage.alt=document.getElementById("help-div-p").innerHTML;
}theCurrentHelpImage=thisImg;var changeImgId=false;if(typeof timeHideHelpBalloon!="undefined"){clearTimeout(timeHideHelpBalloon);}if(thisImg.id==""){thisImg.id="testId";changeImgId=true;}var thisXY=findPos(thisImg.id);var thisW=getObjectWidth(thisImg);var thisH=getObjectHeight(thisImg);var helpW=getObjectWidth("help-div");
var helpH=getObjectHeight("help-div");var helpLeft=thisXY[0]-Math.round(helpW/2)+Math.round(thisW/2);var helpTop=thisXY[1]+thisH;var windowW=getInsideWindowWidth();var topDivId="help-div-top";if(helpLeft+helpW>windowW){topDivId="help-div-top-right";helpLeft=helpLeft-140;}else{if(helpLeft<0){topDivId="help-div-top-left";
helpLeft=helpLeft+150;}}var helpText=thisImg.alt;thisImg.alt="";document.getElementById("help-div").innerHTML='<div id="'+topDivId+'"></div><div id="help-div-middle"><p id="help-div-p">'+helpText+'</p></div><div id="help-div-bottom"></div>';document.getElementById("help-div").style.left=helpLeft+"px";
document.getElementById("help-div").style.top=helpTop+"px";if(changeImgId==true){thisImg.id="";}}function stopHideHelpBalloon(){if(typeof timeHideHelpBalloon!="undefined"){clearTimeout(timeHideHelpBalloon);}}function startHideHelpBalloon(target){var hideForReals=true;if(typeof target==="undefined"){target="image";
}if(theCurrentHelpImage.className.indexOf("form-text-help")!==-1&&target==="balloon"){hideForReals=false;}if(hideForReals===true){var hideTime=400;if(theCurrentHelpImage.className.indexOf("form-text-help")!==-1){hideTime=0;}theCurrentHelpImage.alt=document.getElementById("help-div-p").innerHTML;timeHideHelpBalloon=setTimeout("hideHelpBalloon()",hideTime);
}}function hideHelpBalloon(){document.getElementById("help-div").style.left="-999px";}var searchOptionsTimeout;function initSearchField(id,defaultValue){var theField=jQuery("#"+id);if(theField.val()==""){theField.val(defaultValue);theField.addClass("text-default");}else{theField.removeClass("text-default");
}theField.bind("focus",function(){textFieldFocus(id,defaultValue);clearTimeout(searchOptionsTimeout);var searchBoxWidth=jQuery("#search").outerWidth(true);var searchBoxHeight=jQuery("#search").height();var searchBoxOffSet=jQuery("#search").offset();jQuery("#search-options").width(searchBoxWidth+1);jQuery("#search-options").show();
jQuery("#search-options").offset({top:searchBoxOffSet.top+searchBoxHeight+1,left:searchBoxOffSet.left-2});});theField.bind("blur",function(){searchOptionsTimeout=setTimeout(function(){jQuery("#search-options").hide();textFieldBlur(id,defaultValue);},200);});}
