$.ajaxSetup ({cache: false});
var overdiv=0,mE=0,disZ=0,menu_1=0,dFLAG=0,sFLAG=0,pSUB=0,FST=1,m_label=0,m_adv=0,OZ=[],GIC,GICM,L_R=new Date().getTime();

function fi(I,X1,X2){var p;
	if(I==0.5){p="960.php?";}
	if(I==1){p="CMNT.php?";}// Cmnts

	if(I==3){p="elementSTAT.php?";}
	if(I==4){p="TLG_BASE.php?";}
	if(I==5){p="elementFF.php?";}

	if(I==6){p="elementSTAT.php?ID=22";}//Pixelmast
	if(I==7){p="elementSTAT.php?ID=21&";}//My Pho
	if(I==8){p="elementSTAT.php?ID=18";}//My Top Rated Pho
	if(I==9){p="elementSTAT.php?ID=19";}//My Top Viewed Pho
	if(I==9.7){p="elementSTAT.php?ID=19.7";}//AddDayLate
	if(I==9.8){p="elementSTAT.php?ID=19.8&Z_SORT="+X1+"&SUB_ID="+X2+"&ZF=";}//Author Ays
	if(I==9.9){p="elementSTAT.php?ID=19.9&Z_SORT="+X1+"&SUB_ID="+X2+"&ZF=";}//Annual TL Ays

	if(I==10){p="elementSTAT.php?ID=1&UID=";}//Hikes
	if(I==10.1){p="elementSTAT.php?ID=1.1&UID=";}//Hike Ovrvews
	if(I==11){p="elementSTAT.php?ID=2&UID=";}//Photosets
	if(I==11.1){p="elementSTAT.php?ID=2.1&UID=";}//Phosets inQue
	if(I==11.2){p="elementSTAT.php?ID=2.2&UID=";}//Geocoded Phosets
	if(I==12){p="elementSTAT.php?ID=4&UID=";}//H Rated
	if(I==13){p="elementSTAT.php?ID=14&UID=";}//GPS
	if(I==14){p="elementSTAT.php?ID=20";}//Cal
	if(I==14.1){p="elementSTAT.php?ID=20.1";}//Cal by Pho
	if(I==15){p="elementSTAT.php?ID=44";}//Pho Rated
	if(I==15.1){p="elementSTAT.php?ID=44&UID=";}//Pho Rated
	if(I==15.5){p="elementSTAT.php?ID=44.5";}//Pho Tags
	if(I==15.6){p="elementSTAT.php?ID=44.5&UID=";}//Pho Tags
	if(I==16){p="TLG_BASE.php?UID=0";}//Triplogs

	if(I==19){p="elementSTAT.php?ID=25&";}//My Fauna Pho
	if(I==20){p="elementSTAT.php?ID=26&";}//My Flora Pho
	if(I==20.3){p="elementSTAT.php?ID=26.3&";}//My Geology Pho
	if(I==20.4){p="elementSTAT.php?ID=26.4&";}//My Culture Pho
	if(I==21){p="elementSTAT.php?ID=27&";}//Wildflower TLs
	if(I==22){p="elementSTAT.php?ID=28&";}//Autumn TLs
	if(I==23){p="elementSTAT.php?ID=29&";}//Pro Pho Updates
	if(I==24){p="elementSTAT.php?ID=31&";}//Spring Flow (single)
	if(I==24.1){p="elementSTAT.php?ID=30&";}//Spring Flow Report
	if(I==25){p="interest.php?";}
	if(I==26){p="elementSTAT.php?ID=100&";}//Memberlist
	if(I==27){p="elementSTAT.php?ID=5";}//Memberlist
	if(I==28){p="elementSTAT.php?ID=32&";}// Forum Active Posts
	if(I==29){p="elementSTAT.php?ID=33&";}// Unused
	if(I==30){p="elementSTAT.php?ID=34&";}// Label Catgry-for PhoID ie:Yellow
	if(I==31){p="elementSTAT.php?ID=35&UID=";}// Art Summary
	if(I==32){p="elementSTAT.php?ID=14.5&UID=";}// Linked G
	if(I==33){p="elementSTAT.php?ID=17&UID=";}// Top Photos
	if(I==35){p="elementSTAT.php?ID=6&UID=";}// Most Viewed H
	if(I==36){p="elementSTAT.php?ID=7&UID=";}// Most Printed Viewed H
	return p;}

function aL(C,M,W){
	var p=0,fc="000";
	if(C==1){C="#bce8c0";p=-24;}else if(C==2){C="#ecf48f";p=-48;}else if(C==3){C="#f77878";p=-72;}else if(C==4){C="#000";p=-120;fc="FFF";}else{C="#a5bade";}
	if(!M){M="Loading";}
	var w=(M.length*8)+6;if(w<110){w=110;}
	if(!W){W="ALPHAdiv";}else{W="M";$('#M').remove();dD('M',w+'px','24px','','','','','',5000);}
	$('#'+W).fadeOut(100).html('<table style="border-collapse:collapse;position:relative;z-index:+5000;width:'+(w+10)+'px;height:24px;color:#'+fc+';"><tr><td style="background:url(../images/corners/M.png?V=2) 0px '+p+'px;width:5px;height:24px;"></td><td style="text-align:center;font-family:arial;font-size:14px;background:'+C+';">'+M+'</td><td style="background:url(../images/corners/M.png?V=2) -5px '+p+'px;width:5px;height:24px;"></td></tr></table>').fadeIn(200);}

