// Copyright Team Cowboy, LLC. All rights reserved. Contents of this file are not granted for use without prior permission.

$(document).ready(function(){bindImageCheckRadios("input[type=checkbox]","jqCheckbox_checkBox");bindImageCheckRadios("input[type=radio]","jqCheckbox_radioBox");$(".hoverbox").hoverbox({});});var focusObject;function bindImageCheckRadios(selector,className){$(selector).checkbox({cls:className,empty:GL_SITE_ROOT+'images/checkbox/empty.png'});}
function setLastFocus(obj){focusObject=obj;}
function getLastFocus(){return focusObject;}
function openWindow(url,windowName,width,height){var winl,wint;var settings='';if(screen.width){winl=(screen.width-width)/2;wint=(screen.height-height)/2;}else{winl=0;wint=0;}
if(winl<0){winl=0;}
if(wint<0){wint=0;}
settings+='height='+height+',';settings+='width='+width+',';settings+='top=200,left=200,';settings+='directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes';var win=window.open(url,windowName,settings);return win;}
function trim(str){if(str===""||str==null){return str;}
if(str.charAt){while(str.charAt(0)==' '){str=str.substring(1);}
while(str.charAt(str.length-1)==' '){str=str.substring(0,str.length-1);}
return str;}else{return str;}}
function isEmailValid(sEmail){sEmail=trim(sEmail);if(sEmail===''){return false;}
var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(filter.test(sEmail)){return true;}else{return false;}}
function isValidZipcode(sZip){sZip=trim(sZip);if(sZip.length!==5&&sZip.length!==10&&sZip.length!==9&&sZip.length!==6&&sZip.length!==7){return false;}
if(sZip.length==5||sZip.length==9){if(isNaN(sZip)){return false;}}
if(sZip.length==10){if(!sZip.indexOf('-')==5&&!sZip.indexOf(' ')==5){return false;}
var firstFive=sZip.substring(0,5);var lastFour=sZip.substring(6,10);if(isNaN(firstFive)||isNaN(lastFour)){return false;}}
if(sZip.length==6){if(!isNaN(sZip)){return false;}
var firstChar=sZip.substring(0,1);if(!isNaN(firstChar)){return false;}}
if(sZip.length==7){if(!isNaN(sZip)){return false;}
firstChar=sZip.substring(0,1);if(!isNaN(firstChar)){return false;}
if(!sZip.indexOf('-')==3&&!sZip.indexOf(' ')==3){return false;}}
return true;}
function addDays(myDate,days){return new Date(myDate+(days*24*60*60*1000));}
function FormatNumber(expr,decplaces){if(isNaN(expr)||isNaN(parseFloat(expr,10))){return expr;}
var str=""+Math.round(eval(expr)*Math.pow(10,decplaces));while(str.length<=decplaces){str="0"+str;}
var decpoint=str.length-decplaces;var formatted=str.substring(0,decpoint)+"."+str.substring(decpoint,str.length);formatted=AddCommas(formatted);return formatted;}
function AddCommas(nStr)
{nStr+='';x=nStr.split('.');x1=x[0];x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+','+'$2');}
return x1+x2;}
function isLeapYear(yr){if(yr%4!==0){return false;}
else if(yr%400===0){return true;}
else if(yr%100===0){return false;}
else{return true;}}
function daysInMonth(mn,yr){var mDay;if((mn===4)||(mn===6)||(mn===9)||(mn===11)){mDay=30;}else if(mn===2){mDay=isLeapYear(yr)?29:28;}else{mDay=31;}
return mDay;}
function isValidDate(sDate){sDate=trim(sDate);var dateSplit=sDate.split("/");if(dateSplit.length!==3){return false;}
var month=trim(dateSplit[0]);var day=trim(dateSplit[1]);var year=trim(dateSplit[2]);month=parseInt(month,10);day=parseInt(day,10);year=parseInt(year,10);if(isNaN(month)||isNaN(day)||isNaN(year)){return false;}
if(isNaN(month)||isNaN(day)||isNaN(year)){return false;}
if(month<1||month>12){return false;}
if(day<1||day>31){return false;}
if(year.length===2){if(year<70){year=2000+year;}else{year=1900+year;}}else if(year.length===3){return false;}
if(day>daysInMonth(month,year)){return false;}
return true;}
function isValidTime(sTime){sTime=trim(sTime);if(sTime===''){return true;}
if(sTime.indexOf(":")<0){return false;}
var timeSplit=sTime.split(":");timeSplit[0]=trim(timeSplit[0]);timeSplit[1]=trim(timeSplit[1]);if(isNaN(timeSplit[0])||isNaN(timeSplit[1])){return false;}
if(parseInt(timeSplit[0],10)<1||parseInt(timeSplit[0],10)>12){return false;}
if(parseInt(timeSplit[1],10)<0||parseInt(timeSplit[1],10)>59||timeSplit[1].length!==2){return false;}
return true;}
function getRadioValue(objRadio){var itemChecked=false;if(objRadio){for(var i=0;i<objRadio.length;i++){if(objRadio[i].checked){itemChecked=true;return objRadio[i].value;}}
if(itemChecked===false){return'';}}else{return'';}}
function setRadioValue(objRadio,sValue){if(objRadio){for(var i=0;i<objRadio.length;i++){if(objRadio[i].value===sValue){objRadio[i].checked=true;}}}}
function showHideElement(elementId,action){var oElement=document.getElementById(elementId);if(oElement){if(action==='show'){oElement.style.display='';}else if(action==='hide'){oElement.style.display='none';}else if(action==='toggle'){if(oElement.style.display===''){oElement.style.display='none';}else{oElement.style.display='';}}
return oElement;}}
function setClass(elementId,className){var oElement=document.getElementById(elementId);if(oElement){oElement.className=className;}}
function showHideExpandIcon(elementId,iconId,action,root){var oElement=showHideElement(elementId,action);var oIcon=document.getElementById(iconId);if(oElement.style.display==='none'){oIcon.src=root+'images/icons/arrow-right.gif';}else{oIcon.src=root+'images/icons/arrow-down.gif';}}
function toggleExpandIcon(iconId,action,root){var oIcon=document.getElementById(iconId);if(oIcon){if(action=='toggle'){if(oIcon.src.indexOf('arrow-right')>=0){oIcon.src=root+'images/icons/arrow-down.gif';}else{oIcon.src=root+'images/icons/arrow-right.gif';}}else if(action=='show'){oIcon.src=root+'images/icons/arrow-down.gif';}else if(action=='hide'){oIcon.src=root+'images/icons/arrow-right.gif';}}}
function jqShowHideExpandIcon(elementId,iconId,action,root,callback){var oElement=document.getElementById(elementId);$(document).ready(function(){toggleExpandIcon(iconId,action,root);if(callback==null){callback=function(){};}
if(action=='show'){$(oElement).slideDown("fast",callback);}else if(action=='hide'){$(oElement).slideUp("fast",callback);}else{$(oElement).slideToggle("fast",callback);}});}
function sortSelectOptions(a,b){if((a.text.toLowerCase()+"")<(b.text.toLowerCase()+"")){return-1;}
if((a.text.toLowerCase()+"")>(b.text.toLowerCase()+"")){return 1;}
return 0;}
function sortSelectBox(obj,sortSkipCount){var skippedOptions=[];var existingOptions=[];if(!obj.options){return;}
for(var i=0;i<sortSkipCount;i++){skippedOptions[skippedOptions.length]=obj.options[i];}
for(var i=sortSkipCount;i<obj.options.length;i++){existingOptions[existingOptions.length]=obj.options[i];}
if(existingOptions.length===0){return;}
existingOptions=existingOptions.sort(sortSelectOptions);obj.length=0;for(i=0;i<skippedOptions.length;i++){obj.options[i]=skippedOptions[i];}
for(i=0;i<existingOptions.length;i++){var optionPos=sortSkipCount+i;obj.options[optionPos]=existingOptions[i];}}
function getCursorPosition(e){e=e||window.event;var cursor={x:0,y:0};if(e.pageX||e.pageY){cursor.x=e.pageX;cursor.y=e.pageY;}else{cursor.x=e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft)-
document.documentElement.clientLeft;cursor.y=e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop)-
document.documentElement.clientTop;}
return cursor;}
function f_filterResults(n_win,n_docel,n_body){var n_result;if(n_win){n_result=n_win;}else{n_result=0;}
if(n_docel&&(!n_result||(n_result>n_docel))){n_result=n_docel;}
var retValue;if(n_body&&(!n_result||(n_result>n_body))){retValue=n_body;}else{retValue=n_result;}
return retValue;}
function f_clientWidth(){var param1,param2,param3;if(window.innerWidth){param1=window.innerWidth;}else{param1=0;}
if(document.documentElement){param2=document.documentElement.clientWidth;}else{param2=0;}
if(document.body){param3=document.body.clientWidth;}else{param3=0;}
return f_filterResults(param1,param2,param3);}
function f_clientHeight(){var param1,param2,param3;if(window.innerHeight){param1=window.innerHeight;}else{param1=0;}
if(document.documentElement){param2=document.documentElement.clientHeight;}else{param2=0;}
if(document.body){param3=document.body.clientHeight;}else{param3=0;}
return f_filterResults(param1,param2,param3);}
function f_scrollLeft(){var param1,param2,param3;if(window.pageXOffset){param1=window.pageXOffset;}else{param1=0;}
if(document.documentElement){param2=document.documentElement.scrollLeft;}else{param2=0;}
if(document.body){param3=document.body.scrollLeft;}else{param3=0;}
return f_filterResults(param1,param2,param3);}
function f_scrollTop(){var param1,param2,param3;if(window.pageYOffset){param1=window.pageYOffset;}else{param1=0;}
if(document.documentElement){param2=document.documentElement.scrollTop;}else{param2=0;}
if(document.body){param3=document.body.scrollTop;}else{param3=0;}
return f_filterResults(param1,param2,param3);}
function getWindowSize(){var windowSize={width:0,height:0,scrollLeft:0,scrollTop:0,top:0,left:0};windowSize.width=f_clientWidth();windowSize.height=f_clientHeight();windowSize.scrollLeft=f_scrollLeft();windowSize.scrollTop=f_scrollTop();windowSize.top=windowSize.scrollTop;windowSize.bottom=windowSize.top+windowSize.height;windowSize.left=windowSize.scrollLeft;windowSize.right=windowSize.left+windowSize.width;return windowSize;}
function getPopupSizePosition(clientX,clientY,popupWidth,popupHeight){var windowSize=getWindowSize();var popupSizePosition={width:0,height:0,top:0,left:0,bottom:0,right:0};popupSizePosition.width=popupWidth;popupSizePosition.height=popupHeight;popupSizePosition.bottom=popupHeight;popupSizePosition.right=popupWidth;popupSizePosition.left=clientX+windowSize.scrollLeft+5;popupSizePosition.top=clientY+windowSize.scrollTop+5;popupSizePosition.bottom=popupSizePosition.top+popupSizePosition.height;popupSizePosition.right=popupSizePosition.left+popupSizePosition.width;if(popupSizePosition.bottom>windowSize.bottom){popupSizePosition.top=windowSize.bottom-popupSizePosition.height-7;}
if(popupSizePosition.right>windowSize.right){popupSizePosition.left=windowSize.right-popupSizePosition.width-7;}
return popupSizePosition;}
function getObjectSize(objId){var size={width:0,height:0};var obj=document.getElementById(objId);if(document.layers){size.height=obj.document.height;size.width=obj.document.width;}else if(document.all){size.height=obj.offsetHeight;size.width=obj.offsetWidth;}
return size;}
function tabExists(tabIdsArray,tabId){if(!tabIdsArray){return false;}
var tabPresent=false;var contentDivId,tabElementId;for(var i=0;i<tabIdsArray.length;i++){if(tabIdsArray[i]!==tabId){continue;}
eval('contentDivId = \'tabContent_'+tabIdsArray[i]+'\'');eval('tabElementId = \'tab_'+tabIdsArray[i]+'\'');if(document.getElementById(contentDivId)&&document.getElementById(tabElementId)){tabPresent=true;break;}}
return tabPresent;}
function showTab(tabIdsArray,tabId,callback){var contentDivId,tabElementId;if(!tabExists(tabIdsArray,tabId)){tabId=tabIdsArray[0];}
for(var i=0;i<tabIdsArray.length;i++){eval('contentDivId = \'tabContent_'+tabIdsArray[i]+'\'');eval('tabElementId = \'tab_'+tabIdsArray[i]+'\'');$("#"+contentDivId).hide();setClass(tabElementId,'contentBoxTab_off');}
eval('contentDivId = \'tabContent_'+tabId+'\'');eval('tabElementId = \'tab_'+tabId+'\'');$("#"+contentDivId).show();if(callback!=null){callback();}
setClass(tabElementId,'contentBoxTab_on');}
function trapKeypress(e,theKey){var iKeyCode=0;if(window.event){iKeyCode=window.event.keyCode;}else if(e){iKeyCode=e.which;}
return(iKeyCode!==theKey);}
function enterPressed(event){var result=trapKeypress(event,13);if(result===true){return false;}else{return true;}}
function trapEnter(event){return trapKeypress(event,13);}
function selectOption(selectBoxId,method,matchText){var oSelect=document.getElementById(selectBoxId);var optionValue='';var optionText='';if(oSelect&&oSelect.options){for(var i=0;i<oSelect.options.length;i++){optionValue=oSelect.options[i].value;optionText=oSelect.options[i].text;if(method==='value'&&matchText===optionValue){oSelect.options[i].selected=true;return;}else if(method==='text'&&matchText===optionText){oSelect.options[i].selected=true;return;}}}}
function SelectAllListboxItems(oListbox){if(!oListbox){return;}
for(var i=0;i<oListbox.options.length;i++){oListbox.options[i].selected=true;}}
function SetupJSCalendar(Calendar,inputField,triggerButton,yearRange){Calendar.setup({inputField:inputField,button:triggerButton,ifFormat:"%m/%e/%Y",daFormat:"%A, %B %d, %Y",align:"Br",range:yearRange.split(","),weekNumbers:false,cache:true});}
function doFade(id,opacStart,opacEnd,millisec,delayBeforeFade){var speed=Math.round(millisec/100);var timer=0;if(delayBeforeFade>0){setTimeout('doFade(\''+id+'\', '+opacStart+', '+opacEnd+', '+millisec+', 0);',delayBeforeFade);return;}
var i;if(opacStart>opacEnd){for(i=opacStart;i>=opacEnd;i--){setTimeout('changeOpac(\''+id+'\', '+i+', true)',(timer*speed));timer++;}}else if(opacStart<opacEnd){for(i=opacStart;i<=opacEnd;i++){setTimeout('changeOpac(\''+id+'\', '+i+', true)',(timer*speed));timer++;}}}
function changeOpac(id,opacity,hideWhenZero){var objectStyle=document.getElementById(id).style;objectStyle.opacity=(opacity/100);objectStyle.MozOpacity=(opacity/100);objectStyle.KhtmlOpacity=(opacity/100);objectStyle.filter="alpha(opacity="+opacity+")";if(hideWhenZero===true&&opacity===0){objectStyle.display='none';}}
function getSelectValue(id){var oSelect=document.getElementById(id);if(oSelect){return oSelect.options[oSelect.selectedIndex].value;}}
function getXMLParser(xmlSource){var doc;if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(xmlSource);}else{var parser=new DOMParser();doc=parser.parseFromString(xmlSource,"text/xml");}
return doc;}
function reloadCaptcha(root){var captchaImage=document.getElementById('captcha');var captchaInput=document.getElementById('captchaCode');captchaImage.src=root+'inc/securimage/show.php?t='+Math.random();captchaInput.value='';captchaInput.focus();return false;}
function jqClearQueue(obj){$(obj).stop({clearQueue:true});}
function stopBubble(event){event.cancelBubble=true;if(event.stopPropagation){event.stopPropagation();}}
function refreshDialog(contentDivId,resetPosition){var oDialog=eval('dialog_'+contentDivId);if(oDialog){if(oDialog.isVisible==true){oDialog.resetPosition=resetPosition;oDialog.display();oDialog.adjustPosition();}}}
function showDialog(contentDivId,options){var oDiv=document.getElementById('dialog_'+contentDivId+'_wrapper');var oDialog=eval('dialog_'+contentDivId);var option_width=400;var option_height=null;var option_autoCenter=true;var option_top=null;var option_left=null;var option_borderStyle='border';var option_borderSize=9;var option_borderOpacity=0.6;var option_borderVisible=true;var option_modal=true;var option_draggable=true;var option_fadeOut=true;var optionsArray=options.split(",");var tempOption;for(var i=0;i<optionsArray.length;i++){tempOption=trim(optionsArray[i]).split('=');eval('option_'+trim(tempOption[0])+' = '+trim(tempOption[1])+';');}
var setPosition=false;if(option_top!==null||option_left!==null){option_autoCenter=false;setPosition=true;}
if(oDialog&&oDiv){oDialog.setDivId('dialog_'+contentDivId+'_wrapper');oDialog.setSize(option_width,option_height);if(setPosition===true){oDialog.setPosition(option_top,option_left);}
oDialog.setBorderStyle(option_borderStyle,option_borderSize,option_borderOpacity,option_borderVisible);oDialog.setIsModal(option_modal);oDialog.autoCenter=option_autoCenter;oDialog.resetPosition=true;oDialog.display();$(document).ready(function(){$('#dialog_'+contentDivId+'_titleBar').unbind("dblclick");$('#dialog_'+contentDivId+'_titleBar').dblclick(function(){var contentDisplay=$('#dialog_'+contentDivId+'_content').css("display");if(contentDisplay==='block'){$('#dialog_'+contentDivId+'_content').fadeOut("fast",function(){refreshDialog(contentDivId,false);});}else{$('#dialog_'+contentDivId+'_content').fadeIn("fast",function(){refreshDialog(contentDivId,false);});}});});if(option_draggable===true){$(document).ready(function(){$(oDiv).draggable("destroy");$("#dialog_"+contentDivId+"_titleBar").css("cursor","move");$(oDiv).draggable({cancel:"#dialog_"+contentDivId+"_content",opacity:1.00,delay:0,start:function(){oDialog.startDrag();},stop:function(){oDialog.endDrag();}});});}}}
function closeDialog(contentDivId){var oDialog=eval('dialog_'+contentDivId);if(oDialog){oDialog.close();}}
function setupTeamMenu(){$(document).ready(function(){$("#st_menu").click(function(){$("#st_items_container").slideToggle("fast");});var hoverConfig_menuButton={sensitivity:7,interval:125,over:function(){$("#st_items_container").slideDown("fast");},timeout:0,out:function(){}};var hoverConfig_items_wrapper={sensitivity:7,interval:125,over:function(){$("#st_items_container").stop(true,false);},timeout:0,out:function(){$("#st_items_container").slideUp("fast",function(){});}};var hoverConfig_container={sensitivity:7,interval:125,over:function(){return;},timeout:0,out:function(){$("#st_items_container").slideUp("fast");}};$("#st_menu").hoverIntent(hoverConfig_menuButton);$("#st_container").hoverIntent(hoverConfig_container);$(".st_item_container").click(function(e){var a=$(e.target).find(".st_item_link");if(a){a.click();$("#st_items_wrapper_new").slideUp("fast");}});});}
function loadGMap(mapId,showTypeControl,showMarkerDetails,locationName,locationAddressBare,locationAddressEncoded,locationCity){var mapDiv=document.getElementById(mapId);var oMap;$(document).ready(function(){if(mapDiv&&GBrowserIsCompatible()){oMap=new GMap2(mapDiv);var markerHtml='<div style="white-space: normal;"><h3>'+locationName+'</h3><a href="http://maps.google.com/maps?z=13&saddr=&daddr='+locationAddressEncoded+'" target="_blank"><b>Get directions/view larger map</b></a><img src="'+GL_SITE_ROOT+'images/icons/external.png" alt="" width="10" height="10" border="0" class="valign iconMarginLeft"></div>';var geocoder=new GClientGeocoder();geocoder.getLatLng(locationAddressBare,function(point){if(point===null){geocoder.getLatLng(locationCity,function(point){if(point===null){}else{oMap.setCenter(point,13);}});}else{oMap.setCenter(point,13);var marker=new GMarker(point);oMap.addOverlay(marker);if(showMarkerDetails==true){GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(markerHtml);});}}});oMap.addControl(new GSmallMapControl());if(showTypeControl==true){oMap.addControl(new GMapTypeControl());}}});}
function setOnBeforeUnloadEvent(msg){window.onbeforeunload=function(){return msg;}}
function clearOnBeforeUnloadEvent(){window.onbeforeunload=function(){}}
function jqToggleCheckboxes(className,action){$(document).ready(function(){if(action=="check"){$("."+className).attr("checked","true");}else{$("."+className).attr("checked","");}});}
function editSwatch(swatchProfileName){var swatch=colorPickerPageSwatches[swatchProfileName];var swatchProfileLabel="";if(swatch==null){ColorPicker.show(swatchProfileName,swatchProfileLabel,null,null);}else{ColorPicker.show(swatchProfileName,swatch.labelExtra,swatch.label,swatch.colors);}}
function redirectToLoginPage(){window.location=GL_LOGOUTPAGE;}
function jqueryAjax(ajax_url,ajax_data,ajax_async,beforeSendCallbackFunction,successCallbackFunction,errorCallbackFunction){$.ajax({type:"POST",url:ajax_url,data:ajax_data,cache:false,async:ajax_async,contentType:"application/x-www-form-urlencoded",beforeSend:beforeSendCallbackFunction,success:function(responseData,textStatus){jQueryAjax_checkSuccess(this,responseData,successCallbackFunction);},error:errorCallbackFunction});}
function jQueryAjax_checkSuccess(jqAjaxRequest,responseData,successCallbackFunction){if(responseData=="-1"){redirectToLoginPage();}else if(responseData=="0"){jqAjaxRequest.error();}else{successCallbackFunction(responseData);}}
function jsEscape(string){return encodeURIComponent(string);}
function ValidateUsername(username){var minUsernameLength=parseInt(GL_USERNAME_MIN);username=trim(username);if(username==""){return'Please enter a username.';}
if(username.indexOf(' ')>0){return'Please enter a username that does not contain any spaces.';}
if(username.length<minUsernameLength){return'Please enter a username that is '+minUsernameLength+' or more characters long.';}
return true;}
function formatDate(oInput){var inputDate=trim(oInput.value);if(inputDate==""){return;}
var dateNow=new Date();var now_month=dateNow.getMonth()+1;var now_day=dateNow.getDate();var now_year=dateNow.getFullYear();var regexString=/(\d{1,2})\/(\d{1,2})\/?(\d{2,})?/i;var regexMatches=regexString.exec(inputDate)
if(regexMatches!=null){var inputDate_month=parseInt(regexMatches[1],10);var inputDate_day=parseInt(regexMatches[2],10);var inputDate_year=regexMatches[3];if(inputDate_year==null){if(inputDate_month>=now_month-3){inputDate_year=now_year;}else{inputDate_year=now_year+1;}}else{inputDate_year=parseInt(inputDate_year,10);if(inputDate_year<100){inputDate_year+=2000;}}
oInput.value=inputDate_month+'/'+inputDate_day+'/'+inputDate_year;}else{alert('Please enter a valid date');oInput.focus();}}
function changeSelectOptionOrder(selectId,moveAmount){var oSelect=document.getElementById(selectId);if(oSelect==null||oSelect=='undefined'){return false;}
if(moveAmount!='top'&&moveAmount!='bottom'&&isNaN(moveAmount)){return false;}
var currentSelectedIndex=oSelect.selectedIndex;if(currentSelectedIndex<0){return false;}
if(currentSelectedIndex==0&&moveAmount==-1){return false;}
if(currentSelectedIndex==oSelect.options.length-1&&moveAmount==1){return false;}
var fromSelectedIndex=currentSelectedIndex;var toSelectedIndex;var fromOption=oSelect.options[fromSelectedIndex];var fromValue=oSelect.options[fromSelectedIndex].value;var fromText=oSelect.options[fromSelectedIndex].text;if(moveAmount=='top'){oSelect.remove(fromSelectedIndex);var newOption=document.createElement("option");newOption.value=fromValue;newOption.innerHTML=fromText;oSelect.insertBefore(newOption,oSelect.firstChild);oSelect.selectedIndex=0;}else if(moveAmount=='bottom'){oSelect.remove(fromSelectedIndex);var newOption=document.createElement("option");newOption.value=fromValue;newOption.innerHTML=fromText;oSelect.appendChild(newOption);oSelect.selectedIndex=oSelect.options.length-1;}else{toSelectedIndex=fromSelectedIndex+moveAmount;var toValue=oSelect.options[toSelectedIndex].value;var toText=oSelect.options[toSelectedIndex].text;oSelect.options[toSelectedIndex].value=fromValue;oSelect.options[toSelectedIndex].text=fromText;oSelect.options[toSelectedIndex].selected=true;oSelect.options[fromSelectedIndex].value=toValue;oSelect.options[fromSelectedIndex].text=toText;}
return true;}
function BuildQuerystring(params){var qs="";var value="";var valueType="";for(var key in params){value="";valueType=typeof(params[key]);if(valueType=="object"){try{value=params[key].join(",");}catch(e){}}else{value=params[key];}
qs+=key+"="+encodeURIComponent(value)+"&";}
return qs;}
function Linkify(inputText){if(inputText==undefined||inputText==""){return"";}
var replacePattern1=/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;var replacedText=inputText.replace(replacePattern1,'<a href="$1" target="_blank">$1</a>');var replacePattern2=/(^|[^\/])(www\.[a-zA-Z0-9][\S]+(\b|$))/gim;var replacedText=replacedText.replace(replacePattern2,'$1<a href="http://$2" target="_blank">$2</a>');var replacePattern3=/(^| )([a-zA-Z][a-zA-Z0-9\-_]+\.[a-zA-Z]{2,3}(\b|$))/gim;var replacedText=replacedText.replace(replacePattern3,'$1<a href="http://$2" target="_blank">$2</a>');var replacePattern3=/(\w+@[a-z0-9A-Z_]+?\.[a-zA-Z]{2,6})/gim;var replacedText=replacedText.replace(replacePattern3,'<a href="mailto:$1">$1</a>');return replacedText}
function TrackGAEvent(category,action,label){try{pageTracker._trackEvent(category,action,label);}catch(e){}}
function bindDataListRowHover(selector){$(".dataList_row").hover(function(){$(this).addClass("dataList_row_hover");},function(){$(this).removeClass("dataList_row_hover");});}
function parseJSON(jsonData){try{return(new Function("return "+jsonData))();}catch(e){return null;}}