﻿/* 浏览器相关 */
function $(s){return document.getElementById(s)};
var valexpress=new Array();
valexpress["date"]=/^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))$/;
valexpress["time"]=/^(((0?[0-9])|([1-2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9]))))?$/;
valexpress["datetime"]=/^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|([1-2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$/;
(function(){var Enum=window.Enum=function(n,v){window[n]=v;v.toString=function(){return n};v.parse=function(x){return window.Enum.parse(x,this)}};
var EnumValue=window.EnumValue=function(n,v){this.value=parseInt(v);this.name=n.toString();this.valueOf=function(){return this.value};this.toString=function(){return this.name}}
window.Enum.parse=function(x,v){var t=typeof(x);if(t=="number"){for(var k in v){if(x==v[k])return new EnumValue(k,x)}}else{x=x.toString();if(typeof(v[x])!="undefined"){return new EnumValue(x,v[x])}}return null}
})();
var SYSERROR="系统忙，请稍候再试。";
var w3c=(document.getElementById)?true:false,agt=navigator.userAgent.toLowerCase(),ie=((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1)),isMobile=(agt.indexOf("iphone")!=-1);
function GlobalPosition(){var a=arguments;this.x=(a.length>0)?a[0]:0;this.y=(a.length>1)?a[1]:0;this.z=(a.length>2)?a[2]:0;this.speed=(a.length>3)?a[3]:0;this.location=(a.length>4)?a[4]:"";this.accuracy=(a.length>5)?a[5]:0;this.ip=(a.length>6)?a[6]:"";this.time=(a.length>7)?a[7]:(new Date())}
function GetSavedPosition(){if(user){return (new GlobalPosition(getFloat(user["X"],0),getFloat(user["Y"],0),getFloat(user["Z"],0),getFloat(user["SPEED"],0),user["LOCATION"],getInt(user["ACCURACY"],0),user["VISITIP"],new Date(user["UPDATE"])))}else{return new GlobalPosition()}}
var currentPosition=GetSavedPosition();

window.Position={
getSaved:function(){var u;if(typeof(user)!="undefined"&&(u=user)){this.saved={X:u.X||0,Y:u.Y||0,Z:u.Z||0,Speed:u.SPEED||0,Location:u.LOCATION||'',Accuracy:user.ACCURACY||0,IP:u.VISITIP||'',Time:(new Date(user.UPDATE))}};return this.saved},
combie:function(p1,p2){if(getFloat(p2.X,0)>0)p1.x=p2.X;if(getFloat(p2.Y,0)>0)p1.y=p2.Y;if(getFloat(p2.Z,0)>0) p1.z=p2.Z;if(getFloat(p2.Speed,0)>0)p1.speed=p2.Speed;if(getInt(p2.Accuracy,0)>0)p1.accuracy=p2.Accuracy;if(p2.Time)p1.time=p2.Time;if(p2.Location && p2.Location!="")p1.location=p2.Location;if(p2.IP && p2.IP!="")p1.ip=p2.IP},
R:function(){var t=Position,r;if(!t.registered){Soap.RegisterService(_APPROOT+"/WebServices/PositionService.ashx","","Position");r=Soap.RegisterMethod;r(t,"GetPositionByCoords","x","y");r(t,"GetPositionByIP","ip");r(t,"IPSearch","");r(t,"GetPositionByAddress","address");r(t,"GetPinyin","text");r(t,"GetAbstract","text","length","mode","suspensionPoints");t.registered=1}},
getCurrent:function(a){var f,t=this,o=-1,g,m,u=t.current,d=0;if(a){if(a.constructor==Function){f=a}else{d=(a.queryLocation!==false);f=a.onsuccess;o=a.timeout;m=a.maximumAge}}if(o<0)o=USERCHECKINEXPIRE;if(!m)m=60000;t.R();if((!u)||(new Date())-u.Time>o){if(g=navigator.geolocation){g.getCurrentPosition(function(p){var s=0,c,l;if(p&&(c=p.coords)){u=t.current={Z:c.altitude,Y:c.latitude,X:c.longitude,Speed:c.speed||0,Accuracy:p.accuracy,Location:c.heading,Time:p.stamp};u.Accuracy=Math.log(EARTH_A/(u.Accuracy/1000))/Math.log(2);if((!u.Accuracy)||(u.Accuracy<13))u.Accuracy=13;if(u.Time){u.Time=new Date(u.Time)}else{u.Time=new Date()}l=u.Location;if(typeof(l)=="string"&&l!=""&&d){t.GetPositionByCoords(u.X,u.Y,function(r){if(r){u.Location=r.Location;if(f)f(u)}})}else{if(f)f(u)}}},function(r){t.onerror(r,f)},{maximumAge:m,timeout:0})}else{t.GetPositionByIP('',function(r){if(r){u=t.current=r;if(f)f(u)}})}}},
onerror:function(r,f){var t=Position;t.GetPositionByIP('',function(r){if(r){var u=t.current=r;if(f)f(u)}})}};Position.getSaved();

function CombiePosition(p1,p2){if(getFloat(p2.X,0)>0) p1.x=p2.X;
if(getFloat(p2.Y,0)>0) p1.y=p2.Y;
if(getFloat(p2.Z,0)>0) p1.z=p2.Z;
if(getFloat(p2.Speed,0)>0) p1.speed=p2.Speed;
if(getInt(p2.Accuracy,0)>0) p1.accuracy=p2.Accuracy;
if(p2.Time)p1.time=p2.Time;
if(p2.Location && p2.Location!="")p1.location=p2.Location;
if(p2.IP && p2.IP!="")p1.ip=p2.IP}
function setCurrentPositionByGPS(pos){var stamp=0;if(typeof(pos)!="undefiend" && typeof(pos.coords)!="undefiend"){currentPosition.z=getFloat(pos.coords.altitude,0);currentPosition.y=getFloat(pos.coords.latitude,0);currentPosition.x=getFloat(pos.coords.longitude,0);currentPosition.speed=getFloat(pos.coords.speed,0);if(pos.coords.accuracy && pos.coords.accuracy>0)currentPosition.accuracy=Math.log(EARTH_A/(pos.coords.accuracy/1000))/Math.log(2);if(!currentPosition.accuracy || currentPosition.accuracy<13)currentPosition.accuracy=13;stamp=getInt(pos.timestamp,0);RegisterPositionService();BeginGetPositionByCoords(currentPosition.x,currentPosition.y,function(r){currentPosition.location=r.Location;currentPosition.x=r.X;currentPosition.y=r.Y;if(window.onPositionLoad)setTimeout(window.onPositionLoad,0)})}if(stamp>0){currentPosition.time=new Date(stamp)}}
function BeginSetCurrentPositionByIP(){RegisterPositionService();BeginGetPositionByIP("",function(p){CombiePosition(currentPosition,p);if(window.onPositionLoad){setTimeout(window.onPositionLoad,0)}})}
function getShortAddress(a){return a.replace(/^中国/,"").replace(/(大道|街|弄|路).*号$/,"$1")}
var EARTH_R=6378.137;var EARTH_A=EARTH_R*Math.PI*2;
function onGpsError(err){BeginSetCurrentPositionByIP()}
function DISTANCE(x1,y1,x2,y2){var R=EARTH_R,lon1=x1*Math.PI/180,lat1=y1*Math.PI/180,lon2=x2*Math.PI/180,lat2=y2*Math.PI/180;
var deltaLat=lat1-lat2,deltaLon=lon1-lon2;
var step1=Math.pow(Math.sin(deltaLat/2),2)+Math.cos(lat2)*Math.cos(lat1)*Math.pow(Math.sin(deltaLon/2),2);
var step2=2*Math.atan2(Math.sqrt(step1),Math.sqrt(1-step1));
return step2*R}
function GetCurrentPosition(f){if((new Date())-currentPosition.time>USERCHECKINEXPIRE || currentPosition.accuracy<1){BeginSetCurrentPosition(f)}else if(f){f()}}
function BeginSetCurrentPosition(f){window.onPositionLoad=f;if(navigator.geolocation){navigator.geolocation.getCurrentPosition(setCurrentPositionByGPS,onGpsError,{maximumAge:60000,timeout:0})}else{BeginSetCurrentPositionByIP()}}
function getInt(s,d){var i=parseInt(s);return (isNaN(i))?d:i}
function getFloat(s,d){var f=parseFloat(s);return (isNaN(f))?d:f}
if(typeof(HTMLElement)!="undefined" && !window.opera){
HTMLElement.prototype.__defineGetter__("outerHTML",function(){var a=this.attributes,str="<"+this.tagName,i=0;for(;i<a.length;i++)if(a[i].specified)str+=" "+a[i].name+'="'+a[i].value+'"';if(!this.canHaveChildren)	return str+" />";return str+">"+this.innerHTML+"</"+this.tagName+">"});
HTMLElement.prototype.insertAdjacentHTML=function(where, html){var e=this.ownerDocument.createRange();e.setStartBefore(this);e=e.createContextualFragment(html);switch (where){
case 'beforeBegin': this.parentNode.insertBefore(e, this);break;
case 'afterBegin': this.insertBefore(e, this.firstChild); break;
case 'beforeEnd': this.appendChild(e); break;
case 'afterEnd':
if(!this.nextSibling) this.parentNode.appendChild(e);
else this.parentNode.insertBefore(e, this.nextSibling); break;
}};
HTMLElement.prototype.__defineSetter__("outerHTML",function(s){var r = this.ownerDocument.createRange();r.setStartBefore(this);var df = r.createContextualFragment(s);this.parentNode.replaceChild(df, this);return s});
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase())});
}
function attachEvent(element,evt,func){if(element.attachEvent){element.attachEvent("on"+evt,func)}else if(element.addEventListener){element.addEventListener(evt,func)}else if(element.setAttribute){element.setAttribute("on"+evt,func)}}
function getCheckBoxValue(name){var value=new Array();var elements=document.getElementsByName(name);for(var i=0;i<elements.length;i++){if(elements[i].checked){value.push(elements[i].value)}}switch(value.length){
case 0:	return null;
case 1:	return value[0];
default:return value;
}}
if(typeof(XMLDocument)!="undefined" && XMLDocument.prototype && !(XMLDocument.prototype.selectNodes)){
XMLDocument.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(xpath){var x=this.selectNodes(xpath);if(!x || x.length<1){return null}return x[0]}
XMLDocument.prototype.selectNodes=Element.prototype.selectNodes=function(xpath){var xpe=new XPathEvaluator();
var nsResolver=xpe.createNSResolver(this.ownerDocument==null?this.documentElement:this.ownerDocument.documentElement);
var result=xpe.evaluate(xpath, this,nsResolver,0,null),found=[],res;
while(res=result.iterateNext()){found.push(res)}return found}}
function setCheckBoxValue(name,value){var elements=document.getElementsByName(name);for(var i=0;i<elements.length;i++){elements[i].checked=(elements[i].value==value || (elements[i].value & value==elements[i].value))}}
function setSelectValue(e,value){if(typeof(e)=="string"){e=$(e)}if(e){var o=e.childNodes;for(var i=0;i<o.length;i++){if(o[i].tagName && o[i].tagName.toLowerCase()=="option"){o[i].selected=(o[i].value==value)}}}}
var DOCELEMENT=function(){return (document.compatMode && document.compatMode!="BackCompat")?document.documentElement:document.body}
var BODY=function(){return ie?(document.body):(document.getElementsByTagName("body")[0])}
function getScrollTop(){var t=ie?DOCELEMENT().scrollTop:window.pageYOffset;return t}
function getWorkHeight(){return (document.documentElement)?document.documentElement.clientHeight:BODY().clientHeight}
function getBodyHight(){return BODY().offsetHeight}
function getFirstChild(e,tagName){var es=e.childNodes;tagName=tagName.toLowerCase();for(var i=0;i<es.length;i++){if(es[i].tagName && es[i].tagName.toLowerCase()==tagName)return es[i]}return null}
function formHTML(s){s=s.replace(/^\s+/g,"").replace(/\s+$/g,"");var n=s.indexOf("<");switch(n){
case -1:return "<p>"+s.replace(/[\n\r]/g,"</p><p>")+"</p>";
default:return s.replace(/<p\s+[^>]*>\s*(&nbsp;|&#32;)*/ig,"<p>")}}
function htmlEncode(s){return s.replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/[\r\n]+/g," ")}
function removeHTML(s){return s.replace(/<\/?[\w\:\$\-_]+\s*[^>]*>\s*(&nbsp;|&#32;)*/ig,"")}
var _PAGELOADFUNS=[];
function __PAGEONLOAD(){for(var i=0;i<_PAGELOADFUNS.length;i++){_PAGELOADFUNS[i]()}if($("header")){setTimeout(scrollTo,0,0,0)}}
function attachPageLoadEvent(f){_PAGELOADFUNS.push(f)}
attachPageLoadEvent(function(){var r=window.RIA$extends$member,f;if(r && r.getCurrentPosition){f=function(s,e,o){var p=r.getCurrentPosition();if(p && (p=eval("("+p+")"))){if(s){s(p)}}else if(e){e(new Error(6000,'Location error'))}return p};if(!navigator.geolocation){navigator.geolocation={}};navigator.geolocation.getCurrentPosition=f}});
var _PLACEINV=null,_PLACEINVEVENT=new Array();
function __PLACEINVFUN(){var f;for(var i in _PLACEINVEVENT){f=_PLACEINVEVENT[i];if(!f || !f()){_PLACEINVEVENT[i]=null}}}
function AddPlaceINV(e,f){if(_PLACEINV==null){setInterval(__PLACEINVFUN,100);_PLACEINV=100}_PLACEINVEVENT[e]=f}
function placeBottom(element,m,hold){if(isMobile){element.style.top=(getScrollTop()+getWorkHeight()-m-element.offsetHeight).toString()+"px";if(isMobile){AddPlaceINV(element,function(){if(element.style.display=="none"){return false}element.style.top=(getScrollTop()+getWorkHeight()-m-element.offsetHeight).toString()+"px";return true})}}else{if(!hold){element.style.top=(getScrollTop()+getWorkHeight()-m-element.offsetHeight).toString()+"px"}else{element.style.bottom=m+"px"}element.style.position=hold?"fixed":"absolute"}}
function placeTop(element,m,hold){if(isMobile){element.style.top=(getScrollTop()+m).toString()+"px";if(hold){AddPlaceINV(element,function(){if(element.style.display=="none"){return false}element.style.top=(getScrollTop()+m).toString()+"px";return true})}}else{element.style.top=(hold?0:getScrollTop())+"px";element.style.position=hold?"fixed":"absolute"}}
function placeMiddle(element,hold){if(isMobile){element.style.top=(getScrollTop()+(getWorkHeight()-element.offsetHeight)/2).toString()+"px";if(hold){AddPlaceINV(element,function(){if(element.style.display=="none"){return false}element.style.top=(getScrollTop()+(getWorkHeight()-element.offsetHeight)/2).toString()+"px";return true})}}else{element.style.top=((getWorkHeight()-element.offsetHeight)/2).toString()+"px";element.style.position=hold?"fixed":"absolute"}}
var _ROOT="",_APPROOT=_ROOT;
function SIGHTPATH(i){return _SIGHTPATH.replace("{0}",i)}
function DISTRICTPATH(i){return _DISTRICTPATH.replace("{0}",i)}
function GUIDEPATH(i){return _GUIDEPATH.replace("{0}",i)}
function MEDIAPATH(i){return _MEDIAPATH.replace("{0}",i)}
function PHOTOFILEPATH(t,uid,aid,pid){return (USERPATH(uid)+_PHOTOFILEPATH).replace("{0}",t).replace("{1}",aid).replace("{2}",pid)}
function PHOTOPATH(i){return _PHOTOPATH.replace("{0}",i)}
function ALBUMPATH(i){return _ALBUMPATH.replace("{0}",i)}
function RECORDPATH(i){return _RECORDPATH.replace("{0}",i)}
function SITEPATH(i){return _SITEPATH.replace("{0}",i)}
function RECORDPATH(i){return _RECORDPATH.replace("{0}",i)}
function USERPATH(i){i=parseInt(i);if(i<1000){return _USERPATHROOT+"/"+i+"/"+i}else{i=i.toString();return _USERPATHROOT+"/"+i.substr(0,3)+"/"+i}}
var week={"en":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"cn":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]};
String.prototype.padLeft=function(c,l){var s=this;while(s.length<l){s+=c}return s}
String.prototype.padRight=function(c,l){var s=this;while(s.length<l){s=c+s}return s}
Date.prototype._toString=Date.prototype.toString;
Date.prototype.toString=function(x,l){var t=this;if(!x){x=(l=="en")?"yyyy-M-d HH:mm":"yyyy年M月d日 HH:mm"}else{x=x.toString()}
var yyyy=t.getFullYear(),yy=yyyy%100,M=t.getMonth()+1,MM=(M+"").padRight('0',2),d=t.getDate(),dd=(d+"").padRight('0',2),D=t.getDay(),DD=(l=="en")?(week["en"][D]):(week["cn"][D]);
var HH=(t.getHours()+"").padRight('0',2),H=(t.getHours()>12)?((l=="en")?"PM":"下午"):((l=="en")?"AM":"上午")+" "+t.getHours()%12,m=t.getMinutes(),mm=(m+"").padRight('0',2),s=t.getSeconds(),ss=(s+"").padRight('0',2),fff=t.getMilliseconds(),ff=(fff/10+"").padRight('0',2),f=fff/1000;
fff=(fff+"").padRight('0',2);
x=x.replace(/yyyy/ig,yyyy).replace(/yy/ig,yy).replace(/MM/g,MM).replace(/M/g,M).replace(/dd/g,dd).replace(/d/g,d).replace(/DD/g,DD).replace(/D/g,D);
x=x.replace(/HH/ig,HH).replace(/H/ig,H).replace(/mm/g,mm).replace(/m/g,m).replace(/ss/ig,ss).replace(/s/ig,s).replace(/fff/ig,fff).replace(/ff/ig,ff).replace(/f/ig,f);
return x}
function j(t,i){t=t.toLowerCase();var u=false;switch(t){
case "photo":u=PHOTOPATH(i);break;
case "album":u=ALBUMPATH(i);break;
case "guide":u=GUIDEPATH(i);break;
case "sight":u=SIGHTPATH(i);break;
case "media":u=MEDIAPATH(i);break;
case "userbase":
case "user":
case "member":if(i)u=USERPATH(i);break;
case "record":
case "customrecord":u=RECORDPATH(i);break;
case "site":u=SITEPATH(i);break;
case "district":u=DISTRICTPATH(i);break;
}if(u)location.href=u}
var jump=j;
function STAR(i){if(i<1)return "";var a=arguments,s="",m=(a.length>1)?a[1]:5,x=(a.length>2)?a[2]:"★",X=(a.length>3)?a[3]:"☆";for(var n=0;n<m;n++){s+=(i>n)?x:X}return s}

function onInputFocus(e,d){e.className="";if(e.value==d){e.value=""}}
function onInputBlur(e,d){if(e.value==""){e.value=d;e.className="empty"}else{e.className=""}}
function CL(){if(location.href.toLowerCase().indexOf("signin.aspx")>=0){return false}var u=0;if(!arguments[0] && user && user["PASSPORT"]){return true};location.href=_APPROOT+"/account/signin.aspx?referer"+escape(location.href);return false}
var __PROCESSMAXTIME=9;
var __PROCESSINGMARGIN=20;
var __PROCESSINGID=0;
var __PROCESSMAXTIME=10;
var __PROCESSINGMARGIN=20;
var __PROCESSINGID=0;
var __PROCESSINGTIMER=new Array(),__PROCESSINGINV=new Array();
function BeginProcessing(msg,type,owner){var pid,modalid=false;
if(arguments.length>2){pid=arguments[2];if(pid){var owner;if(typeof(pid)!="object")owner=$(pid);if(owner){modalid=pid;owner.disabled=true}}}
if(modalid){pid="modalProcessing"}else{__PROCESSINGID++;pid="processing_"+__PROCESSINGID}
var body=document.getElementsByTagName("body")[0];var p=$("modalProcessing");msg="<div>(<span id=\""+pid+"_sec\">"+__PROCESSMAXTIME+"</span>)"+msg+"</div>";
if(p==null){p=document.createElement("div");p.innerHTML='<div id="'+pid+'" class="processing'+type+'">'+msg+'</div>';BODY().appendChild(p);p=$(pid)}
else{p.innerHTML=msg;p.className="processing"+type}if(p && p.style){placeBottom(p,50,false);if(modalid)p.setAttribute("ownerid",modalid.id);clearTimeout(__PROCESSINGTIMER[pid]);
__PROCESSINGINV[pid]=__PROCESSMAXTIME;p.style.display="block";__PROCESSINGTIMER[pid]=setInterval("IntervalProcessing(\""+pid+"\")",1000);return p}}
function IntervalProcessing(pid){var p=$(pid);if(p){__PROCESSINGINV[pid]--;if(__PROCESSINGINV[pid]==0){p.innerHTML="<div>"+SYSERROR+"</div>"}else if(__PROCESSINGINV[pid]>0){var s=$(pid+"_sec");if(s){s.innerHTML=__PROCESSINGINV[pid]}}else if(__PROCESSINGINV[pid]<-1){clearInterval(__PROCESSINGTIMER[pid]);EndProcessing(pid)}}}
function CloseProcessing(msg){var pid=(arguments.length>1)?arguments[1]:"modalProcessing";var p=$(pid);if(p){__PROCESSINGINV[pid]=-1;p.innerHTML="<div>"+msg+"</div>"}}
function EndProcessing(){var pid;if(arguments.length>1){pid=arguments[1]}else{pid="modalProcessing"}clearInterval(__PROCESSINGINV[pid]);var p=$(pid);if(p && p.getAttribute){p.style.display="none";var ownerid=p.getAttribute("ownerid");if(ownerid){var owner=$(ownerid);if(owner){owner.disabled=false}}}}
function onError(){CloseProcessing(SYSERROR)}
function fieldValidation(_element,_regExp,_nullMsg){this.element=_element;this.regExp=_regExp;this.regExp=_regExp;this.nullMsg=_nullMsg;this.illegalMsg=(arguments.length>3 && arguments[3])?(arguments[3]):_nullMsg;
this.validate=function(){
if(typeof(this.element)!="object")	this.element=$(this.element.toString());
if(!this.element)	return this.nullMsg;
if(arguments.length>0 && this.element.id!=arguments[0]){return null}
if(this.nullMsg){if(typeof(this.element.value)=="undefined" || this.element.value=="")	{return this.nullMsg}}

if(typeof(this.regExp)=="string"){if(this.regExp.indexOf("confirm:")==0){if(this.element.value!=$(this.regExp.substr(8)).value){return this.illegalMsg}else{return null}}
else if(this.regExp.indexOf(":")>0){var index=this.regExp.indexOf(":");
var attribute=this.regExp.substr(0,index);var value=this.regExp.substr(index+1);var elementValue;switch(attribute){
case "checked":elementValue=this.element.checked;break;
case "id":elementValue=this.element.id;break;
case "name":elementValue=this.element.name;break;
case "readonly":elementValue=this.element.readOnly;break;
case "maxlength":elementValue=this.element.maxLength;break;
case "cellspacing":elementValue=this.element.cellSpacing;break;
case "for":elementValue=this.element.htmlFor;break;
case "class":elementValue=this.element.className;break;
case "length":
elementValue=this.element.value.length;
var ll=value.substr(1,value.length-2).split(",");var l1=parseInt(ll[0]);var l2=parseInt(ll[1]);
if(elementValue>=l1 && elementValue<=l2)return null;
else return this.illegalMsg;
default:elementValue=this.element.getAttribute(attribute);break;
}if(elementValue.toString()!=value){return this.illegalMsg}else{return null}}
else{if(valexpress[this.regExp]!=null){this.regExp=valexpress[this.regExp]}else{this.regExp=new RegExp(this.regExp)}}}
if(!this.nullMsg && this.element.value=="") return null;
if(!this.regExp.test(this.element.value)){return this.illegalMsg}return null}}
function Validation(_form,_promptType){this.form=_form;this.promptType=_promptType.toLowerCase();this.promptWhere=(arguments.length>2)?arguments[2]:"afterBegin";
this.getValitem=function(){var v=$(this.form.id+"_validations");if(!v){this.form.insertAdjacentHTML(this.promptWhere,"<div class=\"validations\" id=\""+this.form.id+"_validations\"></div>");v=$(this.form.id+"_validations")};return v}
this.fieldValidations=new Array();this.clearInvalidate=function(element){
var valitem;switch(this.promptType){
case "errorbox":valitem=$(element.id+"_validation");valitem.innerHTML="";if(valitem.style.display!=null){valitem.style.display="none"}if(valitem.style.visibility!=null){valitem.style.visibility="hidden"}break;
case "allerrorbox":valitem=this.getValitem();valitem.innerHTML="";valitem.style.display="none";break;}}
this.setInvalidate=function(element,msg){var valitem;switch(this.promptType){
case "errorbox":valitem=$(element.id+"_validation");valitem.innerHTML=msg;if(valitem.style.display!=null){valitem.style.display="block"}if(valitem.style.visibility!=null){valitem.style.visibility="visible"}break;
case "allerrorbox":valitem=this.getValitem();valitem.innerHTML="<p>"+msg+"</p>";valitem.style.display="block";break;
default:alert(msg);break;}}
this.addValidation=function(element,regExp,nullMsg){var v=new fieldValidation(element,regExp,nullMsg,arguments[3]);if(typeof(element)!="object")element=$(element.toString());
if(!element)return;
element.validate=function(){return v.validate()};
if(this.promptType=="errorbox"){element.insertAdjacentHTML(this.promptWhere,"<span class=\"validation\" id=\""+element.id+"_validation\"></span>")}
var _this=this,evt="blur";if(element.type && (element.type=="checkbox" || element.type=="radio"))evt="click";
attachEvent(element,evt,function(event){var msg=element.validate();if(msg){_this.setInvalidate(element,msg)}else{_this.clearInvalidate(element)}});
this.fieldValidations.push(v)}
this.reset=function(){if(this.form && typeof(this.form.reset)=="object"){this.form.reset()}var valitem;switch(this.promptType){
case "errorbox":for(var i=0;i<this.fieldValidations.length;i++){valitem=$(this.fieldValidations[i].element.id+"_validation");this.clearInvalidate(valitem)}break;
case "allerrorbox":this.clearInvalidate(null);break;}}
this.validate=function(){var msg,msgs=new Array(),valitem,errorcount=0;
for(var i=0;i<this.fieldValidations.length;i++){msg=this.fieldValidations[i].validate();var element=this.fieldValidations[i].element;
if(msg){switch(this.promptType){
case "errorbox":valitem=$(element.id+"_validation");valitem.innerHTML=msg;if(valitem.style.display!=null){valitem.style.display="block"}if(valitem.style.visibility!=null){valitem.style.visibility="visible"}return false;break;
case "allerrorbox":msgs[i]=msg;errorcount++;if(this.illegalMsg){break;break}break;
default:alert(msg);return false;break;
}}}if(errorcount>0){valitem=$(this.form.id+"_validations");var s="";
for(var i in msgs){if(msgs[i] && this.fieldValidations[i]){s+="<p class=\"row\">"+msgs[i]+"</p>"}}
if(valitem){valitem.innerHTML=s;valitem.style.display="block"}return false}return true}}
var guiLocked=false;
function lockGUI(){var p=$("innerwindow");p.style.height=getBodyHight()+"px";p.style.backgroundColor=((arguments.length)?arguments[0]:"transparent");p.style.display="block";guiLocked=true}
function releaseGUI(){var p=$("innerwindow");p.style.display="none";guiLocked=false}
function openInnerWindow(element){lockGUI("black");if(typeof(element)!="object")element=$(element.toString());var top=parseInt(arguments[1]);if(isNaN(top)){top=10}placeTop(element,top,false);element.style.visibility="visible";element.style.display="block"}
function closeInnerWindow(element){releaseGUI();if(typeof(element)!="object"){element=$(element.toString())}element.style.visibility="hidden";element.style.display="none"}
function expand(c,e){if(typeof(c)=="string")c=$(c);if(typeof(e)=="string")e=$(e);
if(!e)return false;
var v=(arguments.length>2)?arguments[2]:(e.style.display!="block");
e.style.display=v?"block":"none";if(c){c.className=v?"expanded":""}return v}
var MONTHDAYS=[0,31,28,31,30,31,30,31,31,30,31,30,31];
function getMonthDays(year,month){var l=false;if(year%100==0 && year%400==0) l=true;else if(year%4==0) l=true;var days=MONTHDAYS[month];if(days==28)days=(l?29:28);return days}
/* SOAP */
(function(n,m){
if(typeof(JSON)=="undefined"){var JSON=window.JSON={};JSON.parse=function(t){if(typeof(t)=="string"){try{var r=eval("("+t+")");if(arguments.length>0){arguments[1]=r}return r}catch(ex){return null}}else{return t}}}
if(!window.XMLHttpRequest){window.XMLHttpRequest=function(){var progIDs=["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(var i=0;i<progIDs.length;i++){try{var xmlHttp=new ActiveXObject(progIDs[i]);return xmlHttp}catch(ex){}}return null}}
var a=arguments,L=window[n]={method:m,Requests:[],username:((a.length>2)?a[2]:null),password:((a.length>3)?a[3]:null),NL:"\n",alt:(window.alert),debug:false,getText:function(X){var r=X.x.responseText;/*/alert(r);/**/return r},getStatus:function(X){return X.x.readyState},getStatusCode:function(X){return X.x.status}};
L.CreateRequest=function(){var x=new XMLHttpRequest();L.Requests.push(x);return x}
L.Encode=function(s){var t=typeof(s);if(t=="undefined" || s==null || s==undefined){return ""}else{s=s.toString();if(t=="number") return s}return escape(s)}
L.RegisterMethod=function(s,m){var i,p=[],b=arguments;for(i=2;i<b.length;i++){p.push(b[i])}s[m]=function(){var a=arguments,l=p.length,d=new Array();for(i=0;i<l;i++){d[p[i]]=a[i]}L.BeginInvoke(s,m,d,a[l],a[l+1],a[l+2],a[l+3])}}
L.RegisterService=function(u,m,c){var w=window;var n=c.split("."),l=n.length;for(var i=0;i<l;i++){if(!w[n[i]])w[n[i]]={};w=w[n[i]]}w.url=u;w.namespace=m;return w}
L.CreateData=function(s,m,d){var a=new Array();for(var k in d){a.push(k+"="+L.Encode(d[k]))}return a}
L.BeginInvoke=function(s,m,p,ok,ex,err,pro){var X={x:(L.CreateRequest()),processing:pro},x=X.x,u=s.url+"/"+m,data=L.CreateData(s,m,p).join("&");
x.onreadystatechange=function(){L.stateChange(X)};if(L.method=="get"){u+="?"+data}x.open(L.method,u,true,L.username,L.password);x.onreadystatechange=function(){L.stateChange(X)};if(L.method=="post"){x.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(document.cookie){x.setRequestHeader("Cookie",document.cookie)}if(L.method=="post"){x.send(data)}X.begin=true;X.onSuccess=ok;X.onError=err;X.onException=ex}
L.parseReturnValue=function(r){if(typeof(r)=="undefined" || r==null)return null;try{return JSON.parse(r)}catch(ex){return null}}
L.stateChange=function(X){if(!X.begin){return}if(L.getStatus(X)==4){
//try{
var code=L.getStatusCode(X);if(code==200){L.OnInvokeSuccess(X)}else if(code>499){L.OnInvokeException(X)}else{L.OnInvokeError(X)}
//}catch(ex){}
L.EndInvoke(X)}}
L.OnInvokeSuccess=function(X){if(X.onSuccess){X.onSuccess(L.parseReturnValue(L.getText(X)))}else if(L.debug){L.alert("Exception:"+L.getText(X))}}
L.OnInvokeException=function(X){if(X.onException){X.onException(L.getText(X))}else if(L.debug){L.alert("Exception:"+L.getText(X))}}
L.OnInvokeError=function(X){if(X.onError){X.onError(L.getText(X))}else if(L.debug){L.alert("Error:"+L.getText())}}
L.EndInvoke=function(X){L.Requests.splice(X.x);L.Abort(X)}
L.Abort=function(X){if(X){if(X.x){X.x.onreadystatechange=null;try{X.x.about()}catch(ex){};X.x=null}X=null}}
L.Clear=function(){var i,x,q=L.Requests;for(i in q){x=q[i];L.Abort(x)}L.Requests=new Array()}
L.Error=function(ex){if(typeof(ex)=="string"){ex=new Error(ex)}L.alert(ex)}})("Soap","post");

function RegisterPositionService(){if(typeof(WebServices)=="undefined" || typeof(WebServices.CommonService)=="undefined"){
var s=Soap.RegisterService(_APPROOT+"/webservices/CommonService.ashx","http://www.17you8.com/webservice","WebServices.CommonService");
Soap.RegisterMethod(s,"GetPositionByCoords","x","y");Soap.RegisterMethod(s,"GetPositionByIP","ip")}}
function BeginGetPositionByCoords(x,y,f){WebServices.CommonService.GetPositionByCoords(x,y,function(r){if(f){f(r)}})}
function BeginGetPositionByIP(ip,f){WebServices.CommonService.GetPositionByIP(ip,function(r){if(f){f(r)}})}