function aR(){$('#ALPHAdiv').hide(100).load(getBaseURL()+'xSUB2011.php?ID=2').fadeIn(400);}

function fPos(obj){var curleft=0,curtop=0;//alert(obj);
	try{if(obj.offsetParent){
		do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;} while(obj==obj.offsetParent);
		}}catch(e){}
	$('html, body').animate({scrollTop:curtop+158}, 'slow');
	}

function getBaseURL(){var url=location.href;var baseURL=url.substring(0,url.indexOf('/',14));if(baseURL.indexOf('http://localhost')!=-1){var url=location.href;var pathname=location.pathname;var index1=url.indexOf(pathname);var index2=url.indexOf("/",index1+1);var baseLocalUrl=url.substr(0,index2);return baseLocalUrl+"/";}
else{return baseURL+"/";}}

function ax(I,J,TAG,xTYPE,X1,X2,U,S){//alert(I+' '+J+' '+TAG);
	$('#pI').val(I);
	$('#pJ').val(J);
	$('#pU').val(U);
	$('#pS').val(S);
	pSUB=0;
	var page = fi(I,X1,X2);

	if(xTYPE!=3){$('#PL_I').html('<center><img name="LGIF" id="LGIF" src="../images/hazjax-loader.gif"></center>');}
	
	// Check for reset
	if(xTYPE==2&&TAG<1){// Rst btns
		J=J.toString();
		if(J.indexOf('RZT=')>0){// Trip
			$('#result').load(getBaseURL()+'GENERAL_EDITS.php?s=TR&'+J);
			}
		else if(J.indexOf('RCM=')>0){// Comment
			$('#result').load(getBaseURL()+'GENERAL_EDITS.php?s=CR&'+J);
			}
		else{$('#dexDIV').load(getBaseURL()+page+J+'&NHS=1',function(){$('#result').load(getBaseURL()+'header-SAVE.php');});}
		}
	else if(xTYPE==3){// w/Cancel
		aL();$('#dexDIV').load(getBaseURL()+page+J,function(){if(TAG>0){fPos(document.getElementById('FLOAT_'+TAG));}
			if(new Date().getTime()>(L_R+1400)){$('#result').load(getBaseURL()+'header-SAVE.php');}});}
	else{//page loads
		aL();$('#dexDIV').load(getBaseURL()+page+J,function(){if(TAG>0){fPos(document.getElementById('FLOAT_'+TAG));}
			if(new Date().getTime()>(L_R+1400)){$('#result').load(getBaseURL()+'header-SAVE.php');}});}
	
	}

function DEX(M){
	$('#dexDIV').load(getBaseURL()+'interest.php?SHOW=YES&ID=34&STx='+$('#STx').val()+'&SRT='+$('#SRT').val()+'&SHU='+$('#SHU').val()+'&FBF='+$('#FBF').val()+'&LOOP='+$('#LOOP').val()+'&SWI='+$('#SWI').val()+'&MTB='+$('#MTB').val()+'&OFT='+$('#OFT').val()+'&RUI='+$('#RUI').val()+'&DOG='+$('#DOG').val()+'&WTF='+$('#WTF').val()+'&CRK='+$('#CRK').val()+'&PEAK='+$('#PEAK').val()+'&BPK='+$('#BPK').val()+'&G_F='+$('#G_F').val()+'&G_T='+$('#G_T').val()+'&HST='+$('#HST').val()+'&FID='+$('#FID').val()+'&NID='+$('#NID').val()+'&WID='+$('#WID').val()+'&D_F='+$('#D_F').val()+'&D_T='+$('#D_T').val()+'&CM='+$('#CM').val()+'&RID='+$('#RID').val()+'&sRID='+$('#sRID').val()+'&zS='+$('#zS').val()+'&TYP='+$('#TYP').val()+'&LOC='+$('#LOC').val()+'&ZIP='+$('#ZIP').val());
	}

function R_ALL(){$("#HF_I").html('<img src="../images/hazjax-loader.gif">');}

function xscroll(ANC){if(ANC>0){location.hash=ANC;}}

function OCA(DIV){if(document.getElementById(DIV).style.display=="none"){document.getElementById(DIV).style.display="block";}else{document.getElementById(DIV).style.display="none";}}

var menu_sort = 'hidden';
var member_sort = 'hidden';
function switch_sort(){
	switch (menu_sort){
		case 'shown':
			member_sort = 'hidden';menu_sort = 'hidden';
			$('#HIKEdiv').load(getBaseURL()+'dex2/TLOGS_SELECT.php?SHOW=1&PRIDY=<?="$PRIDY";?>&TID=G1');
		break;
		case 'hidden':
			member_sort = 'hidden';menu_sort = 'shown';
			$('#HIKEdiv').load(getBaseURL()+'dex2/TLOGS_SELECT.php?SHOW=2&PRIDY=<?="$PRIDY";?>&TID=G1');
		break;}}

function switch_member(){
	switch (member_sort){
		case 'shown':
			member_sort = 'hidden';menu_sort = 'hidden';
			$('#HIKEdiv').load(getBaseURL()+'dex2/MEMBER_SELECT.php?SHOW=1&PRIDY=<?="$PRIDY";?>&TID=G2');
		break;
		case 'hidden':
			member_sort = 'shown';menu_sort = 'hidden';
			$('#HIKEdiv').load(getBaseURL()+'dex2/MEMBER_SELECT.php?SHOW=2&PRIDY=<?="$PRIDY";?>&TID=G2');
		break;}}

