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,myMaxAds,myAdSpaceDiv,onLoadFunc,catID,subcatID) { 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(typeof myMaxAds!='undefined') { maxAds = myMaxAds; } if(maxAds>0) { xmlLeftAdSpace=GetXmlHttpObject(); if(xmlLeftAdSpace==null) { return; } var myHeightVar=rightHeight-leftHeight; url=myDirectory+"/ADS/showSideAds.cfm?adHeight="+myHeightVar+"&maxAds="+maxAds+"&adKeywords="+adKeywords+"&catID="+catID+"&subcatID="+subcatID; url+="&adPreference="+adPreference+"&sid="+Math.random(); xmlLeftAdSpace.open("GET",url,true); var myDivSpaceName = "MY_ADSPACE"; if(typeof myAdSpaceDiv!='undefined') { myDivSpaceName=myAdSpaceDiv; } xmlLeftAdSpace.onreadystatechange=function() { var sideAdDiv=document.getElementById(myDivSpaceName); if(xmlLeftAdSpace.readyState==4&&xmlLeftAdSpace.responseText!='') { sideAdDiv.innerHTML=xmlLeftAdSpace.responseText;sideAdDiv.style.display="block"; if(typeof onLoadFunc!='undefined') { onLoadFunc(); } } 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="+Base64.encode(websiteURL.value); xmlCheckWebsite.open("GET",url,true); xmlCheckWebsite.onreadystatechange=function() { if(xmlCheckWebsite.readyState==4&&xmlCheckWebsite.responseText!='OK') { var errorMessage = '<p class="txt4 error"><br />That website URL is not valid. If you type your website '; errorMessage+='URL as plain text, we will take care of the rest.</p><p class="txt4 error">Error: '+xmlCheckWebsite.responseText+'</p>'; 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<liRow.length;i++) { liRow[i].onmouseover=function(e) { var liRow=document.getElementById(statusPortion).getElementsByTagName('li'); for (var j=0;j<liRow.length;j++) { liRow[j].style.backgroundColor='#CCCCCC'; } this.style.backgroundColor='#FFFFFF'; }; liRow[i].onmouseout=function(e) { this.style.backgroundColor='#CCCCCC'; }; liRow[i].onclick=function(e) { document.getElementById(ID).value=this.innerHTML; document.getElementById(statusPortion).innerHTML=''; document.getElementById(statusPortion).style.display='none'; document.getElementById(ID).focus(); if (typeof bizNameAutocompleterOnclickFunc!='undefined') { bizNameAutocompleterOnclickFunc(); } if (typeof cityAutocompleterOnclickFunc!='undefined') { cityAutocompleterOnclickFunc(); } }; } } else { document.getElementById(statusPortion).style.display='none'; document.getElementById(statusPortion).innerHTML=''; } } }; oHTTP.send(null); } else { document.getElementById(statusPortion).style.display='none'; document.getElementById(statusPortion).innerHTML=''; } } function autoCompleteStatusModeResponse(page,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; } else { document.getElementById(statusPortion).style.display='none'; document.getElementById(statusPortion).innerHTML=''; } } }; oHTTP.send(null); } function setupAutocompleter(scriptURL,ID,statusPortion,counter,minLength) { if (typeof minLength=='undefined') { minLength=1; } document.getElementById(ID).setAttribute("autocomplete","off"); document.getElementById(ID).onkeyup=function(e) { if (document.getElementById(ID).value.length>=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 setupEventNameAutocompleter(minLength) { var scriptURL = 'http://www.green-watch.org/scripts/autocompleters/getEventNames.cfm?EVENT_NAME='; setupAutocompleter(scriptURL,'EVENT_NAME','EVENT_NAME_HINT',autoeventNameCounter,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(counter<liRow.length-1) { counter++; } for (var i=0;i<liRow.length;i++) { if(counter==i) { liRow[i].style.backgroundColor='white'; document.getElementById(ID).value=liRow[i].innerHTML; } else { liRow[i].style.backgroundColor='#CCCCCC'; } } break; } theElem = theElem.offsetParent; } } else if(keyCode==38) { while(theElem!=null) { if(theElem.id==ID||theElem.id==statusPortion) { var liRow=document.getElementById(statusPortion).getElementsByTagName('li'); if(counter>0) { counter--; } for (var i=0;i<liRow.length;i++) { if(counter==i) { liRow[i].style.backgroundColor='white'; document.getElementById(ID).value=liRow[i].innerHTML; } else { liRow[i].style.backgroundColor='#CCCCCC'; } } break; } theElem=theElem.offsetParent; } } else { while(theElem!=null) { if(theElem.id==ID) { autoCompleteStatusMode(document.getElementById(ID).value,ID,statusPortion,scriptURL); } theElem=theElem.offsetParent; } counter=0; } return counter; } var autobizNameCounter=0; var autocityNameCounter=0; var autoeventNameCounter=0; function addDocOnClickEvent(func) { var oldonload=document.onclick; if (typeof document.onclick!='function') { document.onclick=func; } else { document.onclick=function(e) { if(oldonload) { oldonload(e); } func(e); }; } } var tooltip=function() { var id = 'tt'; var myElement = ''; var top = 3; var left = 3; var width = 100; var mySpeed = 20; var timer = 0; var endalpha = 95; var title = ''; var alpha = 0; var hook = 'none'; var stem = 'true'; var tt,t,c,d,b,h,z; var ie = document.all ? true : false; return{ setGlobals:function(aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk) { endalpha=aa; alpha=bb; timer=cc; mySpeed=dd; width=ee; top=ff; left=gg; title=hh; hook=ii; myElement=jj; stem=kk; }, show:function(v) { if(tt==null) { tt=document.createElement('div'); tt.setAttribute('id',id); d=document.createElement('div'); d.setAttribute('id',id+'title'); c=document.createElement('div'); c.setAttribute('id',id+'cont'); tt.appendChild(d); tt.appendChild(c); document.body.appendChild(tt); tt.style.opacity=0; tt.style.filter='alpha(opacity=0)'; document.onmousemove=this.pos; } if(z==null) { z=document.createElement('div'); document.body.appendChild(z); z.style.opacity=0; z.style.filter='alpha(opacity=0)'; } if (title=='') { d.style.display='none'; } else { d.style.display='block'; } z.setAttribute('id',id+'stem'+hook); tt.style.display='block'; z.style.display='block'; d.innerHTML=title; c.innerHTML=v; tt.style.width=width+'px'; h = parseInt(tt.offsetHeight)+top; clearInterval(tt.timer); tt.timer = setInterval(function(){tooltip.fade(1)},timer); tooltip.updatePosition(); }, updatePosition:function(e) { var ot = myElement.offsetTop; var ol = myElement.offsetLeft; var oh = myElement.offsetHeight; var ow = myElement.offsetWidth; var oh2 = tt.offsetHeight; var ow2 = tt.offsetWidth; var oh3 = z.offsetHeight; var ow3 = z.offsetWidth; tempEl = myElement.offsetParent; while (tempEl!=null) { ot+=tempEl.offsetTop; ol+=tempEl.offsetLeft; tempEl=tempEl.offsetParent; } if(hook=='leftMiddle') { tt.style.top=(Math.floor(ot+oh/2-oh2/2))+'px'; tt.style.left=(Math.floor(ol-ow2-12))+'px'; z.style.top=(Math.floor(ot+oh/2-oh3/2))+'px'; z.style.left=(Math.floor(ol-12))+'px'; } else if(hook=='bottomLeft') { tt.style.top=(Math.floor(ot+oh+7))+'px'; tt.style.left=(Math.floor(ol-ow2))+'px'; z.style.top=(Math.floor(ot+oh+4-oh3/2))+'px'; z.style.left=(Math.floor(ol-ow3+1))+'px'; } else if(hook=='bottomMiddle') { tt.style.top=(Math.floor(ot+oh+12))+'px'; tt.style.left=(Math.floor(ol+ow/2-ow2/2))+'px'; z.style.top=(Math.floor(ot-oh3/2+oh+9))+'px'; z.style.left=(Math.floor(ol+ow/2-ow3/2))+'px'; } else if(hook=='bottomRight') { tt.style.top=(Math.floor(ot+oh+7))+'px'; tt.style.left=(Math.floor(ol+ow+7))+'px'; z.style.top=(Math.floor(ot+oh+5-oh3/2))+'px'; z.style.left=(Math.floor(ol+ow+ow3/2-1))+'px'; } else if(hook=='rightMiddle') { tt.style.top=(Math.floor(ot+oh/2-oh2/2))+'px'; tt.style.left=(Math.floor(ol+ow+12))+'px'; z.style.top=(Math.floor(ot+oh/2-oh3/2))+'px'; z.style.left=(Math.floor(ol+ow))+'px'; } else if(hook=='topRight') { tt.style.top=(Math.floor(ot-oh2-7))+'px'; tt.style.left=(Math.floor(ol+ow+7))+'px'; z.style.top=(Math.floor(ot-7))+'px'; z.style.left=(Math.floor(ol+ow+7))+'px'; } else if(hook=='topMiddle') { tt.style.top=(Math.floor(ot-oh2-15))+'px'; tt.style.left=(Math.floor(ol+ow/2-ow2/2))+'px'; z.style.top=(Math.floor(ot-15))+'px'; z.style.left=(Math.floor(ol+ow/2-ow3/2))+'px'; } else if(hook=='topLeft') { tt.style.top=(Math.floor(ot-oh2-7))+'px'; tt.style.left=(Math.floor(ol-ow2-7))+'px'; z.style.top=(Math.floor(ot-7))+'px'; z.style.left=(Math.floor(ol-ow3-6))+'px'; } }, pos:function(e) { if (hook=='none') { var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY; var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX; tt.style.top=(u-h)+'px'; tt.style.left=(l+left)+'px'; } else { tooltip.updatePosition(); } }, fade:function(d) { var a = alpha; if((a != endalpha && d == 1) || (a != 0 && d == -1)) { var i = mySpeed; if((endalpha - a) < mySpeed && d == 1) { i = endalpha - a; } else if(alpha < mySpeed && d == -1) { i = a; } alpha = a + (i * d); tt.style.opacity = alpha * .01; tt.style.filter = 'alpha(opacity=' + alpha + ')'; z.style.opacity = alpha * .01; z.style.filter = 'alpha(opacity=' + alpha + ')'; } else { clearInterval(tt.timer); if(d == -1) { tt.style.display = 'none'; z.style.display = 'none'; } } }, hide:function() { clearInterval(tt.timer); tt.timer = setInterval(function(){tooltip.fade(-1)},timer); }}; }(); GreenToolTip=function(myID,myDesc,myOptions) { var myEndAlpha=95; var myAlpha=0; var myTimer=20; var mySpeed=10; var myWidth=100; var myTopMargin=3; var myLeftMargin=3; var myTitle=''; var myStem = 'true'; var myHook = 'leftMiddle'; var ajaxContent = ''; if (typeof myOptions!='undefined') { if (typeof myOptions.myEndAlpha!='undefined') { myEndAlpha=myOptions.myEndAlpha; } if (typeof myOptions.myAlpha!='undefined') { myAlpha=myOptions.myAlpha; } if (typeof myOptions.myTimer!='undefined') { myTimer=myOptions.myTimer; } if (typeof myOptions.mySpeed!='undefined') { mySpeed=myOptions.mySpeed; } if (typeof myOptions.myWidth!='undefined') { myWidth=myOptions.myWidth; } if (typeof myOptions.myTopMargin!='undefined') { myTopMargin=myOptions.myTopMargin; } if (typeof myOptions.myLeftMargin!='undefined') { myLeftMargin=myOptions.myLeftMargin; } if (typeof myOptions.myTitle!='undefined') { myTitle=myOptions.myTitle; } if (typeof myOptions.myHook!='undefined') { myHook=myOptions.myHook; } if (typeof myOptions.myStem!='undefined') { myStem=myOptions.myStem; } if (typeof myOptions.ajaxContent!='undefined') { ajaxContent=myOptions.ajaxContent; } } var myElement=document.getElementById(myID); if (ajaxContent=='') { addEvent(myElement,'mouseover',function(e) { tooltip.setGlobals(myEndAlpha,myAlpha,myTimer,mySpeed,myWidth,myTopMargin,myLeftMargin,myTitle,myHook,myElement,myStem); tooltip.show(myDesc); }); } else { addEvent(myElement,'mouseover',function(e) { var evt=(e)?e:event; var keyCode=evt.keyCode; var theElem=(evt.srcElement)?evt.srcElement:evt.target; var myImageID=theElem.id; var myImageXML=GetXmlHttpObject(); if(myImageXML==null){return;} tooltip.setGlobals(myEndAlpha,myAlpha,myTimer,mySpeed,28,5,5,'',myHook,theElem,myStem); myDesc='<img src="http://images10.green-watch.org/img/gif/loading.gif">'; tooltip.show(myDesc); myImageXML.open("GET",ajaxContent,true); myImageXML.onreadystatechange=function() { if(myImageXML.readyState==4&&myImageXML.responseText!='') { tooltip.setGlobals(myEndAlpha,myAlpha,myTimer,mySpeed,myWidth,myTopMargin,myLeftMargin,myTitle,myHook,theElem,myStem); myDesc=myImageXML.responseText; tooltip.show(myDesc); } }; myImageXML.send(null); }); } addEvent(myElement,'mouseout',function(e) { tooltip.hide(); }); }; function turnAutoCompleteOff(ID) { document.getElementById(ID).setAttribute("autocomplete","off"); } function setFocus(ID) { document.getElementById(ID).focus(); } var Base64 = { _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode : function(input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, decode : function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, _utf8_decode : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } }; if(typeof myBodyOnLoadEvent2){myBodyOnLoadEvent2()};
