var swfObjectHasLoaded=0; var swfObjectIsLoading=0; var protoaculousHasLoaded=0; var myDirectory="http://www.green-watch.org"; var myDirectory2="http://cdn.green-watch.org"; function addEvent(obj,type,fn) { if(obj==window&&type=='load'&&bodyHasLoaded==1) { fn(); } else if (obj.addEventListener) { obj.addEventListener(type,fn,false); EventCache.add(obj,type,fn); } else if(obj.attachEvent) { obj["e"+type+fn]=fn; obj[type+fn]=function() { obj["e"+type+fn](window.event); }; obj.attachEvent("on"+type,obj[type+fn]); EventCache.add(obj,type,fn); } else { obj["on"+type]=obj["e"+type+fn]; } } var EventCache=function() { var listEvents=[]; return { listEvents:listEvents, add:function(node,sEventName,fHandler) { listEvents.push(arguments); }, remove:function(node,sEventName,fHandler) { var i,item; for(i=listEvents.length-1;i>=0;i=i-1) { if(node==listEvents[i][0]&&sEventName==listEvents[i][1]&&fHandler==listEvents[i][2]) { item=listEvents[i]; if(item[0].removeEventListener) { item[0].removeEventListener(item[1],item[2],item[3]); } if(item[1].substring(0,2)!="on") { item[1]="on"+item[1]; } if(item[0].detachEvent) { item[0].detachEvent(item[1],item[0][sEventName+fHandler]); } item[0][item[1]] = null; } } }, flush:function() { var i,item; for(i=listEvents.length-1;i>=0;i=i-1) { item=listEvents[i]; if(item[0].removeEventListener) { item[0].removeEventListener(item[1],item[2],item[3]); }; if(item[1].substring(0,2)!="on") { item[1]="on"+item[1]; }; if(item[0].detachEvent) { item[0].detachEvent(item[1],item[2]); }; item[0][item[1]]=null; }; } }; }(); function removeEvent(obj,type,fn) { EventCache.remove(obj, type, fn); } addEvent(window,'unload',EventCache.flush); function importZapatecJS(onLoadFunction) { var headID = document.getElementsByTagName("head")[0]; var zpJavaScriptNode=document.createElement('script'); zpJavaScriptNode.type='text/javascript'; zpJavaScriptNode.onload=function() { if(typeof onLoadFunction=='function') { onLoadFunction(); } }; zpJavaScriptNode.onreadystatechange=function() { if(zpJavaScriptNode.readyState=='complete'||zpJavaScriptNode.readyState=='loaded') { if(typeof onLoadFunction=='function') { onLoadFunction(); } } }; zpJavaScriptNode.src=myDirectory2+'/zapatec/utils/zapatec.js'; headID.appendChild(zpJavaScriptNode); } function importZapatecCalendarJS(onLoadFunction) { var headID = document.getElementsByTagName("head")[0]; var zpCalendarNode=document.createElement('script'); zpCalendarNode.type='text/javascript'; zpCalendarNode.onload=function() { importZapatecCalendarJS2(onLoadFunction); }; zpCalendarNode.onreadystatechange=function() { if(zpCalendarNode.readyState=='complete'||zpCalendarNode.readyState=='loaded') { importZapatecCalendarJS2(onLoadFunction); } }; zpCalendarNode.src=myDirectory2+'/zapatec/zpcal/src/calendar.js'; headID.appendChild(zpCalendarNode); } function importZapatecCalendarJS2(onLoadFunction) { var headID = document.getElementsByTagName("head")[0]; var zpCalendarNode2=document.createElement('script'); zpCalendarNode2.type='text/javascript'; zpCalendarNode2.onload=function() { if(typeof onLoadFunction=='function') { onLoadFunction(); } }; zpCalendarNode2.onreadystatechange=function() { if(zpCalendarNode2.readyState=='complete'||zpCalendarNode2.readyState=='loaded') { if(typeof onLoadFunction=='function') { onLoadFunction(); } } }; zpCalendarNode2.src=myDirectory2+'/zapatec/zpcal/lang/calendar-en.js'; headID.appendChild(zpCalendarNode2); } function importPrototypeJS() { var headID=document.getElementsByTagName("head")[0]; var prototypeNode=document.createElement('script'); prototypeNode.type='text/javascript'; prototypeNode.src=myDirectory2+'/javascript/prototype.cfm'; headID.appendChild(prototypeNode); } function importProtoaculousJS(onLoadFunction) { var headID=document.getElementsByTagName("head")[0]; var protoaculousNode=document.createElement('script'); protoaculousNode.type='text/javascript'; protoaculousNode.onload=function() { protoaculousHasLoaded=1; if(onLoadFunction!='null') { onLoadFunction(); } }; protoaculousNode.onreadystatechange=function() { if(protoaculousNode.readyState=='complete'||protoaculousNode.readyState=='loaded') { protoaculousHasLoaded=1; if(onLoadFunction!='null') { onLoadFunction(); } } }; protoaculousNode.src=myDirectory2 +'/javascript/protoaculous.cfm'; headID.appendChild(protoaculousNode); } function importSwfObjectJS(hookWheelMouse,onLoadFunction) { if(swfObjectIsLoading==1) { return; } else { swfObjectIsLoading=1; } var headID=document.getElementsByTagName("head")[0]; var swfobjectNode=document.createElement('script'); swfobjectNode.type='text/javascript'; swfobjectNode.onload=function() { swfObjectHasLoaded=1; if(onLoadFunction!=null) { onLoadFunction(); } if(hookWheelMouse==1) { hookMouseWheel(); } }; swfobjectNode.onreadystatechange=function() { if(swfobjectNode.readyState=='complete'||swfobjectNode.readyState=='loaded') { swfObjectHasLoaded=1; if(onLoadFunction!=null) { onLoadFunction(); } if(hookWheelMouse==1) { hookMouseWheel(); } } }; swfobjectNode.src=myDirectory2+'/javascript/swfObject.cfm'; headID.appendChild(swfobjectNode); } function hookMouseWheel() { if (window.addEventListener) { window.addEventListener('DOMMouseScroll',onMouseWheel,false); } window.onmousewheel=document.onmousewheel=onMouseWheel; } function isMouseOverSwf(mEvent) { var elem; if(mEvent.srcElement) { elem=mEvent.srcElement.nodeName; } else if(mEvent.target) { elem=mEvent.target.nodeName; } if(elem.toLowerCase()=="object"||elem.toLowerCase()=="embed") { return true; } return false; } function onMouseWheel(event) { var delta=0; if(!event) { event=window.event; } if(event.wheelDelta) { delta=event.wheelDelta/120; if(window.opera) { delta=-delta; } } else if(event.detail) { delta=-event.detail/3; } if(isMouseOverSwf(event)) { return cancelMouseEvent(event); } return true; } function cancelMouseEvent(e) { e=e?e:window.event; if (e.stopPropagation) { e.stopPropagation(); } if(e.preventDefault) { e.preventDefault(); } e.cancelBubble=true; e.cancel=true; e.returnValue=false; return false; } function showAdSpace(adPreference,adMaxModifier,adKeywords) { if(typeof adMaxModifier=='undefined') { adMaxModifier=0; } if(typeof adPreference=='undefined') { adPreference="BUSINESS"; } if(typeof adKeywords=='undefined') { adKeywords=""; } var rightDiv=document.getElementById('col-r'); var leftDiv=document.getElementById('col-l'); var rightHeight=rightDiv.offsetHeight; var leftHeight=leftDiv.offsetHeight; var maxAds=Math.floor((rightHeight-leftHeight)/137)+adMaxModifier; if(maxAds>0) { xmlLeftAdSpace=GetXmlHttpObject(); if(xmlLeftAdSpace==null) { return; } var myHeightVar=rightHeight-leftHeight; url=myDirectory+"/ADS/showSideAds.cfm?adHeight="+myHeightVar+"&maxAds="+maxAds+"&adKeywords="+adKeywords; url+="&adPreference="+adPreference+"&sid="+Math.random(); xmlLeftAdSpace.open("GET",url,true); xmlLeftAdSpace.onreadystatechange=function() { var sideAdDiv=document.getElementById('MY_ADSPACE'); if(xmlLeftAdSpace.readyState==4&&xmlLeftAdSpace.responseText!='') { sideAdDiv.innerHTML=xmlLeftAdSpace.responseText;sideAdDiv.style.display="block"; } else if(xmlLeftAdSpace.readyState==4) { sideAdDiv.style.display="none"; } }; xmlLeftAdSpace.send(null); } } function resizeImage(img,containerHeight,containerWidth,centerImage) { img.onload=null; var nimg=new Image(); nimg.onload=function() { if(nimg.height>containerHeight) { var ratioOne=nimg.width/nimg.height; nimg.height=containerHeight; nimg.width=nimg.height*ratioOne; } if(nimg.width>containerWidth) { var ratioTwo=nimg.height/nimg.width; nimg.width=containerWidth; nimg.height=nimg.width*ratioTwo; } img.height=nimg.height; img.width=nimg.width; img.src=nimg.src; if(centerImage==1) { var heightOffset=parseInt((containerHeight-nimg.height)/2); var widthOffset=parseInt((containerWidth-nimg.width)/2); img.style.marginTop=heightOffset+'px'; img.style.marginBottom=heightOffset+'px'; img.style.marginLeft=widthOffset+'px'; img.style.marginRight=widthOffset+'px'; } img.style.display="block"; }; nimg.src=img.src; } function resizeImage2(myElement,imgURL,containerHeight,containerWidth,centerImage,onLoadFunction) { var myImage=document.getElementById(myElement); myImage.onload=null; var nimg=new Image(); nimg.onload=function() { if(nimg.height>containerHeight) { var ratioOne=nimg.width/nimg.height; nimg.height=containerHeight; nimg.width=nimg.height*ratioOne; } if(nimg.width>containerWidth) { var ratioTwo=nimg.height/nimg.width; nimg.width=containerWidth; nimg.height=nimg.width*ratioTwo; } myImage.height=nimg.height; myImage.width=nimg.width; myImage.src=nimg.src; if(centerImage==1) { var heightOffset=parseInt((containerHeight-nimg.height)/2); var widthOffset=parseInt((containerWidth-nimg.width)/2); myImage.style.marginTop=heightOffset+'px'; myImage.style.marginBottom=heightOffset+'px'; myImage.style.marginLeft=widthOffset+'px'; myImage.style.marginRight=widthOffset+'px'; } myImage.style.display="block"; if (typeof onLoadFunction=='function') { onLoadFunction(myImage); } }; nimg.onerror=function() { myImage.height=100; myImage.width=100; myImage.src='http://images9.green-watch.org/img/png/photoUnavailable.png'; if(centerImage==1) { var heightOffset=parseInt((containerHeight-100)/2); var widthOffset=parseInt((containerWidth-100)/2); myImage.style.marginTop=heightOffset+'px'; myImage.style.marginBottom=heightOffset+'px'; myImage.style.marginLeft=widthOffset+'px'; myImage.style.marginRight=widthOffset+'px'; } }; nimg.src=imgURL; } function updateCatList(scriptParams) { xmlCatList=GetXmlHttpObject(); if(xmlCatList==null){return;} url=myDirectory+"/scripts/cat-list.cfm?search=1&"+scriptParams; xmlCatList.open("GET",url,true); xmlCatList.onreadystatechange=function() { var availableCats=document.getElementById("MY_AVAILABLE_CATS"); if(xmlCatList.readyState==4&&xmlCatList.responseText!='') { availableCats.innerHTML=xmlCatList.responseText; availableCats.style.display="block"; } else if(xmlCatList.readyState==4) { availableCats.style.display="none"; } }; xmlCatList.send(null); } function updateSubcatList(scriptParams) { xmlSubcatList=GetXmlHttpObject(); if(xmlSubcatList==null){return;} url=myDirectory+"/scripts/subcat-list.cfm?search=1&"+scriptParams; xmlSubcatList.open("GET",url,true); xmlSubcatList.onreadystatechange=function() { var availableSubcats=document.getElementById("MY_AVAILABLE_SUBCATS"); if(xmlSubcatList.readyState==4&&xmlSubcatList.responseText!='') { availableSubcats.innerHTML=xmlSubcatList.responseText; availableSubcats.style.display="block"; } else if(xmlSubcatList.readyState==4) { availableSubcats.style.display="none"; } }; xmlSubcatList.send(null); } function updateCountryList(scriptParams,getFocus) { xmlCountryList=GetXmlHttpObject(); if(xmlCountryList==null){return;} url=myDirectory+"/scripts/country-list.cfm?search=1&"+scriptParams; xmlCountryList.open("GET",url,true); xmlCountryList.onreadystatechange=function() { var availableCountries=document.getElementById("MY_AVAILABLE_COUNTRIES"); if(xmlCountryList.readyState==4&&xmlCountryList.responseText!='') { availableCountries.innerHTML=xmlCountryList.responseText; availableCountries.style.display="block"; if(getFocus==1) { setFocus('COUNTRY_ID'); } } else if(xmlCountryList.readyState==4) { availableCountries.style.display="none"; } }; xmlCountryList.send(null); } function updateStateList(scriptParams,callbackFn,getFocus) { xmlStateList=GetXmlHttpObject(); if(xmlStateList==null) { return; } url=myDirectory+"/scripts/state-list.cfm?search=1&"+scriptParams; xmlStateList.open("GET",url,true); xmlStateList.onreadystatechange=function() { var availableRegions=document.getElementById("MY_AVAILABLE_STATES"); if(xmlStateList.readyState==4&&xmlStateList.responseText!='') { availableRegions.innerHTML=xmlStateList.responseText; availableRegions.style.display="block"; if (typeof callbackFn=='function') { callbackFn(); } if(getFocus==1) { setFocus('STATE_ID'); } } else if(xmlStateList.readyState==4) { availableRegions.style.display="none"; } }; xmlStateList.send(null); } function disableForms() { var inputs=document.getElementsByTagName('input'); for(element in inputs) { if(inputs[element].type=='submit') { inputs[element].disabled=true; } } } document.onfocus=function() { var inputs=document.getElementsByTagName('input'); for(element in inputs) { if(inputs[element].type=='submit') { inputs[element].disabled=false; } } }; function disableElement(element) { var myElement=document.getElementById(element); myElement.disabled=true; } function checkHTML(myElement,myElementError) { xmlCheckHTML=GetXmlHttpObject(); if(xmlCheckHTML==null) { return; } var myElement=document.getElementById(myElement); var myElementError=document.getElementById(myElementError); url=myDirectory+"/scripts/htmlCheck.cfm?myStr="+myElement.value; xmlCheckHTML.open("GET",url,true); xmlCheckHTML.onreadystatechange=function() { if(xmlCheckHTML.readyState==4&&xmlCheckHTML.responseText!='') { myElementError.innerHTML=xmlCheckHTML.responseText; myElementError.style.display="block"; } else if(xmlCheckHTML.readyState==4) { myElementError.style.display="none"; } }; xmlCheckHTML.send(null); } function checkUsername(myElement,myElementError) { xmlCheckUsername=GetXmlHttpObject(); if(xmlCheckUsername==null) { return; } var myElement2=document.getElementById(myElement); var myElementError2=document.getElementById(myElementError); url=myDirectory+"/scripts/checkUsername.cfm?USERNAME="+myElement2.value; xmlCheckUsername.open("GET",url,true); xmlCheckUsername.onreadystatechange=function() { if(xmlCheckUsername.readyState==4&&xmlCheckUsername.responseText!='') { myElementError2.innerHTML=xmlCheckUsername.responseText; myElementError2.style.display="block"; } else if(xmlCheckUsername.readyState==4) { myElementError2.style.display="none"; checkHTML(myElement,myElementError); } }; xmlCheckUsername.send(null); } function checkBizName(newBizName,newBizNameError,curBizName) { xmlCheckBizName=GetXmlHttpObject(); if(xmlCheckBizName==null) { return; } var newBizName2=document.getElementById(newBizName); var newBizNameError2=document.getElementById(newBizNameError); url=myDirectory+"/scripts/checkBizName.cfm?BUSINESS_NAME="+newBizName2.value+"&CURRENT_BIZ_NAME="+curBizName;url=url+"&sid="+Math.random(); xmlCheckBizName.open("GET",url,true); xmlCheckBizName.onreadystatechange=function() { if(xmlCheckBizName.readyState==4&&xmlCheckBizName.responseText!='') { newBizNameError2.innerHTML=xmlCheckBizName.responseText; newBizNameError2.style.display="block"; } else if (xmlCheckBizName.readyState==4) { newBizNameError2.style.display="none"; checkHTML(newBizName,newBizNameError); } }; xmlCheckBizName.send(null); } function checkNumeric(myElement,myElementError) { xmlCheckNumeric=GetXmlHttpObject(); if(xmlCheckNumeric==null) { return; } var myElement2=document.getElementById(myElement); var myElementError2=document.getElementById(myElementError); url=myDirectory+"/scripts/numericCheck.cfm?myStr="+myElement2.value; xmlCheckNumeric.open("GET",url,true); xmlCheckNumeric.onreadystatechange=function() { if(xmlCheckNumeric.readyState==4&&xmlCheckNumeric.responseText!='') { myElementError2.innerHTML=xmlCheckNumeric.responseText; myElementError2.style.display="block"; } else if(xmlCheckNumeric.readyState==4) { myElementError2.style.display="none"; } }; xmlCheckNumeric.send(null); } function checkWebsite(myElement,myElementError) { xmlCheckWebsite=GetXmlHttpObject(); if(xmlCheckWebsite==null) { return; } var websiteURL=document.getElementById(myElement); var websiteError=document.getElementById(myElementError); url=myDirectory+"/scripts/checkWebsite.cfm?WEBSITE_URL="+websiteURL.value; xmlCheckWebsite.open("GET",url,true); xmlCheckWebsite.onreadystatechange=function() { if(xmlCheckWebsite.readyState==4&&xmlCheckWebsite.responseText!='') { var errorMessage = '


That website URL is not valid. If you type your website '; errorMessage+='URL as plain text, we will take care of the rest.

Error: '+xmlCheckWebsite.responseText+'

'; websiteError.innerHTML=errorMessage; websiteError.style.display="block"; } else if(xmlCheckWebsite.readyState==4) { websiteError.style.display = "none"; } }; xmlCheckWebsite.send(null); } function checkCityName(regionElement,cityElement,cityElementError) { xmlCheckCity=GetXmlHttpObject(); if(xmlCheckCity==null) { return; } var cityName=document.getElementById(cityElement); var regionID=document.getElementById(regionElement); var cityNameError=document.getElementById(cityElementError); url=myDirectory+"/scripts/checkCityName.cfm?CITY_NAME="+cityName.value;url=url+"&STATE_ID="+regionID.value; xmlCheckCity.open("GET",url,true); xmlCheckCity.onreadystatechange=function() { if(xmlCheckCity.readyState==4&&xmlCheckCity.responseText!='') { cityNameError.innerHTML=xmlCheckCity.responseText; cityNameError.style.display="block"; } else if(xmlCheckCity.readyState==4) { cityNameError.style.display="none"; } }; xmlCheckCity.send(null); } function charCheck(myLabel,myTxtArea,charCount) { var charsRemainingLabel=document.getElementById(myLabel); var myTextArea=document.getElementById(myTxtArea); var charsLeft=charCount-myTextArea.value.length; if(charsLeft < 0) { alert("You can only enter up to "+charCount+" characters for this text field."); myTextArea.value=myTextArea.value.substring(0,charCount); charsRemainingLabel.innerHTML="0 characters remaining"; } else if(charsLeft==1) { charsRemainingLabel.innerHTML=charsLeft+" character remaining"; } else { charsRemainingLabel.innerHTML=charsLeft+" characters remaining"; } } function autoCompleteStatusMode(value,ID,statusPortion,url) { if(value!=""&&ID!=""&&url!="") { var page=url+''+value+'&ID='+ID+'&statusPortion='+statusPortion; oHTTP=GetXmlHttpObject(); if(oHTTP==null){return;} oHTTP.open("GET",page,true); oHTTP.onreadystatechange=function() { if (oHTTP.readyState==4) { if (oHTTP.responseText!='') { document.getElementById(statusPortion).style.display=''; document.getElementById(statusPortion).innerHTML=oHTTP.responseText; var liRow=document.getElementById(statusPortion).getElementsByTagName('li'); for (var i=0;i=minLength) { counter=onkeyupTestKey(e,ID,statusPortion,counter,scriptURL); } else { document.getElementById(statusPortion).innerHTML=''; document.getElementById(statusPortion).style.display='none'; } }; document.getElementById(ID).onkeydown=function(e) { var evt=(e)?e:event; var keyCode=evt.keyCode; if(keyCode==9) { document.getElementById(statusPortion).innerHTML=''; document.getElementById(statusPortion).style.display='none'; } }; document.getElementById(statusPortion).onkeyup=function(e) { counter=onkeyupTestKey(e,ID,statusPortion,counter,scriptURL); }; addDocOnClickEvent(function(e) { e = e || window.event; var theElem = e.target || e.srcElement; while(theElem!=null) { if(theElem.id==statusPortion) { return true; } theElem = theElem.offsetParent; } document.getElementById(statusPortion).innerHTML=''; document.getElementById(statusPortion).style.display='none'; return true; }); } function setupBizNameAutocompleter(minLength) { var scriptURL = 'http://www.green-watch.org/scripts/autocompleters/getBizNames.cfm?BUSINESS_NAME='; setupAutocompleter(scriptURL,'BUSINESS_NAME','BUSINESS_NAME_HINT',autobizNameCounter,minLength); } function setupCityNameAutocompleter(autoOptions) { var scriptURL='http://www.green-watch.org/scripts/autocompleters/getCityNames.cfm?SEARCH=1'; var minLength=3; var myFunc=null; if (typeof autoOptions.minLength!='undefined') { minLength=autoOptions.minLength; } if (typeof autoOptions.cityID!='undefined') { scriptURL+='&CITY_ID='+autoOptions.cityID; } if (typeof autoOptions.stateID!='undefined') { scriptURL+='&STATE_ID='+autoOptions.stateID; } if (typeof autoOptions.stateName!='undefined') { scriptURL+='&STATE_NAME='+autoOptions.stateName; } if (typeof autoOptions.countryID!='undefined') { scriptURL+='&COUNTRY_ID='+autoOptions.countryID; } if (typeof autoOptions.countryName!='undefined') { scriptURL+='&COUNTRY_NAME='+autoOptions.countryName; } if (typeof autoOptions.countryAbbr!='undefined') { scriptURL+='&COUNTRY_ABBR='+autoOptions.countryAbbr; } if (typeof autoOptions.contID!='undefined') { scriptURL+='&CONTINENT_ID='+autoOptions.contID; } if (typeof autoOptions.contName!='undefined') { scriptURL+='&CONTINENT_NAME='+autoOptions.contName; } if (typeof autoOptions.planID!='undefined') { scriptURL+='&PLANET_ID='+autoOptions.planID; } if (typeof autoOptions.planName!='undefined') { scriptURL+='&PLANET_NAME='+autoOptions.planName; } if (typeof autoOptions.filter!='undefined') { scriptURL+='&FILTER='+autoOptions.filter; } if (typeof autoOptions.maxCities!='undefined') { scriptURL+='&MAX_CITIES='+autoOptions.maxCities; } setupAutocompleter(scriptURL+"&CITY_NAME=",'CITY_NAME','CITY_HINT',autocityNameCounter,minLength); } function onkeyupTestKey(e,ID,statusPortion,counter,scriptURL) { var evt=(e)?e:event; var keyCode=evt.keyCode; var theElem=(evt.srcElement)?evt.srcElement:evt.target; if(keyCode==13) { } else if(keyCode==9) { while(theElem!=null) { if(theElem.id==ID) { document.getElementById(statusPortion).innerHTML=''; document.getElementById(statusPortion).style.display='none'; break; } theElem = theElem.offsetParent; } } else if(keyCode==40) { while(theElem!=null) { if(theElem.id==ID||theElem.id==statusPortion) { var liRow=document.getElementById(statusPortion).getElementsByTagName('li'); if(counter0) { counter--; } for (var i=0;i