function element_load(){
	var browser=navigator.appName;
	if(browser=="Microsoft Internet Explorer"){
	document.getElementById('PL_I').innerHTML='<center><font style="font-family:arial;">Loading</font></center>';}
	else{
	document.getElementById('PL_I').innerHTML='<center><img name="LGIF" id="LGIF" src="../images/hazjax-loader.gif"></center>';}}

function page_load(){
	var browser=navigator.appName;
	if(browser=="Microsoft Internet Explorer"){
	document.getElementById('PL').innerHTML='<center><font style="font-family:arial;color:#FFF;">Loading</font></center>';}
	else{
	document.getElementById('PL').innerHTML='<center><img name="LGIF" id="LGIF" src="../images/hazjax-loader.gif"></center>';}}

function findPosX(X){try{var pos=$(X).offset();return pos.left;}catch(e){try{var pos=$('#'+X).offset();return parseInt(pos.left);}catch(e){return 0;}}}

function findPosY(X){try{var pos=$(X).offset();return pos.top;}catch(e){try{var pos=$('#'+X).offset();return parseInt(pos.top);}catch(e){return 0;}}}
 
function popEDIT(ZIP,PID,START){
	$('#object1').load(getBaseURL()+'xPHO_EDIT.php?ZIP='+ZIP+'&PID='+PID+'&start='+START).hide().fadeIn(400);
	document.getElementById("object1").style.left=x+"px";
	document.getElementById("object1").style.top=y-100+"px";}

function popBOOK(ID){menu_1=1;
	$('#object1').load(getBaseURL()+'xBOOK.php?ID='+ID).hide().fadeIn(400);
	document.getElementById("object1").style.left=x+50;
	document.getElementById("object1").style.top=y-100;
	}

function FFLOAD(){$("#divTHREE").html("<BR><BR><BR><div style='width:100%;text-align:center;color:#F00;font-size:24px;'>Loading...</div>");}
function FFLOAD2(){$("#divZERO").html("<BR><BR><BR><div style='width:100%;text-align:center;color:#F00;font-size:24px;'>Loading...</div>");}
function FFLOAD3(){wI(1);$("#listDIV").html("<BR><BR><BR><BR><BR><div style='width:100%;text-align:center;color:#000;font-size:24px;'>Loading...</div>");}

function popG(GPS,OFF){
	if(OFF==8){
		hideLayer();
		shield();
		$('#object1').load(getBaseURL()+'gpsRDIV.php?GPS='+GPS+'&OFF='+OFF,function(){C_DIV('object1');aR();});
		}
	else{	var C;
		if(CUR_TAB==9){C='rFEATUREsetM';}else{C='rFEATUREset';}
		$('#'+C).load(getBaseURL()+'gps-INFO.php?GPS='+GPS+'&OFF='+OFF);}}

function popLayer(PRIDY){
	$('#object1').load(getBaseURL()+'xSTAT.php?PRIDY='+PRIDY).hide().fadeIn(400);
	document.getElementById("object1").style.left=($('body').innerWidth()/2)-225+"px";
	document.getElementById("object1").style.top=y+"px";}

function popPHOTO(ZIP,PRI){
	$('#object1').load(getBaseURL()+'xPHOTO.php?ZIP='+ZIP+'&PRIDY='+PRI).hide().fadeIn(400);
	document.getElementById("object1").style.left=x-200+"px";
	document.getElementById("object1").style.top=y-80+"px";}

function popPHOTO2(ID,OBJCT,X,Y){
	$('#objectM').load(getBaseURL()+'xPHOTO.php?ZIP='+ID).hide().fadeIn(400);
	document.getElementById("objectM").style.left=findPosX(OBJCT)+X+"px";
	document.getElementById("objectM").style.top=findPosY(OBJCT)+Y+"px";}

function memPHOTO(ZIP,PRI){
	$('#object1').load(getBaseURL()+'xMPHOTO.php?ZIP='+ZIP+'&PRIDY='+PRI).hide().fadeIn(400);
	document.getElementById("object1").style.left=x-140+"px";
	document.getElementById("object1").style.top=y-120+"px";}

function popMEMBER(u,OBJCT,X,Y){
	$('#object1').load(getBaseURL()+'xMEMBER.php?u='+u).hide().fadeIn(400);
	if(OBJCT){
	document.getElementById("object1").style.left=findPosX(OBJCT)+X+"px";
	document.getElementById("object1").style.top=findPosY(OBJCT)+Y+"px";}
	else{
	document.getElementById("object1").style.left=x+50+"px";
	document.getElementById("object1").style.top=y-100+"px";}}

function popSPRING(ID,X){
	$('#object1').load(getBaseURL()+'xSPRING.php?ID='+ID).hide().fadeIn(400);
	if(X==1){document.getElementById("object1").style.left=200;document.getElementById("object1").style.top=y-250+"px";}
	else{document.getElementById("object1").style.left=300;document.getElementById("object1").style.top=y+"px";}}

function shield(){
	ie6('hidden');
	var F99=$(document).height();
	dD('Dt','100%',F99+'px','absolute','0','0','','5','1','','dF');
	$('#Dt').html("<div class='FADE' onclick='rD(\"#Dt\");' style='cursor:pointer;background: url(\"../images/icon2011/close.png\") 0px 0px;width:18px;height:18px;position:absolute;margin-top:4px;margin-left:4px;' onmouseover='this.style.backgroundPosition=\"0px -18px\"' onmouseout='this.style.backgroundPosition=\"0px 0px\"'></div>");
	$('#Dt').dblclick(function(){rD('#Dt');});
	$('.FADE').fadeTo(0,0.1);}

function hideF(){document.getElementById("objectF").innerHTML="";}

function hideLayerM(){pSUB=0;if($('#objectM').length){document.getElementById("objectM").innerHTML="";}}

function hideLayer(){
	pSUB=0;menu_1=0;disZ=0;sFLAG=0;dFLAG=0;
	$("#object1").empty();
	ie6("visible");rD($("#Dt"));
	hideLayerM();}

function popSUB(ID,OB,X,Y,UR,M,MX,MY){
	if($.browser.msie){if(M!=1){X=X-(($('body').innerWidth()-960)/2)-($.scrollbarWidth()/2);}}
	if($.browser.msie){if(MX){X=X+MX;}if(MY){Y=Y+MY;}}
	if(pSUB===0){
	wI(1);
	$('#objectM').load(getBaseURL()+'xSUBMENU.php?ID='+ID+UR).hide().fadeIn(400);
	document.getElementById("objectM").style.left=findPosX(OB)+X+"px";
	document.getElementById("objectM").style.top=findPosY(OB)+Y+"px";
	pSUB=1;}
	else{$('#WAIT').remove();hideLayer();}}

function popS(ID,OB,X,Y,O,UR){if(O>$('body').innerWidth()){X=0;}else{X=X+(($('body').innerWidth()-O)/2)-($.scrollbarWidth()/2);}
	if(pSUB===0){
	$('#objectM').load(getBaseURL()+'xSUBMENU.php?ID='+ID+UR).hide().fadeIn(400);
	document.getElementById("objectM").style.left=X+"px";
	document.getElementById("objectM").style.top=findPosY(OB)+Y+"px";
	pSUB=1;}
	else{hideLayer();}}

function helpME(ID,X,Y,UID,ZIP,CP,DATA,DiV){if(DiV==1){DiV="objectM";}else if(DiV==2){DiV="objectF";}else{DiV="object1";}
	if(!$('#'+DiV).length){dD(DiV,'','','absolute','0','0','','','3');}
	menu_1=1;
	wI(1);
	$("#"+DiV).load("../xHELP.php?ID="+ID+"&UID="+UID+"&ZIP="+ZIP+"&DATA="+DATA+"&DiV="+DiV).hide().fadeIn(400);
	if(CP==1){
	document.getElementById(DiV).style.left=($('body').innerWidth()/2)+X+"px";
	document.getElementById(DiV).style.top=y+Y+"px";}
	else if(CP==2){
	document.getElementById(DiV).style.left=($('body').innerWidth()/2)+X+"px";
	document.getElementById(DiV).style.top=($(window).height()/2)+Y+"px";}
	else if(CP==3){
	document.getElementById(DiV).style.left=($('body').innerWidth()/2)+X+"px";
	document.getElementById(DiV).style.top=Y+"px";}
	else if(CP==4){C_DIV(DiV);}
	else{
	if(X>0 || X<0){document.getElementById(DiV).style.left=x+X+"px";document.getElementById(DiV).style.top=y+Y+"px";}
	else if(Y>0 || Y<0){document.getElementById(DiV).style.left="150px";document.getElementById(DiV).style.top=y+Y+"px";}
	else{document.getElementById(DiV).style.left="150px";document.getElementById(DiV).style.top="200px";}}
	}

function disLayer(){disZ=1;}
function scroll_FF(H){var HGHT=H+100;setTimeout("window.scrollTo(0,"+HGHT+")",600);}

function getCheckedValue(radioObj) {
	if(!radioObj){return "";}
	var radioLength = radioObj.length;
	if(radioLength === undefined){if(radioObj.checked){return radioObj.value;}}else{return "";}
	for(var i=0; i<radioLength; i++){if(radioObj[i].checked){return radioObj[i].value;}}
	return "";}

function gof(xf){document.getElementById(xf).submit();}

function isE(v){if(v%2===0){return true;}else{return false;}}//#a2ceb9

function cRover(b,ID){if(b.style.backgroundColor!='#A2CEB9'){b.style.backgroundColor='#c1c5ff';}}

function cRout(b,ID){if(isE(ID)){b.style.backgroundColor='#E2E2E2';}else{b.style.backgroundColor='#FFFFFF';}}

var lastHt="TR0";
function Ht(b){document.getElementById(lastHt).style.background="";lastHt="TR"+b;document.getElementById(lastHt).style.background="#c1ffd7";}

function pop_forecast(X){
	aL();
	ie6('hidden');
	dD('Dt','100%',$(window).height()+'px','absolute','0','0','','5','1','','dF');
	$('#objectF').load(getBaseURL()+'forecast.php?e='+X,function(){
		aR();
		$('#objectF').css('left',($('body').innerWidth()/2)-($('#objectF').width()/2)-($.scrollbarWidth()/2)+'px');
		$('#objectF').css('top',($(window).height()/2)-($('#objectF').height()/2));
		}).hide().fadeIn(400);
	}

// For upload Status
var HttpRequestObject = false;
if(window.XMLHttpRequest) {HttpRequestObject = new XMLHttpRequest();}
else if(window.ActiveXObject) {HttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");}

function getProgress(uid){
   if(HttpRequestObject){
      HttpRequestObject.open('GET', 'getprogress.php?uid=' + uid, true);
      HttpRequestObject.onreadystatechange = function(){
         if(HttpRequestObject.readyState == 4 && HttpRequestObject.status == 200) {
            var progress = HttpRequestObject.responseText;
            document.getElementById('pb_inner').style.width = progress + '%';
            document.getElementById('pb_inner').innerHTML = progress + '%';
            if(progress < 100){setTimeout(function(){getProgress(uid);}, 100);}
            else{document.getElementById('pb_inner').innerHTML='One moment...';}}};
      HttpRequestObject.send(null);}}

function startProgress(uid) {
   document.getElementById('upload').style.display = 'none';
   document.getElementById('pb_outer').style.display = 'block';
   setTimeout('getProgress("' + uid + '")', 1000);}

function dEKey(e){var key;
     if(window.event){key=window.event.keyCode;}//IE
     else{key=e.which;}//FF      
     return (key!=13);}

function addEvent(elm, evType, fn, useCapture){
   if(elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true;}
   else if(elm.attachEvent){return elm.attachEvent('on' + evType, fn);}
   else{elm['on' + evType] = fn;}}

function dD(D,w,h,a,l,t,b,B,z,H,c,x,y){
	if(!$('#'+D).length){
	$('<div id='+D+'></div>').appendTo('body');
	if(w){if(w.match(/%/)){$('#'+D).width(w);}else if(w.match(/px/)){$('#'+D).css('width',w);}else{$('#'+D).css('width',w+'px');}}
	if(h){if(h.match(/%/)){$('#'+D).height(h);}else if(h.match(/px/)){$('#'+D).css('height',h);}else{$('#'+D).css('height',h+'px');}}
	if(!a){a="absolute";}
	$('#'+D).css('position',a);
	if(l){$('#'+D).css('left',l);}
	if(t){$('#'+D).css('top',t);}
	if(b){$('#'+D).css('background-color',b);}
	if(B){$('#'+D).css('border',B);}
	if(z){$('#'+D).css('z-index',z);}
	if(H){$('#'+D).html(H);}
	if(c){$('#'+D).addClass(c);}
	if(x){$('#'+D).css('overflow-x',x);}
	if(y){$('#'+D).css('overflow-y',y);}
	}}

function rD(D){if($(D).length){$(D).fadeOut(250,function(){$(D).remove();});}}

function ie6(n){
	var el=document.documentElement.getElementsByTagName('select');for(var i=0; i<el.length; i++){el[i].style.visibility=n;}
	var el=document.documentElement.getElementsByTagName('ul');for(var i=0; i<el.length; i++){
		if(el[i].className!='CTM'){el[i].style.visibility=n;}}} 

$(window).bind('load',function(){
	dD('SCH','','','','','','','','10','','STP BCC');
	$('body').click(function(){$('.BCH,.BCC').hide();});
	$('.STP').click(function(event){event.stopPropagation();});
	if($('.PD1A').length){$('.PD1A').load(getBaseURL()+'poll.php');}});

(function($,b,a){$.scrollbarWidth=function(){var c,d;if(a===b){c=$('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body");d=c.children();a=d.innerWidth()-d.height(99).innerWidth();c.remove()}return a}})(jQuery);

function shw(STi,Ax,F,FTN,SLx){
	//if(navigator.userAgent.match(/iPhone/i)){$('#ALPHAdiv').load(getBaseURL()+'ALPHAdiv.php?FTN='+FTN+'&STi='+STi+'&ID=11&SUB_ID='+Ax);}
	$('#SCH').load(getBaseURL()+'ALPHAdiv.php?FTN='+FTN+'&STi='+STi+'&ID=11&SUB_ID='+Ax);
	}

function gow(STi,Ax,F_LEV){if(document.pcX.pcPAGE.value == "interest.php"){document.getElementById('loadDIV').innerHTML='<table align=center cellpadding=0 cellspacing=0 style="border:none;font-family:arial;font-size:14px;"><tr><td><div><b class=spFC0><b class=spFC01><b></b></b><b class=spFC02><b></b></b><b class=spFC03></b><b class=spFC04></b><b class=spFC05></b></b><div class=spFC0fg>&nbsp;Loading...&nbsp;'+Ax+'&nbsp;</div><b class=spFC0><b class=spFC05></b><b class=spFC04></b><b class=spFC03></b><b class=spFC02><b></b></b><b class=spFC01><b></b></b></b></div></td></tr></table>';
	$('#dexDIV').load(F_LEV+'interest.php?ID=11&SUB_ID='+Ax+'&STi='+STi);}
	else{location = F_LEV+"traildex.php?ID=11&SUB_ID="+Ax+'&STi='+STi;}}

function urlencode(str) {str = (str+'').toString();
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
                                                                    replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');}

var Url={encode:function(string){return escape(this._utf8_encode(string));},decode:function(string){return this._utf8_decode(unescape(string));},_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;}}

function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;}}}

function bE(x,X,U,D,R,L){if(!U){U=1500;}if(!D){D=1500;}if(U>1&&D>1){$(X).slideUp(U).slideDown(D);}hazF(X,R,L);return false;}

function hazF(X,R,L){
	if(!L){L=0;}
	if(!R){R='result';}
	if($('#ALPHAdiv').get(0)&&L<1){aL();}
        $.ajax({
		type: $(X).attr('method'),
		url: $(X).attr('action'),
		enctype: $(X).attr('enctype'),
		data: $(X).serialize(),
		success: function(responseText){$('#'+R).html(responseText);if($('#ALPHAdiv').get(0)&&L<1){aR();}}});}

function get_page_boundaries(event){
	distance_to_right_edge = $('body').innerWidth()-(x-$.scrollbarWidth());
	distance_to_bottom = $(window).height()-y;}

function pop_MC(X,event){
	try{
	X=$('#'+X).get(0);
	get_page_boundaries(event);
	X.style.left = 5+x+"px";
	X.style.top = 5+y+"px";
	var scroll_now=$(window).scrollTop();
	if(distance_to_right_edge < (X.offsetWidth+5)){X.style.left = x - X.offsetWidth-5+"px";}
	if(distance_to_bottom < (X.offsetHeight+5)){
		if(y - (X.offsetHeight-5)>scroll_now){X.style.top = y - X.offsetHeight-5+"px";}}
	}catch(e){}
	}

function valX(X){X.value=X.value.replace(/[^0-9A-Z!().+&;-=@# \']/gim,"_");}

function C_DIV(D,T){
	if(!T){T=$(window).scrollTop()+(($(window).height()-$('#'+D).height())/2);}
	if($('#'+D).height()>$(window).height()){T=0;}
	$('#'+D).css({'left':(($('body').innerWidth()-$('#'+D).width())/2),'top':T});}

function St(){
	var St = document.body.scrollTop;
	if(St==0){if(window.pageYOffset){St = window.pageYOffset;}
	else{St = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;}}
	return St;
	}

$.fn.checkAll=function(name,flag){var selector=':checkbox'+(name?'[@name='+name+']':'');$(selector,this).attr('checked',flag);}	
$.fn.getCheckboxVal = function(){var vals=[],i=0;this.each(function(){vals[i++]=$(this).val();});return vals;}

// Global variables
x = 0;
y = 0;
xMax = 0;
yMax = 0;
scrOfY=0;
scrOfx=0;

function captureMousePosition(e) {
	if(!e){var e = window.event;}
        x=e.pageX;y=e.pageY;
    if (document.layers) {// Netscape (old?)
        xMax = window.innerWidth+window.pageXOffset;	xWin=window.innerWidth;		scrOfY = window.pageYOffset;	bW=window.innerWidth;
        yMax = window.innerHeight+window.pageYOffset;	yWin=window.innerHeight;	scrOfX = window.pageXOffset;	bH=window.innerHeight;
    } else if (document.all) {// Windows
xMax=document.body.clientWidth+document.body.scrollLeft;xWin=document.body.clientWidth;scrOfY=document.body.scrollTop;bW=document.body.offsetWidth;
yMax=document.body.clientHeight+document.body.scrollTop;yWin=document.body.clientHeight;scrOfX=document.body.scrollLeft;bH=document.body.offsetHeight;
    } else if (document.getElementById) {// Netscape 6 behaves as 4 in this regard
        xMax = window.innerWidth+window.pageXOffset;	xWin=window.innerWidth;		scrOfY = window.pageYOffset;	bW=window.innerWidth;
        yMax = window.innerHeight+window.pageYOffset;	yWin=window.innerHeight;	scrOfX = window.pageXOffset;	bH=window.innerHeight;
    }}
 
function wI(X){
	if(!$('#WAIT').length){
		if(X==1){dD('WAIT','30','30','absolute',(x-15),(y-7),'','',1000,'<img src=http://hikearizona.com/images/wait/haz2.gif>');}
		else{dD('WAIT','128','15','absolute',(x-64),(y-7),'','',1000,'<img src=http://hikearizona.com/images/waitbar.gif>');}}
	$("#WAIT").topZIndex({increment:1});}

function likeM(C,I){
	if(!$('#MENU_L').is(':hidden')){$('#MENU_L').hide();rD('#WAIT');}
	else{
	wI();$('#MENU_L').load(getBaseURL()+'xSUBMENU.php?ID=51&C='+C+'&I='+I,function(event){pop_MC('MENU_L',event);});
	}
	}

function setOPT(H){
	if(!H){H="Set!";}
	aL(0,H,1);
	$('#M').css({'left':x+30,'top':y-12}).topZIndex({increment:1});
	setTimeout(function(){$('#M').fadeOut().remove();},1200);}

$('.HIL').live('mouseover',function(){$(this).css('background-color','#c1c5ff');});
$('.HIL').live('mouseout',function(){$(this).css('background-color','transparent');});

$(document).ready(function(){
	if(!window.location.href.match(/map.php/) && !window.location.href.match(/location/)){$('#result').load(getBaseURL()+'header-SAVE.php');}
	if($('#alphaST').get(0)){$('#alphaST').load(getBaseURL()+'element-alpha.php');}
	$(document).mousemove(function(e){captureMousePosition(e);});
	$('.HLK').each(function(){
		var id=$(this).attr('id');
		var C=$(this).attr('hazcat');
		var I=$(this).attr('hazid');
		if(C>0&&I>0){$('#'+id).load(getBaseURL()+'like.php?CLR='+$(this).attr('clr')+'&C='+C+'&I='+I+'&K='+$(this).attr('k'));}
		});
	$('.MPOP').live('mouseover', function(){
		if(!$(this).data('init')){
			$(this).data('init', true);
			$(this).hoverIntent({over:function(){$(this).trigger('click');},out:function(){},timeout:10});
			$(this).trigger('mouseover');}
			});
	$('.BCH').live('mouseout', function(){
		if(!$(this).data('iH')){
			$(this).data('iH', true);
			$(this).hoverIntent({over:function(){},out:function(){$(this).hide();},timeout:400,interval:20,sensitivity:20});
			$(this).trigger('mouseover');}
			});
	});

function eFAT(e,I,L,A){var key;
	if(window.event){key=window.event.keyCode;}//IE
	else{key=e.which;}//FF
	if(key==13){if($('#FAT_'+A+'_'+I).val().length>2){ 
		$('#SELECT_TD_'+A+'_'+I).load(getBaseURL()+'xSELECT.php?'+L+urlencode($('#FAT_'+A+'_'+I).val()));
		$('.AA_'+A+'_'+I).css({'color':'#FFF'});
		$('.AB_'+A+'_'+I).css({'background-color':'inherit'});}}
	return (key!=13);}

function isNum(n){return !isNaN(parseFloat(n)) && isFinite(n);}

// Cookie
function createC(name,value,days){
	if(days){
		var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires="; expires="+date.toGMTString();}
	else{
		var expires="";}
	document.cookie=name+"="+value+expires+"; path=/; domain=.hikearizona.com";
	}
function readC(name){var nEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nEQ)==0)return c.substring(nEQ.length,c.length);}return null;}

// Hazlight
jQuery.fn.hazlight=function(pat,BGC,FNC){function innerHazlight(node,pat){var skip=0;if(node.nodeType==3){var pos=node.data.toUpperCase().indexOf(pat);if(pos>=0){var spannode=document.createElement('span');spannode.className='hazlight';spannode.style.backgroundColor=BGC;spannode.style.color=FNC;var middlebit=node.splitText(pos);var endbit=middlebit.splitText(pat.length);var middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);skip=1;}}
else if(node.nodeType==1&&node.childNodes&&!/(script|style)/i.test(node.tagName)){for(var i=0;i<node.childNodes.length;++i){i+=innerHazlight(node.childNodes[i],pat);}}
return skip;}
return this.each(function(){innerHazlight(this,pat.toUpperCase());});};jQuery.fn.removeHazlight=function(){return this.find("span.hazlight").each(function(){this.parentNode.firstChild.nodeName;with(this.parentNode){replaceChild(this.firstChild,this);normalize();}}).end();};

// Hover Intent
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);

// Top Index
(function(a){a.topZIndex=function(b){return Math.max(0,Math.max.apply(null,a.map((b||"*")==="*"?a.makeArray(document.getElementsByTagName("*")):a(b),function(b){return parseFloat(a(b).css("z-index"))||null})))};a.fn.topZIndex=function(b){if(this.length===0)return this;b=a.extend({increment:1},b);var c=a.topZIndex(b.selector),d=b.increment;return this.each(function(){this.style.zIndex=c+=d})}})(jQuery);

// Caret Get/Set
new function($){$.fn.getCaret=function(){var pos=0;var input=$(this).get(0);if(document.selection){input.focus();var sel=document.selection.createRange();var selLen=document.selection.createRange().text.length;sel.moveStart('character',-input.value.length);pos=sel.text.length-selLen;}
else if(input.selectionStart||input.selectionStart=='0'){pos=input.selectionStart;}
return pos;}}($);new function($){$.fn.setCaret=function(pos){if($(this).get(0).setSelectionRange){$(this).get(0).setSelectionRange(pos,pos);}else if($(this).get(0).createTextRange){var range=$(this).get(0).createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}}}($);

//Slimbox v2.04
(function(w){
var E=w(window),u,f,F=-1,n,x,D,v,y,L,r,m=!window.XMLHttpRequest,s=[],l=document.documentElement,k={},t=new Image(),J=new Image(),H,a,g,p,I,d,G,c,A,K;

w(function(){// box
	w("body").append(w([H=w('<div id="lbOverlay" />')[0],a=w('<div id="lbCenter" />')[0],G=w('<div id="lbBottomContainer" />')[0]]).css("display","none"));
	g=w('<div id="lbImage" />').appendTo(a).append(p=w('<div style="position: relative;" />').append([I=w('<a id="lbPrevLink" href="javascript:void(0);" />').click(B)[0],d=w('<a id="lbNextLink" href="javascript:void(0);" />').click(e)[0]])[0])[0];
	c=w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="javascript:void(0);" />').add(H).click(C)[0],w('<a id="lbDownload" title="Download" />').add(H)[0],w('<a id="lbPrint" href="javascript:void(0);" title="Print" />').add(H)[0],w('<a id="lbO" href="javascript:void(0);" title="Full size view" />').add(H)[0],A=w('<div id="lbCaption" />')[0],K=w('<div id="lbNumber" />')[0],w('<div style="clear: both;" />')[0]])[0]
	});

w.slimbox=function(O,N,M){
u=w.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400, resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},M);if(typeof O=="string"){O=[[O,N]];N=0}y=E.scrollTop()+(E.height()/2);L=u.initialWidth;r=u.initialHeight;w(a).css({top:Math.max(0,y-(r/2)),width:L,height:r,marginLeft:-L/2}).show();v=m||(H.currentStyle&&(H.currentStyle.position!="fixed"));if(v){H.style.position="absolute"}w(H).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);z();j(1);f=O;u.loop=u.loop&&(f.length>1);return b(N)};

w.fn.slimbox=function(M,P,O){P=P||function(Q){return[Q.href,Q.title]};O=O||function(){return true};var N=this;return N.unbind("click").click(function(){var S=this,U=0,T,Q=0,R;T=w.grep(N,function(W,V){return O.call(S,W,V)});for(R=T.length;Q<R;++Q){if(T[Q]==S){U=Q}T[Q]=P(T[Q],Q)}return w.slimbox(T,U,M)})};

function z(){var N=E.scrollLeft(),M=E.width();w([a,G]).css("left",N+(M/2));if(v){w(H).css({left:N,top:E.scrollTop(),width:M,height:E.height()})}}

function j(M){if(M){w("object").add(m?"select":"embed").each(function(O,P){s[O]=[P,P.style.visibility];P.style.visibility="hidden"})}else{w.each(s,function(O,P){P[0].style.visibility=P[1]});s=[]}var N=M?"bind":"unbind";E[N]("scroll resize",z);w(document)[N]("keydown",o)}

function o(O){var N=O.keyCode,M=w.inArray;return(M(N,u.closeKeys)>=0)?C():(M(N,u.nextKeys)>=0)?e():(M(N,u.previousKeys)>=0)?B():false}

function B(){return b(x)}

function e(){return b(D)}

function b(M){if(M>=0){F=M;n=f[F][0];x=(F||(u.loop?f.length:0))-1;D=((F+1)%f.length)||(u.loop?0:-1);q();a.className="lbLoading";k=new Image();k.onload=i;k.src=n;$('#lbDownload').attr('href','http://hikearizona.com/pD.php?ID='+k.src);$('#lbPrint').unbind('click').bind('click',function(){pp=window.open('','',pds);$('#result').load(getBaseURL()+'xSUB2011.php?ID=17&URL='+k.src,function(){pHAZ();});});}return false}

function i(){
	a.className="";
	w(g).css({backgroundImage:"url("+n+")",visibility:"hidden",display:""});
	var sw=k.width<($('body').innerWidth()-60)?k.width:($('body').innerWidth()-60);
	var sh=k.height<($(window).height()-80)?k.height:($(window).height()-80);
	w(p).width(sw);
	w([p,I,d]).height(sh);
	$('#lbImage').css({'width':sw,'height':sh});
	if(k.width>($('body').innerWidth()-60) || k.height>($(window).height()-80)){$('#lbO').unbind('click').bind('click',function(){window.open(k.src);});}else{$('#lbO').remove();}
	w(A).html(f[F][1]||"");
	w(K).html((((f.length>1)&&u.counterText)||"").replace(/{x}/,F+1).replace(/{y}/,f.length));
	if(x>=0){t.src=f[x][0]}
	if(D>=0){J.src=f[D][0]}
	L=g.offsetWidth;
	r=g.offsetHeight;
	var M=Math.max(0,y-(r/2));
	if(a.offsetHeight!=r){w(a).animate({height:r,top:M},u.resizeDuration,u.resizeEasing)}
	if(a.offsetWidth!=L){w(a).animate({width:L,marginLeft:-L/2},u.resizeDuration,u.resizeEasing)}
	w(a).queue(function(){w(G).css({width:L,top:M+r,marginLeft:-L/2,visibility:"hidden",display:""});w(g).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,h)})
	}

function h(){if(x>=0){w(I).show()}if(D>=0){w(d).show()}w(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);G.style.visibility=""}

function q(){k.onload=null;k.src=t.src=J.src=n;w([a,g,c]).stop(true);w([I,d,g,G]).hide()}

function C(){if(F>=0){q();F=x=D=-1;w(a).hide();w(H).stop().fadeOut(u.overlayFadeDuration,j)}return false}

})(jQuery);

// Slimset in elementSTATS,xFF-INFO/SELECT too
if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
	jQuery(function($) {
		$("a[rel^='lbox']").slimbox({/*options*/}, null, function(el) {
			return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
		});
	});
}

var pds="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=650, height=600, left=100, top=50",pp;
function pHAZ(){
	pp.document.write('<html><head><title>HikeArizona.COM - Print</title><link rel="stylesheet" href="http://hikearizona.com/dex2/styles/prosilver/template/haz.css" type="text/css"></head>');
	pp.document.write('<body>'+$('#result').html()+'</body></html>');
	pp.print();
	return false;
	}

function popCAL(YE,nD){
	wI();
	if(!nD){nD='newDATE';}
	if(!$('#D_mCAL').length){dD('D_mCAL');}
	$('#D_mCAL').load(getBaseURL()+'micro_cal.php?tgt_dt='+YE+'&nD='+nD);
	}

function IsVal(sText){
   var ValidChars="[]<>=:! ,.\"$;0123456789\\\n\r\t.abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ-_'#()?",IsV=true,Char; 
   for(i=0; i<sText.length && IsV===true; i++) {Char = sText.charAt(i);if(ValidChars.indexOf(Char)==-1){IsV=false;}}return IsV;}

