var StreamTypes={"ALERT_MASK_ALL":0,"ALERT_MASK_POI_ENTER":1,"ALERT_MASK_POI_EXIT":2,"ALERT_MASK_GLOBAL_ALARM":3,"ALERT_MASK_PANIC":4,"ALERT_MASK_SHIELD_BREACH":5,"ALERT_MASK_THEFT_ATTEMPT":6,"ALERT_MASK_TAMPER":7,"ALERT_MASK_ALARMING":8,"ALERT_MASK_HEARTBEAT":9,"ALERT_MASK_POWER_LOSS":10,"ALERT_MASK_TEMPERATURE_TAG_WITHIN":11,"ALERT_MASK_TEMPERATURE_TAG_OUT":12,"ALERT_MASK_FAULT_CODE":13,"ALERT_MASK_CAN_OVER":14,"ALERT_MASK_CAN_UNDER":15,"ALERT_MASK_CAN_WITHIN":16,"ALERT_MASK_CAN_OUT":17,"ALERT_MASK_DER_OVER":18,"ALERT_MASK_DER_UNDER":19,"ALERT_MASK_DER_WITHIN":20,"ALERT_MASK_DER_OUT":21,"ALERT_MASK_DIO_GOES_LOW":22,"ALERT_MASK_DIO_GOES_HIGH":23,"ALERT_MASK_EXCESS_STOP":24,"ALERT_MASK_OVERSPEED":25,"ALERT_MASK_BORDER_POST":26,"alert_name_token":{"1":"poi_enter","2":"poi_exit","3":"global_alarm","4":"panic","5":"shield_breach","6":"theft_attempt","7":"tamper","8":"alarming","9":"heartbeat","10":"power_loss","11":"temp_tag_in_bounds","12":"temp_tag_out_bounds","13":"fault_code","14":"can_over_range","15":"can_under_range","16":"can_within_range","17":"can_out_range","18":"der_over_range","19":"der_under_range","20":"der_within_range","21":"der_out_range","22":"dio_goes_low","23":"dio_goes_high","24":"excessive_stop","25":"overspeed","26":"border_post"},"UTF_SHIELD_BREACH":1,"UTF_TAMPER":2,"UTF_BORDER_POST":4,"UTF_POWER_LOSS":5,"UTF_PANIC":6,"UTF_ALARM":7,"UTF_THEFT_ATTEMPT":8,"UTF_TEMP_TAG_OUT_BOUNDS":9,"UTF_TEMP_TAG_IN_BOUNDS":10,"UTF_CAN_OVER_RANGE":11,"UTF_CAN_UNDER_RANGE":12,"UTF_CAN_IN_RANGE":13,"UTF_POI_ENTER":22,"UTF_POI_EXIT":23,"UTF_EXCESS_STOP":24,"UTF_OVERSPEED":26,"UTF_NAME":0,"UTF_VIEW_ONLY_BUSINESS":17,"UTF_VIEW_SATELLITE_MAP":18,"UTF_SMS_ALERTING":19,"UTF_EMAIL_ALERTING":20,"UTF_INBOX_ALERTING":21,"UTF_VIEW_TRAFFIC":25,"UTF_SMS_PING":27,"UTF_WEBSERVICE_ACCESS":28,"UTF_ADDREPORT":29,"UTF_DIO_GOES_HIGH":30,"UTF_DIO_GOES_LOW":31,"UTF_FAULT_CODE_ALERT":32,"UTF_SENSOR_REQUEST_START_LIMIT":33,"UTF_SENSOR_REQUEST_RANGE_LIMIT":34,"UTF_IMMOBILISE":35,"UTF_JOURNEYTIME_EST":36,"UF_UID":0,"UF_FULLNAME":1,"UF_USERNAME":2,"UF_PASSWORD":3,"UF_EMAIL":4,"UF_TYPE_ID":5,"UF_LANGUAGE_ID":6,"UF_TIMEZONE_ID":7,"UF_UOM":8,"UF_WEEK_START":9,"UF_TYPE_NAME":10,"UF_TIMEZONE_NAME":11,"UF_PHONE_NUMBER":12,"UF_SMS_ALERTING":13,"UF_EMAIL_ALERTING":14,"UF_INBOX_ALERTING":15,"UF_SHIELD_BREACH_ALERT":16,"UF_TAMPER_ALERT":17,"UF_HEALTH_CHECK_ALERT":18,"UF_BORDER_POST_ALERT":19,"UF_POWER_LOSS_ALERT":20,"UF_PANIC_ALERT":21,"UF_ALARM_ALERT":22,"UF_THEFT_ATTEMPT_ALERT":23,"UF_TEMP_TAG_OUT_BOUNDS_ALERT":24,"UF_TEMP_TAG_IN_BOUNDS_ALERT":25,"UF_CAN_OVER_RANGE_ALERT":26,"UF_CAN_UNDER_RANGE_ALERT":27,"UF_CAN_IN_RANGE_ALERT":28,"UF_DER_OVER_RANGE_ALERT":29,"UF_DER_UNDER_RANGE_ALERT":30,"UF_DER_IN_RANGE_ALERT":31,"UF_POI_ENTERED_ALERT":32,"UF_POI_EXITED_ALERT":33,"UF_EXCESS_STOP_ALERT":34,"UF_CURRENCY_PREFIX":35,"UF_CURRENCY_SUFFIX":36,"UF_CURRENCY_DECIMAL":37,"UF_CURRENCY_DECIMAL_COUNT":38,"UF_CURRENCY_SEPARATOR":39,"UF_CURRENCY_SEPARATOR_COUNT":40,"UF_OVERSPEED_ALERT":41,"UF_DIO_GOES_HIGH_ALERT":42,"UF_DIO_GOES_LOW_ALERT":43,"UF_FAULT_CODE_ALERT":44,"UF_PASSWORD_STRENGTH":45,"VF_UID":0,"VF_REGISTRATION_NUMBER":1,"VF_VIN":2,"VF_MAKE":3,"VF_MODEL":4,"VF_TYPE_ID":5,"VF_FTP_SERVER":6,"VF_FLEET_KEY_RO":7,"VF_FLEET_KEY_RW":8,"VF_SOC_KEY":9,"VF_NOTES":10,"VF_BUTTON_PUSH_BUSINESS":11,"VF_ODOMETER":12,"VF_MPG":13,"VF_FUEL_TYPE":14,"VF_PRIMARY_LOCATION_ID":15,"VF_PRIMARY_LOCATION_NAME":16,"VF_TYPE_NAME":17,"VF_ICON":18,"VF_IMMOB_STATE":19,"VF_OWNER":20,"VF_COLOUR":21,"VF_STATUS":22,"VF_COSTCENTRE":23,"VF_GPSLIFEODO":24,"DF_UID":0,"DF_FORENAME":1,"DF_SURNAME":2,"DF_TAG_ID":3,"DF_TAG_SITE_CODE":4,"DF_ADDRESS":5,"DF_PHONE_NUMBER":6,"DF_ENGINEER_ID":7,"DF_USERNAME":8,"DF_PASSWORD":9,"DF_GRADE":10,"RT_UNKNOWN":0,"RT_GROUP":1,"RT_VEHICLE":2,"RT_USER":3,"RT_DRIVER":4,"RT_ASSET":5,"RT_POI":6,"RT_SERVER":7,"RT_RESOURCE_COLLECTION":8,"RF_SPECIFY_START_DATE":0,"RF_SPECIFY_START_TIME":1,"RF_SPECIFY_END_DATE":2,"RF_SPECIFY_END_TIME":3,"RF_DAY":4,"RF_WEEKEND":5,"RF_WEEK":6,"RF_MONTH":7,"RF_YEAR":8,"RF_BY_VEHICLE":9,"RF_BY_VEHICLE_COLLECTION":10,"RF_BY_POI":11,"RF_BY_POI_COLLECTION":12,"RF_BY_DRIVER":13,"RF_BY_DRIVER_COLLECTION":14,"RF_BY_ASSET":15,"RF_BY_ASSET_COLLECTION":16,"RF_BY_USER":17,"RF_BY_GROUP":18,"RF_MIN_SPEED_FILTER":19,"RF_MIN_TOTAL_DISTANCE_FILTER":20,"RF_POI_ID_FILTER":21,"RF_POI_COLLECTION_ID_FILTER":22,"RF_MIN_FUEL_FILTER":23,"RF_MAX_FUEL_FILTER":24,"RF_OUT_OF_HOURS_FILTER":25,"RF_NAMESPACE_FILTER":26,"RF_IDLESTOP_FILTER":27,"RF_PERCENT_OVERSPEED_FILTER":28,"RF_SORT_ORDER":29,"RF_FUEL_COST":30,"RF_MAX_RESOURCES_PER_CHUNK":31,"RF_MAX_RESOURCES_PER_PAGE":32,"RF_ALERT_TYPE_FILTER":33,"RF_EXPECTED_START_TIME_FILTER":34,"RF_EXPECTED_END_TIME_FILTER":35,"RF_MIN_DAY_DRIVING_TIME_FILTER":36,"RF_MIN_NON_DAY_USE_FILTER":37,"RF_MIN_DAY_DIST_FILTER":38,"RF_SORT_FIELD_MASK":39,"RF_GET_RESOURCE_LOCATION":40,"RF_EXCEPTION":41,"RF_POST_SORT":42,"RF_GET_CONNECTED_RESOURCE_ARRAY":43,"RF_GET_GROUP_FEATURES":44,"RF_SUBREPORT":45,"RF_POI_TYPE_ID_FILTER":46,"RF_BY_SERVER":47,"RF_DIO_HIGHLIGHT_FILTER":48,"RF_DASHLET":49,"RF_LYNX_EXCEPTION_FILTER":50,"RF_GET_RESOURCE_INHERITED_FEATURES":51,"RF_INTERVAL_FILTER":52,"RF_HTML_FORMAT":100,"RF_DHTML_FORMAT":101,"RF_CSV_FORMAT":102,"RF_ASYNCXML_FORMAT":103,"RF_PDF_FORMAT":104,"RF_XLS_FORMAT":105,"RF_WEBSERVICE_METHODS":200,"RF_ASYNC_WEBSERVICE_METHODS":201,"GS_UNKNOWN":0,"GS_INTRANSIT":1,"GS_ONLINE":2,"GS_OFFLINE":3,"GS_IDLE":4,"GS_PARKED":5,"SECOND_INTERVAL":0,"MINUTE_INTERVAL":1,"HOUR_INTERVAL":2,"DAY_INTERVAL":3,"WEEK_INTERVAL":4,"MONTH_INTERVAL":5,"YEAR_INTERVAL":6,"TIMESCALE_TODAY":0,"TIMESCALE_YESTERDAY":1,"TIMESCALE_CURRENT_WEEK":2,"TIMESCALE_PREVIOUS_WEEK":3,"TIMESCALE_CURRENT_MONTH":4,"TIMESCALE_PREVIOUS_MONTH":5,"TIMESCALE_PREVIOUS_WEEKEND":6,"TIMESCALE_CURRENT_YEAR":7,"TIMESCALE_PREVIOUS_YEAR":8,"AF_ALERT_EMAIL":1,"AF_ALERT_INBOX":2,"AF_ALERT_SMS":4,"VTF_NAME":0,"utf_alert_name":{"1":"shield_breach","2":"tamper","4":"border_post","5":"power_loss","6":"panic","7":"alarming","8":"theft_attempt","9":"temp_tag_out_bounds","10":"temp_tag_in_bounds","11":"can_over_range","12":"can_under_range","13":"can_within_range","22":"poi_enter","23":"poi_exit","24":"excessive_stop","26":"overspeed","30":"dio_goes_high","31":"dio_goes_low","32":"fault_code"},"uf_to_utf_map":{"13":19,"14":20,"15":21,"16":1,"17":2,"19":4,"20":5,"21":6,"22":7,"23":8,"24":9,"25":10,"26":11,"27":12,"28":13,"32":22,"33":23,"34":24,"41":26,"42":30,"43":31,"44":32},"utf_to_uf_map":{"19":13,"20":14,"21":15,"1":16,"2":17,"4":19,"5":20,"6":21,"7":22,"8":23,"9":24,"10":25,"11":26,"12":27,"13":28,"22":32,"23":33,"24":34,"26":41,"30":42,"31":43,"32":44}};var g_dbg_log="",session_id="",webservice_callback_array=[],plugin_callback_array=[],language_hash={},logout_tb_id=-1,enable_anim_tb_id=-1,animation_enabled=true,refresh_tb_id=-1,minimise_tb_id=-1,print_tb_id=-1,tools_tb_id=-1,help_tb_id=-1,routing_tb_id=-1,report_issue_tb_id=-1,minimised_plugin_array=[],plugin_wait_count=0,fx_semaphore=false,g_fx_duration=0.20,g_dock_height=28,g_webservice_call_total=0,g_initialisation_state=0,g_mouse_hover_div="",g_modal_button_owner=-1,g_modal_button_event="",g_minimise_cache=[],g_ticker_array=[],g_dock_bottom_offset=20,g_loaded_plugin_type_hash={},g_fx_queue=0,g_mousedown=false,g_tooltip=null,g_is_modal_closing=false,tempX=0,tempY=0,old_x=0,old_y=0,g_tooltip_visible=false,g_delay_display_plugin="",g_lang_cache={},g_mouse_popup_time=-1,g_mouse_popup_id=-1,g_mouse_popup_width=-1,g_mouse_popup_height=-1,gPopupMask=null,gPopupContainer=null,gPopFrame=null,gPopTitle=null,gReturnFunc,gPopupIsShown=false,gHideSelects=true,gReturnVal=null,g_is_IE6=false,gTabIndexes=[],gTabbableTags=["A","BUTTON","TEXTAREA","INPUT","IFRAME"],_mainframe_={};function is_utf_alert(feature_id)
{try{var p_StreamTypes=StreamTypes;if(feature_id){if(feature_id==p_StreamTypes.UTF_SMS_ALERTING){return false;}
if(feature_id==p_StreamTypes.UTF_EMAIL_ALERTING){return false;}
if(feature_id==p_StreamTypes.UTF_INBOX_ALERTING){return false;}
if(p_StreamTypes.utf_to_uf_map[feature_id]){return true;}}
return false;}catch(e){debug(this.id,0,"is_utf_alert:"+e.message);}};function get_session_id(id)
{try{return session_id;}catch(e){_DBG(0,"get_session_id:"+e.message);}}
function is_mobile_client()
{return g_is_mobile;}
function get_extended_map_client_id()
{try{return g_map_client_id;}catch(e){_DBG(0,"get_extended_map_client_id:"+e.message);}}
function call_plugin_function(plugin_id,call,arg,event_type)
{var id="plugin_"+plugin_id;try
{var p=document.getElementById(id);var param=(arg===null?plugin_id:arg);var result=undefined;if(parseInt(plugin_id,10)===-1){eval("result="+call+"(arg);");return result;}
var exists=false;var s="if(typeof("+id+") !== 'undefined'){if(typeof("+id+"."+call+") === 'function'){result = "+id+"."+call+"("+param+");}}";eval(s);return result;}
catch(e)
{_DBG(0,"Exception when trying to call plugin callback [callback:"+call+"][plugin:"+id+"][error:"+e.message+"]");}}
function register_webservice_callback_array(id,call_array)
{try{var l=call_array.length;for(var i=0;i<l;i++){var call=call_array[i];var ws_cb_item=webservice_callback_array[call.i];if(ws_cb_item===undefined){ws_cb_item=webservice_callback_array[call.i]=[];}
var method_cb_item=ws_cb_item[call.m];if(method_cb_item===undefined){method_cb_item=webservice_callback_array[call.i][call.m]=[];}
var plugin_cb_item=method_cb_item[id];if(plugin_cb_item===undefined){plugin_cb_item=webservice_callback_array[call.i][call.m][id]=call.c;}else{_DBG(2,"plugin "+id+" attempting to register the same webservice callback ["+call.i+"::"+call.m+"] twice");plugin_cb_item=call.c;}}}catch(e){_DBG(0,"register_webservice_callback_array:"+e.message);}}
function register_webservice_callback(id,ws_interface,ws_method,callback_func)
{try{var ws_cb_item=webservice_callback_array[ws_interface];if(ws_cb_item===undefined){ws_cb_item=webservice_callback_array[ws_interface]=[];}
var method_cb_item=ws_cb_item[ws_method];if(method_cb_item===undefined){method_cb_item=webservice_callback_array[ws_interface][ws_method]=[];}
var plugin_cb_item=method_cb_item[id];if(plugin_cb_item===undefined){plugin_cb_item=webservice_callback_array[ws_interface][ws_method][id]=callback_func;}else{_DBG(2,"plugin "+id+" attempting to register the same webservice callback ["+ws_interface+"::"+ws_method+"] twice");plugin_cb_item=callback_func;}}catch(e){_DBG(0,"register_webservice_callback:"+e.message);}}
function unregister_webservice_callback(id,ws_interface,ws_method)
{try{if(webservice_callback_array[ws_interface]===undefined){return;}
if(webservice_callback_array[ws_interface][ws_method]===undefined){return;}
if(webservice_callback_array[ws_interface][ws_method][id]===undefined){return;}
delete webservice_callback_array[ws_interface][ws_method][id];}catch(e){_DBG(0,"unregister_webservice_callback:"+e.message);}}
function get_plugin_name(id)
{try
{var name="framework";var i_id=parseInt(id,10);if(typeof(plugin_array)!=="undefined"){var i=plugin_array.length-1;if(plugin_array.length>0){do{var p=plugin_array[i];if(parseInt(p.id,10)===i_id){name=p.name;return name;}}while(i--);}}
return name;}catch(e)
{_DBG(0,"get_plugin_name:"+e.message);}}
function get_plugin_id(type)
{try
{var id=-1;if(typeof(plugin_array)!=="undefined"){if(plugin_array.length>0){var i=plugin_array.length-1;do{var p=plugin_array[i];if(p.type===type){id=p.id;return id;}}while(i--);}}
return id;}catch(e)
{_DBG(0,"get_plugin_id:"+e.message);}}
function get_plugin_type(id)
{try{var name="framework";var i_id=parseInt(id,10);if(typeof(plugin_array)!=="undefined"){var i=plugin_array.length-1;if(plugin_array.length>0){do{var p=plugin_array[i];if(parseInt(p.id,10)===i_id){type=p.type;return type;}}while(i--);}}
return name;}catch(e){_DBG(0,"get_plugin_type:"+e.message);}}
function get_pwd()
{try{var branding="trakm8";if((typeof(g_user)!="undefined")&&g_user.branding_name&&g_branding_exists){branding=g_user.branding_name;}
return g_app_path+"/branding/"+branding;}catch(e){_DBG(0,"get_pwd:"+e.message);}}
function get_language_string(token,param1,param2,param3)
{try{if(typeof(token.toLowerCase)=="function"){var result=language_hash[token.toLowerCase()];if(result||(result==="")){if(param1){result=result.replace(/\$1/g,param1);}
if(param2){result=result.replace(/\$2/g,param2);}
if(param3){result=result.replace(/\$3/g,param3);}
return result;}}
return"#"+token;}catch(e){_DBG(0,"get_language_string:"+e.message);}}
function get_language_token(str)
{try{for(var x in language_hash){if(language_hash[x]==str){return x;}}
return"";}catch(e){_DBG(0,"get_language_token:"+e.message);}}
function get_config_value(key)
{try{if(typeof(g_config)!="undefined"){if(g_config[key]){return g_config[key];}}
return"";}catch(e){_DBG(0,"get_config_value:"+e.message);}}
function ajax_failure(method,data)
{try
{_DBG(0,"ajax_failure: "+method+" "+$.toJSON(data));if((!g_is_mobile)&&(method==="check_app_version_event")){setTimeout(check_app_version,parseInt(get_config_value("APP_VERSION_CHECK_INTERVAL"),10));return;}
if(method==="report_issue_event"){return;}
eval("var x="+decodeURIComponent(data.ws_request));var error={};error.__wsi_interface=data.ws_interface;error.__wsi_call=data.ws_method;error.__plugin_id=data.plugin_id;error.__client_param=x.__client_param;error.error_code="-1";var s=method+"('"+$.toJSON(error)+"');";eval(s);}catch(e)
{_DBG(0,"ajax_failure:"+e.message);}}
function do_async_call(id,url,type,request,callback_success,callback_error)
{try{var name=get_plugin_name(id);var wrapper={};wrapper.plugin_id=id;wrapper.url=url;wrapper.type=type;wrapper.request=$.toJSON(request);wrapper.rsrnd=new Date().getTime().toString();wrapper.ajax_method="do_async_call";var aj=$.ajax({type:'POST',url:get_pwd()+"/app/php/sajax_calls.php",success:callback_success,contentType:"application/x-www-form-urlencoded; charset=utf-8",error:function(){ajax_failure("callback_error",wrapper);},data:wrapper,dataType:"text"});}catch(e){_DBG(0,"do_async_call:"+e.message);}}
function call_webservice(id,ws_interface,ws_method,ws_request)
{try{var i_id=parseInt(id,10);if(i_id===-1){g_webservice_call_total=g_webservice_call_total+1;}
var name=get_plugin_name(id);if(session_id!==""){ws_request.session_id=session_id;}
var wrapper={};wrapper.plugin_id=id;wrapper.ws_method=ws_method;wrapper.ws_interface=ws_interface;wrapper.ws_request=$.toJSON(ws_request);wrapper.rsrnd=new Date().getTime().toString();wrapper.ajax_method="do_wsi_call";method="GET";if(wrapper.ws_request.length>1000){method="POST";}
var aj=$.ajax({type:method,url:get_pwd()+"/app/php/sajax_calls.php",success:call_ws_event,contentType:"application/x-www-form-urlencoded; charset=utf-8",error:function(){ajax_failure("call_ws_event",wrapper);},data:wrapper,timeout:600000,dataType:"text"});}catch(e){_DBG(0,"call_webservice:"+e.message);}}
function call_array_ws_event(result,status)
{try{eval("ws_array_response="+result);var i=0;var len=ws_array_response.length;while(i<len){call_ws_event($.toJSON(ws_array_response[i++]));}}catch(e){_DBG(0,"call_array_ws_event:"+e.message);}}
function call_webservice_array(id,request_array)
{try{var name=get_plugin_name(id);if(session_id!==""){var i=request_array.length-1;if(request_array.length>0){do{request_array[i].ws_request.session_id=session_id;}while(i--);}}
if(parseInt(id,10)===-1){g_webservice_call_total+=request_array.length;}
var wrapper={};wrapper.plugin_id=id;wrapper.ws_request_array=$.toJSON(request_array);wrapper.rsrnd=new Date().getTime().toString();wrapper.ajax_method="do_wsi_array_call";var aj=$.ajax({type:'POST',url:get_pwd()+"/app/php/sajax_calls.php",contentType:"application/x-www-form-urlencoded; charset=utf-8",success:call_array_ws_event,error:function(){ajax_failure("call_array_ws_event",wrapper);},data:wrapper,timeout:600000,dataType:"text"});}catch(e){_DBG(0,"call_webservice_array:"+e.message);}}
function post_plugin_msg(id,cb,param)
{try{var i_id=parseInt(id,10);if(plugin_callback_array[cb]===undefined){_DBG(2,"post_plugin_msg: no registered callbacks for "+cb);return;}
var name=get_plugin_name(id);if(typeof(param)==="array"){}else if(typeof(param)==="object"){param.__plugin_id=id;}
var i=plugin_callback_array[cb].length-1;if(plugin_callback_array[cb].length>0){do
{var temp_i_id=parseInt(plugin_callback_array[cb][i],10);var p_id="plugin_"+plugin_callback_array[cb][i];if(i_id===temp_i_id){continue;}
var done=false;if(temp_i_id==1){if((get_config_value("release_tag")=="ALPHA")&&(get_config_value("uname")=="apldev1")){_DBG(3,"post_plugin_msg: "+get_plugin_name(id)+" ["+id+"] ["+cb.toString()+"] param =  "+$.toJSON(param));}}
var s="if(typeof("+p_id+") !== 'undefined'){if(typeof("+p_id+"."+cb+") === 'function'){"+p_id+"."+cb+"(param);}}";eval(s);}while(i--);}}catch(e){_DBG(0,"post_plugin_msg:"+e.message);}}
function get_locale_datetime(date,tz_code)
{try{if(typeof(date)!=="string"){return"";}
var datetime_split=date.split(" ");if(datetime_split.length===2){var date_split=datetime_split[0].split("-");var time_split=datetime_split[1].split(":");if((date_split.length===3)&&(time_split.length=3)){var datetime_ob=new Date(date_split[0],date_split[1]-1,date_split[2],time_split[0],time_split[1],time_split[2]);if(tz_code!==""){return datetime_ob.formatDate(g_lang_cache.datetime_format)+" ("+tz_code+")";}else{return datetime_ob.formatDate(g_lang_cache.datetime_format);}}}
return"";}catch(e){_DBG(0,"get_locale_datetime:"+e.message);}}
function get_locale_date(date,tz_code)
{try{if(typeof(date)!=="string"){return"";}
var datetime_split=date.split(" ");if(datetime_split.length===2)
{var date_split=datetime_split[0].split("-");var time_split=datetime_split[1].split(":");if((date_split.length===3)&&(time_split.length=3))
{var datetime_ob=new Date(date_split[0],date_split[1]-1,date_split[2],time_split[0],time_split[1],time_split[2]);if(tz_code!==""){return datetime_ob.formatDate(get_language_string('date_format'))+" ("+tz_code+")";}else{return datetime_ob.formatDate(get_language_string('date_format'));}}}
return"";}catch(e){_DBG(0,"get_locale_date:"+e.message);}}
function register_plugin_msg_callback_array(id,callback_func_array)
{try{var i_id=parseInt(id,10);for(var i=0;i<callback_func_array.length;i++){var callback_func=callback_func_array[i];var p_cb=plugin_callback_array[callback_func];if(p_cb===undefined){plugin_callback_array[callback_func]=[];p_cb=plugin_callback_array[callback_func];}
p_cb.push(id);}}catch(e){_DBG(0,"register_plugin_msg_callback_array:"+e.message);}}
function register_plugin_msg_callback(id,callback_func)
{try{var i_id=parseInt(id,10);var p_cb=plugin_callback_array[callback_func];if(p_cb===undefined)
{plugin_callback_array[callback_func]=[];p_cb=plugin_callback_array[callback_func];}
p_cb.push(id);}catch(e){_DBG(0,"register_plugin_msg_callback:"+e.message);}}
function is_plugin_msg_callback_registered(id,callback_func)
{try{var i_id=parseInt(id,10);var p_cb=plugin_callback_array[callback_func];if(p_cb===undefined)
{return false;}else{for(var j=0;j<p_cb.length;j=j+1)
{if(parseInt(p_cb[j],10)!=i_id){return true;}}}
return false;}catch(e){_DBG(0,"is_plugin_msg_callback_registered:"+e.message);}}
function unregister_plugin_msg_callback(id,callback_func)
{try{var i_id=parseInt(id,10);if(plugin_callback_array[callback_func]===undefined){return;}
var i=plugin_callback_array[callback_func].length-1;if(plugin_callback_array[callback_func].length>0){do
{if(parseInt(plugin_callback_array[callback_func][i],10)===i_id){plugin_callback_array[callback_func].splice(i,1);}}while(i--);}
plugin_callback_array[callback_func].push(id);}catch(e){_DBG(0,"unregister_plugin_msg_callback:"+e.message);}}
function set_user_setting(id,key,value,is_global)
{try{var found=false;var plugin_key="";if(is_global===true){plugin_key="global."+key.toString();}else{plugin_key="plugin"+id.toString()+"."+key.toString();}
var i=g_user_setting_array.length-1;if(g_user_setting_array.length>0){do
{var setting=g_user_setting_array[i];if(setting.key===plugin_key){setting.value=value.toString();found=true;break;}}while(i--);}
if(!found){var o={key:plugin_key,value:value.toString()};g_user_setting_array.push(o);}
var request={application_id:"0",item_array:{0:{key:plugin_key,value:value.toString()}}};call_webservice(-1,"tm8User1","wsSetUserSettingArray1",request);}catch(e){_DBG(0,"set_user_setting:"+e.message);}}
function set_user_setting_array(id,setting_array)
{try{var found=false;var plugin_key="";var request={application_id:"0",item_array:{}};var i=setting_array.length-1;if(setting_array.length>0){do
{var setting=setting_array[i];var key=setting.key;var is_global=setting.is_global;var value=setting.value;if(is_global===true){plugin_key="global."+key.toString();}else{plugin_key="plugin"+id.toString()+"."+key.toString();}
for(var j=0;j<g_user_setting_array.length;j=j+1)
{var p_setting=g_user_setting_array[j];if(p_setting.key===plugin_key){p_setting.value=value.toString();found=true;break;}}
if(!found)
{var o={key:plugin_key,value:value.toString()};g_user_setting_array.push(o);}
request.item_array[i]={key:plugin_key,value:value.toString()};}while(i--);}
call_webservice(-1,"tm8User1","wsSetUserSettingArray1",request);}catch(e){_DBG(0,"set_user_setting:"+e.message);}}
function get_user_setting(id,key,is_global)
{try{var plugin_key="";if(is_global&&(is_global===true))
{plugin_key="global."+key.toString();}else{plugin_key="plugin"+id.toString()+"."+key.toString();}
var i=g_user_setting_array.length-1;if(g_user_setting_array.length>0){do
{if(g_user_setting_array[i].key===plugin_key)
{return g_user_setting_array[i].value;}}while(i--);}
return"";}catch(e){_DBG(0,"get_user_setting:"+e.message);}}
function PluginLoad_Event()
{try{}catch(ex)
{_DBG(0,"PluginLoad_Event:"+ex.message);}}
function get_user(plugin_id)
{try{return g_user;}catch(e){_DBG(0,"get_user:"+e.message);}}
function get_plugin_feature_array(plugin_id)
{try{var i=plugin_array.length-1;if(plugin_array.length>0){do
{var p_id=parseInt(plugin_array[i].id,10);if(p_id===plugin_id){return plugin_array[i].feature_array;}}while(i--);}
_DBG(1,"get_plugin_feature_array:unknown plugin id");return null;}catch(e)
{_DBG(0,"get_plugin_feature_array:"+e.message);}}
function add_plugin(id,type,name,feature_array)
{try
{var i_id=parseInt(id,10);var i=plugin_array.length-1;if(plugin_array.length>0){do
{var p_id=parseInt(plugin_array[i].id,10);if(p_id===i_id){_DBG(1,"add_plugin:"+id+" already exists");return;}}while(i--);}
var p={id:id.toString(),state:0,type:type,name:name,wait_count:0,feature_array:feature_array};plugin_array.push(p);}
catch(e)
{_DBG(0,"add_plugin:"+e.message);}}
function remove_plugin(id)
{try
{var i_id=parseInt(id,10);var i=plugin_array.length-1;if(plugin_array.length>0){do
{var p_id=parseInt(plugin_array[i].id,10);if(p_id===i_id){plugin_array.splice(i,1);_DBG(3,"remove_plugin:"+id+" removed");$("#"+id).remove();return;}}while(i--);}
_DBG(1,"remove_plugin:"+id+" doesnt exist");}
catch(e)
{_DBG(0,"remove_plugin:"+e.message);}}
function plugin_func_iterator(call,arg)
{try
{var i=plugin_array.length-1;var p_call_plugin_function=call_plugin_function;if(plugin_array.length>0){do
{var p_id=parseInt(plugin_array[i],10);if(p_id===-2){continue;}
p_call_plugin_function(p_id,call,arg,1);}while(i--);}}
catch(e)
{_DBG(0,"plugin_func_iterator:"+e.message);}}
capitalise=function(str)
{try
{return str.toLowerCase().replace(/\b\S/g,function(x){return x.toUpperCase();});}catch(e){_DBG(0,"close_modal:"+e.message);}};function is_visible(item)
{try
{if(typeof(item)==="string"){return(document.getElementById(item).style.display!=="none");}else{return(item.style.display!=="none");}}
catch(ex)
{_DBG(0,"is_visible:"+ex.message);}}
function add_handler(target,eventName,handlerName)
{try
{if(target.addEventListener){target.addEventListener(eventName,handlerName,false);}else if(target.attachEvent){target.attachEvent("on"+eventName,handlerName);}else{target["on"+eventName]=handlerName;}}catch(e)
{_DBG(0,"add_handler:"+e.message);}}
function logout_event(r)
{try{eval("var response = "+r);if(parseInt(response.error_code,10)===0){}}
catch(ex)
{_DBG(0,"logout_event:"+ex.message);}}
window.onerror=function(err,file,line){_DBG(0,'The following error occured: '+err+'\n'+'In file: '+file+'\n'+'At line: '+line);return true;};var tm8Util={};tm8Util.today_start_datetime="";tm8Util.today_end_datetime="";tm8Util.yesterday_start_datetime="";tm8Util.yesterday_end_datetime="";tm8Util.current_week_start_datetime="";tm8Util.current_week_end_datetime="";tm8Util.previous_week_end_datetime="";tm8Util.previous_week_start_datetime="";tm8Util.current_month_start_datetime="";tm8Util.current_month_end_datetime="";tm8Util.previous_month_start_datetime="";tm8Util.previous_month_end_datetime="";tm8Util.previous_weekend_start_datetime="";tm8Util.previous_weekend_end_datetime="";tm8Util.start_of_weekend_time=" 20:00:00";tm8Util.end_of_weekend_time=" 04:00:00";tm8Util.start_of_day_time=" 00:00:00";tm8Util.end_of_day_time=" 23:59:59";tm8Util.start_of_weekend_day=5;tm8Util.end_of_weekend_day=1;tm8Util.lang_tokens={};tm8Util.escape_html=function(str){return str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');};tm8Util.unescape_html=function(str){return str.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');};tm8Util.populate_select=function(select,content)
{try{$(select).html(content);}catch(e){_DBG(0,"tm8Util.populate_select:"+e.message);}};tm8Util.clear_select=function(o)
{try{var selectObj=null;if(typeof(o)=="string"){selectObj=document.getElementById(o);}else{selectObj=o;}
var selectParentNode=selectObj.parentNode;var newSelectObj=selectObj.cloneNode(false);selectParentNode.replaceChild(newSelectObj,selectObj);return newSelectObj;}catch(e){_DBG(0,"tm8Util.clear_select:"+e.message);}};tm8Util.get_immob_state_info=function(state)
{try{var ob={};if(typeof(this.lang_tokens.immob_deactivated)=="undefined"){this.lang_tokens.immob_deactivated=get_language_string("immob_deactivated");this.lang_tokens.immob_activate_requested=get_language_string("immob_activate_requested");this.lang_tokens.immob_activate_pending=get_language_string("immob_activate_pending");this.lang_tokens.immob_deactivate_requested=get_language_string("immob_deactivate_requested");this.lang_tokens.immob_deactivate_pending=get_language_string("immob_deactivate_pending");}
switch(state)
{case 0:ob={state:this.lang_tokens.immob_deactivated,colour:"#00ff00",class_suffix:"_immob_unlocked"};break;case 1:ob={state:this.lang_tokens.immob_activate_requested,colour:"#ff00ff",class_suffix:"_immob_locking"};break;case 2:ob={state:this.lang_tokens.immob_activate_pending,colour:"#00ffff",class_suffix:"_immob_locking"};break;case 3:ob={state:this.lang_tokens.immob_activated,colour:"#ff0000",class_suffix:"_immob_locked"};break;case 4:ob={state:this.lang_tokens.immob_deactivate_requested,colour:"#ff00ff",class_suffix:"_immob_unlocking"};break;case 5:ob={state:this.lang_tokens.immob_deactivate_pending,colour:"#00ff00",class_suffix:"_immob_unlocked"};break;default:ob={state:this.lang_tokens.immob_deactivated,colour:"#00ff00",class_suffix:"_immob_locked"};break;}
return ob;}catch(e){_DBG(0,"tm8Util.get_immob_state_info:"+e.message);}};tm8Util.has_date_changed=function()
{try{var temp_date=new Date();if(this.today_start_datetime!==(temp_date.formatDate("Y-m-d")+this.start_of_day_time)){return true;}else{return false;}}catch(e){_DBG(0,"tm8Util.has_date_changed:"+e.message);}};tm8Util.get_uom_speed_units=function()
{try{if((g_user.uom==='metric')||(g_user.uom==='1')){return g_lang_cache.kmh;}else{return g_lang_cache.mph;}}catch(e){_DBG(0,"tm8Util.get_uom_speed_units:"+e.message);}};tm8Util.get_uom_distance_units=function()
{try{if((g_user.uom==='metric')||(g_user.uom==='1')){return get_language_string('km');}else{return get_language_string('miles');}}catch(e){_DBG(0,"tm8Util.get_uom_distance_units:"+e.message);}};tm8Util.get_m_from_uom=function(d)
{try
{if(d>0){var m_distance=0;if((g_user.uom==='metric')||(g_user.uom==='1')){m_distance=d*1000.0;}else{m_distance=d*1609.344;}
return Math.round(m_distance);}else{return 0;}}catch(e){_DBG(0,"tm8Util.get_ms_from_uom:"+e.message);}};tm8Util.get_ms_from_uom=function(s)
{try
{if(s>0){var ms_speed=0;if((g_user.uom==='metric')||(g_user.uom==='1')){ms_speed=speed/3.6;}else{ms_speed=speed/2.23693629;}
return ms_speed;}else{return 0;}}catch(e){_DBG(0,"tm8Util.get_ms_from_uom:"+e.message);}};tm8Util.get_uom_speed=function(s)
{try{if((g_user.uom==='metric')||(g_user.uom==='1')){return Math.round(s*3.6).toString();}else{return Math.round(s*2.23693629).toString();}}catch(e){_DBG(0,"tm8Util.get_uom_speed:"+e.message);}};tm8Util.get_uom_distance=function(d)
{try{if((g_user.uom==='metric')||(g_user.uom==='1')){return Math.round(d/1000.0);}else{return Math.round(d/1609.344);}}catch(e){_DBG(0,"tm8Util.get_uom_distance:"+e.message);}};tm8Util.get_alert_description=function(alert_type,alert_param_array)
{try{var p_get_language_string=get_language_string;switch(parseInt(alert_type,10)){case 1:return p_get_language_string("entered")+": "+alert_param_array[0].param;break;case 2:return p_get_language_string("exited")+": "+alert_param_array[0].param;break;case 3:return p_get_language_string("global_alarm");break;case 4:return p_get_language_string("panic");break;case 5:return p_get_language_string("shield_breach");break;case 6:return p_get_language_string("theft_attempt");break;case 7:return p_get_language_string("tamper");break;case 8:return p_get_language_string("alarming");break;case 9:return p_get_language_string("heartbeat");break;case 10:return p_get_language_string("power_loss");break;case 11:return p_get_language_string("temp_tag_in");break;case 12:return p_get_language_string("temp_tag_out");break;case 13:return alert_param_array[1].param.param;break;case 14:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_over")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 15:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_under")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 16:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_within")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 17:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_outside")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 18:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_over")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 19:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_under")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 20:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_within")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 21:return get_language_string(alert_param_array[0].param)+" "+get_language_string("has_gone_outside")+" "+alert_param_array[1].param+" "+get_language_string(alert_param_array[0].param+"_units");break;case 22:return alert_param_array[0].param;break;case 23:return alert_param_array[0].param;break;case 24:return get_language_string("duration")+": "+alert_param_array[0].param+" "+p_get_language_string("seconds");break;case 25:return get_language_string("speed")+": "+alert_param_array[0].param+" "+get_uom_speed_units();break;default:return"";break;}}catch(e){_DBG(0,"tm8Util.get_alert_description:"+e.message);}};tm8Util.get_alert_title=function(alert_type)
{try{var atn=StreamTypes.alert_name_token;if(atn[alert_type]){return atn[alert_type];}
else return"";}catch(e){_DBG(0,"tm8Util.get_alert_title:"+e.message);}};tm8Util.get_alert_img=function(alert_type)
{try{switch(parseInt(alert_type,10)){case 1:return"alert_poi_entered.png";break;case 2:return"alert_poi_exited.png";break;case 3:return"alert_alert_global_alarm.png";break;case 4:return"alert_panic.png";break;case 5:return"alert_shield_breach.png";break;case 6:return"alert_theft_attempt.png";break;case 7:return"alert_tamper.png";break;case 8:return"alert_alarming.png";break;case 9:return"alert_heartbeat.png";break;case 10:return"alert_power_loss.png";break;case 11:return"alert_temp_tag_in.png";break;case 12:return"alert_temp_tag_out.png";break;case 13:return"alert_fault_code.png";break;case 14:return"alert_can_over.png";break;case 15:return"alert_can_under.png";break;case 16:return"alert_can_within.png";break;case 17:return"alert_can_out.png";break;case 18:return"alert_can_over.png";break;case 19:return"alert_can_under.png";break;case 20:return"alert_can_within.png";break;case 21:return"alert_can_out.png";break;case 22:return"alert_dio_low.png";break;case 23:return"alert_dio_high.png";break;case 24:return"alert_excess_stop.png";break;case 25:return"alert_overspeed.png";break;default:return"alert_panic.png";break;}}catch(e){_DBG(0,"tm8Util.get_alert_img:"+e.message);}};tm8Util.get_array_item=function(item_array,item_index,item_index_keyname)
{try
{var i=item_array.length-1;if(item_array.length>0){do
{var item=item_array[i];if(item&&(item[item_index_keyname]==item_index)){return item;}}while(i--);}
return 0;}catch(e){_DBG(0,"tm8Util.get_array_item:"+e.message);}};tm8Util.init_timeframes=function(week_start_index)
{try
{var temp_date=new Date();today_date=temp_date.formatDate("Y-m-d H:i:s");this.today_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;this.today_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date=new Date();temp_date.addDays(-1);this.yesterday_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;this.yesterday_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date=new Date();if(temp_date.getDay()!==parseInt(week_start_index,10)){temp_date.moveToDayOfWeek(week_start_index,-1);}
this.current_week_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;temp_date.addDays(6);this.current_week_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date.addDays(-7);this.previous_week_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date.addDays(-6);this.previous_week_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;temp_date=new Date();temp_date.setDate(1);this.current_month_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;temp_date.addMonths(1);temp_date.addDays(-1);this.current_month_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date=new Date();temp_date.addMonths(-1);temp_date.setDate(1);this.previous_month_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_day_time;temp_date.addMonths(1);temp_date.addDays(-1);this.previous_month_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_day_time;temp_date=new Date();temp_date.moveToDayOfWeek(this.start_of_weekend_day,-1);this.previous_weekend_start_datetime=temp_date.formatDate("Y-m-d")+this.start_of_weekend_time;temp_date.moveToDayOfWeek(this.end_of_weekend_day,1);this.previous_weekend_end_datetime=temp_date.formatDate("Y-m-d")+this.end_of_weekend_time;}catch(e){_DBG(0,"tm8Util.init_timeframes:"+e.message);}};tm8Util.remove_all_children=function(id)
{try
{if(typeof(id)=="string"){var list=document.getElementById(id);}else{var list=id;}
if(list==null){return;}
if(list.hasChildNodes()){while(list.childNodes.length>=1){list.removeChild(list.firstChild);}}}catch(e){_DBG(0,"tm8Util.remove_all_children:"+e.message);}};tm8Util.get_datetime_diff=function(t1,t2)
{var duration=0;var Split_t1=t1.split(" ");var i=0;var start_datesplit=Split_t1[0].split("-");var start_timesplit=Split_t1[1].split(":");var Split_t2=t2.split(" ");var i=0;var end_datesplit=Split_t2[0].split("-");var end_timesplit=Split_t2[1].split(":");var start_date=new Date(start_datesplit[0],start_datesplit[1]-1,start_datesplit[2],start_timesplit[0],start_timesplit[1],start_timesplit[2]);var end_date=new Date(end_datesplit[0],end_datesplit[1]-1,end_datesplit[2],end_timesplit[0],end_timesplit[1],end_timesplit[2]);duration=(end_date.getTime()-start_date.getTime());return duration/1000;};tm8Util.set_pw_meter=function(meter,strength)
{var width=(50/32)*strength;var meter_jq=$(meter);tm8FX.Morph(meter_jq,{width:width.toString()+'px'});if(strength<=8){meter_jq.attr("alt",get_language_string("password_strength_very_weak"));meter_jq.attr("title",get_language_string("password_strength_very_weak"));}else if(strength<=16){meter_jq.attr("alt",get_language_string("password_strength_weak"));meter_jq.attr("title",get_language_string("password_strength_weak"));}else if(strength<=24){meter_jq.attr("alt",get_language_string("password_strength_strong"));meter_jq.attr("title",get_language_string("password_strength_strong"));}else{meter_jq.attr("alt",get_language_string("password_strength_very_strong"));meter_jq.attr("title",get_language_string("password_strength_very_strong"));}};tm8Util.get_pw_strength=function(passwd){intScore=0;if(passwd.match(/[a-z]/))
{intScore=(intScore+2)}
if(passwd.match(/[A-Z]/))
{intScore=(intScore+6)}
if(passwd.match(/\d+/))
{intScore=(intScore+6)}
if(passwd.match(/(\d.*\d.*\d)/))
{intScore=(intScore+6)}
if(passwd.match(/[a-z]/)&&passwd.match(/[A-Z]/))
{intScore=(intScore+4)}
if(passwd.match(/\d/)&&passwd.match(/\D/))
{intScore=(intScore+4)}
if(passwd.match(/[a-z]/)&&passwd.match(/[A-Z]/)&&passwd.match(/\d/))
{intScore=(intScore+4)}
return intScore;};tm8Util.get_hhmmss_duration=function(duration)
{var result="";var h=0;var m=0;var s=0;while(duration>=3600)
{h++;duration-=3600;}
while(duration>=60)
{m++;duration-=60;}
s=duration;if(h<10)
{result+="0";}
result+=h;result+=":";if(m<10)
{result+="0";}
result+=m;result+=":";if(s<10)
{result+="0";}
result+=s;return result;};function _DBG(level,str)
{try
{if(!animation_enabled&&(level>0)){return;}
var out="";if(typeof(str)==="object"){out=$.toJSON(str);}else{out=str;}
var level_desc="[UNKNOWN]";if(level===0){level_desc="[EXCEPTION]";if(debugHelper){debugHelper.Exception(Date()+" : "+out);}}else if(level===1){level_desc="[ERROR]";if(debugHelper){debugHelper.Warn(Date()+" : "+out);}}else if(level===2){level_desc="[WARNING]";if(debugHelper){debugHelper.Message(Date()+" : "+out);}}else if(level===3){level_desc="[INFO]";if(debugHelper){debugHelper.Message(Date()+" : "+out);}}
if(console){if((level<=1)&&(get_config_value('uname')=="apldev")){console.error(Date()+" "+level_desc+":"+out);}else{console.info(Date()+" "+level_desc+":"+out);}}
if(level<3){g_dbg_log+=Date()+" "+level_desc+" "+out+"<br>";}}catch(ex){}}
var RightClick={init:function(){this.FlashObjectID="customRightClick";this.FlashContainerID="flashcontent";this.Cache=this.FlashObjectID;if(window.addEventListener){window.addEventListener("mousedown",this.onGeckoMouse(),true);}else{var theDoc=document;theDoc.getElementById(this.FlashContainerID).onmouseup=function(){theDoc.getElementById(RightClick.FlashContainerID).releaseCapture();}
theDoc.oncontextmenu=function(){if(window.event.srcElement.id==RightClick.FlashObjectID){return false;}else{RightClick.Cache="nan";}}
theDoc.getElementById(this.FlashContainerID).onmousedown=RightClick.onIEMouse;}},killEvents:function(eventObject){if(eventObject){if(eventObject.stopPropagation)eventObject.stopPropagation();if(eventObject.preventDefault)eventObject.preventDefault();if(eventObject.preventCapture)eventObject.preventCapture();if(eventObject.preventBubble)eventObject.preventBubble();}},onGeckoMouse:function(ev){return function(ev){if(ev.button!=0){RightClick.killEvents(ev);if(ev.target.id==RightClick.FlashObjectID&&RightClick.Cache==RightClick.FlashObjectID){RightClick.call();}
RightClick.Cache=ev.target.id;}}},onIEMouse:function(){if(event.button>1){if(window.event.srcElement.id==RightClick.FlashObjectID&&RightClick.Cache==RightClick.FlashObjectID){RightClick.call();}
document.getElementById(RightClick.FlashContainerID).setCapture();if(window.event.srcElement.id)
RightClick.Cache=window.event.srcElement.id;}},call:function(){document.getElementById(this.FlashObjectID).rightClick();}};function login_processkey(ev)
{try
{if(window.event)
{if(ev.keyCode===13){login();}}else if(ev.which)
{if(ev.which===13){login();}}
return true;}catch(ex){_DBG(0,"login_processkey:"+ex.message);}}
function init_mainframe()
{try{$.fx.off=true;var p_get_language_string=get_language_string;$.browser.version=$.browser.msie&&/msie 7\.0/i.test(navigator.userAgent)?"7.0":$.browser.version;g_is_IE6=($.browser.msie&&(parseInt($.browser.version)<7)&&(parseInt($.browser.version)>4)&&(!g_is_mobile));var jq_tab=$(".jquery_tab");jq_tab.tabs().addClass('ui-tabs-vertical');$(".jquery_tab li").removeClass('ui-corner-top').addClass('ui-corner-left');var delay_load=(get_config_value("delay_load_plugins")==="1");jq_tab.bind('tabsshow',function(event,ui)
{try{if(delay_load){get_plugin_content();}
call_plugin_function(ui.panel.id.replace("tabber_tab_plugin_",""),"ShowPlugin_Event",null,1);}catch(e){_DBG(1,"tab_click_event:"+e.message);}});_DBG(2,"init_mainframe: sessionid = "+session_id);if(get_config_value("release_tag")==="ALPHA"){$("#logo_div").addClass("logo_alpha");}else if(get_config_value("release_tag")==="BETA"){$("#logo_div").addClass("logo_beta");}else{$("#logo_div").addClass("logo_release");}
$.tablesorter.addWidget({id:"rowInteract",format:function(table){$("td",table.tBodies[0]).click(function(){table.config.rowInteract.click_fn($(this).parent().attr("id"));});}});$("#ticker_div").bind("click",_mainframe_.ticker_button_click_wrapper);var btn=$("#modal_button");btn.bind("click",_mainframe_.modal_button_click_wrapper);btn.attr("className","tm8buttonmask");g_tooltip=$("#tooltip_div");initPopUp();var html="<div id='loading_div' style='padding-top:10px;text-align:left;height:100px'></div>";html+="<br style='clear:both'/>";html+="<div style='text-align:left;width:100%' id='loading_progress_wrapper_div'>";html+="<div style='margin-left:45px;width:100px;border:solid 1px #cccccc;text-align:left' id='loading_progress_border_div'>";html+="<div id='loading_progress_bar_div' style='width:0px;' class='progress_bar'></div>";html+="</div>";html+="</div>";show_modal_popup(-1,html,null,200,200,"initialising");var inner_html="<br style='clear:both'/>";inner_html+="<label style='float:left;text-align:left;padding-left:5px' class='tm8title'>"+get_language_string("initialising_display")+"...</label>";document.getElementById("loading_div").innerHTML=inner_html;g_lang_cache.kmh=get_language_string("kmh");g_lang_cache.mph=get_language_string("mph");g_lang_cache.datetime_format=get_language_string("datetime_format");tm8Util.init_timeframes(g_user.week_start_index);var frames=$("div.plugin_frame");if(frames.length===0){_DBG(1,"no frames");}
var i=0;for(i=0;i<frames.length;i=i+1)
{var f=frames[i];if("popupInner"===f.id){continue;}
if(f.childNodes.length===1){_DBG(2,"removing :"+f.id+" (no content)");f.parentNode.removeChild(f);}}
var panel_background=$("div.panel_background");if(panel_background.length===0){_DBG(2,"no panel_background");}
for(i=0;i<panel_background.length;i=i+1)
{if(panel_background[i].childNodes.length===1){_DBG(1,"removing :"+panel_background[i].id+" (no content)");panel_background[i].parentNode.removeChild(panel_background[i]);}}
for(i=0;i<plugin_array.length;i=i+1)
{var t=plugin_array[i].type;var n=t.replace(/\./gi,"_")+"_div";if(t==="tm8.plugin.stream.mapviewer"){continue;}
if(g_loaded_plugin_type_hash[n]){continue;}
g_loaded_plugin_type_hash[n]=true;$("#"+n).show();resize_plugin(n);if(($("div.panel_left").length==1)&&(n==$("div.panel_left").attr("id"))){_DBG(1,"Showing "+n+" on left as it is the only one the user has ");continue;}
if(t==="tm8.plugin.stream.livetrack"){continue;}
if(t==="tm8.plugin.stream.report.preview"){continue;}
var prev_anim_enabled
minimise_plugin(n);}
page_load_event();var elements=$("input[type=='password'][type=='text']");elements.focus(function(event){$(this).addClass("input_active");});elements.blur(function(event){$(this).removeClass("input_active");});var p_title="";var header_titles=$("h2");for(i=0;i<header_titles.length;i=i+1){p_title=header_titles[i];p_title.innerHTML=p_get_language_string(p_title.innerHTML);}
var tabbed_titles=$(".tab_list_item");for(i=0;i<tabbed_titles.length;i=i+1){p_title=tabbed_titles[i];p_title.innerHTML=p_get_language_string(p_title.innerHTML);}
var plugin_titles=$(".plugin_title_label");for(i=0;i<plugin_titles.length;i=i+1){p_title=plugin_titles[i];p_title.innerHTML=p_get_language_string(p_title.innerHTML);}
var dock_plugin_titles=$(".dock_button");for(i=0;i<dock_plugin_titles.length;i=i+1){p_title=dock_plugin_titles[i];p_title.innerHTML=p_get_language_string(p_title.innerHTML);}
$(".inside").children(":first-child[class='']").addClass("ui-widget-content ui-corner-all");var helpers=$(".tm8helper");helpers.hover(function(){show_helper($(this))},function(){hide_helper($(this));});$('.dock_button').live('mouseover mouseout',function(event){if(event.type=='mouseover'){$(this).css("color","#ffffff");}else{$(this).css("color","#eeeeee");}});$('.plugin_title_label').live('mouseover mouseout',function(event){if(event.type=='mouseover'){$(this).css("color","#ffffff");}else{$(this).css("color","#eeeeee");}});init_plugin_timer();animation_enabled=!!!(get_user_setting(-1,"animation_enabled",!g_is_IE6)==="0");if(animation_enabled){update_toolbar_button(-1,enable_anim_tb_id,"",get_language_string("disable_animations"),"toolbar_button_anim_off");}else{update_toolbar_button(-1,enable_anim_tb_id,"",get_language_string("enable_animations"),"toolbar_button_anim_on");}
$.fx.off=!animation_enabled;setTimeout(check_app_version,parseInt(get_config_value("APP_VERSION_CHECK_INTERVAL"),10));}catch(e){_DBG(0,"init_mainframe:"+e.message);}}
function call_ws_event(result)
{try{var ws_response=null;var delay_load=(get_config_value("delay_load_plugins")==="1");if(typeof(result)==="string"){eval("ws_response="+result);}else{if(result.responseText){eval("ws_response ="+result.responseText);}else{ws_response=result;}}
var wsi_call=ws_response.__wsi_call;if(ws_response.error_code){if(ws_response.error_code!=="0"){_DBG(0,"Webservice Error ["+get_plugin_name(ws_response.__plugin_id)+"]: "+wsi_call+" code:"+ws_response.error_code);}}else{_DBG(0,"Webservice Error: no error code");}
if(parseInt(ws_response.__plugin_id,10)===-1){switch(parseInt(ws_response.error_code,10))
{case 0:if(wsi_call==='wsLogin1'){$("#session_id_value").attr("value",ws_response.session_id);$("#session_form").submit();}
if(wsi_call==='wsLogout1'){window.open(logout_url,"_self","left=0,screenX=0,top=0,screenY=0,fullscreen=1");}
if(wsi_call=='wsSetGroupItemArray1'){if(ws_response.error_code!=="0"){hidePopWin();show_message_box(-1,get_language_string("password_change_error"),get_language_string("close"),get_language_string("error"));}else{hidePopWin();}}
if(wsi_call==='wsSetUserSettingArray1'){}
break;case 1:window.open(logout_url,"_self","left=0,screenX=0,top=0,screenY=0,fullscreen=1");return;default:if(wsi_call==='wsLogin1')
{if(typeof(login_error)==="function")
{login_error(ws_response);}}
break;}}
else{if(parseInt(ws_response.error_code,10)===1)
{window.open(logout_url,"_self","left=0,screenX=0,top=0,screenY=0,fullscreen=1");return;}
var i=plugin_array.length-1;if(plugin_array.length>0){do{var temp_p=plugin_array[i];var temp_p_id=parseInt(temp_p.id,10);if(temp_p_id===-2){continue;}
var id="plugin_"+temp_p_id;var temp_i=webservice_callback_array[ws_response.__wsi_interface];if(temp_i===undefined)
{_DBG(1,"no callbacks for this interface ["+ws_response.__wsi_interface+"] ");break;}
var temp_c=temp_i[wsi_call];if(temp_c===undefined)
{_DBG(1,"no callbacks for this method ["+wsi_call+"] ");break;}
var callback=temp_c[temp_p.id];if(callback===undefined){continue;}
if(typeof(result)==="string"){call_plugin_function(temp_p.id,callback,result,0);}else{call_plugin_function(temp_p.id,callback,result.responseText,0);}}while(i--);}}
if(parseInt(ws_response.__plugin_id,10)===-1){g_webservice_call_total=g_webservice_call_total-1;}}catch(e){_DBG(0,"call_ws_event:"+e.message);}}
function play_sound(file){try{document.getElementById("playsound").playerPlay(file);}catch(e){_DBG(0,"play_sound:"+e.message);}}
function debug(id,level,msg)
{try{if(g_is_mobile){return;}
var name="framework";var i_id=parseInt(id,10);var i=plugin_array.length-1;if(plugin_array.length>0){do
{var p=plugin_array[i];var p_id=parseInt(p.id,10);if(p_id===i_id){name=p.name;break;}}while(i--);}
_DBG(level,"PLUGIN["+name+"]["+id+"] "+msg);}catch(e){_DBG(0,"debug:"+e.message);}}
function page_load_event()
{try{var pwd=get_pwd();logout_tb_id=add_toolbar_button(-1,"",get_language_string("logout"),"toolbar_button_logout");if(animation_enabled){enable_anim_tb_id=add_toolbar_button(-1,"",get_language_string("disable_animations"),"toolbar_button_anim_off");}else{enable_anim_tb_id=add_toolbar_button(-1,"",get_language_string("enable_animations"),"toolbar_button_anim_on");}
refresh_tb_id=add_toolbar_button(-1,"",get_language_string("refresh"),"toolbar_button_refresh");minimise_tb_id=add_toolbar_button(-1,"",get_language_string("minimise_all"),"toolbar_button_minimise");print_tb_id=add_toolbar_button(-1,"",get_language_string("print"),"toolbar_button_print");help_tb_id=add_toolbar_button(-1,"",get_language_string("help"),"toolbar_button_help");if(get_config_value("release_tag")!=="RELEASE"){report_issue_tb_id=add_toolbar_button(-1,"",get_language_string("report_issue"),"toolbar_button_bug");}}catch(e){_DBG(0,"page_load_event:"+e.message);}}
function display_plugin(id,animate)
{try{if(is_plugin_visible(id)){return;}
var tab_id="tabber_tab_plugin_"+id;var tab_index=0;if(plugin_array.length>0){var i=plugin_array.length-1;do{var p=plugin_array[i];if(parseInt(p.id,10)===-2){continue;}
var result=call_plugin_function(p.id,"IsPluginLocked_Event",null,1);var temp_tab_id="tabber_tab_plugin_"+p.id;if((result===true)&&document.getElementById(temp_tab_id)&&(tab_id!==temp_tab_id)){_DBG(2,"display_plugin: rejecting request to switch plugins due to plugin : "+p.id);return;}}while(i--);}
if(!display_tab(tab_id)){var type=get_plugin_type(id);type=type.replace(/\./gi,"_")+"_div";var do_animate=true;if(animation_enabled){if(animate!=undefined){do_animate=animate;}}else{do_animate=false;}
maximise_plugin(type,do_animate);document.getElementById(type).style.display="block";}}catch(e){_DBG(0,"display_plugin:"+e.message);}}
function open_plugin(id)
{try{document.getElementById(id).style.visibility="visible";}
catch(e){_DBG(0,"open_plugin:"+e.message);}}
function close_plugin(id)
{try{document.getElementById(id).style.visibility="hidden";}
catch(e){_DBG(0,"close_plugin:"+e.message);}}
function get_plugin_button(id)
{try
{var b=$("#"+id.replace("_div","_button_div"));if(b){return b;}
return 0;}
catch(e)
{_DBG(0,"get_plugin_button:"+e.message);}}
function minimise_plugin(el_id)
{try
{var maximised_size={};var button_id="dock_"+el_id;var delay_load=(get_config_value("delay_load_plugins")==="1");if($("#"+button_id).length>0){return;}
var move_to={};maximised_size.top=$("#"+el_id).offset().top;maximised_size.left=$("#"+el_id).offset().left;maximised_size.width=$("#"+el_id).width();maximised_size.height=$("#"+el_id).height();maximised_size.id=el_id;var dock=document.getElementById("dock_anim_div");dock.style.top=maximised_size.top+"px";dock.style.left=maximised_size.left+"px";dock.style.width=maximised_size.width+"px";dock.style.height=maximised_size.height+"px";$("#dock_anim_div").show();$("#"+el_id).hide();$("#"+el_id+" select").css("visibility","hidden");move_to.height="20px";move_to.left="10px";move_to.width="150px";move_to.top=(get_viewport_height()-(g_dock_bottom_offset+((minimised_plugin_array.length+1)*20))).toString()+"px";var dock_div=$("#dock_div");var move_finish=function()
{var new_button=document.createElement("div");var image_path=get_pwd()+"/images/unknown.png";new_button.id=button_id;new_button.innerHTML=$("#"+el_id+"_title").html();new_button.className="dock_button";$("#dock_anim_div").hide();dock_div.prepend(new_button);$("#"+button_id).click(function(event){toggle_plugin(el_id,true);});minimised_plugin_array.push(maximised_size);if(delay_load){$("#"+el_id+" .inside").html("");}
call_plugin_function(get_plugin_id(el_id.replace("_div","").replace(/_/gi,".")),"HidePlugin_Event",null,1);};tm8FX.Morph($("#dock_anim_div"),move_to,move_finish);return true;}
catch(e)
{_DBG(0,"minimise_plugin:"+e.message);}
return false;}
function maximise_plugin(el_id,do_show_event)
{try
{var i=0;if($("#dock_"+el_id).length>0)
{var index=-1;var maximise_move_to={};var maximise_scale_to={};var i=minimised_plugin_array.length-1;if(minimised_plugin_array.length>0){do
{var p_plugin=minimised_plugin_array[i];if(p_plugin.id===el_id)
{maximise_move_to.top=p_plugin.top+"px";maximise_move_to.left=p_plugin.left+"px";maximise_move_to.zIndex=200;maximise_scale_to.top=p_plugin.top+"px";maximise_scale_to.left=p_plugin.left+"px";maximise_scale_to.width=p_plugin.width+"px";maximise_scale_to.height=p_plugin.height+"px";index=i;break;}}while(i--);}
if(-1===index){_DBG(0,"maximise_plugin: Not minimised "+el_id);return;}
var dock=document.getElementById("dock_anim_div");dock.style.top=(get_viewport_height()-(g_dock_bottom_offset+((index+1)*20))).toString()+"px";dock.style.left="10px";dock.style.width="150px";dock.style.height="20px";$("#dock_"+el_id).hide();$("#dock_"+el_id).remove();$("#dock_anim_div").show();var maximise_move_finish=function()
{try{tm8FX.Morph($("#dock_anim_div"),maximise_scale_to,maximise_scale_finish);}catch(e){_DBG(0,"maximise_move_finish:"+e.message);}};var maximise_scale_finish=function()
{try{var j=0;$("#"+el_id).show();resize_plugin(el_id);$("#dock_anim_div").hide();var j=minimised_plugin_array.length-1
if(minimised_plugin_array.length>0){do
{if(minimised_plugin_array[j].id===p_plugin.id){minimised_plugin_array.splice(j,1);}}while(j--);}
var current_class=$("#"+el_id).attr("class");var open_frame=$("."+current_class.replace(" ","").replace("plugin_frame",""));var j=open_frame.length-1;if(open_frame.length>0){do
{var p_open_frame=open_frame[j];if((p_open_frame.id!==el_id)&&(p_open_frame.style.display!=="none"))
{minimise_plugin(p_open_frame.id);}}while(j--);}
if(g_delay_display_plugin!=="")
{display_tab(g_delay_display_plugin);}
$("#"+el_id+" select").css("visibility","visible");var plugin_id_to_show=get_plugin_id(el_id.replace("_div","").replace(/_/gi,"."));var tab=$("#"+el_id+" div.ui-tabs-panel:not(.ui-tabs-hide)");if(tab.length>0){plugin_id_to_show=tab[0].id.replace("tabber_tab_plugin_","");}else{}
if((do_show_event==undefined)||(do_show_event))
{setTimeout("call_plugin_function('"+plugin_id_to_show+"','ShowPlugin_Event',null,1)",100);}}catch(e){_DBG(0,"maximise_scale_finish:"+e.message);}};tm8FX.Morph($("#dock_anim_div"),maximise_scale_to,maximise_scale_finish);return true;}
else
{_DBG(1,"maximise_plugin: couldnt find docked button for "+el_id);return false;}}
catch(e)
{_DBG(0,"maximise_plugin:"+e.message);}}
function get_plugin_content(id)
{try{var aj=$.ajax({type:'GET',url:get_pwd()+"/app/plugins/alert/alert.html",success:get_plugin_content_event,error:function(){ajax_failure("get_plugin_content_event",wrapper);},data:{},dataType:"html"});}catch(e){_DBG(0,"get_plugin_content:"+e.message);}}
function get_plugin_content_event(r)
{try{$("#tm8_plugin_stream_alert_div .inside").html(r);}catch(e){_DBG(0,"get_plugin_content_event:"+e.message);}}
function toggle_plugin(el_id,do_fx)
{try{g_minimise_cache.length=0;var i=minimised_plugin_array.length-1;if(minimised_plugin_array.length>0){do
{var p=minimised_plugin_array[i];if(el_id===p.id)
{maximise_plugin(el_id,true);return;}}while(i--);}
minimise_plugin(el_id);}catch(e){_DBG(0,"toggle_plugin:"+e.message);}}
function resize_page()
{try
{resize_plugin_containers();}catch(e)
{_DBG(0,"resize_page:"+e.message);}}
window.onresize=resize_page;function show_helper(ob)
{try{if(ob&&(ob.data("helper")!="")){var hint=$("#helper_div");hint.hide();var pos=ob.offset();var width=ob.width();var height=ob.height();ob.removeClass("tm8helper").addClass("tm8helper_over");var title=ob.attr("title");if(title!=""){ob.data("helper",title);ob.attr("title","");}
var content=ob.data("helper");if((typeof(content)=="undefined")||(content=="")){content=title;}
$("#helper_inner_div").html(content);var new_pos={left:(pos.left-30),top:(pos.top-hint.height()-5)};hint.css({"left":new_pos.left+"px","top":new_pos.top+"px"});tm8FX.Purge(hint);tm8FX.FadeIn(hint);}}catch(e){_DBG(0,"show_helper:"+e.message);}}
function close_modal()
{try
{tm8FX.FadeOut($("#modal_overlay_container"));}catch(e)
{_DBG(0,"close_modal:"+e.message);}}
function hide_helper(ob)
{try{if(ob.attr("id")!="helper_div"){ob.removeClass("tm8helper_over").addClass("tm8helper");}
var hint=$("#helper_div");tm8FX.Purge(hint);tm8FX.FadeOut(hint);}catch(e){_DBG(0,"hide_helper:"+e.message);}}
function on_login_load(msg)
{try
{document.getElementById("login_info_div").innerHTML=msg;var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i=i+1){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!==-1){return data[i].identity;}}
else if(dataProp){return data[i].identity;}}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index===-1){return;}
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();$("#username").focus();if(BrowserDetect.browser&&BrowserDetect.version)
{if(BrowserDetect.browser==="Explorer")
{var ver=parseInt(BrowserDetect.version,10);if(ver===6){document.getElementById("login_error_div").innerHTML="Note: You may experience some issues using "+BrowserDetect.browser+" "+BrowserDetect.version+" (please upgrade to IE7)";tm8FX.FadeIn($("#login_error_div"));}}else if(BrowserDetect.browser==="Firefox"){}else if(BrowserDetect.browser==="Chrome"){}else{document.getElementById("login_error_div").innerHTML="Note: You may experience some issues using "+BrowserDetect.browser+" "+BrowserDetect.version;tm8FX.FadeIn($("#login_error_div"));}}
var flash_ver=swfobject.getFlashPlayerVersion();if(swfobject.hasFlashPlayerVersion(min_flash_player_ver)){}else{document.getElementById("login_error_div").innerHTML="Please install Adobe Flash Player version "+requiredMajorVersion+"."+requiredMinorVersion+"."+requiredRevision+" or later.</label> <a  id='login_ok_button' target='_blank' style='display:inline;color:#ffffff;margin-left:10px;' href='http://www.adobe.com/go/getflash/'  >(Click Here)</a>";tm8FX.FadeIn($("#login_error_div"));}}catch(e)
{_DBG(0,"on_login_load:"+e.message);}}
function display_tab(tab_id)
{try{var tab_page=document.getElementById(tab_id);var delay_load=(get_config_value("delay_load_plugins")==="1");if(tab_page){if(tab_page.parentNode.parentNode.parentNode.style.display==="none"){g_delay_display_plugin=tab_id;return true;}
g_delay_display_plugin="";var tab_control=$(tab_page.parentNode);var prev_selected_id=$(tab_control).find(".ui-tabs-selected").attr("id");var prev_plugin_id=prev_selected_id.replace("tabber_tab_plugin_","");if(delay_load){$(tab_control).find(".ui-tabs-selected").attr("id").html("");get_plugin_content();}
call_plugin_function(prev_plugin_id,"HidePlugin_Event",null,1);tab_control.tabs("select",tab_id);call_plugin_function(tab_id.replace("tabber_tab_plugin_",""),"ShowPlugin_Event",null,1);return true;}}catch(e){_DBG(0,"display_tab:"+e.message);}
return false;}
function check_app_version()
{try
{var wrapper={};wrapper.rsrnd=new Date().getTime().toString();wrapper.ajax_method="check_app_version";var aj=$.ajax({type:'POST',url:get_pwd()+"/app/php/sajax_calls.php",success:check_app_version_event,error:function(){ajax_failure("check_app_version_event",wrapper);},data:wrapper,dataType:"text"});}catch(ex){_DBG(0,"check_app_version:"+ex.message);}}
function check_app_version_event(v)
{try
{eval("ob="+v);if(tm8Util.has_date_changed())
{tm8Util.init_timeframes(g_user.week_start_index);_DBG(1,"Date has changed to :"+tm8Util.today_start_datetime+"-"+tm8Util.today_end_datetime);}
if(ob){if(ob.version&&(ob.version!=="")){if(ob.version!==get_config_value("version"))
{var label="A new version of the Application is available ("+ob.version+"), please logout and restart your browser to get the latest update.";show_toast_popup(0,label);return;}}
if(ob.message&&(ob.message!=="")){show_toast_popup(0,ob.message);return;}}}catch(ex){_DBG(0,"check_app_version_event:"+ex.message);}
setTimeout(check_app_version,parseInt(get_config_value("APP_VERSION_CHECK_INTERVAL"),10));}
function show_modal_popup(id,html,button_array,width,height,title)
{try{if(g_is_mobile){return;}
if(!g_is_modal_closing&&(gPopupIsShown)){return false;}
g_is_modal_closing=false;var button_width=0;var button_content="";var has_buttons=(button_array&&(button_array.length>0));if(button_array)
{for(var i=0;i<button_array.length;i=i+1)
{if(typeof(button_array[i].callback)==="undefined"){button_array[i].callback="";}
button_width+=120;button_content+="<a style='float:left;"+(i===0?"text-decoration:underline;":"")+"'  class='tm8button' id='"+button_array[i].id+"' href='javascript:call_modal_result("+id+",\""+button_array[i].callback+"\")'>"+button_array[i].caption+"</a>";}}
var default_action="";if(has_buttons)
{default_action="javascript:call_modal_result("+id+",'"+button_array[0].callback+"')";}
var modal_content="";if(has_buttons){modal_content+="<form id='modal_form' action=\""+default_action+"\" >";}
modal_content+="<div id='modal_container_div' style='height:100%;width:100%'>"+html;modal_content+="<br style='clear:both'/><div id='modal_popup_button_div' style='padding-left:5px;text-align:center;width:"+button_width+"px'>";modal_content+=button_content;modal_content+="</div></div>";if(has_buttons){modal_content+="</form>";}
showPopWin(title,modal_content,width,height+30,null,false,true);if(has_buttons){$("#modal_form input").focus();}
return true;}catch(e){_DBG(0,"show_modal_popup:"+e.message);}}
function show_message_box(id,msg,close_caption,title)
{try{var html="";html+="<div style='padding:5px;text-align:left'>";html+="<br></br><label class='tm8title'>"+msg+"</label><br></br>";html+="</div>";var button_array=[];var ok_button={};ok_button.id="msg_box_close_button";ok_button.caption=close_caption;ok_button.callback="";button_array.push(ok_button);return show_modal_popup(id,html,button_array,400,100,title);}catch(e){_DBG(0,"show_message_box:"+e.message);}}
function hide_modal_popup(id)
{try{hidePopWin();}catch(e){_DBG(0,"hide_modal_popup:"+e.message);}}
function call_modal_result(id,cb)
{try
{if(cb.toString()===""){hidePopWin();post_plugin_msg(-1,"CloseModal_Event",{});return;}
g_is_modal_closing=true;var result=call_plugin_function(id,cb.toString(),null,1);if((result===true)||(result===undefined)){if(g_is_modal_closing===true){hidePopWin();post_plugin_msg(-1,"CloseModal_Event",{});}}}catch(e){_DBG(0,"call_modal_result:"+e.message);}}
function move_tooltip(){try{if(g_is_mobile){return;}
var theDoc=document;var tt=$("#tooltip_div:visible");if(tt.length>0){var x=(tempX+15+theDoc.body.scrollLeft);var y=(tempY+theDoc.body.scrollTop);var vh=get_viewport_height();var vw=get_viewport_width();var d="";if(x<(vw/2)){tt.css("left",x.toString()+"px");}else{tt.css("left",(x-g_mouse_popup_width).toString()+"px");}
if(y<(vh/2)){tt.css("top",y.toString()+"px");}else{tt.css("top",(y-g_mouse_popup_height).toString()+"px");}}}catch(e){_DBG(0,"move_tooltip:"+e.message);}}
get_loader_content=function(id,caption)
{try{return"<div style='width:100%;margin-top:10px;'><img style='margin-left:50px;float:left;width:20px;margin-right:3px;' src='"+get_pwd()+"/images/loader.gif'></img><label class='tm8title'>"+caption+"</label></div>";}catch(e){_DBG(0,"get_loader_content:"+e.message);}};var onMainInterval=function()
{if(!g_tooltip_visible){return;}
if(true===g_mousedown){g_mousedown=false;hide_tooltip(false);return;}
move_tooltip();if((old_x!==0)&&(old_y!==0)&&(old_y!==tempY)&&(old_x!==tempX))
{var y_diff=old_y-tempY;var x_diff=old_x-tempX;var hyp=Math.sqrt((y_diff*y_diff)+(x_diff*x_diff));if(hyp>30)
{hide_tooltip(false);return;}}
g_mouse_interval=setTimeout(onMainInterval,500);return true;}
function show_tooltip(content){try{g_mouse_interval=setTimeout(onMainInterval,500);g_tooltip_visible=true;old_x=tempX;old_y=tempY;var tt_div=document.getElementById("tooltip_div");tt_div.innerHTML=content;tt_div.style.display="block";move_tooltip();}catch(e){_DBG(0,"show_tooltip:"+e.message);}}
function hide_tooltip(timer_event){try{var tt=$("#tooltip_div:visible");if(tt.length>0){g_tooltip_visible=false;g_tooltip.hide();}}catch(e){_DBG(0,"hide_tooltip:"+e.message);}}
function show_cursor_popup(id,html,width,height,duration)
{try{if(g_is_mobile){return;}
g_mouse_popup_time=duration;g_mouse_popup_id=id;g_mouse_popup_width=(width+20);g_mouse_popup_height=(height+20);show_tooltip(html);if(g_mouse_popup_time!==0){setTimeout("hide_tooltip(true)",duration*1000);}}catch(e){_DBG(0,"show_cursor_popup:"+e.message);}}
function hide_toolbar(id)
{try{if(g_is_mobile){return;}
$("#toolbar_div").hide();}catch(e){_DBG(0,"hide_toolbar:"+e.message);}}
function is_anim_enabled(id)
{try{return animation_enabled;}catch(e){_DBG(0,"is_anim_enabled:"+e.message);}}
function show_toolbar(id)
{try{if(g_is_mobile){return;}
$("#toolbar_div").show();}catch(e){_DBG(0,"show_toolbar:"+e.message);}}
function show_floating_plugins()
{try
{if(g_is_mobile){return;}
var frames=$(".plugin_frame");for(i=0;i<frames.length;i=i+1)
{var f=frames[i];var dock=document.getElementById("dock_"+f.id);if("popupInner"===f.id){continue;}
if(dock){dock.style.display="block";}else{f.style.display="block";}}}catch(e){_DBG(0,"show_floating_plugins:"+e.message);}}
function hide_ticker()
{try
{if(g_is_mobile){return;}
var theDoc=document;theDoc.getElementById("ticker_image").style.display="none";theDoc.getElementById("ticker_div").style.display="none";theDoc.getElementById("ticker_wrapper_div").style.display="none";}catch(e){_DBG(0,"hide_ticker:"+e.message);}}
function update_ticker()
{try
{if(g_ticker_array.length===0){hide_ticker();return;}
var ticker=g_ticker_array[g_ticker_array.length-1];var image=ticker.image;var text="<label id='ticker_datetime_label'>"+ticker.datetime+"</label><label id='ticker_label' >"+ticker.caption+"</label><label id='ticker_unread_label'> ("+g_ticker_array.length+" "+get_language_string("unread")+")</label>";if((image!==$("#ticker_image").attr("src"))||(text!==$("#ticker_div").html())){var img=$("#ticker_image");img.attr("src",image);img.attr("title",ticker.caption);img.attr("alt",ticker.caption);var div=$("#ticker_div");div.html(text);div.attr("title",ticker.caption);div.attr("alt",ticker.caption);tm8FX.Flash($("#ticker_wrapper_div"));}
var theDoc=document;theDoc.getElementById("ticker_wrapper_div").style.width="0px";theDoc.getElementById("ticker_image").style.display="block";theDoc.getElementById("ticker_div").style.display="block";theDoc.getElementById("ticker_wrapper_div").style.width="538px";tm8FX.FadeIn($("#ticker_wrapper_div"));}catch(e){_DBG(0,"update_ticker:"+e.message);}}
function hide_plugins(id)
{try{var i_id=parseInt(id,10);var selected_type="";for(i=0;i<plugin_array.length;i=i+1)
{var p=plugin_array[i];if(parseInt(p.id,10)===i_id){selected_type=p.type;}}
var frames=$(".plugin_frame");var theDoc=document;for(i=0;i<frames.length;i=i+1){var f=frames[i];if("popupInner"===f.id){continue;}
var plugin_frame_type=f.id.replace("_div","").replace(/_/gi,".");var dock=theDoc.getElementById("dock_"+f.id);if(plugin_frame_type!==selected_type){if(dock){dock.style.display="none";}else{f.style.display="none";}}}}catch(e){_DBG(0,"hide_plugins:"+e.message);}}
function show_plugins(id)
{try{var i_id=parseInt(id,10);var selected_type="";for(i=0;i<plugin_array.length;i=i+1)
{var p=plugin_array[i];if(parseInt(p.id,10)===i_id){selected_type=p.type;}}
var frames=$(".plugin_frame");var theDoc=document;for(i=0;i<frames.length;i=i+1){var f=frames[i];if("popupInner"===f.id){continue;}
var plugin_frame_type=f.id.replace("_div","").replace(/_/gi,".");var dock=theDoc.getElementById("dock_"+f.id);if(plugin_frame_type!==selected_type){if(dock){dock.style.display="block";}else{f.style.display="block";}}}}catch(e){_DBG(0,"show_plugins:"+e.message);}}
function show_modal_button(id,caption,click_event)
{try{var i_id=parseInt(id,10);var div=$("#modal_button_div");if(div.css("display")!=="none"){call_plugin_function(g_modal_button_id,g_modal_button_event,null,1);}
div.show();$("#modal_button").html(caption);g_modal_button_id=id;g_modal_button_event=click_event;var selected_type="";for(i=0;i<plugin_array.length;i=i+1)
{var p=plugin_array[i];if(parseInt(p.id,10)===i_id){selected_type=p.type;}}
var frames=$(".plugin_frame");g_minimise_cache.length=0;var theDoc=document;for(i=0;i<frames.length;i=i+1)
{var f=frames[i];if("popupInner"===f.id){continue;}
var plugin_frame_type=f.id.replace("_div","").replace(/_/gi,".");var dock=theDoc.getElementById("dock_"+f.id);if(plugin_frame_type!==selected_type){if(dock){dock.style.display="none";}else{f.style.display="none";}}
else
{if(dock){maximise_plugin(f.id,true);}else{f.style.display="block";}}}
hide_toolbar(-1);}catch(e){_DBG(0,"show_modal_button:"+e.message);}}
function hide_floating_plugins()
{try
{if(g_is_mobile){return;}
var frames=$(".plugin_frame");var theDoc=document;var frames_len=frames.length;for(i=0;i<frames_len;i=i+1)
{var f=frames[i];var dock=theDoc.getElementById("dock_"+f.id);if("popupInner"===f.id){continue;}
if(dock){dock.style.display="none";}
else
{frames[i].style.display="none";}}}catch(e){_DBG(0,"hide_floating_plugins:"+e.message);}}
function set_plugin_title(id,title)
{try{var type=get_plugin_type(id);type=type.replace(/\./gi,"_")+"_div";$("#"+type+"_title").html(title);$("#dock_"+type).html(title);}catch(e){_DBG(0,"set_plugin_title:"+e.message);}}
function add_plugin_bar_button(id,label,hover_text)
{try{var type=get_plugin_type(id);type=type.replace(/\./gi,"_")+"_div";var pluginbar_id=1;var new_button="<div class='pluginbar_button' id='pb_"+pluginbar_id+"' title='"+hover_text+"'><a href='javascript:_mainframe_.plugin_bar_click_wrapper({button_id:"+pluginbar_id+",plugin_id:"+id+"});' >"+label+"</a></div>";$("#"+type+" div.plugin_title").append(new_button);return pluginbar_id;}catch(e){_DBG(0,"add_plugin_bar_button:"+e.message);}}
function hide_plugin_bar_button(id,plugin_bar_id)
{try{$("#pb_"+plugin_bar_id).hide();}catch(e){_DBG(0,"hide_plugin_bar_button:"+e.message);}}
function show_plugin_bar_button(id,plugin_bar_id)
{try{$("#pb_"+plugin_bar_id).show();}catch(e){_DBG(0,"add_plugin_bar_button:"+e.message);}}
function add_toolbar_button(id,image,caption,classname)
{try{var tb_tbl=$("#toolbar_div");var i_id=parseInt(id,10);var tb_id=-1;if(tb_tbl){var new_button=document.createElement("div");tb_id=tb_tbl.children().length+1;var image_path="";var class_path="";if(image!=""){image_path=(image.indexOf("http")===-1?get_pwd()+"/images/"+image:image);}
if(typeof(classname)!="undefined"){class_path=classname;}
new_button.className="toolbar_button";new_button.id="tb_"+tb_id;new_button.innerHTML="<div id='tb_button_"+(i_id===-1?"":i_id+"_")+tb_id+"' "+(image!=""?"style=\"width:21px;height:21px;background-image:url('"+image_path+"');\"":"")+" "+(class_path!=""?"class=\"toolbar_button_icon "+class_path+"\"":"")+" title='"+caption+"' onclick='javascript:call_toolbar_event("+i_id+","+tb_id+")' ></div>";var tb_1=$("#tb_1");if(tb_1.length>0){tb_1.before(new_button);}else{tb_tbl.append(new_button);}
$("#ticker_wrapper_div").css("right",(2+(tb_tbl.children().length*25)).toString()+"px");$("#tb_"+tb_id).hover(function(){$(this).css("border","solid 1px #aaaaaa");},function(){$(this).css("border","solid 1px black");});}
return tb_id;}catch(e){_DBG(0,"add_toolbar_button:"+e.message);}}
function update_toolbar_button(id,toolbar_id,image,caption,classname)
{try{var i_id=parseInt(id,10);var button=$("#tb_button_"+(i_id===-1?"":id+"_")+toolbar_id);if(button){if(image!=""){var image_path=(image.indexOf("http")===-1?get_pwd()+"/images/"+image:image);button.css("backgroundImage","url("+image_path+")");}else{button[0].className="toolbar_button_icon "+classname;}
button.attr("alt",caption);button.attr("title",caption);}}catch(e){_DBG(0,"update_toolbar_button:"+e.message);}}
function add_ticker_alert(plugin_id,id,image,datetime,caption,callback_func)
{try{if(plugin_id&&id&&image&&caption&&callback_func){var ticker={};var i_plugin_id=parseInt(plugin_id,10);ticker.plugin_id=plugin_id;ticker.callback_func=callback_func;ticker.image=image;ticker.datetime=datetime;ticker.caption=caption;ticker.id=id;var inserted=false;for(var i=0;i<g_ticker_array.length;i=i+1)
{var ticker_item=g_ticker_array[i];var ticker_plugin_id=parseInt(ticker_item.plugin_id,10);if(ticker_plugin_id===i_plugin_id){if(ticker_item.id>id){g_ticker_array.splice(i,0,ticker);inserted=true;break;}}}
if(!inserted){g_ticker_array.push(ticker);}
update_ticker();}
else
{_DBG(0,"invalid parameters for ticker alert:"+plugin_id+" "+id+" "+image+" "+caption+" "+callback_func);}}catch(e){_DBG(0,"add_ticker_alert:"+e.message);}}
function add_ticker_alert_array(plugin_id,ticker_array,callback_func)
{try{if(plugin_id){var i_plugin_id=parseInt(plugin_id,10);for(var i=0;i<ticker_array.length;i++){var ticker={};var p_ticker=ticker_array[i];ticker.plugin_id=plugin_id;ticker.callback_func=callback_func;ticker.image=p_ticker.image;ticker.datetime=p_ticker.datetime;ticker.caption=p_ticker.caption;ticker.id=p_ticker.id;g_ticker_array.push(ticker);}
update_ticker();}
else
{_DBG(0,"invalid parameters for ticker alert:"+plugin_id+" "+id+" "+image+" "+caption+" "+callback_func);}}catch(e){_DBG(0,"add_ticker_alert_array:"+e.message);}}
function delete_ticker_alert(plugin_id,id)
{try{var i_plugin_id=parseInt(plugin_id,10);for(var i=0;i<g_ticker_array.length;i=i+1)
{var ticker=g_ticker_array[i];var ticker_plugin_id=parseInt(ticker.plugin_id,10);if((ticker.id===id)&&(ticker_plugin_id===i_plugin_id)){g_ticker_array.splice(i,1);update_ticker();return;}}}catch(e){_DBG(0,"delete_ticker_alert:"+e.message);}}
function delete_ticker_alert_array(plugin_id,id_array)
{try{var i_plugin_id=parseInt(plugin_id,10);for(var j=0;j<id_array.length;j=j+1)
{var id=id_array[j];for(var i=0;i<g_ticker_array.length;i=i+1)
{var ticker=g_ticker_array[i];var ticker_plugin_id=parseInt(ticker.plugin_id,10);if((ticker.id===id)&&(ticker_plugin_id===i_plugin_id)){g_ticker_array.splice(i,1);break;}}}
update_ticker();}catch(e){_DBG(0,"delete_ticker_alert:"+e.message);}}
function is_plugin_tabcontrol_visible(id)
{try{var type=get_plugin_type(id);type=type.replace(/\./gi,"_")+"_div";if($("#"+type).length>0){if($("#"+type).css("display")==="none"){return false;}else{return true;}}
return false;}catch(e){_DBG(0,"is_plugin_tabcontrol_visible:"+e.message);}};function is_plugin_visible(id)
{try
{var type=get_plugin_type(id);var type_div=type.replace(/\./gi,"_")+"_div";if($("#"+type_div).length>0){if($("#"+type_div).css("display")==="none"){return false;}}
var i_id=parseInt(id,10);for(var i=0;i<plugin_array.length;i=i+1)
{var plugin=plugin_array[i];var plugin_id=parseInt(plugin.id,10);if(i_id===plugin_id){var tab_id="tabber_tab_plugin_"+plugin_id;var tab=$("#"+tab_id);if(tab.length>0){if((tab.hasClass("ui-tabs-hide"))||(tab[0].parentNode.style.display=="none")){return false;}else{return true;}}else{return true;}}}
return false;}catch(e){_DBG(0,"is_plugin_visible:"+e.message);}}
function show_ticker()
{try
{var ticker_wrapper_div=$("#ticker_wrapper_div");if(ticker_wrapper_div.length>0){ticker_wrapper_div.show();tm8FX.Morph(ticker_wrapper_div,{width:"495px"});tm8FX.FadeIn($("#ticker_image"));tm8FX.FadeIn($("#ticker_div"));}
else
{_DBG(1,"couldnt find ticker wrapper");}}catch(e){_DBG(0,"show_ticker:"+e.message);}}
function hide_cursor_popup(id)
{try{if(g_is_mobile){return;}
if(id!==g_mouse_popup_id){return;}
hide_tooltip(false);}catch(e){_DBG(0,"hide_cursor_popup:"+e.message);}}
function show_toast_popup(duration,label){try{if(duration==0){$("#toast_div").clearQueue();$("#toast_div").stop();$("#toast_div").fadeTo(400,1,function(){$("#toast_label").html(label);});}
else
{$("#toast_div").clearQueue().stop().fadeTo(1,0).fadeTo(400,1,function(){$("#toast_label").html(label);$("#toast_div").fadeTo(duration,1).fadeTo(400,0);});}}catch(e){_DBG(0,"show_toast_popup:"+e.message);}}
function hide_toast_popup(){try{$("#toast_div").clearQueue();$("#toast_div").stop();$("#toast_div").fadeTo(400,0);}catch(e){_DBG(0,"hide_toast_popup:"+e.message);}}
function call_toolbar_event(plugin_id,tb_id)
{try{var i_id=parseInt(plugin_id,10);var pwd=get_pwd();if(i_id===-1){switch(tb_id)
{case logout_tb_id:call_webservice(-1,"tm8Session1","wsLogout1",{});break;case enable_anim_tb_id:animation_enabled=!!!animation_enabled;$.fx.off=!animation_enabled;set_user_setting(-1,"animation_enabled",(animation_enabled?"1":"0"),false);if(animation_enabled){update_toolbar_button(-1,enable_anim_tb_id,"",get_language_string("disable_animations"),"toolbar_button_anim_off");}else{update_toolbar_button(-1,enable_anim_tb_id,"",get_language_string("enable_animations"),"toolbar_button_anim_on");}
post_plugin_msg(-1,"Refresh_Event",{});break;case refresh_tb_id:post_plugin_msg(-1,"Refresh_Event",{});break;case help_tb_id:window.open("../manual.pdf","_blank","left=0,screenX=0,top=0,screenY=0,fullscreen=1");break;case minimise_tb_id:if(g_minimise_cache.length>0){for(var i=0;i<g_minimise_cache.length;i=i+1)
{maximise_plugin(g_minimise_cache[i],true);}
g_minimise_cache.length=0;}
else
{g_minimise_cache.length=0;for(var key_var in g_loaded_plugin_type_hash)
{if(minimise_plugin(key_var)){g_minimise_cache.push(key_var);}}}
break;case print_tb_id:var html="<div style='text-align:left;background-color:#ffffff;width:100%;'>";html+="<b><label class='tm8label'>"+get_language_string("print_landscape_warning")+"</label></b>";html+="</div>";var button_array=[];var ok_button={};ok_button.id="ok_button";ok_button.caption=get_language_string("ok");ok_button.callback="print_ok";button_array.push(ok_button);show_modal_popup(-1,html,button_array,400,100,get_language_string("warning"));break;case report_issue_tb_id:var report_issue_html="<div style='text-align:left;background-color:#ffffff;width:100%;' id='report_issue_modal'>";report_issue_html+="<b><label class='tm8label'>Your Name</label></b>";report_issue_html+="<input type='text' style='width:100%' id='report_issue_name'/><br/>";report_issue_html+="<b><label class='tm8label'>Description</label></b>";report_issue_html+="<textarea style='width:100%' rows='10' id='report_issue_comment'></textarea>";report_issue_html+="</div>";var button_array=[];var ok_button={};var cancel_button={};ok_button.id="ok_button";ok_button.caption=get_language_string("ok");ok_button.callback="report_issue_ok";cancel_button.id="cancel_button";cancel_button.caption=get_language_string("cancel");cancel_button.callback="report_issue_cancel";button_array.push(ok_button);button_array.push(cancel_button);show_modal_popup(-1,report_issue_html,button_array,500,300,"Report a Bug");break;default:_DBG(1,"Unknown toolbar ID:"+tb_id);break;}}
else
{call_plugin_function(i_id,"Toolbar_Event",tb_id,1);}}catch(e){_DBG(0,"call_toolbar_event:"+e.message);}}
function print_ok()
{try{hidePopWin();window.print();}catch(e){_DBG(0,"print_ok:"+e.message);}}
function report_issue_ok(x)
{try
{var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i=i+1){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!==-1){return data[i].identity;}}
else if(dataProp){return data[i].identity;}}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index===-1){return;}
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();var version="Unknown";if(BrowserDetect.browser&&BrowserDetect.version){version=BrowserDetect.browser+" "+BrowserDetect.version;}
var content="<div style='text-align:left'>";content+="<label style='font-weight:bold;font-family:\"Courier New\"'>reporter:"+document.getElementById("report_issue_name").value+"</label><br/>";content+="<label style='font-weight:bold;font-family:\"Courier New\"'>username:"+g_user.username+"</label><br/>";content+="<label style='font-weight:bold;font-family:\"Courier New\"'>trace</label><hr/>";content+="<div style='font-weight:bold;font-family:\"Courier New\"'>";content+="version :"+g_version+"<br/>";content+="g_dbg_log length:"+g_dbg_log.length+"<br/>";content+="session_id:"+session_id+"<br/>";content+="webservice_callback_array  length:"+webservice_callback_array.length+"<br/>";content+="plugin_callback_array  length:"+plugin_callback_array.length+"<br/>";content+="g_webservice_call_total:"+g_webservice_call_total+"<br/>";content+="g_ticker_array length:"+g_ticker_array.length+"<br/>";content+="version:"+version+"<br/>";content+="</div><hr/>";content+="<label style='font-weight:bold;font-family:\"Courier New\"'>"+document.getElementById("report_issue_comment").innerHTML+"</label>";content+="</div>";var wrapper={};wrapper.rsrnd=new Date().getTime().toString();wrapper.ajax_method="report_issue";wrapper.msg=content;wrapper.log=g_dbg_log;var aj=$.ajax({type:'POST',url:get_pwd()+"/app/php/sajax_calls.php",success:report_issue_event,error:function(){ajax_failure("report_issue_event",wrapper);},data:wrapper});}catch(e){_DBG(0,"report_issue_ok:"+e.message);}}
function report_issue_cancel(x)
{try
{}catch(e){_DBG(0,"report_issue_cancel:"+e.message);}}
function report_issue_event(x)
{try{}catch(e){_DBG(0,"report_issue_event:"+e.message);}}
function resize_plugin_containers()
{try{var frames=$(".plugin_frame");for(i=0;i<frames.length;i=i+1){var f=frames[i];if("popupInner"===f.id){continue;}
resize_plugin(f.id);}}catch(e){_DBG(0,"resize_plugin_containers:"+e.message);}}
function resize_plugin(id)
{try{if(id==="popupInner"){return;}
var element=$("#"+id);var plugin_frame_type=id.replace("_div","").replace(/_/gi,".");if(element.length>0){if(element.css("display")!=="none"){var height=0;if(element.height()!==0){height=element.height()-30;element.children(".inside").css("height",height+"px");}else{var h_s=element.css("height");if((h_s!=="auto")&&(parseInt(h_s,10)!==0)){var vh=get_viewport_height();var b_s=element.css("bottom");var b=parseInt(element.css("bottom"),10);var t=element.offset().top;if((t!==0)&&(b!==0)){height=vh-(b+t);element.children(".inside").css("height",height+"px");}}}}}}catch(e){_DBG(0,"resize_plugin:"+e.message+" id="+id);}}
function minimise_plugin(el_id)
{try
{var maximised_size={};var button_id="dock_"+el_id;var delay_load=(get_config_value("delay_load_plugins")==="1");if($("#"+button_id).length>0){return;}
var move_to={};maximised_size.top=$("#"+el_id).offset().top;maximised_size.left=$("#"+el_id).offset().left;maximised_size.width=$("#"+el_id).width();maximised_size.height=$("#"+el_id).height();maximised_size.id=el_id;var dock=document.getElementById("dock_anim_div");dock.style.top=maximised_size.top+"px";dock.style.left=maximised_size.left+"px";dock.style.width=maximised_size.width+"px";dock.style.height=maximised_size.height+"px";$("#dock_anim_div").show();$("#"+el_id).hide();$("#"+el_id+" select").css("visibility","hidden");move_to.height="20px";move_to.left="10px";move_to.width="150px";move_to.top=(get_viewport_height()-(g_dock_bottom_offset+((minimised_plugin_array.length+1)*20))).toString()+"px";var dock_div=$("#dock_div");var move_finish=function()
{var new_button=document.createElement("div");var image_path=get_pwd()+"/images/unknown.png";new_button.id=button_id;new_button.innerHTML=$("#"+el_id+"_title").html();new_button.className="dock_button";$("#dock_anim_div").hide();dock_div.prepend(new_button);$("#"+button_id).click(function(event){toggle_plugin(el_id,true);});minimised_plugin_array.push(maximised_size);if(delay_load){$("#"+el_id+" .inside").html("");}
call_plugin_function(get_plugin_id(el_id.replace("_div","").replace(/_/gi,".")),"HidePlugin_Event",null,1);};tm8FX.Morph($("#dock_anim_div"),move_to,move_finish);return true;}
catch(e)
{_DBG(0,"minimise_plugin:"+e.message);}
return false;}
function get_viewport_height()
{try
{var h=null;h=window.undefined;var theDoc=document;if(window.innerHeight!==window.undefined){h=window.innerHeight;}
if((h===0||h===window.undefined)&&theDoc.compatMode==='CSS1Compat'){h=theDoc.documentElement.clientHeight;}
if((h===0||h===window.undefined)&&theDoc.body){h=theDoc.body.clientHeight;}
return h;}catch(ex){_DBG(0,"get_viewport_height:"+ex.message);}}
function get_viewport_width()
{try
{var offset=17;var width=null;var theDoc=document;if(window.innerWidth!==window.undefined){return window.innerWidth;}
if(theDoc.compatMode==='CSS1Compat'){return theDoc.documentElement.clientWidth;}
if(theDoc.body){return theDoc.body.clientWidth;}}
catch(ex)
{_DBG(0,"get_viewport_width:"+ex.message);}}
function initPopUp(){var theDoc=document;theBody=theDoc.getElementsByTagName('body')[0];popcont=theDoc.createElement('div');popcont.id='popupContainer';popcont.innerHTML=''+'<div id="popupInner" class="plugin_frame" style="display:block">'+'<div style="display:block" id="popup_tl" class="top-left"></div><div id="popup_tr" style="display:block" class="top-right"></div>'+'<div id="popupTitle" class="plugin_title">'+'<label id="modal_title_label" class="plugin_title_label"></label>'+'<div id="popCloseBox" class="plugin_close_button" onclick="hidePopWin(false);"></div>'+'</div>'+'<div class="inside" style="clear:both">'+'<div scrolling="no" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame"></div>'+'</div>'+'<div style="display:block" class="bottom-left" id="popup_bl"></div><div style="display:block" id="popup_br" class="bottom-right"></div>'+'</div>';theBody.appendChild(popcont);gPopupMask=theDoc.getElementById("popupMask");gPopupContainer=theDoc.getElementById("popupContainer");gPopFrame=theDoc.getElementById("popupFrame");gPopTitle=theDoc.getElementById("popupTitle");var brsVersion=parseInt(window.navigator.appVersion.charAt(0),10);if(brsVersion<=6&&window.navigator.userAgent.indexOf("MSIE")>-1){gHideSelects=true;}
var elms=theDoc.getElementsByTagName('a');var elms_length=elms.length;for(i=0;i<elms_length;i+=1){var e=elms[i];if(e.className.indexOf("submodal")===0){e.onclick=function(){var width=400;var height=200;params=this.className.split('-');if(params.length===3){width=parseInt(params[1],10);height=parseInt(params[2],10);}
showPopWin("",this.href,width,height,null);return false;};}}}
function resize_modal_popup(plugin_id,width,height){try{if(gPopupIsShown){centerPopWin(width,height);var titleBarHeight=parseInt(gPopTitle.offsetHeight,10)+9;gPopupContainer.style.height=(height+titleBarHeight)+9+"px";gPopupContainer.style.height=(height+titleBarHeight)+9+"px";setMaskSize();gPopFrame.style.height=(height)+"px";gPopFrame.style.width=(width)+"px";}}catch(e){_DBG(0,"set_modal_popup_height:"+e.message);}}
function get_scroll_top(){try
{var theDoc=document;if(self.pageYOffset){return self.pageYOffset;}else if(theDoc.documentElement&&theDoc.documentElement.scrollTop){return theDoc.documentElement.scrollTop;}else if(theDoc.body){return theDoc.body.scrollTop;}}
catch(ex)
{_DBG(0,"get_scroll_top:"+ex.message);}}
function get_scroll_left(){try
{var theDoc=document;if(self.pageXOffset)
{return self.pageXOffset;}
else if(theDoc.documentElement&&theDoc.documentElement.scrollLeft)
{return theDoc.documentElement.scrollLeft;}
else if(theDoc.body)
{return theDoc.body.scrollLeft;}}
catch(ex)
{_DBG(0,"get_scroll_left:"+ex.message);}}
function showPopWin(title,html,width,height,returnFunc,showCloseBox,isModal){try{var theDoc=document;theDoc.getElementById("modal_title_label").innerHTML=title;if(showCloseBox===null||showCloseBox===true){theDoc.getElementById("popCloseBox").style.display="block";}else{theDoc.getElementById("popCloseBox").style.display="none";}
gPopupIsShown=true;disableTabIndexes();gPopupMask.style.display=(isModal?"block":"none");gPopupContainer.style.display="block";centerPopWin(width,height);var titleBarHeight=parseInt(gPopTitle.offsetHeight,10)+9;gPopupContainer.style.width=width+30+"px";gPopupContainer.style.height=(height+titleBarHeight)+9+"px";setMaskSize();gPopFrame.style.width=(width)+"px";gPopFrame.style.height=(height)+"px";gPopFrame.innerHTML=html;gPopTitle.style.width=width+12+"px";gReturnFunc=returnFunc;$("#popup_tl").width(width+6+"px");$("#popup_tr").width(width+6+"px");$("#popup_bl").width(width+6+"px");$("#popup_br").width(width+6+"px");if(gHideSelects===true){hideSelectBoxes();}}catch(ex)
{_DBG(0,"showPopWin:"+ex.message);}}
var gi=0;function centerPopWin(width,height){try{if(gPopupIsShown===true){if(width===null||isNaN(width)){width=gPopupContainer.offsetWidth;}
if(height===null){height=gPopupContainer.offsetHeight;}
var theBody=document.getElementsByTagName("body")[0];var scTop=parseInt(get_scroll_top(),10);var scLeft=parseInt(theBody.scrollLeft,10);setMaskSize();var titleBarHeight=parseInt(document.getElementById("popupTitle").offsetHeight,10)+9;var fullHeight=get_viewport_height();var fullWidth=get_viewport_width();gPopupContainer.style.top=(scTop+((fullHeight-(height+titleBarHeight))/2))+"px";gPopupContainer.style.left=(scLeft+((fullWidth-width)/2))+"px";}}catch(ex)
{_DBG(0,"centerPopWin:"+ex.message);}}
function addEvent(obj,evType,fn)
{try
{if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
catch(ex)
{_DBG(0,"addEvent:"+ex.message);}}
addEvent(window,"resize",centerPopWin);addEvent(window,"scroll",centerPopWin);window.onscroll=centerPopWin;function setMaskSize(){try{var theBody=document.getElementsByTagName("body")[0];var fullHeight=get_viewport_height();var fullWidth=get_viewport_width();if(fullHeight>theBody.scrollHeight){popHeight=fullHeight;}else{popHeight=theBody.scrollHeight;}
if(fullWidth>theBody.scrollWidth){popWidth=fullWidth;}else{popWidth=theBody.scrollWidth;}
gPopupMask.style.height=popHeight+"px";gPopupMask.style.width=popWidth+"px";}catch(ex)
{_DBG(0,"centerPopWin:"+ex.message);}}
function hidePopWin(callReturnFunc){try{gPopupIsShown=false;gPopupMask.style.display="none";$("#popupContainer").hide();if(callReturnFunc===true&&gReturnFunc!==null){gReturnVal=window.frames.popupFrame.returnVal;window.setTimeout('gReturnFunc(gReturnVal);',1);}
if(gHideSelects===true){displaySelectBoxes();}}catch(ex)
{_DBG(0,"hidePopWin:"+ex.message);}}
function setPopTitle(){try{if(window.frames.popupFrame.document.title===null){window.setTimeout("setPopTitle();",10);}else{document.getElementById("popupTitle").innerHTML=window.frames.popupFrame.document.title;}}catch(ex)
{_DBG(0,"setPopTitle:"+ex.message);}}
function keyDownHandler(e){if(typeof window.event!='undefined'){e=window.event;e.target=event.srcElement;}
var theDoc=document;var keycode=e.keyCode;var targettype=e.target.type;if(gPopupIsShown){if(keycode===9){if(theDoc.activeElement){if($(theDoc.activeElement).parents().filter("#modal_form").length>0){return true;}else{$("#modal_form input").focus();return false;}}}
if(keycode===13){}
if(keycode===27){call_modal_result(-1,"");}
if(keycode===8){if(targettype=='text'||targettype=='textarea'||targettype=='password'){var readOnly=e.target.attributes.getNamedItem('readOnly');if(readOnly!=null){if(readOnly.value=='true'){return false;}else{return true;}}
else{return true;}}
else{return true;}}}
return true;}
if(!document.all){document.onkeypress=keyDownHandler;}
function disableTabIndexes(){try{if(document.all){var i=0;var theDoc=document;for(var j=0;j<gTabbableTags.length;j+=1){var tagElements=theDoc.getElementsByTagName(gTabbableTags[j]);for(var k=0;k<tagElements.length;k+=1){var temp_tag=tagElements[k];gTabIndexes[i]=temp_tag.tabIndex;temp_tag.tabIndex="-1";i+=1;}}}}catch(ex)
{_DBG(0,"disableTabIndexes:"+ex.message);}}
function restoreTabIndexes(){try{if(document.all){var i=0;var theDoc=document;for(var j=0;j<gTabbableTags.length;j+=1){var tagElements=theDoc.getElementsByTagName(gTabbableTags[j]);for(var k=0;k<tagElements.length;k+=1){var temp_tag=tagElements[k];temp_tag.tabIndex=gTabIndexes[i];temp_tag.tabEnabled=true;i+=1;}}}}catch(ex)
{_DBG(0,"restoreTabIndexes:"+ex.message);}}
function hideSelectBoxes(){try{var i=0;$("select").css("visibility","hidden");$("#popupContainer select").css("visibility","visible");}catch(ex){_DBG(0,"hideSelectBoxes:"+ex.message);}}
function displaySelectBoxes(){try{$("select").css("visibility","visible");}catch(ex)
{_DBG(0,"hideSelectBoxes:"+ex.message);}}
function enable_js_button(id,button,enable,fn)
{try{var btn=$("#"+button);btn.unbind("click",fn);if(enable===true){eval("var p = plugin_"+id);btn.bind("click",{self:p},fn).removeClass("tm8button_disabled").addClass("tm8button");}else{btn.removeClass("tm8button").addClass("tm8button_disabled");}}catch(e){_DBG(0,"enable_js_button:"+e.message);}}
function init_plugin_timer()
{var loaded_total=0;var skip_total=0;var all_loaded=false;var i=0;var p_plugin=null;var p_plugin_id=-1;var plugin_wait_limit=parseInt(get_config_value("MAX_INIT_PLUGIN_ATTEMPTS"),10);var loading_progress_bar_div=$("#loading_progress_bar_div");var theDoc=document;var loading_div=theDoc.getElementById("loading_div");var l_pwd=get_pwd();var p_get_language_string=get_language_string;var delay_load=(get_config_value("delay_load_plugins")==="1");switch(g_initialisation_state)
{case 0:if((g_user_setting_array===null)||(g_user===null)){break;}
if(!g_is_mobile){loading_div.innerHTML+="<img style='float:right;width:16px;height:16px;vertical-align:baseline;padding-right:5px' src='"+l_pwd+"/images/ok.png' /><br style='clear:both'/><label style='float:left;text-align:left;padding-left:5px' class='tm8title'>"+p_get_language_string("loading_plugins")+"</label>";tm8FX.Morph(loading_progress_bar_div,{width:'10px'});}
g_initialisation_state=g_initialisation_state+1;break;case 1:for(i=0;i<plugin_array.length;i=i+1)
{p_plugin=plugin_array[i];p_plugin_id=parseInt(p_plugin,10);try{if(p_plugin_id===-2){skip_total=skip_total+1;if((skip_total+loaded_total)===plugin_array.length){if(!g_is_mobil){loading_div.innerHTML+="<img style='float:right;width:16px;height:16px;vertical-align:baseline;padding-right:5px' src='"+l_pwd+"/images/ok.png' /><br style='clear:both'/><label style='float:left;text-align:left;padding-left:5px' class='tm8title'>"+p_get_language_string("retrieving_data")+"...</label>";tm8FX.Morph(loading_progress_bar_div,{width:'20px'});}
g_initialisation_state=g_initialisation_state+1;break;}
continue;}
if(p_plugin.state!==0){loaded_total=loaded_total+1;if((skip_total+loaded_total)===plugin_array.length){if(!g_is_mobile){loading_div.innerHTML+="<img style='float:right;width:16px;height:16px;vertical-align:baseline;padding-right:5px' src='"+l_pwd+"/images/ok.png' /><br style='clear:both'/><label style='float:left;text-align:left;padding-left:5px' class='tm8title'>"+p_get_language_string("retrieving_data")+"...</label>";tm8FX.Morph(loading_progress_bar_div,{width:'20px'});}
g_initialisation_state=g_initialisation_state+1;break;}
continue;}
var id="plugin_"+p_plugin.id;eval("var p  = "+id);if(p)
{if(typeof(p.init_plugin)!=="function"){_DBG(2,"init_plugin function not found in plugin yet (still loading?): ["+get_plugin_name(p_plugin.id)+"]");if(p_plugin.wait_count>=plugin_wait_limit){p_plugin.id=-2;continue;}else{p_plugin.wait_count=p_plugin.wait_count+1;continue;}}}
p_plugin.state=1;}
catch(e){_DBG(0,"init_plugin_timer:"+e.message);if(!g_is_mobile){loading_div.innerHTML+="<div style='float:right;width:16px;height:16px;vertical-align:baseline;padding-right:5px' class='error_status_icon'></div>";}
return;}}
break;case 2:_DBG(2,"init_plugin_timer: All plugins loaded, initialising...");for(i=0;i<plugin_array.length;i+=1)
{p_plugin=plugin_array[i];p_plugin_id=parseInt(p_plugin.id,10);try{if((p_plugin_id!==-2)&&(p_plugin.state===1)&&(!delay_load)){call_plugin_function(p_plugin.id,'init_plugin',null,1);}}catch(e){var plugin_name=p_get_language_string(p_plugin.name);_DBG(0,"init_plugin_timer: Failed to initialise plugin, "+e.message+" plugin id = "+p_plugin.id+" name = "+p_plugin.name);var html="<div style='text-align:left;background-color:#ffffff;width:100%;'>";html+="<b><label class='tm8title'>An error was encountered initialising the following plugin:</label></b><br/>";html+="<br/><b><label class='tm8title'>"+plugin_name+"</label></b><br/><br/>";html+="</div>";ok_button.id="ok_button";ok_button.caption=p_get_language_string("ok");var button_array=[];button_array.push(ok_button);show_modal_popup(-1,html,button_array,500,300,"Error Initialising "+plugin_name);return;}}
g_initialisation_state=g_initialisation_state+1;break;case 3:if(g_webservice_call_total===0){_DBG(2,"init_plugin_timer: All plugins initialised, starting...");if(!g_is_mobile){loading_div.innerHTML+="<br style='clear:both'/><label style='float:left;text-align:left;padding-left:5px' class='tm8title'>"+p_get_language_string("done")+"...</label><img style='float:right;width:16px;height:16px;vertical-align:baseline;padding-right:5px' src='"+l_pwd+"/images/ok.png' />";hidePopWin();}
if((parseInt(get_config_value("encryptpass_prompt"),10)==1)&&(parseInt(get_config_value("encryptpass"),10)==1)&&(g_user.password.length<32)){_mainframe_.show_password_change_dialog();}
return;}
_DBG(2,"init_plugin_timer: Oustanding webservice calls..."+g_webservice_call_total);break;}
var init_plugin_timer_interval=parseInt(get_config_value("INIT_PLUGIN_RETRY_TIME"),10);setTimeout(init_plugin_timer,init_plugin_timer_interval);}
function change_password_cb()
{var save_request={};save_request.item_array={};save_request.item_array[0]={};save_request.item_array[0].id=g_user.user_id;save_request.item_array[0].type="3";save_request.item_array[0].feature_array={};var feature_count=0;var email=$("#change_pass_email_input").val();var pwd_1=$('#change_pass_1_input').val();var sha_pwd_1=$.sha256($('#change_pass_1_input'));var sha_pwd_2=$.sha256($('#change_pass_2_input'));if(sha_pwd_1!=sha_pwd_2){$("#change_pass_1_input").css("border","solid 1px red");$("#change_pass_2_input").css("border","solid 1px red");$("#change_pass_status").html(get_language_string("passwords_do_not_match"));return false;}
if(pwd_1==""){$("#change_pass_1_input").css("border","solid 1px red");$("#change_pass_2_input").css("border","solid 1px red");$("#change_pass_status").html(get_language_string("enter_password"));return false;}
if(pwd_1==g_user.password){$("#change_pass_1_input").css("border","solid 1px red");$("#change_pass_2_input").css("border","solid 1px red");$("#change_pass_status").html(get_language_string("enter_new_password"));return false;}
if(email==""){$("#change_pass_email_input").css("border","solid 1px red");$("#change_pass_status").html(get_language_string("invalid_email_address"));return false;}
save_request.item_array[0].feature_array[feature_count]={};save_request.item_array[0].feature_array[feature_count].id=StreamTypes.UF_PASSWORD.toString();save_request.item_array[0].feature_array[feature_count].value=sha_pwd_1;feature_count++;save_request.item_array[0].feature_array[feature_count]={};save_request.item_array[0].feature_array[feature_count].id=StreamTypes.UF_PASSWORD_STRENGTH.toString();save_request.item_array[0].feature_array[feature_count].value=tm8Util.get_pw_strength(pwd_1);feature_count++;save_request.item_array[0].feature_array[feature_count]={};save_request.item_array[0].feature_array[feature_count].id=StreamTypes.UF_EMAIL.toString();save_request.item_array[0].feature_array[feature_count].value=email;feature_count++;$("#change_pass_status").html(get_language_string("saving"));call_webservice(-1,"tm8Group1","wsSetGroupItemArray1",save_request);return true;}
_mainframe_.show_password_change_dialog=function()
{var html="<div style='padding:5px;text-align:left'>";html+="<label class='tm8title'>"+get_language_string("change_password_prompt")+"</label><br/><br/>";html+="<div style='padding:5px;text-align:left' class='tm8form'>";html+="<label class='tm8title'>"+get_language_string("new_password")+"</label><input onkeypress=\"javascript:_mainframe_.pw_change_event(event)\" onkeyup=\"javascript:_mainframe_.pw_change_event(event)\" onchange=\"javascript:_mainframe_.pw_change_event(event)\" id='change_pass_1_input' type='password'></input>";html+="<div id=\"change_pass_pw_meter_container\" class=\"pw_meter_container\"><div id=\"change_pass_pw_meter\" class=\"pw_meter\"></div></div>";html+="<br/>";html+="<label class='tm8title'>"+get_language_string("new_password_confirm")+"</label><input id='change_pass_2_input' type='password'></input><br/>";html+="<label class='tm8title'>"+get_language_string("email_address")+"</label><input id='change_pass_email_input' type='text' value='"+g_user.email_address+"'></input><br/>";html+="<div style='height:24px;'><label id='change_pass_status' class='tm8title'></label></div><br/>";html+="</div>";var button_array=[];var ok_button={};ok_button.id="save";ok_button.caption=get_language_string("save");ok_button.callback="change_password_cb";button_array.push(ok_button);show_modal_popup(-1,html,button_array,500,200,get_language_string("change_password"));$("#change_pass_1_input").focus();};_mainframe_.pw_change_event=function(e)
{if(document.getElementById("change_pass_1_input")){var pw=document.getElementById("change_pass_1_input").value;if(this.previous_entered_pw!=pw){var strength=tm8Util.get_pw_strength(pw);this.previous_entered_pw=pw;if(strength==this.previous_entered_pw_strength){return;}
this.previous_entered_pw_strength=strength;tm8Util.set_pw_meter($("#change_pass_pw_meter"),strength);}}};_mainframe_.modal_button_click_wrapper=function()
{call_plugin_function(g_modal_button_id,g_modal_button_event,null,1);$("#modal_button_div").hide();g_modal_button_id=-1;g_modal_button_event="";show_toolbar(-1);show_floating_plugins();};_mainframe_.ticker_button_click_wrapper=function()
{var ticker=g_ticker_array.pop();call_plugin_function(ticker.plugin_id,ticker.callback_func,ticker.id,1);if(g_ticker_array.length>0)
{update_ticker();}
else
{hide_ticker();}};_mainframe_.plugin_bar_click_wrapper=function(ob)
{try{call_plugin_function(ob.plugin_id,"PluginBarButton_Event",ob.button_id,1);}catch(e){_DBG(0,"_mainframe_.plugin_bar_click_wrapper:"+e.message);}};var tm8FX={};tm8FX.flash_total=0;tm8FX.Purge=function(o)
{try
{$(o).stop(true,true);}catch(e){_DBG(0,"tm8FX.Purge:"+e.message);}};tm8FX.getOptions=function(complete_callback)
{try
{var o={};o.queue={};o.queue.position='end';o.queue.scope='tm8fx_queue';o.duration=200;o.pulses=1;if(complete_callback){o.afterFinish=complete_callback;o.complete=complete_callback;}
return o;}catch(e){_DBG(0,"tm8FX.getOptions:"+e.message);}};tm8FX.Flash=function(o,complete_callback)
{try
{this.flash_total+=1;if(this.flash_total>1){return;}
var options=this.getOptions(complete_callback);o.fadeOut(options.duration,options.complete);o.fadeIn(options.duration,options.complete);o.fadeOut(options.duration,options.complete);o.fadeIn(options.duration,options.complete);}catch(e)
{_DBG(0,"tm8FX.Flash:"+e.message);}};tm8FX.Show=function(o)
{try{o.show();}catch(e){_DBG(0,"tm8FX.Show:"+e.message);}};tm8FX.Hide=function(o)
{try{o.hide();}catch(e){_DBG(0,"tm8FX.Hide:"+e.message);}};tm8FX.FadeIn=function(o,complete_callback)
{try
{var options=this.getOptions(complete_callback);o.fadeIn(options.duration,options.complete);}catch(e){_DBG(0,"tm8FX.FadeIn:"+e.message);}};tm8FX.FadeOut=function(o,complete_callback)
{try
{var options=this.getOptions(complete_callback);o.fadeOut(options.duration,options.complete);}catch(e){_DBG(0,"tm8FX.FadeOut:"+e.message);}};tm8FX.SlideDown=function(o,complete_callback)
{try
{var options=this.getOptions(complete_callback);o.slideDown(options.duration,options.complete);}catch(e){_DBG(0,"tm8FX.SlideDown:"+e.message);}};tm8FX.SlideUp=function(o,complete_callback)
{try
{var options=this.getOptions(complete_callback);o.slideUp(options.duration,options.complete);}catch(e){_DBG(0,"tm8FX.SlideUp:"+e.message);}};tm8FX.Morph=function(o,style,complete_callback)
{try{var options=this.getOptions(complete_callback);o.animate(style,{duration:options.duration,queue:true,complete:complete_callback});}catch(e){_DBG(0,"tm8FX.Morph:"+e.message);}};var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion(){var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version")}catch(e){}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version")}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version")}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0"}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11"}catch(e){version=-1}}return version}function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];var versionRevision=descArray[3];if(versionRevision==""){versionRevision=descArray[4]}if(versionRevision[0]=="d"){versionRevision=versionRevision.substring(1)}else if(versionRevision[0]=="r"){versionRevision=versionRevision.substring(1);if(versionRevision.indexOf("d")>0){versionRevision=versionRevision.substring(0,versionRevision.indexOf("d"))}}var flashVer=versionMajor+"."+versionMinor+"."+versionRevision}}else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera){flashVer=ControlVersion()}return flashVer}function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision){versionStr=GetSwfVer();if(versionStr==-1){return false}else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",")}else{versionArray=versionStr.split(".")}var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVer))return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=parseFloat(reqRevision))return true}}return false}}function AC_AddExtension(src,ext){if(src.indexOf('?')!=-1)return src.replace(/\?/,ext+'?');else return src+ext}function AC_Generateobj(objAttrs,params,embedAttrs){var str='';if(isIE&&isWin&&!isOpera){str+='<object ';for(var i in objAttrs)str+=i+'="'+objAttrs[i]+'" ';str+='>';for(var i in params)str+='<param name="'+i+'" value="'+params[i]+'" /> ';str+='</object>'}else{str+='<embed ';for(var i in embedAttrs)str+=i+'="'+embedAttrs[i]+'" ';str+='> </embed>'}document.write(str)}function AC_FL_RunContent(){var ret=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs)}function AC_GetArgs(args,ext,srcParamName,classid,mimeType){var ret={};ret.embedAttrs={};ret.params={};ret.objAttrs={};for(var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch(currArg){case"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;case"src":case"movie":args[i+1]=AC_AddExtension(args[i+1],ext);ret.embedAttrs["src"]=args[i+1];ret.params[srcParamName]=args[i+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":ret.objAttrs[args[i]]=args[i+1];break;case"id":case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1]}}ret.objAttrs["classid"]=classid;if(mimeType)ret.embedAttrs["type"]=mimeType;return ret}
function Epoch(name,mode,targetelement,multiselect)
{try
{this.state=0;this.name=name;this.curDate=new Date();this.mode=mode;this.selectMultiple=(multiselect==true);this.selectedDates=[];this.calendar;this.calHeading;this.calCells;this.rows;this.cols;this.cells=[];this.monthSelect;this.yearSelect;var p_get_language_string=get_language_string;if(typeof(tm8Util.lang_tokens.sun)=="undefined"){tm8Util.lang_tokens.sun=p_get_language_string("sun");tm8Util.lang_tokens.mon=p_get_language_string("mon");tm8Util.lang_tokens.tue=p_get_language_string("tue");tm8Util.lang_tokens.wed=p_get_language_string("wed");tm8Util.lang_tokens.thu=p_get_language_string("thu");tm8Util.lang_tokens.fri=p_get_language_string("fri");tm8Util.lang_tokens.sat=p_get_language_string("sat");tm8Util.lang_tokens.sunday=p_get_language_string("sunday");tm8Util.lang_tokens.monday=p_get_language_string("monday");tm8Util.lang_tokens.tuesday=p_get_language_string("tuesday");tm8Util.lang_tokens.wednesday=p_get_language_string("wednesday");tm8Util.lang_tokens.thursday=p_get_language_string("thursday");tm8Util.lang_tokens.friday=p_get_language_string("friday");tm8Util.lang_tokens.saturday=p_get_language_string("saturday");tm8Util.lang_tokens.jan=p_get_language_string("jan");tm8Util.lang_tokens.feb=p_get_language_string("feb");tm8Util.lang_tokens.mar=p_get_language_string("mar");tm8Util.lang_tokens.apr=p_get_language_string("apr");tm8Util.lang_tokens.may=p_get_language_string("may");tm8Util.lang_tokens.jun=p_get_language_string("jun");tm8Util.lang_tokens.jul=p_get_language_string("jul");tm8Util.lang_tokens.aug=p_get_language_string("aug");tm8Util.lang_tokens.sep=p_get_language_string("sep");tm8Util.lang_tokens.oct=p_get_language_string("oct");tm8Util.lang_tokens.nov=p_get_language_string("nov");tm8Util.lang_tokens.dec=p_get_language_string("dec");tm8Util.lang_tokens.january=p_get_language_string("january");tm8Util.lang_tokens.february=p_get_language_string("february");tm8Util.lang_tokens.march=p_get_language_string("march");tm8Util.lang_tokens.april=p_get_language_string("april");tm8Util.lang_tokens.may=p_get_language_string("may");tm8Util.lang_tokens.june=p_get_language_string("june");tm8Util.lang_tokens.july=p_get_language_string("july");tm8Util.lang_tokens.august=p_get_language_string("august");tm8Util.lang_tokens.september=p_get_language_string("september");tm8Util.lang_tokens.october=p_get_language_string("october");tm8Util.lang_tokens.november=p_get_language_string("november");tm8Util.lang_tokens.december=p_get_language_string("december");tm8Util.lang_tokens.go_to_next_month=p_get_language_string("go_to_next_month");tm8Util.lang_tokens.go_to_previous_month=p_get_language_string("go_to_previous_month");tm8Util.lang_tokens.clear=p_get_language_string("clear");tm8Util.lang_tokens.clears_any_dates_selected_in_the_calendar=p_get_language_string("clears_any_dates_selected_in_the_calendar");tm8Util.lang_tokens.this_is_the_maximum_range=p_get_language_string("this_is_the_maximum_range");tm8Util.lang_tokens.date_format=p_get_language_string("date_format");tm8Util.lang_tokens.datetime_format=p_get_language_string("datetime_format");}
this.mousein=false;this.calConfig();this.setDays();this.displayYear=this.displayYearInitial;this.displayMonth=this.displayMonthInitial;this.createCalendar();if(this.mode=='popup'&&targetelement&&targetelement.type=='text')
{this.tgt=targetelement;this.calendar.style.position='absolute';this.topOffset=this.tgt.offsetHeight;this.leftOffset=0;this.calendar.style.top=this.getTop(targetelement)+this.topOffset+'px';this.calendar.style.left=this.getLeft(targetelement)+this.leftOffset+'px';document.body.appendChild(this.calendar);this.tgt.calendar=this;this.tgt.onfocus=function(){this.calendar.show();};this.tgt.onblur=function(){if(!this.calendar.mousein){this.calendar.hide();}};}
else
{this.container=targetelement;this.container.appendChild(this.calendar);}
this.state=2;this.visible?this.show():this.hide();}
catch(e)
{_DBG(0,"Epoch:"+e.message);}}
Epoch.prototype.calConfig=function()
{try
{this.displayYearInitial=this.curDate.getFullYear();this.displayMonthInitial=this.curDate.getMonth();this.rangeYearLower=2005;this.rangeYearUpper=2037;this.minDate=new Date(2005,0,1);this.maxDate=new Date(2037,0,1);this.startDay=0;this.showWeeks=true;this.selCurMonthOnly=false;this.clearSelectedOnChange=true;switch(this.mode)
{case'popup':this.visible=false;break;case'flat':this.visible=true;break;}
this.setLang();}
catch(e)
{_DBG(0,e.message);}};Epoch.prototype.setLang=function()
{try
{this.daylist=new Array();this.daylist.push(tm8Util.lang_tokens.sun);this.daylist.push(tm8Util.lang_tokens.mon);this.daylist.push(tm8Util.lang_tokens.tue);this.daylist.push(tm8Util.lang_tokens.wed);this.daylist.push(tm8Util.lang_tokens.thu);this.daylist.push(tm8Util.lang_tokens.fri);this.daylist.push(tm8Util.lang_tokens.sat);this.daylist.push(tm8Util.lang_tokens.sun);this.daylist.push(tm8Util.lang_tokens.mon);this.daylist.push(tm8Util.lang_tokens.tue);this.daylist.push(tm8Util.lang_tokens.wed);this.daylist.push(tm8Util.lang_tokens.thu);this.daylist.push(tm8Util.lang_tokens.fri);this.daylist.push(tm8Util.lang_tokens.sat);this.months_sh=new Array();this.months_sh.push(tm8Util.lang_tokens.jan);this.months_sh.push(tm8Util.lang_tokens.feb);this.months_sh.push(tm8Util.lang_tokens.mar);this.months_sh.push(tm8Util.lang_tokens.apr);this.months_sh.push(tm8Util.lang_tokens.may);this.months_sh.push(tm8Util.lang_tokens.jun);this.months_sh.push(tm8Util.lang_tokens.jul);this.months_sh.push(tm8Util.lang_tokens.aug);this.months_sh.push(tm8Util.lang_tokens.sep);this.months_sh.push(tm8Util.lang_tokens.oct);this.months_sh.push(tm8Util.lang_tokens.nov);this.months_sh.push(tm8Util.lang_tokens.dec);this.monthup_title=tm8Util.lang_tokens.go_to_next_month;this.monthdn_title=tm8Util.lang_tokens.go_to_previous_month;this.clearbtn_caption=tm8Util.lang_tokens.clear;this.clearbtn_title=tm8Util.lang_tokens.clears_any_dates_selected_in_the_calendar;this.maxrange_caption=tm8Util.lang_tokens.this_is_the_maximum_range;}
catch(e)
{_DBG(0,e.message);}};Epoch.prototype.getTop=function(element)
{try
{var oNode=element;if(oNode==null)_DBG(0,"ONODE is undefined");var iTop=0;while(oNode&&oNode.tagName!='BODY'&&oNode.tagName!='HTML'){iTop+=oNode.offsetTop;oNode=oNode.offsetParent;}
return iTop;}
catch(e)
{_DBG(0,e.message);}};Epoch.prototype.getLeft=function(element)
{try
{var oNode=element;if(oNode==null)_DBG(0,"ONODE is undefined");var iLeft=0;while(oNode&&oNode.tagName!='BODY'&&oNode.tagName!='HTML'){iLeft+=oNode.offsetLeft;oNode=oNode.offsetParent;}
return iLeft;}
catch(e)
{_DBG(0,e.message);}};Epoch.prototype.show=function()
{try
{this.calendar.style.zIndex='400';this.calendar.style.display='block';}catch(e)
{_DBG(0,"Epoch.show:"+e.message);}};Epoch.prototype.hide=function()
{this.calendar.style.display='none';};Epoch.prototype.toggle=function()
{try
{if(this.visible){this.hide();}
else{this.show();}}catch(e)
{_DBG(0,"Epoch.toggle:"+e.message);}};Epoch.prototype.setDays=function()
{this.daynames=[];var j=0;for(var i=this.startDay;i<this.startDay+7;i++){this.daynames[j++]=this.daylist[i];}
this.monthDayCount=new Array(31,((this.curDate.getFullYear()-2000)%4?28:29),31,30,31,30,31,31,30,31,30,31);};Epoch.prototype.setClass=function(element,className)
{element.setAttribute('class',className);element.setAttribute('className',className);};Epoch.prototype.createCalendar=function()
{try
{var tbody,tr,td;this.calendar=document.createElement('table');this.calendar.setAttribute('id',this.name+'_calendar');this.setClass(this.calendar,'calendar');this.calendar.onselectstart=function(){return false;};this.calendar.ondrag=function(){return false;};tbody=document.createElement('tbody');tr=document.createElement('tr');td=document.createElement('td');td.appendChild(this.createMainHeading());tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');td.appendChild(this.createDayHeading());tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');td.setAttribute('id',this.name+'_cell_td');this.calCellContainer=td;td.appendChild(this.createCalCells());tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');td.appendChild(this.createFooter());tr.appendChild(td);tbody.appendChild(tr);this.calendar.appendChild(tbody);this.calendar.owner=this;this.calendar.onmouseover=function(){this.owner.mousein=true;};this.calendar.onmouseout=function(){this.owner.mousein=false;};}
catch(e)
{_DBG(0,"createCaledar:"+e.message);}};Epoch.prototype.createMainHeading=function()
{try
{var container=document.createElement('div');container.setAttribute('id',this.name+'_mainheading');this.setClass(container,'mainheading');this.monthSelect=document.createElement('select');this.yearSelect=document.createElement('select');var monthDn=document.createElement('input'),monthUp=document.createElement('input');var opt,i;for(i=0;i<12;i++)
{opt=document.createElement('option');opt.setAttribute('value',i);if(this.state==0&&this.displayMonth==i){opt.setAttribute('selected','selected');}
opt.appendChild(document.createTextNode(this.months_sh[i]));this.monthSelect.appendChild(opt);}
for(i=this.rangeYearLower;i<=this.rangeYearUpper;i++)
{opt=document.createElement('option');opt.setAttribute('value',i);if(this.state==0&&this.displayYear==i){opt.setAttribute('selected','selected');}
opt.appendChild(document.createTextNode(i));this.yearSelect.appendChild(opt);}
monthUp.setAttribute('type','button');monthUp.setAttribute('value','>');monthUp.setAttribute('title',this.monthup_title);monthDn.setAttribute('type','button');monthDn.setAttribute('value','<');monthDn.setAttribute('title',this.monthdn_title);this.monthSelect.owner=this.yearSelect.owner=monthUp.owner=monthDn.owner=this;monthUp.onmouseup=function(){this.owner.nextMonth();};monthDn.onmouseup=function(){this.owner.prevMonth();};this.monthSelect.onchange=function(){this.owner.displayMonth=this.value;this.owner.displayYear=this.owner.yearSelect.value;this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);};this.yearSelect.onchange=function(){this.owner.displayMonth=this.owner.monthSelect.value;this.owner.displayYear=this.value;this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);};container.appendChild(monthDn);container.appendChild(this.monthSelect);container.appendChild(this.yearSelect);container.appendChild(monthUp);return container;}
catch(e)
{_DBG(0,e.message);}};Epoch.prototype.createFooter=function()
{var container=document.createElement('div');var clearSelected=document.createElement('input');clearSelected.setAttribute('type','button');clearSelected.setAttribute('value',this.clearbtn_caption);clearSelected.setAttribute('title',this.clearbtn_title);clearSelected.owner=this;clearSelected.onclick=function(){this.owner.resetSelections(false);};container.appendChild(clearSelected);return container;};Epoch.prototype.resetSelections=function(returnToDefaultMonth)
{this.selectedDates=[];this.rows=new Array(false,false,false,false,false,false,false);this.cols=new Array(false,false,false,false,false,false,false);if(this.tgt)
{this.tgt.value='';if(this.mode=='popup'){this.hide();}}
if(returnToDefaultMonth==true){this.goToMonth(this.displayYearInitial,this.displayMonthInitial);}
else{this.reDraw();}};Epoch.prototype.createDayHeading=function()
{this.calHeading=document.createElement('table');this.calHeading.setAttribute('id',this.name+'_caldayheading');this.setClass(this.calHeading,'caldayheading');var tbody,tr,td;tbody=document.createElement('tbody');tr=document.createElement('tr');this.cols=new Array(false,false,false,false,false,false,false);if(this.showWeeks)
{td=document.createElement('td');td.setAttribute('class','wkhead');td.setAttribute('className','wkhead');tr.appendChild(td);}
for(var dow=0;dow<7;dow++)
{td=document.createElement('td');td.appendChild(document.createTextNode(this.daynames[dow]));if(this.selectMultiple){td.headObj=new CalHeading(this,td,(dow+this.startDay<7?dow+this.startDay:dow+this.startDay-7));}
tr.appendChild(td);}
tbody.appendChild(tr);this.calHeading.appendChild(tbody);return this.calHeading;};Epoch.prototype.createCalCells=function()
{this.rows=new Array(false,false,false,false,false,false);this.cells=[];var row=-1,totalCells=(this.showWeeks?48:42);var beginDate=new Date(this.displayYear,this.displayMonth,1);var endDate=new Date(this.displayYear,this.displayMonth,this.monthDayCount[this.displayMonth]);var sdt=new Date(beginDate);sdt.setDate(sdt.getDate()+(this.startDay-beginDate.getDay())-(this.startDay-beginDate.getDay()>0?7:0));this.calCells=document.createElement('table');this.calCells.setAttribute('id',this.name+'_calcells');this.setClass(this.calCells,'calcells');var tbody,tr,td;tbody=document.createElement('tbody');for(var i=0;i<totalCells;i++)
{if(this.showWeeks)
{if(i%8==0)
{row++;tr=document.createElement('tr');td=document.createElement('td');if(this.selectMultiple){td.weekObj=new WeekHeading(this,td,sdt.getWeek(),row)}
else
{td.setAttribute('class','wkhead');td.setAttribute('className','wkhead');}
td.appendChild(document.createTextNode(sdt.getWeek()));tr.appendChild(td);i++;}}
else if(i%7==0)
{row++;tr=document.createElement('tr');}
td=document.createElement('td');td.appendChild(document.createTextNode(sdt.getDate()));var cell=new CalCell(this,td,sdt,row);this.cells.push(cell);td.cellObj=cell;sdt.setDate(sdt.getDate()+1);tr.appendChild(td);tbody.appendChild(tr);}
this.calCells.appendChild(tbody);this.reDraw();return this.calCells;};Epoch.prototype.reDraw=function()
{this.state=1;var i,j;for(i=0;i<this.cells.length;i++){this.cells[i].selected=false;}
for(i=0;i<this.cells.length;i++)
{for(j=0;j<this.selectedDates.length;j++){if(this.cells[i].date.getUeDay()==this.selectedDates[j].getUeDay()){this.cells[i].selected=true;}}
this.cells[i].setClass();}
this.state=2;};Epoch.prototype.deleteCells=function()
{this.calCellContainer.removeChild(this.calCellContainer.firstChild);this.cells=[];};Epoch.prototype.goToMonth=function(year,month)
{this.monthSelect.value=this.displayMonth=month;this.yearSelect.value=this.displayYear=year;this.deleteCells();this.calCellContainer.appendChild(this.createCalCells());};Epoch.prototype.nextMonth=function()
{if(this.monthSelect.value<11){this.monthSelect.value++;}
else
{if(this.yearSelect.value<this.rangeYearUpper)
{this.monthSelect.value=0;this.yearSelect.value++;}
else{alert(this.maxrange_caption);}}
this.displayMonth=this.monthSelect.value;this.displayYear=this.yearSelect.value;this.deleteCells();this.calCellContainer.appendChild(this.createCalCells());};Epoch.prototype.prevMonth=function()
{if(this.monthSelect.value>0)
this.monthSelect.value--;else
{if(this.yearSelect.value>this.rangeYearLower)
{this.monthSelect.value=11;this.yearSelect.value--;}
else{alert(this.maxrange_caption);}}
this.displayMonth=this.monthSelect.value;this.displayYear=this.yearSelect.value;this.deleteCells();this.calCellContainer.appendChild(this.createCalCells());};Epoch.prototype.addZero=function(vNumber)
{return((vNumber<10)?'0':'')+vNumber;};Epoch.prototype.addDates=function(dates,redraw)
{var j,in_sd;for(var i=0;i<dates.length;i++)
{in_sd=false;for(j=0;j<this.selectedDates.length;j++)
{if(dates[i].getUeDay()==this.selectedDates[j].getUeDay())
{in_sd=true;break;}}
if(!in_sd){this.selectedDates.push(dates[i]);}}
if(redraw!=false){this.reDraw();}};Epoch.prototype.removeDates=function(dates,redraw)
{var j;for(var i=0;i<dates.length;i++)
{for(j=0;j<this.selectedDates.length;j++)
{if(dates[i].getUeDay()==this.selectedDates[j].getUeDay()){this.selectedDates.splice(j,1);}}}
if(redraw!=false){this.reDraw();}};Epoch.prototype.outputDate=function(vDate,vFormat)
{var vDay=this.addZero(vDate.getDate());var vMonth=this.addZero(vDate.getMonth()+1);var vYearLong=this.addZero(vDate.getFullYear());var vYearShort=this.addZero(vDate.getFullYear().toString().substring(3,4));var vYear=(vFormat.indexOf('yyyy')>-1?vYearLong:vYearShort);var vHour=this.addZero(vDate.getHours());var vMinute=this.addZero(vDate.getMinutes());var vSecond=this.addZero(vDate.getSeconds());return vFormat.replace(/dd/g,vDay).replace(/mm/g,vMonth).replace(/y{1,4}/g,vYear).replace(/hh/g,vHour).replace(/nn/g,vMinute).replace(/ss/g,vSecond);};Epoch.prototype.updatePos=function(target)
{try
{this.calendar.style.top=$(target).offset().top+$(this.calendar).offset().top+'px';this.calendar.style.left=$(target).offset().left+$(target).width()+'px';}catch(e){_DBG(0,"Epoch.updatePos:"+e.message);}}
function CalHeading(owner,tableCell,dow)
{try
{this.owner=owner;this.tableCell=tableCell;this.dayOfWeek=dow;this.tableCell.onclick=this.onclick;}catch(e)
{_DBG(0,"Epoch.CalHeading:"+e.message);}}
CalHeading.prototype.onclick=function()
{var owner=this.headObj.owner;var sdates=owner.selectedDates;var cells=owner.cells;owner.cols[this.headObj.dayOfWeek]=!owner.cols[this.headObj.dayOfWeek];for(var i=0;i<cells.length;i++)
{if(cells[i].dayOfWeek==this.headObj.dayOfWeek&&(!owner.selCurMonthOnly||cells[i].date.getMonth()==owner.displayMonth&&cells[i].date.getFullYear()==owner.displayYear))
{if(owner.cols[this.headObj.dayOfWeek])
{if(owner.selectedDates.arrayIndex(cells[i].date)==-1){sdates.push(cells[i].date);}}
else
{for(var j=0;j<sdates.length;j++)
{if(cells[i].dayOfWeek==sdates[j].getDay())
{sdates.splice(j,1);break;}}}
cells[i].selected=owner.cols[this.headObj.dayOfWeek];}}
owner.reDraw();};function WeekHeading(owner,tableCell,week,row)
{this.owner=owner;this.tableCell=tableCell;this.week=week;this.tableRow=row;this.tableCell.setAttribute('class','wkhead');this.tableCell.setAttribute('className','wkhead');this.tableCell.onclick=this.onclick;}
WeekHeading.prototype.onclick=function()
{var owner=this.weekObj.owner;var cells=owner.cells;var sdates=owner.selectedDates;var i,j;owner.rows[this.weekObj.tableRow]=!owner.rows[this.weekObj.tableRow];for(i=0;i<cells.length;i++)
{if(cells[i].tableRow==this.weekObj.tableRow)
{if(owner.rows[this.weekObj.tableRow]&&(!owner.selCurMonthOnly||cells[i].date.getMonth()==owner.displayMonth&&cells[i].date.getFullYear()==owner.displayYear))
{if(owner.selectedDates.arrayIndex(cells[i].date)==-1){sdates.push(cells[i].date);}}
else
{for(j=0;j<sdates.length;j++)
{if(sdates[j].getTime()==cells[i].date.getTime())
{sdates.splice(j,1);break;}}}}}
owner.reDraw();};function CalCell(owner,tableCell,dateObj,row)
{this.owner=owner;this.tableCell=tableCell;this.cellClass;this.selected=false;this.date=new Date(dateObj);this.dayOfWeek=this.date.getDay();this.week=this.date.getWeek();this.tableRow=row;this.tableCell.onclick=this.onclick;this.tableCell.onmouseover=this.onmouseover;this.tableCell.onmouseout=this.onmouseout;this.setClass();}
CalCell.prototype.onmouseover=function()
{this.setAttribute('class',this.cellClass+' hover');this.setAttribute('className',this.cellClass+' hover');};CalCell.prototype.onmouseout=function()
{this.cellObj.setClass();};CalCell.prototype.onclick=function()
{var cell=this.cellObj;var owner=cell.owner;if(!owner.selCurMonthOnly||cell.date.getMonth()==owner.displayMonth&&cell.date.getFullYear()==owner.displayYear)
{if(owner.selectMultiple==true)
{if(!cell.selected)
{if(owner.selectedDates.arrayIndex(cell.date)==-1){owner.selectedDates.push(cell.date);}}
else
{var tmp=owner.selectedDates;for(var i=0;i<tmp.length;i++)
{if(tmp[i].getUeDay()==cell.date.getUeDay()){tmp.splice(i,1);}}}}
else
{owner.selectedDates=new Array(cell.date);if(owner.tgt)
{if(typeof(change_calendar_event)=="function")
{change_calendar_event(owner.tgt,owner.selectedDates[0].formatDate(get_language_string('date_format')));}
if(owner.mode=='popup'){owner.hide();}}}
owner.reDraw();}};CalCell.prototype.setClass=function()
{if(this.selected){this.cellClass='cell_selected';}
else if(this.owner.displayMonth!=this.date.getMonth()){this.cellClass='notmnth';}
else if(this.date.getDay()>0&&this.date.getDay()<6){this.cellClass='wkday';}
else{this.cellClass='wkend';}
if(this.date.getFullYear()==this.owner.curDate.getFullYear()&&this.date.getMonth()==this.owner.curDate.getMonth()&&this.date.getDate()==this.owner.curDate.getDate()){this.cellClass=this.cellClass+' curdate';}
this.tableCell.setAttribute('class',this.cellClass);this.tableCell.setAttribute('className',this.cellClass);};Date.prototype.getDayOfYear=function()
{return parseInt((this.getTime()-new Date(this.getFullYear(),0,1).getTime())/86400000+1);};Date.prototype.getWeek=function()
{return parseInt((this.getTime()-new Date(this.getFullYear(),0,1).getTime())/604800000+1);};Date.prototype.getUeDay=function()
{return parseInt(Math.floor((this.getTime()-this.getTimezoneOffset()*60000)/86400000));};Date.prototype.dateFormat=function(format)
{return formatDate(tm8Util.lang_tokens.date_format);}
Array.prototype.arrayIndex=function(searchVal,startIndex)
{startIndex=(startIndex!=null?startIndex:0);for(var i=startIndex;i<this.length;i++)
{if(searchVal==this[i]){return i;}}
return-1;};Array.prototype.exists=function(x)
{for(var i=0;i<this.length;i++){if(this[i]==x)return true;}
return false;}
Date.prototype.formatDate=function(input,time,tz_code){var switches=["a","A","B","d","D","F","g","G","h","H","i","j","l","L","m","M","n","O","r","s","S","t","U","w","W","y","Y","z","T"];var daysLong=Array();daysLong.push(tm8Util.lang_tokens.sunday);daysLong.push(tm8Util.lang_tokens.monday);daysLong.push(tm8Util.lang_tokens.tuesday);daysLong.push(tm8Util.lang_tokens.wednesday);daysLong.push(tm8Util.lang_tokens.thursday);daysLong.push(tm8Util.lang_tokens.friday);var daysShort=Array();daysShort.push(tm8Util.lang_tokens.sun);daysShort.push(tm8Util.lang_tokens.mon);daysShort.push(tm8Util.lang_tokens.tue);daysShort.push(tm8Util.lang_tokens.wed);daysShort.push(tm8Util.lang_tokens.thu);daysShort.push(tm8Util.lang_tokens.fri);var monthsShort=Array();monthsShort.push(tm8Util.lang_tokens.jan);monthsShort.push(tm8Util.lang_tokens.feb);monthsShort.push(tm8Util.lang_tokens.mar);monthsShort.push(tm8Util.lang_tokens.apr);monthsShort.push(tm8Util.lang_tokens.may);monthsShort.push(tm8Util.lang_tokens.jun);monthsShort.push(tm8Util.lang_tokens.jul);monthsShort.push(tm8Util.lang_tokens.aug);monthsShort.push(tm8Util.lang_tokens.sep);monthsShort.push(tm8Util.lang_tokens.oct);monthsShort.push(tm8Util.lang_tokens.nov);monthsShort.push(tm8Util.lang_tokens.dec);var monthsLong=Array();monthsLong.push(tm8Util.lang_tokens.january);monthsLong.push(tm8Util.lang_tokens.february);monthsLong.push(tm8Util.lang_tokens.march);monthsLong.push(tm8Util.lang_tokens.april);monthsLong.push(tm8Util.lang_tokens.may);monthsLong.push(tm8Util.lang_tokens.june);monthsLong.push(tm8Util.lang_tokens.july);monthsLong.push(tm8Util.lang_tokens.august);monthsLong.push(tm8Util.lang_tokens.september);monthsLong.push(tm8Util.lang_tokens.octtober);monthsLong.push(tm8Util.lang_tokens.november);monthsLong.push(tm8Util.lang_tokens.december);var daysSuffix=["st","nd","rd","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","st","nd","rd","th","th","th","th","th","th","th","st"];function a(){return self.getHours()>11?"pm":"am";}
function A(){return self.getHours()>11?"PM":"AM";}
function B(){var off=(self.getTimezoneOffset()+60)*60;var theSeconds=(self.getHours()*3600)+
(self.getMinutes()*60)+
self.getSeconds()+off;var beat=Math.floor(theSeconds/86.4);if(beat>1000)beat-=1000;if(beat<0)beat+=1000;if((""+beat).length==1)beat="00"+beat;if((""+beat).length==2)beat="0"+beat;return beat;}
function d(){return new String(self.getDate()).length==1?"0"+self.getDate():self.getDate();}
function D(){return daysShort[self.getDay()];}
function F(){return monthsLong[self.getMonth()];}
function g(){return self.getHours()>12?self.getHours()-12:self.getHours();}
function G(){return self.getHours();}
function h(){if(self.getHours()>12){var s=new String(self.getHours()-12);return s.length==1?"0"+(self.getHours()-12):self.getHours()-12;}else{var s=new String(self.getHours());return s.length==1?"0"+self.getHours():self.getHours();}}
function H(){return new String(self.getHours()).length==1?"0"+self.getHours():self.getHours();}
function i(){return new String(self.getMinutes()).length==1?"0"+self.getMinutes():self.getMinutes();}
function j(){return self.getDate();}
function l(){return daysLong[self.getDay()];}
function L(){var y_=Y();if((y_%4==0&&y_%100!=0)||(y_%4==0&&y_%100==0&&y_%400==0)){return 1;}else{return 0;}}
function m(){return self.getMonth()<9?"0"+(self.getMonth()+1):self.getMonth()+1;}
function M(){return monthsShort[self.getMonth()];}
function n(){return self.getMonth()+1;}
function O(){var os=Math.abs(self.getTimezoneOffset());var h=""+Math.floor(os/60);var m=""+(os%60);h.length==1?h="0"+h:1;m.length==1?m="0"+m:1;return self.getTimezoneOffset()<0?"+"+h+m:"-"+h+m;}
function r(){var r;r=D()+", "+j()+" "+M()+" "+Y()+" "+H()+":"+i()+":"+s()+" "+O();return r;}
function S(){return daysSuffix[self.getDate()-1];}
function s(){return new String(self.getSeconds()).length==1?"0"+self.getSeconds():self.getSeconds();}
function T(){var r;r=" ("+tz_code+")";return r;}
function t(){var daysinmonths=[null,31,28,31,30,31,30,31,31,30,31,30,31];if(L()==1&&n()==2)return 29;return daysinmonths[n()];}
function U(){return Math.round(self.getTime()/1000);}
function W(){var beforeNY=364+L()-z();var afterNY=z();var weekday=w()!=0?w()-1:6;if(beforeNY<=2&&weekday<=2-beforeNY){return 1;}
var ny=new Date("January 1 "+Y()+" 00:00:00");var nyDay=ny.getDay()!=0?ny.getDay()-1:6;if((afterNY<=2)&&(nyDay>=4)&&(afterNY>=(6-nyDay))){var prevNY=new Date("December 31 "+(Y()-1)+" 00:00:00");return prevNY.formatDate("W");}
if(nyDay<=3){return 1+Math.floor((z()+nyDay)/7);}else{return 1+Math.floor((z()-(7-nyDay))/7);}}
function w(){return self.getDay();}
function Y(){if(self.getFullYear){var newDate=new Date("January 1 2001 00:00:00 +0000");var x=newDate.getFullYear();if(x==2001){return self.getFullYear();}}
var x=self.getYear();var y=x%100;y+=(y<38)?2000:1900;return y;}
function y(){var y=Y()+"";return y.substring(y.length-2,y.length);}
function z(){var t=new Date("January 1 "+Y()+" 00:00:00");var diff=self.getTime()-t.getTime();return Math.floor(diff/1000/60/60/24);}
var self=this;if(time){var prevTime=self.getTime();self.setTime(time);}
var ia=input.split("");var ij=0;while(ia[ij]){if(ia[ij]=="\\"){ia.splice(ij,1);}else{if(switches.exists(ia[ij])){ia[ij]=eval(ia[ij]+"()");}}
ij++;}
if(prevTime){self.setTime(prevTime);}
return ia.join("");}
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
if(x.month||x.months){this.addMonths(x.month||x.months);}
if(x.year||x.years){this.addYears(x.year||x.years);}
if(x.day||x.days){this.addDays(x.day||x.days);}
return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
if(!x.second&&x.second!==0){x.second=-1;}
if(!x.minute&&x.minute!==0){x.minute=-1;}
if(!x.hour&&x.hour!==0){x.hour=-1;}
if(!x.day&&x.day!==0){x.day=-1;}
if(!x.month&&x.month!==0){x.month=-1;}
if(!x.year&&x.year!==0){x.year=-1;}
if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
if(x.timezone){this.setTimezone(x.timezone);}
if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
break;}
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
rx.push(r[0]);s=r[1];}
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){r=null;}
if(r){return r;}}
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
rx.push(r[0]);s=r[1];}
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
s=q[1];}
if(!r){throw new $P.Exception(s);}
if(q){throw new $P.Exception(q[1]);}
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
if(!last&&q[1].length===0){last=true;}
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
if(rx[1].length<best[1].length){best=rx;}
if(best[1].length===0){break;}}
if(best[0].length===0){return best;}
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
best[1]=q[1];}
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
if(this.now){return new Date();}
var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
if(!this.unit){this.unit="day";}
if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
this[this.unit+"s"]=this.value*orient;}
return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
if(this.month&&!this.day){this.day=1;}
return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
fn=_C[keys]=_.any.apply(null,px);}
return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};Array.prototype.exists=function(x)
{for(var i=0;i<this.length;i++){if(this[i]==x)return true;}
return false;}
Date.prototype.formatDate=function(input,time,tz_code){var switches=["a","A","B","d","D","F","g","G","h","H","i","j","l","L","m","M","n","O","r","s","S","t","U","w","W","y","Y","z","T"];var daysLong=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var daysShort=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var monthsLong=["January","February","March","April","May","June","July","August","September","October","November","December"];var daysSuffix=["st","nd","rd","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","st","nd","rd","th","th","th","th","th","th","th","st"];function a(){return self.getHours()>11?"pm":"am";}
function A(){return self.getHours()>11?"PM":"AM";}
function B(){var off=(self.getTimezoneOffset()+60)*60;var theSeconds=(self.getHours()*3600)+
(self.getMinutes()*60)+
self.getSeconds()+off;var beat=Math.floor(theSeconds/86.4);if(beat>1000)beat-=1000;if(beat<0)beat+=1000;if((""+beat).length==1)beat="00"+beat;if((""+beat).length==2)beat="0"+beat;return beat;}
function d(){return new String(self.getDate()).length==1?"0"+self.getDate():self.getDate();}
function D(){return daysShort[self.getDay()];}
function F(){return monthsLong[self.getMonth()];}
function g(){return self.getHours()>12?self.getHours()-12:self.getHours();}
function G(){return self.getHours();}
function h(){if(self.getHours()>12){var s=new String(self.getHours()-12);return s.length==1?"0"+(self.getHours()-12):self.getHours()-12;}else{var s=new String(self.getHours());return s.length==1?"0"+self.getHours():self.getHours();}}
function H(){return new String(self.getHours()).length==1?"0"+self.getHours():self.getHours();}
function i(){return new String(self.getMinutes()).length==1?"0"+self.getMinutes():self.getMinutes();}
function j(){return self.getDate();}
function l(){return daysLong[self.getDay()];}
function L(){var y_=Y();if((y_%4==0&&y_%100!=0)||(y_%4==0&&y_%100==0&&y_%400==0)){return 1;}else{return 0;}}
function m(){return self.getMonth()<9?"0"+(self.getMonth()+1):self.getMonth()+1;}
function M(){return monthsShort[self.getMonth()];}
function n(){return self.getMonth()+1;}
function O(){var os=Math.abs(self.getTimezoneOffset());var h=""+Math.floor(os/60);var m=""+(os%60);h.length==1?h="0"+h:1;m.length==1?m="0"+m:1;return self.getTimezoneOffset()<0?"+"+h+m:"-"+h+m;}
function r(){var r;r=D()+", "+j()+" "+M()+" "+Y()+" "+H()+":"+i()+":"+s()+" "+O();return r;}
function S(){return daysSuffix[self.getDate()-1];}
function s(){return new String(self.getSeconds()).length==1?"0"+self.getSeconds():self.getSeconds();}
function T(){var r;r=" ("+tz_code+")";return r;}
function t(){var daysinmonths=[null,31,28,31,30,31,30,31,31,30,31,30,31];if(L()==1&&n()==2)return 29;return daysinmonths[n()];}
function U(){return Math.round(self.getTime()/1000);}
function W(){var beforeNY=364+L()-z();var afterNY=z();var weekday=w()!=0?w()-1:6;if(beforeNY<=2&&weekday<=2-beforeNY){return 1;}
var ny=new Date("January 1 "+Y()+" 00:00:00");var nyDay=ny.getDay()!=0?ny.getDay()-1:6;if((afterNY<=2)&&(nyDay>=4)&&(afterNY>=(6-nyDay))){var prevNY=new Date("December 31 "+(Y()-1)+" 00:00:00");return prevNY.formatDate("W");}
if(nyDay<=3){return 1+Math.floor((z()+nyDay)/7);}else{return 1+Math.floor((z()-(7-nyDay))/7);}}
function w(){return self.getDay();}
function Y(){if(self.getFullYear){var newDate=new Date("January 1 2001 00:00:00 +0000");var x=newDate.getFullYear();if(x==2001){return self.getFullYear();}}
var x=self.getYear();var y=x%100;y+=(y<38)?2000:1900;return y;}
function y(){var y=Y()+"";return y.substring(y.length-2,y.length);}
function z(){var t=new Date("January 1 "+Y()+" 00:00:00");var diff=self.getTime()-t.getTime();return Math.floor(diff/1000/60/60/24);}
var self=this;if(time){var prevTime=self.getTime();self.setTime(time);}
var ia=input.split("");var ij=0;while(ia[ij]){if(ia[ij]=="\\"){ia.splice(ij,1);}else{if(switches.exists(ia[ij])){ia[ij]=eval(ia[ij]+"()");}}
ij++;}
if(prevTime){self.setTime(prevTime);}
return ia.join("");}
Date.prototype.timeUntil=function(laterDate)
{var t={swapped:false,years:0,months:0,weeks:0,days:0,weekDays:0,hours:0,minutes:0,seconds:0,milliseconds:0,total:0};var after=laterDate;var before=this;t.total=after-before;if(t.total<0)
{t.swapped=true;t.total=-t.total;var tmp=after;after=before;before=tmp;}
var backtrack=function()
{var thisYear=after.getFullYear();var thisMonth=after.getMonth();var lastMonth=(thisMonth==0?11:thisMonth-1);var daysInMonth=new Array(31,function(){if(thisYear%400==0||(thisYear%4==0&&thisYear%100!=0))return 29;return 28;}(),31,30,31,30,31,31,30,31,30,31);if(t.milliseconds<0)
{t.seconds--;t.milliseconds=1000+t.milliseconds;}
if(t.seconds<0)
{t.minutes--;t.seconds=60+t.seconds;}
if(t.minutes<0)
{t.hours--;t.minutes=60+t.minutes;}
if(t.hours<0)
{t.weekDays--;t.days--;t.hours=24+t.hours;}
if(t.weekDays<0)
{t.weeks--;t.weekDays=7+t.weekDays;}
if(t.weeks<0||t.days<0)
{if(after.getDate()==daysInMonth[thisMonth])
{t.days=0;}
else
{t.months--;t.days=daysInMonth[lastMonth]-before.getDate()+after.getDate();t.weeks=Math.floor(t.days/7);t.weekDays=t.days-(t.weeks*7);}}
if(t.months<0)
{t.years--;t.months=12+t.months;}};t.years=after.getFullYear()-before.getFullYear();t.months=after.getMonth()-before.getMonth();backtrack();t.days=after.getDate()-before.getDate();backtrack();t.weeks=Math.floor(t.days/7);t.weekDays=t.days-(t.weeks*7);t.hours=after.getHours()-before.getHours();backtrack();t.minutes=after.getMinutes()-before.getMinutes();backtrack();t.seconds=after.getSeconds()-before.getSeconds();backtrack();t.milliseconds=after.getMilliseconds()-before.getMilliseconds();backtrack();return t;};Date.prototype.timeSince=function(earlierDate)
{return earlierDate.timeUntil(this);};var DebugHelper=function()
{this.Active=true;this.ShowException=true;this.ShowURL=false;this.ShowLastModified=false;this.ShowReferrer=false;this.VerboseMode=false;this.DebugWindow=null;this.WindowStyle=new String("left=0,top=800,width=1024,height=100,scrollbars=yes,status=no,resizable=yes");this.WindowName=new String("JavascriptDebugWindow");this.WindowTitle=new String("Debug");}
DebugHelper.prototype.ShowWindow=function()
{try
{if(this.Active)
{this.CssStyleFile=new String(g_app_path+"branding/trakm8/css/style5.2.18a5.css");this.DebugWindow=window.open("",this.WindowName,this.WindowStyle);this.DebugWindow.opener=window;this.DebugWindow.document.open();this.DebugWindow.document.write("<html><head><title>"+this.WindowTitle+"</title>\n"+"<link rel='stylesheet' type='text/css' href='"+this.CssStyleFile+"' />\n"+"</head><body>\n"+"<div id='renderSurface' style='background-color:#000000;width: 100%; height: 100%;overflow:scroll'>"+"</div></body></html>\n");this.DebugWindow.document.close();}}
catch(ex)
{}}
DebugHelper.prototype.$Write=function(cssClass,message,url,lastModified,referrer)
{try
{if(this.Active)
{if(this.DebugWindow&&!this.DebugWindow.closed)
{var msg=message;if(this.ShowURL&&url!=null)
msg+=" at "+url;if(this.ShowLastModified&&lastModified!=null)
msg+=" last modified in "+lastModified;if(this.ShowReferrer&&referrer!=null)
msg+=" referrer "+referrer;this.DebugWindow.document.getElementById("renderSurface").innerHTML="<span class='"+cssClass+"'>"+msg+"<br></span>"+this.DebugWindow.document.getElementById("renderSurface").innerHTML;}}}
catch(ex)
{}}
DebugHelper.prototype.Verbose=function(message)
{try
{this.$Write("debugVerbose",message,document.URL,document.lastModified,document.referrer);}
catch(ex)
{}}
DebugHelper.prototype.Message=function(message)
{try
{this.$Write("debugMessage",message,document.URL,document.lastModified,document.referrer);}
catch(ex)
{}}
DebugHelper.prototype.ServerMessage=function(message)
{try
{this.$Write("debugServerMessage",message,document.URL,document.lastModified,document.referrer);}
catch(ex)
{}}
DebugHelper.prototype.Warn=function(message)
{try
{this.$Write("debugWarn",message,document.URL,document.lastModified,document.referrer);}
catch(ex)
{}}
DebugHelper.prototype.Exception=function(message)
{try
{if(this.ShowException)
{this.$Write("debugException",message,document.URL,document.lastModified,document.referrer);}}
catch(ex)
{}}
DebugHelper.prototype.HideWindow=function()
{try
{if(this.DebugWindow&&!this.DebugWindow.closed)
{this.DebugWindow.close();this.DebugWindow=null;}}
catch(ex)
{}}
var debugHelper=new DebugHelper();function WindowOnError(msg,url,line)
{if(debugHelper)
{debugHelper.Exception(msg);}}
window.onerror=WindowOnError;function _FUNC(f)
{if(!js_debug)return"";var tmp=f.toString();var re=/(\s*function\s+)(\w+)(\s*\()/m;re.exec(tmp);return RegExp.$2;}
(function(window,undefined){var document=window.document,navigator=window.navigator,location=window.location;var jQuery=(function(){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery);},_jQuery=window.jQuery,_$=window.$,rootjQuery,quickExpr=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,rnotwhite=/\S/,trimLeft=/^\s+/,trimRight=/\s+$/,rdigit=/\d/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,rvalidchars=/^[\],:{}\s]*$/,rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rwebkit=/(webkit)[ \/]([\w.]+)/,ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/,rmsie=/(msie) ([\w.]+)/,rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/,userAgent=navigator.userAgent,browserMatch,readyList,DOMContentLoaded,toString=Object.prototype.toString,hasOwn=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,trim=String.prototype.trim,indexOf=Array.prototype.indexOf,class2type={};jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem,ret,doc;if(!selector){return this;}
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}
if(selector==="body"&&!context&&document.body){this.context=document;this[0]=document.body;this.selector=selector;this.length=1;return this;}
if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null];}else{match=quickExpr.exec(selector);}
if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true);}else{selector=[doc.createElement(ret[1])];}}else{ret=jQuery.buildFragment([match[1]],[doc]);selector=(ret.cacheable?jQuery.clone(ret.fragment):ret.fragment).childNodes;}
return jQuery.merge(this,selector);}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return this.constructor(context).find(selector);}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length;},toArray:function(){return slice.call(this,0);},get:function(num){return num==null?this.toArray():(num<0?this[this.length+num]:this[num]);},pushStack:function(elems,name,selector){var ret=this.constructor();if(jQuery.isArray(elems)){push.apply(ret,elems);}else{jQuery.merge(ret,elems);}
ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector;}else if(name){ret.selector=this.selector+"."+name+"("+selector+")";}
return ret;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.bindReady();readyList.done(fn);return this;},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||this.constructor(null);},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[];}else{clone=src&&jQuery.isPlainObject(src)?src:{};}
target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({noConflict:function(deep){if(window.$===jQuery){window.$=_$;}
if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}
return jQuery;},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}},ready:function(wait){if((wait===true&&!--jQuery.readyWait)||(wait!==true&&!jQuery.isReady)){if(!document.body){return setTimeout(jQuery.ready,1);}
jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return;}
readyList.resolveWith(document,[jQuery]);if(jQuery.fn.trigger){jQuery(document).trigger("ready").unbind("ready");}}},bindReady:function(){if(readyList){return;}
readyList=jQuery._Deferred();if(document.readyState==="complete"){return setTimeout(jQuery.ready,1);}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null;}catch(e){}
if(document.documentElement.doScroll&&toplevel){doScrollCheck();}}},isFunction:function(obj){return jQuery.type(obj)==="function";},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array";},isWindow:function(obj){return obj&&typeof obj==="object"&&"setInterval"in obj;},isNaN:function(obj){return obj==null||!rdigit.test(obj)||isNaN(obj);},type:function(obj){return obj==null?String(obj):class2type[toString.call(obj)]||"object";},isPlainObject:function(obj){if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false;}
if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false;}
var key;for(key in obj){}
return key===undefined||hasOwn.call(obj,key);},isEmptyObject:function(obj){for(var name in obj){return false;}
return true;},error:function(msg){throw msg;},parseJSON:function(data){if(typeof data!=="string"||!data){return null;}
data=jQuery.trim(data);if(window.JSON&&window.JSON.parse){return window.JSON.parse(data);}
if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return(new Function("return "+data))();}
jQuery.error("Invalid JSON: "+data);},parseXML:function(data,xml,tmp){if(window.DOMParser){tmp=new DOMParser();xml=tmp.parseFromString(data,"text/xml");}else{xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data);}
tmp=xml.documentElement;if(!tmp||!tmp.nodeName||tmp.nodeName==="parsererror"){jQuery.error("Invalid XML: "+data);}
return xml;},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){(window.execScript||function(data){window["eval"].call(window,data);})(data);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break;}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break;}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break;}}}else{for(;i<length;){if(callback.call(object[i],i,object[i++])===false){break;}}}}
return object;},trim:trim?function(text){return text==null?"":trim.call(text);}:function(text){return text==null?"":text.toString().replace(trimLeft,"").replace(trimRight,"");},makeArray:function(array,results){var ret=results||[];if(array!=null){var type=jQuery.type(array);if(array.length==null||type==="string"||type==="function"||type==="regexp"||jQuery.isWindow(array)){push.call(ret,array);}else{jQuery.merge(ret,array);}}
return ret;},inArray:function(elem,array){if(indexOf){return indexOf.call(array,elem);}
for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i;}}
return-1;},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var ret=[],retVal;inv=!!inv;for(var i=0,length=elems.length;i<length;i++){retVal=!!callback(elems[i],i);if(inv!==retVal){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var value,key,ret=[],i=0,length=elems.length,isArray=elems instanceof jQuery||length!==undefined&&typeof length==="number"&&((length>0&&elems[0]&&elems[length-1])||length===0||jQuery.isArray(elems));if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}}else{for(key in elems){value=callback(elems[key],key,arg);if(value!=null){ret[ret.length]=value;}}}
return ret.concat.apply([],ret);},guid:1,proxy:function(fn,context){if(typeof context==="string"){var tmp=fn[context];context=fn;fn=tmp;}
if(!jQuery.isFunction(fn)){return undefined;}
var args=slice.call(arguments,2),proxy=function(){return fn.apply(context,args.concat(slice.call(arguments)));};proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;return proxy;},access:function(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){jQuery.access(elems,k,key[k],exec,fn,value);}
return elems;}
if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass);}
return elems;}
return length?fn(elems[0],key):undefined;},now:function(){return(new Date()).getTime();},uaMatch:function(ua){ua=ua.toLowerCase();var match=rwebkit.exec(ua)||ropera.exec(ua)||rmsie.exec(ua)||ua.indexOf("compatible")<0&&rmozilla.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};},sub:function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context);}
jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context);}
return jQuery.fn.init.call(this,selector,context,rootjQuerySub);};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);return jQuerySub;},browser:{}});jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase();});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version;}
if(jQuery.browser.webkit){jQuery.browser.safari=true;}
if(rnotwhite.test("\xA0")){trimLeft=/^[\s\xA0]+/;trimRight=/[\s\xA0]+$/;}
rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready();};}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready();}};}
function doScrollCheck(){if(jQuery.isReady){return;}
try{document.documentElement.doScroll("left");}catch(e){setTimeout(doScrollCheck,1);return;}
jQuery.ready();}
return jQuery;})();var
promiseMethods="done fail isResolved isRejected promise then always pipe".split(" "),sliceDeferred=[].slice;jQuery.extend({_Deferred:function(){var
callbacks=[],fired,firing,cancelled,deferred={done:function(){if(!cancelled){var args=arguments,i,length,elem,type,_fired;if(fired){_fired=fired;fired=0;}
for(i=0,length=args.length;i<length;i++){elem=args[i];type=jQuery.type(elem);if(type==="array"){deferred.done.apply(deferred,elem);}else if(type==="function"){callbacks.push(elem);}}
if(_fired){deferred.resolveWith(_fired[0],_fired[1]);}}
return this;},resolveWith:function(context,args){if(!cancelled&&!fired&&!firing){args=args||[];firing=1;try{while(callbacks[0]){callbacks.shift().apply(context,args);}}
finally{fired=[context,args];firing=0;}}
return this;},resolve:function(){deferred.resolveWith(this,arguments);return this;},isResolved:function(){return!!(firing||fired);},cancel:function(){cancelled=1;callbacks=[];return this;}};return deferred;},Deferred:function(func){var deferred=jQuery._Deferred(),failDeferred=jQuery._Deferred(),promise;jQuery.extend(deferred,{then:function(doneCallbacks,failCallbacks){deferred.done(doneCallbacks).fail(failCallbacks);return this;},always:function(){return deferred.done.apply(deferred,arguments).fail.apply(this,arguments);},fail:failDeferred.done,rejectWith:failDeferred.resolveWith,reject:failDeferred.resolve,isRejected:failDeferred.isResolved,pipe:function(fnDone,fnFail){return jQuery.Deferred(function(newDefer){jQuery.each({done:[fnDone,"resolve"],fail:[fnFail,"reject"]},function(handler,data){var fn=data[0],action=data[1],returned;if(jQuery.isFunction(fn)){deferred[handler](function(){returned=fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().then(newDefer.resolve,newDefer.reject);}else{newDefer[action](returned);}});}else{deferred[handler](newDefer[action]);}});}).promise();},promise:function(obj){if(obj==null){if(promise){return promise;}
promise=obj={};}
var i=promiseMethods.length;while(i--){obj[promiseMethods[i]]=deferred[promiseMethods[i]];}
return obj;}});deferred.done(failDeferred.cancel).fail(deferred.cancel);delete deferred.cancel;if(func){func.call(deferred,deferred);}
return deferred;},when:function(firstParam){var args=arguments,i=0,length=args.length,count=length,deferred=length<=1&&firstParam&&jQuery.isFunction(firstParam.promise)?firstParam:jQuery.Deferred();function resolveFunc(i){return function(value){args[i]=arguments.length>1?sliceDeferred.call(arguments,0):value;if(!(--count)){deferred.resolveWith(deferred,sliceDeferred.call(args,0));}};}
if(length>1){for(;i<length;i++){if(args[i]&&jQuery.isFunction(args[i].promise)){args[i].promise().then(resolveFunc(i),deferred.reject);}else{--count;}}
if(!count){deferred.resolveWith(deferred,args);}}else if(deferred!==firstParam){deferred.resolveWith(deferred,length?[firstParam]:[]);}
return deferred.promise();}});jQuery.support=(function(){var div=document.createElement("div"),documentElement=document.documentElement,all,a,select,opt,input,marginDiv,support,fragment,body,bodyStyle,tds,events,eventName,i,isSupported;div.setAttribute("className","t");div.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return{};}
select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];support={leadingWhitespace:(div.firstChild.nodeType===3),tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:(a.getAttribute("href")==="/a"),opacity:/^0.55$/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:(input.value==="on"),optSelected:opt.selected,getSetAttribute:div.className!=="t",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;select.disabled=true;support.optDisabled=!opt.disabled;try{delete div.test;}catch(e){support.deleteExpando=false;}
if(!div.addEventListener&&div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function click(){support.noCloneEvent=false;div.detachEvent("onclick",click);});div.cloneNode(true).fireEvent("onclick");}
input=document.createElement("input");input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","checked");div.appendChild(input);fragment=document.createDocumentFragment();fragment.appendChild(div.firstChild);support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="";div.style.width=div.style.paddingLeft="1px";body=document.createElement("body");bodyStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(i in bodyStyle){body.style[i]=bodyStyle[i];}
body.appendChild(div);documentElement.insertBefore(body,documentElement.firstChild);support.appendChecked=input.checked;support.boxModel=div.offsetWidth===2;if("zoom"in div.style){div.style.display="inline";div.style.zoom=1;support.inlineBlockNeedsLayout=(div.offsetWidth===2);div.style.display="";div.innerHTML="<div style='width:4px;'></div>";support.shrinkWrapBlocks=(div.offsetWidth!==2);}
div.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";tds=div.getElementsByTagName("td");isSupported=(tds[0].offsetHeight===0);tds[0].style.display="";tds[1].style.display="none";support.reliableHiddenOffsets=isSupported&&(tds[0].offsetHeight===0);div.innerHTML="";if(document.defaultView&&document.defaultView.getComputedStyle){marginDiv=document.createElement("div");marginDiv.style.width="0";marginDiv.style.marginRight="0";div.appendChild(marginDiv);support.reliableMarginRight=(parseInt((document.defaultView.getComputedStyle(marginDiv,null)||{marginRight:0}).marginRight,10)||0)===0;}
body.innerHTML="";documentElement.removeChild(body);if(div.attachEvent){for(i in{submit:1,change:1,focusin:1}){eventName="on"+i;isSupported=(eventName in div);if(!isSupported){div.setAttribute(eventName,"return;");isSupported=(typeof div[eventName]==="function");}
support[i+"Bubbles"]=isSupported;}}
return support;})();jQuery.boxModel=jQuery.support.boxModel;var rbrace=/^(?:\{.*\}|\[.*\])$/,rmultiDash=/([a-z])([A-Z])/g;jQuery.extend({cache:{},uuid:0,expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),noData:{"embed":true,"object":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000","applet":true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem);},data:function(elem,name,data,pvt){if(!jQuery.acceptData(elem)){return;}
var internalKey=jQuery.expando,getByName=typeof name==="string",thisCache,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:elem[jQuery.expando]&&jQuery.expando;if((!id||(pvt&&id&&!cache[id][internalKey]))&&getByName&&data===undefined){return;}
if(!id){if(isNode){elem[jQuery.expando]=id=++jQuery.uuid;}else{id=jQuery.expando;}}
if(!cache[id]){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop;}}
if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id][internalKey]=jQuery.extend(cache[id][internalKey],name);}else{cache[id]=jQuery.extend(cache[id],name);}}
thisCache=cache[id];if(pvt){if(!thisCache[internalKey]){thisCache[internalKey]={};}
thisCache=thisCache[internalKey];}
if(data!==undefined){thisCache[jQuery.camelCase(name)]=data;}
if(name==="events"&&!thisCache[name]){return thisCache[internalKey]&&thisCache[internalKey].events;}
return getByName?thisCache[jQuery.camelCase(name)]:thisCache;},removeData:function(elem,name,pvt){if(!jQuery.acceptData(elem)){return;}
var internalKey=jQuery.expando,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:jQuery.expando;if(!cache[id]){return;}
if(name){var thisCache=pvt?cache[id][internalKey]:cache[id];if(thisCache){delete thisCache[name];if(!isEmptyDataObject(thisCache)){return;}}}
if(pvt){delete cache[id][internalKey];if(!isEmptyDataObject(cache[id])){return;}}
var internalCache=cache[id][internalKey];if(jQuery.support.deleteExpando||cache!=window){delete cache[id];}else{cache[id]=null;}
if(internalCache){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop;}
cache[id][internalKey]=internalCache;}else if(isNode){if(jQuery.support.deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}else{elem[jQuery.expando]=null;}}},_data:function(elem,name,data){return jQuery.data(elem,name,data,true);},acceptData:function(elem){if(elem.nodeName){var match=jQuery.noData[elem.nodeName.toLowerCase()];if(match){return!(match===true||elem.getAttribute("classid")!==match);}}
return true;}});jQuery.fn.extend({data:function(key,value){var data=null;if(typeof key==="undefined"){if(this.length){data=jQuery.data(this[0]);if(this[0].nodeType===1){var attr=this[0].attributes,name;for(var i=0,l=attr.length;i<l;i++){name=attr[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.substring(5));dataAttr(this[0],name,data[name]);}}}}
return data;}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);data=dataAttr(this[0],key,data);}
return data===undefined&&parts[1]?this.data(parts[0]):data;}else{return this.each(function(){var $this=jQuery(this),args=[parts[0],value];$this.triggerHandler("setData"+parts[1]+"!",args);jQuery.data(this,key,value);$this.triggerHandler("changeData"+parts[1]+"!",args);});}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});function dataAttr(elem,key,data){if(data===undefined&&elem.nodeType===1){var name="data-"+key.replace(rmultiDash,"$1-$2").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:!jQuery.isNaN(data)?parseFloat(data):rbrace.test(data)?jQuery.parseJSON(data):data;}catch(e){}
jQuery.data(elem,key,data);}else{data=undefined;}}
return data;}
function isEmptyDataObject(obj){for(var name in obj){if(name!=="toJSON"){return false;}}
return true;}
function handleQueueMarkDefer(elem,type,src){var deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",defer=jQuery.data(elem,deferDataKey,undefined,true);if(defer&&(src==="queue"||!jQuery.data(elem,queueDataKey,undefined,true))&&(src==="mark"||!jQuery.data(elem,markDataKey,undefined,true))){setTimeout(function(){if(!jQuery.data(elem,queueDataKey,undefined,true)&&!jQuery.data(elem,markDataKey,undefined,true)){jQuery.removeData(elem,deferDataKey,true);defer.resolve();}},0);}}
jQuery.extend({_mark:function(elem,type){if(elem){type=(type||"fx")+"mark";jQuery.data(elem,type,(jQuery.data(elem,type,undefined,true)||0)+1,true);}},_unmark:function(force,elem,type){if(force!==true){type=elem;elem=force;force=false;}
if(elem){type=type||"fx";var key=type+"mark",count=force?0:((jQuery.data(elem,key,undefined,true)||1)-1);if(count){jQuery.data(elem,key,count,true);}else{jQuery.removeData(elem,key,true);handleQueueMarkDefer(elem,type,"mark");}}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type,undefined,true);if(data){if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data),true);}else{q.push(data);}}
return q||[];}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift(),defer;if(fn==="inprogress"){fn=queue.shift();}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
fn.call(elem,function(){jQuery.dequeue(elem,type);});}
if(!queue.length){jQuery.removeData(elem,type+"queue",true);handleQueueMarkDefer(elem,type,"queue");}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined){return jQuery.queue(this[0],type);}
return this.each(function(){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type);},time);});},clearQueue:function(type){return this.queue(type||"fx",[]);},promise:function(type,object){if(typeof type!=="string"){object=type;type=undefined;}
type=type||"fx";var defer=jQuery.Deferred(),elements=this,i=elements.length,count=1,deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",tmp;function resolve(){if(!(--count)){defer.resolveWith(elements,[elements]);}}
while(i--){if((tmp=jQuery.data(elements[i],deferDataKey,undefined,true)||(jQuery.data(elements[i],queueDataKey,undefined,true)||jQuery.data(elements[i],markDataKey,undefined,true))&&jQuery.data(elements[i],deferDataKey,jQuery._Deferred(),true))){count++;tmp.done(resolve);}}
resolve();return defer.promise();}});var rclass=/[\n\t\r]/g,rspace=/\s+/,rreturn=/\r/g,rtype=/^(?:button|input)$/i,rfocusable=/^(?:button|input|object|select|textarea)$/i,rclickable=/^a(?:rea)?$/i,rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,rinvalidChar=/\:/,formHook,boolHook;jQuery.fn.extend({attr:function(name,value){return jQuery.access(this,name,value,true,jQuery.attr);},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name);});},prop:function(name,value){return jQuery.access(this,name,value,true,jQuery.prop);},removeProp:function(name){name=jQuery.propFix[name]||name;return this.each(function(){try{this[name]=undefined;delete this[name];}catch(e){}});},addClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.addClass(value.call(this,i,self.attr("class")||""));});}
if(value&&typeof value==="string"){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1){if(!elem.className){elem.className=value;}else{var className=" "+elem.className+" ",setClass=elem.className;for(var c=0,cl=classNames.length;c<cl;c++){if(className.indexOf(" "+classNames[c]+" ")<0){setClass+=" "+classNames[c];}}
elem.className=jQuery.trim(setClass);}}}}
return this;},removeClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.removeClass(value.call(this,i,self.attr("class")));});}
if((value&&typeof value==="string")||value===undefined){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1&&elem.className){if(value){var className=(" "+elem.className+" ").replace(rclass," ");for(var c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ");}
elem.className=jQuery.trim(className);}else{elem.className="";}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.toggleClass(value.call(this,i,self.attr("class"),stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery._data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery._data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ";for(var i=0,l=this.length;i<l;i++){if((" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;},val:function(value){var hooks,ret,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.nodeName.toLowerCase()]||jQuery.valHooks[elem.type];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret;}
return(elem.value||"").replace(rreturn,"");}
return undefined;}
var isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}else{val=value;}
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+"";});}
hooks=jQuery.valHooks[this.nodeName.toLowerCase()]||jQuery.valHooks[this.type];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val;}});}});jQuery.extend({valHooks:{option:{get:function(elem){var val=elem.attributes.value;return!val||val.specified?elem.value:elem.text;}},select:{get:function(elem){var value,index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null;}
for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected&&(jQuery.support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
if(one&&!values.length&&options.length){return jQuery(options[index]).val();}
return values;},set:function(elem,value){var values=jQuery.makeArray(value);jQuery(elem).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){elem.selectedIndex=-1;}
return values;}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attrFix:{tabindex:"tabIndex"},attr:function(elem,name,value,pass){var nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return undefined;}
if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value);}
if(!("getAttribute"in elem)){return jQuery.prop(elem,name,value);}
var ret,hooks,notxml=nType!==1||!jQuery.isXMLDoc(elem);name=notxml&&jQuery.attrFix[name]||name;hooks=jQuery.attrHooks[name];if(!hooks){if(rboolean.test(name)&&(typeof value==="boolean"||value===undefined||value.toLowerCase()===name.toLowerCase())){hooks=boolHook;}else if(formHook&&(jQuery.nodeName(elem,"form")||rinvalidChar.test(name))){hooks=formHook;}}
if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return undefined;}else if(hooks&&"set"in hooks&&notxml&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{elem.setAttribute(name,""+value);return value;}}else if(hooks&&"get"in hooks&&notxml){return hooks.get(elem,name);}else{ret=elem.getAttribute(name);return ret===null?undefined:ret;}},removeAttr:function(elem,name){var propName;if(elem.nodeType===1){name=jQuery.attrFix[name]||name;if(jQuery.support.getSetAttribute){elem.removeAttribute(name);}else{jQuery.attr(elem,name,"");elem.removeAttributeNode(elem.getAttributeNode(name));}
if(rboolean.test(name)&&(propName=jQuery.propFix[name]||name)in elem){elem[propName]=false;}}},attrHooks:{type:{set:function(elem,value){if(rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed");}else if(!jQuery.support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}
return value;}}},tabIndex:{get:function(elem){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?parseInt(attributeNode.value,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(elem,name,value){var nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return undefined;}
var ret,hooks,notxml=nType!==1||!jQuery.isXMLDoc(elem);name=notxml&&jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{return(elem[name]=value);}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==undefined){return ret;}else{return elem[name];}}},propHooks:{}});boolHook={get:function(elem,name){return elem[jQuery.propFix[name]||name]?name.toLowerCase():undefined;},set:function(elem,value,name){var propName;if(value===false){jQuery.removeAttr(elem,name);}else{propName=jQuery.propFix[name]||name;if(propName in elem){elem[propName]=value;}
elem.setAttribute(name,name.toLowerCase());}
return name;}};jQuery.attrHooks.value={get:function(elem,name){if(formHook&&jQuery.nodeName(elem,"button")){return formHook.get(elem,name);}
return elem.value;},set:function(elem,value,name){if(formHook&&jQuery.nodeName(elem,"button")){return formHook.set(elem,value,name);}
elem.value=value;}};if(!jQuery.support.getSetAttribute){jQuery.attrFix=jQuery.propFix;formHook=jQuery.attrHooks.name=jQuery.valHooks.button={get:function(elem,name){var ret;ret=elem.getAttributeNode(name);return ret&&ret.nodeValue!==""?ret.nodeValue:undefined;},set:function(elem,value,name){var ret=elem.getAttributeNode(name);if(ret){ret.nodeValue=value;return value;}}};jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{set:function(elem,value){if(value===""){elem.setAttribute(name,"auto");return value;}}});});}
if(!jQuery.support.hrefNormalized){jQuery.each(["href","src","width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{get:function(elem){var ret=elem.getAttribute(name,2);return ret===null?undefined:ret;}});});}
if(!jQuery.support.style){jQuery.attrHooks.style={get:function(elem){return elem.style.cssText.toLowerCase()||undefined;},set:function(elem,value){return(elem.style.cssText=""+value);}};}
if(!jQuery.support.optSelected){jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}});}
if(!jQuery.support.checkOn){jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(elem){return elem.getAttribute("value")===null?"on":elem.value;}};});}
jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(elem,value){if(jQuery.isArray(value)){return(elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0);}}});});var hasOwn=Object.prototype.hasOwnProperty,rnamespaces=/\.(.*)$/,rformElems=/^(?:textarea|input|select)$/i,rperiod=/\./g,rspaces=/ /g,rescape=/[^\w\s.|`]/g,fcleanup=function(nm){return nm.replace(rescape,"\\$&");};jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType===3||elem.nodeType===8){return;}
if(handler===false){handler=returnFalse;}else if(!handler){return;}
var handleObjIn,handleObj;if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;}
if(!handler.guid){handler.guid=jQuery.guid++;}
var elemData=jQuery._data(elem);if(!elemData){return;}
var events=elemData.events,eventHandle=elemData.handle;if(!events){elemData.events=events={};}
if(!eventHandle){elemData.handle=eventHandle=function(e){return typeof jQuery!=="undefined"&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.handle.apply(eventHandle.elem,arguments):undefined;};}
eventHandle.elem=elem;types=types.split(" ");var type,i=0,namespaces;while((type=types[i++])){handleObj=handleObjIn?jQuery.extend({},handleObjIn):{handler:handler,data:data};if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();handleObj.namespace=namespaces.slice(0).sort().join(".");}else{namespaces=[];handleObj.namespace="";}
handleObj.type=type;if(!handleObj.guid){handleObj.guid=handler.guid;}
var handlers=events[type],special=jQuery.event.special[type]||{};if(!handlers){handlers=events[type]=[];if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
handlers.push(handleObj);jQuery.event.global[type]=true;}
elem=null;},global:{},remove:function(elem,types,handler,pos){if(elem.nodeType===3||elem.nodeType===8){return;}
if(handler===false){handler=returnFalse;}
var ret,type,fn,j,i=0,all,namespaces,namespace,special,eventType,handleObj,origType,elemData=jQuery.hasData(elem)&&jQuery._data(elem),events=elemData&&elemData.events;if(!elemData||!events){return;}
if(types&&types.type){handler=types.handler;types=types.type;}
if(!types||typeof types==="string"&&types.charAt(0)==="."){types=types||"";for(type in events){jQuery.event.remove(elem,type+types);}
return;}
types=types.split(" ");while((type=types[i++])){origType=type;handleObj=null;all=type.indexOf(".")<0;namespaces=[];if(!all){namespaces=type.split(".");type=namespaces.shift();namespace=new RegExp("(^|\\.)"+
jQuery.map(namespaces.slice(0).sort(),fcleanup).join("\\.(?:.*\\.)?")+"(\\.|$)");}
eventType=events[type];if(!eventType){continue;}
if(!handler){for(j=0;j<eventType.length;j++){handleObj=eventType[j];if(all||namespace.test(handleObj.namespace)){jQuery.event.remove(elem,origType,handleObj.handler,j);eventType.splice(j--,1);}}
continue;}
special=jQuery.event.special[type]||{};for(j=pos||0;j<eventType.length;j++){handleObj=eventType[j];if(handler.guid===handleObj.guid){if(all||namespace.test(handleObj.namespace)){if(pos==null){eventType.splice(j--,1);}
if(special.remove){special.remove.call(elem,handleObj);}}
if(pos!=null){break;}}}
if(eventType.length===0||pos!=null&&eventType.length===1){if(!special.teardown||special.teardown.call(elem,namespaces)===false){jQuery.removeEvent(elem,type,elemData.handle);}
ret=null;delete events[type];}}
if(jQuery.isEmptyObject(events)){var handle=elemData.handle;if(handle){handle.elem=null;}
delete elemData.events;delete elemData.handle;if(jQuery.isEmptyObject(elemData)){jQuery.removeData(elem,undefined,true);}}},customEvent:{"getData":true,"setData":true,"changeData":true},trigger:function(event,data,elem,onlyHandlers){var type=event.type||event,namespaces=[],exclusive;if(type.indexOf("!")>=0){type=type.slice(0,-1);exclusive=true;}
if(type.indexOf(".")>=0){namespaces=type.split(".");type=namespaces.shift();namespaces.sort();}
if((!elem||jQuery.event.customEvent[type])&&!jQuery.event.global[type]){return;}
event=typeof event==="object"?event[jQuery.expando]?event:new jQuery.Event(type,event):new jQuery.Event(type);event.type=type;event.exclusive=exclusive;event.namespace=namespaces.join(".");event.namespace_re=new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.)?")+"(\\.|$)");if(onlyHandlers||!elem){event.preventDefault();event.stopPropagation();}
if(!elem){jQuery.each(jQuery.cache,function(){var internalKey=jQuery.expando,internalCache=this[internalKey];if(internalCache&&internalCache.events&&internalCache.events[type]){jQuery.event.trigger(event,data,internalCache.handle.elem);}});return;}
if(elem.nodeType===3||elem.nodeType===8){return;}
event.result=undefined;event.target=elem;data=data?jQuery.makeArray(data):[];data.unshift(event);var cur=elem,ontype=type.indexOf(":")<0?"on"+type:"";do{var handle=jQuery._data(cur,"handle");event.currentTarget=cur;if(handle){handle.apply(cur,data);}
if(ontype&&jQuery.acceptData(cur)&&cur[ontype]&&cur[ontype].apply(cur,data)===false){event.result=false;event.preventDefault();}
cur=cur.parentNode||cur.ownerDocument||cur===event.target.ownerDocument&&window;}while(cur&&!event.isPropagationStopped());if(!event.isDefaultPrevented()){var old,special=jQuery.event.special[type]||{};if((!special._default||special._default.call(elem.ownerDocument,event)===false)&&!(type==="click"&&jQuery.nodeName(elem,"a"))&&jQuery.acceptData(elem)){try{if(ontype&&elem[type]){old=elem[ontype];if(old){elem[ontype]=null;}
jQuery.event.triggered=type;elem[type]();}}catch(ieError){}
if(old){elem[ontype]=old;}
jQuery.event.triggered=undefined;}}
return event.result;},handle:function(event){event=jQuery.event.fix(event||window.event);var handlers=((jQuery._data(this,"events")||{})[event.type]||[]).slice(0),run_all=!event.exclusive&&!event.namespace,args=Array.prototype.slice.call(arguments,0);args[0]=event;event.currentTarget=this;for(var j=0,l=handlers.length;j<l;j++){var handleObj=handlers[j];if(run_all||event.namespace_re.test(handleObj.namespace)){event.handler=handleObj.handler;event.data=handleObj.data;event.handleObj=handleObj;var ret=handleObj.handler.apply(this,args);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped()){break;}}}
return event.result;},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[jQuery.expando]){return event;}
var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=event.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}
if(event.pageX==null&&event.clientX!=null){var eventDocument=event.target.ownerDocument||document,doc=eventDocument.documentElement,body=eventDocument.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(event.which==null&&(event.charCode!=null||event.keyCode!=null)){event.which=event.charCode!=null?event.charCode:event.keyCode;}
if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey;}
if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));}
return event;},guid:1E8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(handleObj){jQuery.event.add(this,liveConvert(handleObj.origType,handleObj.selector),jQuery.extend({},handleObj,{handler:liveHandler,guid:handleObj.handler.guid}));},remove:function(handleObj){jQuery.event.remove(this,liveConvert(handleObj.origType,handleObj.selector),handleObj);}},beforeunload:{setup:function(data,namespaces,eventHandle){if(jQuery.isWindow(this)){this.onbeforeunload=eventHandle;}},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null;}}}}};jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false);}}:function(elem,type,handle){if(elem.detachEvent){elem.detachEvent("on"+type,handle);}};jQuery.Event=function(src,props){if(!this.preventDefault){return new jQuery.Event(src,props);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=(src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault())?returnTrue:returnFalse;}else{this.type=src;}
if(props){jQuery.extend(this,props);}
this.timeStamp=jQuery.now();this[jQuery.expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;event.type=event.data;try{if(parent&&parent!==document&&!parent.parentNode){return;}
while(parent&&parent!==this){parent=parent.parentNode;}
if(parent!==this){jQuery.event.handle.apply(this,arguments);}}catch(e){}},delegate=function(event){event.type=event.data;jQuery.event.handle.apply(this,arguments);};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={setup:function(data){jQuery.event.add(this,fix,data&&data.selector?delegate:withinElement,orig);},teardown:function(data){jQuery.event.remove(this,fix,data&&data.selector?delegate:withinElement);}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(data,namespaces){if(!jQuery.nodeName(this,"form")){jQuery.event.add(this,"click.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="submit"||type==="image")&&jQuery(elem).closest("form").length){trigger("submit",this,arguments);}});jQuery.event.add(this,"keypress.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="text"||type==="password")&&jQuery(elem).closest("form").length&&e.keyCode===13){trigger("submit",this,arguments);}});}else{return false;}},teardown:function(namespaces){jQuery.event.remove(this,".specialSubmit");}};}
if(!jQuery.support.changeBubbles){var changeFilters,getVal=function(elem){var type=elem.type,val=elem.value;if(type==="radio"||type==="checkbox"){val=elem.checked;}else if(type==="select-multiple"){val=elem.selectedIndex>-1?jQuery.map(elem.options,function(elem){return elem.selected;}).join("-"):"";}else if(jQuery.nodeName(elem,"select")){val=elem.selectedIndex;}
return val;},testChange=function testChange(e){var elem=e.target,data,val;if(!rformElems.test(elem.nodeName)||elem.readOnly){return;}
data=jQuery._data(elem,"_change_data");val=getVal(elem);if(e.type!=="focusout"||elem.type!=="radio"){jQuery._data(elem,"_change_data",val);}
if(data===undefined||val===data){return;}
if(data!=null||val){e.type="change";e.liveFired=undefined;jQuery.event.trigger(e,arguments[1],elem);}};jQuery.event.special.change={filters:{focusout:testChange,beforedeactivate:testChange,click:function(e){var elem=e.target,type=jQuery.nodeName(elem,"input")?elem.type:"";if(type==="radio"||type==="checkbox"||jQuery.nodeName(elem,"select")){testChange.call(this,e);}},keydown:function(e){var elem=e.target,type=jQuery.nodeName(elem,"input")?elem.type:"";if((e.keyCode===13&&!jQuery.nodeName(elem,"textarea"))||(e.keyCode===32&&(type==="checkbox"||type==="radio"))||type==="select-multiple"){testChange.call(this,e);}},beforeactivate:function(e){var elem=e.target;jQuery._data(elem,"_change_data",getVal(elem));}},setup:function(data,namespaces){if(this.type==="file"){return false;}
for(var type in changeFilters){jQuery.event.add(this,type+".specialChange",changeFilters[type]);}
return rformElems.test(this.nodeName);},teardown:function(namespaces){jQuery.event.remove(this,".specialChange");return rformElems.test(this.nodeName);}};changeFilters=jQuery.event.special.change.filters;changeFilters.focus=changeFilters.beforeactivate;}
function trigger(type,elem,args){var event=jQuery.extend({},args[0]);event.type=type;event.originalEvent={};event.liveFired=undefined;jQuery.event.handle.call(elem,event);if(event.isDefaultPrevented()){args[0].preventDefault();}}
if(!jQuery.support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var attaches=0;jQuery.event.special[fix]={setup:function(){if(attaches++===0){document.addEventListener(orig,handler,true);}},teardown:function(){if(--attaches===0){document.removeEventListener(orig,handler,true);}}};function handler(donor){var e=jQuery.event.fix(donor);e.type=fix;e.originalEvent={};jQuery.event.trigger(e,null,e.target);if(e.isDefaultPrevented()){donor.preventDefault();}}});}
jQuery.each(["bind","one"],function(i,name){jQuery.fn[name]=function(type,data,fn){var handler;if(typeof type==="object"){for(var key in type){this[name](key,data,type[key],fn);}
return this;}
if(arguments.length===2||data===false){fn=data;data=undefined;}
if(name==="one"){handler=function(event){jQuery(this).unbind(event,handler);return fn.apply(this,arguments);};handler.guid=fn.guid||jQuery.guid++;}else{handler=fn;}
if(type==="unload"&&name!=="one"){this.one(type,data,fn);}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.add(this[i],type,handler,data);}}
return this;};});jQuery.fn.extend({unbind:function(type,fn){if(typeof type==="object"&&!type.preventDefault){for(var key in type){this.unbind(key,type[key]);}}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.remove(this[i],type,fn);}}
return this;},delegate:function(selector,types,data,fn){return this.live(types,data,fn,selector);},undelegate:function(selector,types,fn){if(arguments.length===0){return this.unbind("live");}else{return this.die(types,null,fn,selector);}},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){return jQuery.event.trigger(type,data,this[0],true);}},toggle:function(fn){var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){var lastToggle=(jQuery.data(this,"lastToggle"+fn.guid)||0)%i;jQuery.data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;};toggler.guid=guid;while(i<args.length){args[i++].guid=guid;}
return this.click(toggler);},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);}});var liveMap={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};jQuery.each(["live","die"],function(i,name){jQuery.fn[name]=function(types,data,fn,origSelector){var type,i=0,match,namespaces,preType,selector=origSelector||this.selector,context=origSelector?this:jQuery(this.context);if(typeof types==="object"&&!types.preventDefault){for(var key in types){context[name](key,data,types[key],selector);}
return this;}
if(name==="die"&&!types&&origSelector&&origSelector.charAt(0)==="."){context.unbind(origSelector);return this;}
if(data===false||jQuery.isFunction(data)){fn=data||returnFalse;data=undefined;}
types=(types||"").split(" ");while((type=types[i++])!=null){match=rnamespaces.exec(type);namespaces="";if(match){namespaces=match[0];type=type.replace(rnamespaces,"");}
if(type==="hover"){types.push("mouseenter"+namespaces,"mouseleave"+namespaces);continue;}
preType=type;if(liveMap[type]){types.push(liveMap[type]+namespaces);type=type+namespaces;}else{type=(liveMap[type]||type)+namespaces;}
if(name==="live"){for(var j=0,l=context.length;j<l;j++){jQuery.event.add(context[j],"live."+liveConvert(type,selector),{data:data,selector:selector,handler:fn,origType:type,origHandler:fn,preType:preType});}}else{context.unbind("live."+liveConvert(type,selector),fn);}}
return this;};});function liveHandler(event){var stop,maxLevel,related,match,handleObj,elem,j,i,l,data,close,namespace,ret,elems=[],selectors=[],events=jQuery._data(this,"events");if(event.liveFired===this||!events||!events.live||event.target.disabled||event.button&&event.type==="click"){return;}
if(event.namespace){namespace=new RegExp("(^|\\.)"+event.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");}
event.liveFired=this;var live=events.live.slice(0);for(j=0;j<live.length;j++){handleObj=live[j];if(handleObj.origType.replace(rnamespaces,"")===event.type){selectors.push(handleObj.selector);}else{live.splice(j--,1);}}
match=jQuery(event.target).closest(selectors,event.currentTarget);for(i=0,l=match.length;i<l;i++){close=match[i];for(j=0;j<live.length;j++){handleObj=live[j];if(close.selector===handleObj.selector&&(!namespace||namespace.test(handleObj.namespace))&&!close.elem.disabled){elem=close.elem;related=null;if(handleObj.preType==="mouseenter"||handleObj.preType==="mouseleave"){event.type=handleObj.preType;related=jQuery(event.relatedTarget).closest(handleObj.selector)[0];if(related&&jQuery.contains(elem,related)){related=elem;}}
if(!related||related!==elem){elems.push({elem:elem,handleObj:handleObj,level:close.level});}}}}
for(i=0,l=elems.length;i<l;i++){match=elems[i];if(maxLevel&&match.level>maxLevel){break;}
event.currentTarget=match.elem;event.data=match.handleObj.data;event.handleObj=match.handleObj;ret=match.handleObj.origHandler.apply(match.elem,arguments);if(ret===false||event.isPropagationStopped()){maxLevel=match.level;if(ret===false){stop=false;}
if(event.isImmediatePropagationStopped()){break;}}}
return stop;}
function liveConvert(type,selector){return(type&&type!=="*"?type+".":"")+selector.replace(rperiod,"`").replace(rspaces,"&");}
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){if(fn==null){fn=data;data=null;}
return arguments.length>0?this.bind(name,data,fn):this.trigger(name);};if(jQuery.attrFn){jQuery.attrFn[name]=true;}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true,rBackslash=/\\/g,rNonWord=/\W/;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;var origContext=context;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var m,set,checkSet,extra,ret,cur,pop,i,prune=true,contextXML=Sizzle.isXML(context),parts=[],soFar=selector;do{chunker.exec("");m=chunker.exec(soFar);if(m){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}}while(m);if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift();}
set=posProcess(selector,set);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){cur=parts.pop();pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){Sizzle.error(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&Sizzle.contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.matchesSelector=function(node,expr){return Sizzle(expr,null,null,[node]).length>0;};Sizzle.find=function(expr,context,isXML){var set;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var match,type=Expr.order[i];if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(rBackslash,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName("*"):[];}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var match,anyFound,old=expr,result=[],curLoop=set,isXMLFilter=set&&set[0]&&Sizzle.isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){var found,item,filter=Expr.filter[type],left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue;}
if(curLoop===result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr===old){if(anyFound==null){Sizzle.error(expr);}else{break;}}
old=expr;}
return curLoop;};Sizzle.error=function(msg){throw"Syntax error, unrecognized expression: "+msg;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");},type:function(elem){return elem.getAttribute("type");}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!rNonWord.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part){var elem,isPartStr=typeof part==="string",i=0,l=checkSet.length;if(isPartStr&&!rNonWord.test(part)){part=part.toLowerCase();for(;i<l;i++){elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false;}}}else{for(;i<l;i++){elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m&&m.parentNode?[m]:[];}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(match[1]);}}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(rBackslash,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n\r]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem);}}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(rBackslash,"");},TAG:function(match,curLoop){return match[1].replace(rBackslash,"").toLowerCase();},CHILD:function(match){if(match[1]==="nth"){if(!match[2]){Sizzle.error(match[0]);}
match[2]=match[2].replace(/^\+|\s*/g,'');var test=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
else if(match[2]){Sizzle.error(match[0]);}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1]=match[1].replace(rBackslash,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
match[4]=(match[4]||match[5]||"").replace(rBackslash,"");if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex;}
return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return(/h\d/i).test(elem.nodeName);},text:function(elem){var attr=elem.getAttribute("type"),type=elem.type;return elem.nodeName.toLowerCase()==="input"&&"text"===type&&(attr===type||attr===null);},radio:function(elem){return elem.nodeName.toLowerCase()==="input"&&"radio"===elem.type;},checkbox:function(elem){return elem.nodeName.toLowerCase()==="input"&&"checkbox"===elem.type;},file:function(elem){return elem.nodeName.toLowerCase()==="input"&&"file"===elem.type;},password:function(elem){return elem.nodeName.toLowerCase()==="input"&&"password"===elem.type;},submit:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"submit"===elem.type;},image:function(elem){return elem.nodeName.toLowerCase()==="input"&&"image"===elem.type;},reset:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"reset"===elem.type;},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&"button"===elem.type||name==="button";},input:function(elem){return(/input|select|textarea|button/i).test(elem.nodeName);},focus:function(elem){return elem===elem.ownerDocument.activeElement;}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0===i;},eq:function(elem,i,match){return match[3]-0===i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||Sizzle.getText([elem])||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var j=0,l=not.length;j<l;j++){if(not[j]===elem){return false;}}
return true;}else{Sizzle.error(name);}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case"only":case"first":while((node=node.previousSibling)){if(node.nodeType===1){return false;}}
if(type==="first"){return true;}
node=elem;case"last":while((node=node.nextSibling)){if(node.nodeType===1){return false;}}
return true;case"nth":var first=match[2],last=match[3];if(first===1&&last===0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first===0){return diff===0;}else{return(diff%first===0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName.toLowerCase()===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS,fescape=function(all,num){return"\\"+(num-0+1);};for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+(/(?![^\[]*\])(?![^\(]*\))/.source));Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,fescape));}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType;}catch(e){makeArray=function(array,results){var i=0,ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var l=array.length;i<l;i++){ret.push(array[i]);}}else{for(;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder,siblingCheck;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0;}
if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1;}
return a.compareDocumentPosition(b)&4?-1:1;};}else{sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0;}else if(a.sourceIndex&&b.sourceIndex){return a.sourceIndex-b.sourceIndex;}
var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;if(aup===bup){return siblingCheck(a,b);}else if(!aup){return-1;}else if(!bup){return 1;}
while(cur){ap.unshift(cur);cur=cur.parentNode;}
cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode;}
al=ap.length;bl=bp.length;for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i]);}}
return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1);};siblingCheck=function(a,b,ret){if(a===b){return ret;}
var cur=a.nextSibling;while(cur){if(cur===b){return-1;}
cur=cur.nextSibling;}
return 1;};}
Sizzle.getText=function(elems){var ret="",elem;for(var i=0;elems[i];i++){elem=elems[i];if(elem.nodeType===3||elem.nodeType===4){ret+=elem.nodeValue;}else if(elem.nodeType!==8){ret+=Sizzle.getText(elem.childNodes);}}
return ret;};(function(){var form=document.createElement("div"),id="script"+(new Date()).getTime(),root=document.documentElement;form.innerHTML="<a name='"+id+"'/>";root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div"),id="__sizzle__";div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&!Sizzle.isXML(context)){var match=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query);if(match&&(context.nodeType===1||context.nodeType===9)){if(match[1]){return makeArray(context.getElementsByTagName(query),extra);}else if(match[2]&&Expr.find.CLASS&&context.getElementsByClassName){return makeArray(context.getElementsByClassName(match[2]),extra);}}
if(context.nodeType===9){if(query==="body"&&context.body){return makeArray([context.body],extra);}else if(match&&match[3]){var elem=context.getElementById(match[3]);if(elem&&elem.parentNode){if(elem.id===match[3]){return makeArray([elem],extra);}}else{return makeArray([],extra);}}
try{return makeArray(context.querySelectorAll(query),extra);}catch(qsaError){}}else if(context.nodeType===1&&context.nodeName.toLowerCase()!=="object"){var oldContext=context,old=context.getAttribute("id"),nid=old||id,hasParent=context.parentNode,relativeHierarchySelector=/^\s*[+~]/.test(query);if(!old){context.setAttribute("id",nid);}else{nid=nid.replace(/'/g,"\\$&");}
if(relativeHierarchySelector&&hasParent){context=context.parentNode;}
try{if(!relativeHierarchySelector||hasParent){return makeArray(context.querySelectorAll("[id='"+nid+"'] "+query),extra);}}catch(pseudoError){}finally{if(!old){oldContext.removeAttribute("id");}}}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();}
(function(){var html=document.documentElement,matches=html.matchesSelector||html.mozMatchesSelector||html.webkitMatchesSelector||html.msMatchesSelector;if(matches){var disconnectedMatch=!matches.call(document.createElement("div"),"div"),pseudoWorks=false;try{matches.call(document.documentElement,"[test!='']:sizzle");}catch(pseudoError){pseudoWorks=true;}
Sizzle.matchesSelector=function(node,expr){expr=expr.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!Sizzle.isXML(node)){try{if(pseudoWorks||!Expr.match.PSEUDO.test(expr)&&!/!=/.test(expr)){var ret=matches.call(node,expr);if(ret||!disconnectedMatch||node.document&&node.document.nodeType!==11){return ret;}}}catch(e){}}
return Sizzle(expr,null,null,[node]).length>0;};}})();(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return;}
div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return;}
Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName.toLowerCase()===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
if(document.documentElement.contains){Sizzle.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):true);};}else if(document.documentElement.compareDocumentPosition){Sizzle.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16);};}else{Sizzle.contains=function(){return false;};}
Sizzle.isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};var posProcess=function(selector,context){var match,tmpSet=[],later="",root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,isSimple=/^.[^:#\[\.,]*$/,slice=Array.prototype.slice,POS=jQuery.expr.match.POS,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({find:function(selector){var self=this,i,l;if(typeof selector!=="string"){return jQuery(selector).filter(function(){for(i=0,l=self.length;i<l;i++){if(jQuery.contains(self[i],this)){return true;}}});}
var ret=this.pushStack("","find",selector),length,n,r;for(i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(n=length;n<ret.length;n++){for(r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break;}}}}}
return ret;},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector);},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector);},is:function(selector){return!!selector&&(typeof selector==="string"?jQuery.filter(selector,this).length>0:this.filter(selector).length>0);},closest:function(selectors,context){var ret=[],i,l,cur=this[0];if(jQuery.isArray(selectors)){var match,selector,matches={},level=1;if(cur&&selectors.length){for(i=0,l=selectors.length;i<l;i++){selector=selectors[i];if(!matches[selector]){matches[selector]=POS.test(selector)?jQuery(selector,context||this.context):selector;}}
while(cur&&cur.ownerDocument&&cur!==context){for(selector in matches){match=matches[selector];if(match.jquery?match.index(cur)>-1:jQuery(cur).is(match)){ret.push({selector:selector,elem:cur,level:level});}}
cur=cur.parentNode;level++;}}
return ret;}
var pos=POS.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(i=0,l=this.length;i<l;i++){cur=this[i];while(cur){if(pos?pos.index(cur)>-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break;}else{cur=cur.parentNode;if(!cur||!cur.ownerDocument||cur===context||cur.nodeType===11){break;}}}}
ret=ret.length>1?jQuery.unique(ret):ret;return this.pushStack(ret,"closest",selectors);},index:function(elem){if(!elem||typeof elem==="string"){return jQuery.inArray(this[0],elem?jQuery(elem):this.parent().children());}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all));},andSelf:function(){return this.add(this.prevObject);}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until),args=slice.call(arguments);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret,name,args.join(","));};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break;}}
return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});function winnow(elements,qualifier,keep){qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,filtered);}}
return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep;});}
var rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnocache=/<(?:script|object|embed|option|style)/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/\/(java|ecma)script/i,rcleanScript=/^\s*<!(?:\[CDATA\[|\-\-)/,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"];}
jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()));});}
if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));}
return jQuery.text(this);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild);}});},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});}else if(arguments.length){var set=jQuery(arguments[0]);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery(arguments[0]).toArray());return set;}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem]);}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}}
return this;},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));}
while(elem.firstChild){elem.removeChild(elem.firstChild);}}
return this;},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents);});},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null;}else if(typeof value==="string"&&!rnocache.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){jQuery.cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value;}}}catch(e){this.empty().append(value);}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this);self.html(value.call(this,i,self.html()));});}else{this.empty().append(value);}
return this;},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old));});}
if(typeof value!=="string"){value=jQuery(value).detach();}
return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value);}else{jQuery(parent).append(value);}});}else{return this.length?this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value):this;}},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){var results,first,fragment,parent,value=args[0],scripts=[];if(!jQuery.support.checkClone&&arguments.length===3&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback,true);});}
if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback);});}
if(this[0]){parent=value&&value.parentNode;if(jQuery.support.parentNode&&parent&&parent.nodeType===11&&parent.childNodes.length===this.length){results={fragment:parent};}else{results=jQuery.buildFragment(args,this,scripts);}
fragment=results.fragment;if(fragment.childNodes.length===1){first=fragment=fragment.firstChild;}else{first=fragment.firstChild;}
if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length,lastIndex=l-1;i<l;i++){callback.call(table?root(this[i],first):this[i],results.cacheable||(l>1&&i<lastIndex)?jQuery.clone(fragment,true,true):fragment);}}
if(scripts.length){jQuery.each(scripts,evalScript);}}
return this;}});function root(elem,cur){return jQuery.nodeName(elem,"table")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}
function cloneCopyEvent(src,dest){if(dest.nodeType!==1||!jQuery.hasData(src)){return;}
var internalKey=jQuery.expando,oldData=jQuery.data(src),curData=jQuery.data(dest,oldData);if((oldData=oldData[internalKey])){var events=oldData.events;curData=curData[internalKey]=jQuery.extend({},oldData);if(events){delete curData.handle;curData.events={};for(var type in events){for(var i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type+(events[type][i].namespace?".":"")+events[type][i].namespace,events[type][i],events[type][i].data);}}}}}
function cloneFixAttributes(src,dest){var nodeName;if(dest.nodeType!==1){return;}
if(dest.clearAttributes){dest.clearAttributes();}
if(dest.mergeAttributes){dest.mergeAttributes(src);}
nodeName=dest.nodeName.toLowerCase();if(nodeName==="object"){dest.outerHTML=src.outerHTML;}else if(nodeName==="input"&&(src.type==="checkbox"||src.type==="radio")){if(src.checked){dest.defaultChecked=dest.checked=src.checked;}
if(dest.value!==src.value){dest.value=src.value;}}else if(nodeName==="option"){dest.selected=src.defaultSelected;}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}
dest.removeAttribute(jQuery.expando);}
jQuery.buildFragment=function(args,nodes,scripts){var fragment,cacheable,cacheresults,doc=(nodes&&nodes[0]?nodes[0].ownerDocument||nodes[0]:document);if(args.length===1&&typeof args[0]==="string"&&args[0].length<512&&doc===document&&args[0].charAt(0)==="<"&&!rnocache.test(args[0])&&(jQuery.support.checkClone||!rchecked.test(args[0]))){cacheable=true;cacheresults=jQuery.fragments[args[0]];if(cacheresults&&cacheresults!==1){fragment=cacheresults;}}
if(!fragment){fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts);}
if(cacheable){jQuery.fragments[args[0]]=cacheresults?fragment:1;}
return{fragment:fragment,cacheable:cacheable};};jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),parent=this.length===1&&this[0].parentNode;if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);return this;}else{for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,insert.selector);}};});function getAll(elem){if("getElementsByTagName"in elem){return elem.getElementsByTagName("*");}else if("querySelectorAll"in elem){return elem.querySelectorAll("*");}else{return[];}}
function fixDefaultChecked(elem){if(elem.type==="checkbox"||elem.type==="radio"){elem.defaultChecked=elem.checked;}}
function findInputs(elem){if(jQuery.nodeName(elem,"input")){fixDefaultChecked(elem);}else if(elem.getElementsByTagName){jQuery.grep(elem.getElementsByTagName("input"),fixDefaultChecked);}}
jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var clone=elem.cloneNode(true),srcElements,destElements,i;if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){cloneFixAttributes(elem,clone);srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneFixAttributes(srcElements[i],destElements[i]);}}
if(dataAndEvents){cloneCopyEvent(elem,clone);if(deepDataAndEvents){srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneCopyEvent(srcElements[i],destElements[i]);}}}
return clone;},clean:function(elems,context,fragment,scripts){var checkScriptType;context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;}
var ret=[],j;for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+="";}
if(!elem){continue;}
if(typeof elem==="string"){if(!rhtml.test(elem)){elem=context.createTextNode(elem);}else{elem=elem.replace(rxhtmlTag,"<$1></$2>");var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild;}
if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j]);}}}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild);}
elem=div.childNodes;}}
var len;if(!jQuery.support.appendChecked){if(elem[0]&&typeof(len=elem.length)==="number"){for(j=0;j<len;j++){findInputs(elem[j]);}}else{findInputs(elem);}}
if(elem.nodeType){ret.push(elem);}else{ret=jQuery.merge(ret,elem);}}
if(fragment){checkScriptType=function(elem){return!elem.type||rscriptType.test(elem.type);};for(i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1){var jsTags=jQuery.grep(ret[i].getElementsByTagName("script"),checkScriptType);ret.splice.apply(ret,[i+1,0].concat(jsTags));}
fragment.appendChild(ret[i]);}}}
return ret;},cleanData:function(elems){var data,id,cache=jQuery.cache,internalKey=jQuery.expando,special=jQuery.event.special,deleteExpando=jQuery.support.deleteExpando;for(var i=0,elem;(elem=elems[i])!=null;i++){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){continue;}
id=elem[jQuery.expando];if(id){data=cache[id]&&cache[id][internalKey];if(data&&data.events){for(var type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{jQuery.removeEvent(elem,type,data.handle);}}
if(data.handle){data.handle.elem=null;}}
if(deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}}});function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"});}else{jQuery.globalEval((elem.text||elem.textContent||elem.innerHTML||"").replace(rcleanScript,"/*$0*/"));}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}
var ralpha=/alpha\([^)]*\)/i,ropacity=/opacity=([^)]*)/,rdashAlpha=/-([a-z])/ig,rupper=/([A-Z]|^ms)/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,rrelNum=/^[+\-]=/,rrelNumFilter=/[^+\-\.\de]+/g,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],curCSS,getComputedStyle,currentStyle,fcamelCase=function(all,letter){return letter.toUpperCase();};jQuery.fn.css=function(name,value){if(arguments.length===2&&value===undefined){return this;}
return jQuery.access(this,name,value,true,function(elem,name,value){return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name);});};jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity","opacity");return ret===""?"1":ret;}else{return elem.style.opacity;}}}},cssNumber:{"zIndex":true,"fontWeight":true,"opacity":true,"zoom":true,"lineHeight":true,"widows":true,"orphans":true},cssProps:{"float":jQuery.support.cssFloat?"cssFloat":"styleFloat"},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return;}
var ret,type,origName=jQuery.camelCase(name),style=elem.style,hooks=jQuery.cssHooks[origName];name=jQuery.cssProps[origName]||origName;if(value!==undefined){type=typeof value;if(type==="number"&&isNaN(value)||value==null){return;}
if(type==="string"&&rrelNum.test(value)){value=+value.replace(rrelNumFilter,"")+parseFloat(jQuery.css(elem,name));}
if(type==="number"&&!jQuery.cssNumber[origName]){value+="px";}
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value))!==undefined){try{style[name]=value;}catch(e){}}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret;}
return style[name];}},css:function(elem,name,extra){var ret,hooks;name=jQuery.camelCase(name);hooks=jQuery.cssHooks[name];name=jQuery.cssProps[name]||name;if(name==="cssFloat"){name="float";}
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,true,extra))!==undefined){return ret;}else if(curCSS){return curCSS(elem,name);}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(name in options){elem.style[name]=old[name];}},camelCase:function(string){return string.replace(rdashAlpha,fcamelCase);}});jQuery.curCSS=jQuery.css;jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){var val;if(computed){if(elem.offsetWidth!==0){val=getWH(elem,name,extra);}else{jQuery.swap(elem,cssShow,function(){val=getWH(elem,name,extra);});}
if(val<=0){val=curCSS(elem,name,name);if(val==="0px"&&currentStyle){val=currentStyle(elem,name,name);}
if(val!=null){return val===""||val==="auto"?"0px":val;}}
if(val<0||val==null){val=elem.style[name];return val===""||val==="auto"?"0px":val;}
return typeof val==="string"?val:val+"px";}},set:function(elem,value){if(rnumpx.test(value)){value=parseFloat(value);if(value>=0){return value+"px";}}else{return value;}}};});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":computed?"1":"";},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle;style.zoom=1;var opacity=jQuery.isNaN(value)?"":"alpha(opacity="+value*100+")",filter=currentStyle&&currentStyle.filter||style.filter||"";style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity;}};}
jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){var ret;jQuery.swap(elem,{"display":"inline-block"},function(){if(computed){ret=curCSS(elem,"margin-right","marginRight");}else{ret=elem.style.marginRight;}});return ret;}};}});if(document.defaultView&&document.defaultView.getComputedStyle){getComputedStyle=function(elem,name){var ret,defaultView,computedStyle;name=name.replace(rupper,"-$1").toLowerCase();if(!(defaultView=elem.ownerDocument.defaultView)){return undefined;}
if((computedStyle=defaultView.getComputedStyle(elem,null))){ret=computedStyle.getPropertyValue(name);if(ret===""&&!jQuery.contains(elem.ownerDocument.documentElement,elem)){ret=jQuery.style(elem,name);}}
return ret;};}
if(document.documentElement.currentStyle){currentStyle=function(elem,name){var left,ret=elem.currentStyle&&elem.currentStyle[name],rsLeft=elem.runtimeStyle&&elem.runtimeStyle[name],style=elem.style;if(!rnumpx.test(ret)&&rnum.test(ret)){left=style.left;if(rsLeft){elem.runtimeStyle.left=elem.currentStyle.left;}
style.left=name==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;if(rsLeft){elem.runtimeStyle.left=rsLeft;}}
return ret===""?"auto":ret;};}
curCSS=getComputedStyle||currentStyle;function getWH(elem,name,extra){var which=name==="width"?cssWidth:cssHeight,val=name==="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return val;}
jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.css(elem,"padding"+this))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.css(elem,"margin"+this))||0;}else{val-=parseFloat(jQuery.css(elem,"border"+this+"Width"))||0;}});return val;}
if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight;return(width===0&&height===0)||(!jQuery.support.reliableHiddenOffsets&&(elem.style.display||jQuery.css(elem,"display"))==="none");};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rhash=/#.*$/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,rinput=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,rlocalProtocol=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rquery=/\?/,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,rselectTextarea=/^(?:select|textarea)/i,rspacesAjax=/\s+/,rts=/([?&])_=[^&]*/,rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,_load=jQuery.fn.load,prefilters={},transports={},ajaxLocation,ajaxLocParts;try{ajaxLocation=location.href;}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href;}
ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}
if(jQuery.isFunction(func)){var dataTypes=dataTypeExpression.toLowerCase().split(rspacesAjax),i=0,length=dataTypes.length,dataType,list,placeBefore;for(;i<length;i++){dataType=dataTypes[i];placeBefore=/^\+/.test(dataType);if(placeBefore){dataType=dataType.substr(1)||"*";}
list=structure[dataType]=structure[dataType]||[];list[placeBefore?"unshift":"push"](func);}}};}
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,dataType,inspected){dataType=dataType||options.dataTypes[0];inspected=inspected||{};inspected[dataType]=true;var list=structure[dataType],i=0,length=list?list.length:0,executeOnly=(structure===prefilters),selection;for(;i<length&&(executeOnly||!selection);i++){selection=list[i](options,originalOptions,jqXHR);if(typeof selection==="string"){if(!executeOnly||inspected[selection]){selection=undefined;}else{options.dataTypes.unshift(selection);selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,selection,inspected);}}}
if((executeOnly||!selection)&&!inspected["*"]){selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,"*",inspected);}
return selection;}
jQuery.fn.extend({load:function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments);}else if(!this.length){return this;}
var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=undefined;}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST";}}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(jqXHR,status,responseText){responseText=jqXHR.responseText;if(jqXHR.isResolved()){jqXHR.done(function(r){responseText=r;});self.html(selector?jQuery("<div>").append(responseText.replace(rscript,"")).find(selector):responseText);}
if(callback){self.each(callback,[responseText,status,jqXHR]);}}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}):{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined;}
return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type});};});jQuery.extend({getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},ajaxSetup:function(target,settings){if(!settings){settings=target;target=jQuery.extend(true,jQuery.ajaxSettings,settings);}else{jQuery.extend(true,target,jQuery.ajaxSettings,settings);}
for(var field in{context:1,url:1}){if(field in settings){target[field]=settings[field];}else if(field in jQuery.ajaxSettings){target[field]=jQuery.ajaxSettings[field];}}
return target;},ajaxSettings:{url:ajaxLocation,isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML}},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined;}
options=options||{};var
s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=callbackContext!==s&&(callbackContext.nodeType||callbackContext instanceof jQuery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery._Deferred(),statusCode=s.statusCode||{},ifModifiedKey,requestHeaders={},requestHeadersNames={},responseHeadersString,responseHeaders,transport,timeoutTimer,parts,state=0,fireGlobals,i,jqXHR={readyState:0,setRequestHeader:function(name,value){if(!state){var lname=name.toLowerCase();name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value;}
return this;},getAllResponseHeaders:function(){return state===2?responseHeadersString:null;},getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while((match=rheaders.exec(responseHeadersString))){responseHeaders[match[1].toLowerCase()]=match[2];}}
match=responseHeaders[key.toLowerCase()];}
return match===undefined?null:match;},overrideMimeType:function(type){if(!state){s.mimeType=type;}
return this;},abort:function(statusText){statusText=statusText||"abort";if(transport){transport.abort(statusText);}
done(0,statusText);return this;}};function done(status,statusText,responses,headers){if(state===2){return;}
state=2;if(timeoutTimer){clearTimeout(timeoutTimer);}
transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status?4:0;var isSuccess,success,error,response=responses?ajaxHandleResponses(s,jqXHR,responses):undefined,lastModified,etag;if(status>=200&&status<300||status===304){if(s.ifModified){if((lastModified=jqXHR.getResponseHeader("Last-Modified"))){jQuery.lastModified[ifModifiedKey]=lastModified;}
if((etag=jqXHR.getResponseHeader("Etag"))){jQuery.etag[ifModifiedKey]=etag;}}
if(status===304){statusText="notmodified";isSuccess=true;}else{try{success=ajaxConvert(s,response);statusText="success";isSuccess=true;}catch(e){statusText="parsererror";error=e;}}}else{error=statusText;if(!statusText||status){statusText="error";if(status<0){status=0;}}}
jqXHR.status=status;jqXHR.statusText=statusText;if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR]);}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error]);}
jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger("ajax"+(isSuccess?"Success":"Error"),[jqXHR,s,isSuccess?success:error]);}
completeDeferred.resolveWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop");}}}
deferred.promise(jqXHR);jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;jqXHR.complete=completeDeferred.done;jqXHR.statusCode=function(map){if(map){var tmp;if(state<2){for(tmp in map){statusCode[tmp]=[statusCode[tmp],map[tmp]];}}else{tmp=map[jqXHR.status];jqXHR.then(tmp,tmp);}}
return this;};s.url=((url||s.url)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().split(rspacesAjax);if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))));}
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return false;}
fireGlobals=s.global;s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart");}
if(!s.hasContent){if(s.data){s.url+=(rquery.test(s.url)?"&":"?")+s.data;}
ifModifiedKey=s.url;if(s.cache===false){var ts=jQuery.now(),ret=s.url.replace(rts,"$1_="+ts);s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"");}}
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType);}
if(s.ifModified){ifModifiedKey=ifModifiedKey||s.url;if(jQuery.lastModified[ifModifiedKey]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[ifModifiedKey]);}
if(jQuery.etag[ifModifiedKey]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[ifModifiedKey]);}}
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", */*; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i]);}
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){jqXHR.abort();return false;}
for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i]);}
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}
if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}
try{state=1;transport.send(requestHeaders,done);}catch(e){if(status<2){done(-1,e);}else{jQuery.error(e);}}}
return jqXHR;},param:function(a,traditional){var s=[],add=function(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);};if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional;}
if(jQuery.isArray(a)||(a.jquery&&!jQuery.isPlainObject(a))){jQuery.each(a,function(){add(this.name,this.value);});}else{for(var prefix in a){buildParams(prefix,a[prefix],traditional,add);}}
return s.join("&").replace(r20,"+");}});function buildParams(prefix,obj,traditional,add){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v,traditional,add);}});}else if(!traditional&&obj!=null&&typeof obj==="object"){for(var name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add);}}else{add(prefix,obj);}}
jQuery.extend({active:0,lastModified:{},etag:{}});function ajaxHandleResponses(s,jqXHR,responses){var contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields,ct,type,finalDataType,firstDataType;for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type];}}
while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("content-type");}}
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break;}}}
if(dataTypes[0]in responses){finalDataType=dataTypes[0];}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break;}
if(!firstDataType){firstDataType=type;}}
finalDataType=finalDataType||firstDataType;}
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType);}
return responses[finalDataType];}}
function ajaxConvert(s,response){if(s.dataFilter){response=s.dataFilter(response,s.dataType);}
var dataTypes=s.dataTypes,converters={},i,key,length=dataTypes.length,tmp,current=dataTypes[0],prev,conversion,conv,conv1,conv2;for(i=1;i<length;i++){if(i===1){for(key in s.converters){if(typeof key==="string"){converters[key.toLowerCase()]=s.converters[key];}}}
prev=current;current=dataTypes[i];if(current==="*"){current=prev;}else if(prev!=="*"&&prev!==current){conversion=prev+" "+current;conv=converters[conversion]||converters["* "+current];if(!conv){conv2=undefined;for(conv1 in converters){tmp=conv1.split(" ");if(tmp[0]===prev||tmp[0]==="*"){conv2=converters[tmp[1]+" "+current];if(conv2){conv1=converters[conv1];if(conv1===true){conv=conv2;}else if(conv2===true){conv=conv1;}
break;}}}}
if(!(conv||conv2)){jQuery.error("No conversion from "+conversion.replace(" "," to "));}
if(conv!==true){response=conv?conv(response):conv2(conv1(response));}}}
return response;}
var jsc=jQuery.now(),jsre=/(\=)\?(&|$)|\?\?/i;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return jQuery.expando+"_"+(jsc++);}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var inspectData=s.contentType==="application/x-www-form-urlencoded"&&(typeof s.data==="string");if(s.dataTypes[0]==="jsonp"||s.jsonp!==false&&(jsre.test(s.url)||inspectData&&jsre.test(s.data))){var responseContainer,jsonpCallback=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback,previous=window[jsonpCallback],url=s.url,data=s.data,replace="$1"+jsonpCallback+"$2";if(s.jsonp!==false){url=url.replace(jsre,replace);if(s.url===url){if(inspectData){data=data.replace(jsre,replace);}
if(s.data===data){url+=(/\?/.test(url)?"&":"?")+s.jsonp+"="+jsonpCallback;}}}
s.url=url;s.data=data;window[jsonpCallback]=function(response){responseContainer=[response];};jqXHR.always(function(){window[jsonpCallback]=previous;if(responseContainer&&jQuery.isFunction(previous)){window[jsonpCallback](responseContainer[0]);}});s.converters["script json"]=function(){if(!responseContainer){jQuery.error(jsonpCallback+" was not called");}
return responseContainer[0];};s.dataTypes[0]="json";return"script";}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(text){jQuery.globalEval(text);return text;}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false;}
if(s.crossDomain){s.type="GET";s.global=false;}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;return{send:function(_,callback){script=document.createElement("script");script.async="async";if(s.scriptCharset){script.charset=s.scriptCharset;}
script.src=s.url;script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}
script=undefined;if(!isAbort){callback(200,"success");}}};head.insertBefore(script,head.firstChild);},abort:function(){if(script){script.onload(0,1);}}};}});var
xhrOnUnloadAbort=window.ActiveXObject?function(){for(var key in xhrCallbacks){xhrCallbacks[key](0,1);}}:false,xhrId=0,xhrCallbacks;function createStandardXHR(){try{return new window.XMLHttpRequest();}catch(e){}}
function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}
jQuery.ajaxSettings.xhr=window.ActiveXObject?function(){return!this.isLocal&&createStandardXHR()||createActiveXHR();}:createStandardXHR;(function(xhr){jQuery.extend(jQuery.support,{ajax:!!xhr,cors:!!xhr&&("withCredentials"in xhr)});})(jQuery.ajaxSettings.xhr());if(jQuery.support.ajax){jQuery.ajaxTransport(function(s){if(!s.crossDomain||jQuery.support.cors){var callback;return{send:function(headers,complete){var xhr=s.xhr(),handle,i;if(s.username){xhr.open(s.type,s.url,s.async,s.username,s.password);}else{xhr.open(s.type,s.url,s.async);}
if(s.xhrFields){for(i in s.xhrFields){xhr[i]=s.xhrFields[i];}}
if(s.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(s.mimeType);}
if(!s.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}
try{for(i in headers){xhr.setRequestHeader(i,headers[i]);}}catch(_){}
xhr.send((s.hasContent&&s.data)||null);callback=function(_,isAbort){var status,statusText,responseHeaders,responses,xml;try{if(callback&&(isAbort||xhr.readyState===4)){callback=undefined;if(handle){xhr.onreadystatechange=jQuery.noop;if(xhrOnUnloadAbort){delete xhrCallbacks[handle];}}
if(isAbort){if(xhr.readyState!==4){xhr.abort();}}else{status=xhr.status;responseHeaders=xhr.getAllResponseHeaders();responses={};xml=xhr.responseXML;if(xml&&xml.documentElement){responses.xml=xml;}
responses.text=xhr.responseText;try{statusText=xhr.statusText;}catch(e){statusText="";}
if(!status&&s.isLocal&&!s.crossDomain){status=responses.text?200:404;}else if(status===1223){status=204;}}}}catch(firefoxAccessException){if(!isAbort){complete(-1,firefoxAccessException);}}
if(responses){complete(status,statusText,responses,responseHeaders);}};if(!s.async||xhr.readyState===4){callback();}else{handle=++xhrId;if(xhrOnUnloadAbort){if(!xhrCallbacks){xhrCallbacks={};jQuery(window).unload(xhrOnUnloadAbort);}
xhrCallbacks[handle]=callback;}
xhr.onreadystatechange=callback;}},abort:function(){if(callback){callback(0,1);}}};}});}
var elemdisplay={},iframe,iframeDoc,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],fxNow,requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame;jQuery.fn.extend({show:function(speed,easing,callback){var elem,display;if(speed||speed===0){return this.animate(genFx("show",3),speed,easing,callback);}else{for(var i=0,j=this.length;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(!jQuery._data(elem,"olddisplay")&&display==="none"){display=elem.style.display="";}
if(display===""&&jQuery.css(elem,"display")==="none"){jQuery._data(elem,"olddisplay",defaultDisplay(elem.nodeName));}}}
for(i=0;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(display===""||display==="none"){elem.style.display=jQuery._data(elem,"olddisplay")||"";}}}
return this;}},hide:function(speed,easing,callback){if(speed||speed===0){return this.animate(genFx("hide",3),speed,easing,callback);}else{for(var i=0,j=this.length;i<j;i++){if(this[i].style){var display=jQuery.css(this[i],"display");if(display!=="none"&&!jQuery._data(this[i],"olddisplay")){jQuery._data(this[i],"olddisplay",display);}}}
for(i=0;i<j;i++){if(this[i].style){this[i].style.display="none";}}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2,callback){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments);}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();});}else{this.animate(genFx("toggle",3),fn,fn2,callback);}
return this;},fadeTo:function(speed,to,easing,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,easing,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete,[false]);}
prop=jQuery.extend({},prop);return this[optall.queue===false?"each":"queue"](function(){if(optall.queue===false){jQuery._mark(this);}
var opt=jQuery.extend({},optall),isElement=this.nodeType===1,hidden=isElement&&jQuery(this).is(":hidden"),name,val,p,display,e,parts,start,end,unit;opt.animatedProperties={};for(p in prop){name=jQuery.camelCase(p);if(p!==name){prop[name]=prop[p];delete prop[p];}
val=prop[name];if(jQuery.isArray(val)){opt.animatedProperties[name]=val[1];val=prop[name]=val[0];}else{opt.animatedProperties[name]=opt.specialEasing&&opt.specialEasing[name]||opt.easing||'swing';}
if(val==="hide"&&hidden||val==="show"&&!hidden){return opt.complete.call(this);}
if(isElement&&(name==="height"||name==="width")){opt.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(jQuery.css(this,"display")==="inline"&&jQuery.css(this,"float")==="none"){if(!jQuery.support.inlineBlockNeedsLayout){this.style.display="inline-block";}else{display=defaultDisplay(this.nodeName);if(display==="inline"){this.style.display="inline-block";}else{this.style.display="inline";this.style.zoom=1;}}}}}
if(opt.overflow!=null){this.style.overflow="hidden";}
for(p in prop){e=new jQuery.fx(this,opt,p);val=prop[p];if(rfxtypes.test(val)){e[val==="toggle"?hidden?"show":"hide":val]();}else{parts=rfxnum.exec(val);start=e.cur();if(parts){end=parseFloat(parts[2]);unit=parts[3]||(jQuery.cssNumber[p]?"":"px");if(unit!=="px"){jQuery.style(this,p,(end||1)+unit);start=((end||1)/e.cur())*start;jQuery.style(this,p,start+unit);}
if(parts[1]){end=((parts[1]==="-="?-1:1)*end)+start;}
e.custom(start,end,unit);}else{e.custom(start,val,"");}}}
return true;});},stop:function(clearQueue,gotoEnd){if(clearQueue){this.queue([]);}
this.each(function(){var timers=jQuery.timers,i=timers.length;if(!gotoEnd){jQuery._unmark(true,this);}
while(i--){if(timers[i].elem===this){if(gotoEnd){timers[i](true);}
timers.splice(i,1);}}});if(!gotoEnd){this.dequeue();}
return this;}});function createFxNow(){setTimeout(clearFxNow,0);return(fxNow=jQuery.now());}
function clearFxNow(){fxNow=undefined;}
function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(noUnmark){if(opt.queue!==false){jQuery.dequeue(this);}else if(noUnmark!==false){jQuery._unmark(this);}
if(jQuery.isFunction(opt.old)){opt.old.call(this);}};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;options.orig=options.orig||{};}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}
(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}
var parsed,r=jQuery.css(this.elem,this.prop);return isNaN(parsed=parseFloat(r))?!r||r==="auto"?0:r:parsed;},custom:function(from,to,unit){var self=this,fx=jQuery.fx,raf;this.startTime=fxNow||createFxNow();this.start=from;this.end=to;this.unit=unit||this.unit||(jQuery.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){if(requestAnimationFrame){timerId=1;raf=function(){if(timerId){requestAnimationFrame(raf);fx.tick();}};requestAnimationFrame(raf);}else{timerId=setInterval(fx.tick,fx.interval);}}},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=fxNow||createFxNow(),done=true,elem=this.elem,options=this.options,i,n;if(gotoEnd||t>=options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();options.animatedProperties[this.prop]=true;for(i in options.animatedProperties){if(options.animatedProperties[i]!==true){done=false;}}
if(done){if(options.overflow!=null&&!jQuery.support.shrinkWrapBlocks){jQuery.each(["","X","Y"],function(index,value){elem.style["overflow"+value]=options.overflow[index];});}
if(options.hide){jQuery(elem).hide();}
if(options.hide||options.show){for(var p in options.animatedProperties){jQuery.style(elem,p,options.orig[p]);}}
options.complete.call(elem);}
return false;}else{if(options.duration==Infinity){this.now=t;}else{n=t-this.startTime;this.state=n/options.duration;this.pos=jQuery.easing[options.animatedProperties[this.prop]](this.state,n,0,1,options.duration);this.now=this.start+((this.end-this.start)*this.pos);}
this.update();}
return true;}};jQuery.extend(jQuery.fx,{tick:function(){for(var timers=jQuery.timers,i=0;i<timers.length;++i){if(!timers[i]()){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}},interval:13,stop:function(){clearInterval(timerId);timerId=null;},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=(fx.prop==="width"||fx.prop==="height"?Math.max(0,fx.now):fx.now)+fx.unit;}else{fx.elem[fx.prop]=fx.now;}}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
function defaultDisplay(nodeName){if(!elemdisplay[nodeName]){var elem=jQuery("<"+nodeName+">").appendTo("body"),display=elem.css("display");elem.remove();if(display==="none"||display===""){if(!iframe){iframe=document.createElement("iframe");iframe.frameBorder=iframe.width=iframe.height=0;}
document.body.appendChild(iframe);if(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write("<!doctype><html><body></body></html>");}
elem=iframeDoc.createElement(nodeName);iframeDoc.body.appendChild(elem);display=jQuery.css(elem,"display");document.body.removeChild(iframe);}
elemdisplay[nodeName]=display;}
return elemdisplay[nodeName];}
var rtable=/^t(?:able|d|h)$/i,rroot=/^(?:body|html)$/i;if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0],box;if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
try{box=elem.getBoundingClientRect();}catch(e){}
var doc=elem.ownerDocument,docElem=doc.documentElement;if(!box||!jQuery.contains(docElem,elem)){return box?{top:box.top,left:box.left}:{top:0,left:0};}
var body=doc.body,win=getWindow(doc),clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,scrollTop=win.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop,scrollLeft=win.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft,top=box.top+scrollTop-clientTop,left=box.left+scrollLeft-clientLeft;return{top:top,left:left};};}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
jQuery.offset.initialize();var computedStyle,offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){break;}
computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&rtable.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevOffsetParent=offsetParent;offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft;}
if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft);}
return{top:top,left:left};};}
jQuery.offset={initialize:function(){var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,bodyMarginTop=parseFloat(jQuery.css(body,"marginTop"))||0,html="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";jQuery.extend(container.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild;checkDiv=innerDiv.firstChild;td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);checkDiv.style.position="fixed";checkDiv.style.top="20px";this.supportsFixedPosition=(checkDiv.offsetTop===20||checkDiv.offsetTop===15);checkDiv.style.position=checkDiv.style.top="";innerDiv.style.overflow="hidden";innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==bodyMarginTop);body.removeChild(container);jQuery.offset.initialize=jQuery.noop;},bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.css(body,"marginTop"))||0;left+=parseFloat(jQuery.css(body,"marginLeft"))||0;}
return{top:top,left:left};},setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");if(position==="static"){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left;}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0;}
if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}
if(options.top!=null){props.top=(options.top-curOffset.top)+curTop;}
if(options.left!=null){props.left=(options.left-curOffset.left)+curLeft;}
if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({position:function(){if(!this[0]){return null;}
var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=rroot.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.css(elem,"marginTop"))||0;offset.left-=parseFloat(jQuery.css(elem,"marginLeft"))||0;parentOffset.top+=parseFloat(jQuery.css(offsetParent[0],"borderTopWidth"))||0;parentOffset.left+=parseFloat(jQuery.css(offsetParent[0],"borderLeftWidth"))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!rroot.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent;});}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem,win;if(val===undefined){elem=this[0];if(!elem){return null;}
win=getWindow(elem);return win?("pageXOffset"in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method];}
return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop());}else{this[method]=val;}});};});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?parseFloat(jQuery.css(this[0],type,"padding")):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?parseFloat(jQuery.css(this[0],type,margin?"margin":"border")):null;};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this;}
if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()));});}
if(jQuery.isWindow(elem)){var docElemProp=elem.document.documentElement["client"+name];return elem.document.compatMode==="CSS1Compat"&&docElemProp||elem.document.body["client"+name]||docElemProp;}else if(elem.nodeType===9){return Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name]);}else if(size===undefined){var orig=jQuery.css(elem,type),ret=parseFloat(orig);return jQuery.isNaN(ret)?orig:ret;}else{return this.css(type,typeof size==="string"?size:size+"px");}};});window.jQuery=window.$=jQuery;})(window);(function($,undefined){$.ui=$.ui||{};if($.ui.version){return;}
$.extend($.ui,{version:"1.8.9",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});$.fn.extend({_focus:$.fn.focus,focus:function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem);}},delay);}):this._focus.apply(this,arguments);},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex);}
if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value;}}
elem=elem.parent();}}
return 0;},disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault();});},enableSelection:function(){return this.unbind(".ui-disableSelection");}});$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.curCSS(elem,"padding"+this,true))||0;if(border){size-=parseFloat($.curCSS(elem,"border"+this+"Width",true))||0;}
if(margin){size-=parseFloat($.curCSS(elem,"margin"+this,true))||0;}});return size;}
$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this);}
return this.each(function(){$(this).css(type,reduce(this,size)+"px");});};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size);}
return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px");});};});function visible(element){return!$(element).parents().andSelf().filter(function(){return $.curCSS(this,"visibility")==="hidden"||$.expr.filters.hidden(this);}).length;}
$.extend($.expr[":"],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,"tabindex");if("area"===nodeName){var map=element.parentNode,mapName=map.name,img;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false;}
img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img);}
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&visible(element);},tabbable:function(element){var tabIndex=$.attr(element,"tabindex");return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(":focusable");}});$(function(){var body=document.body,div=body.appendChild(div=document.createElement("div"));$.extend(div.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});$.support.minHeight=div.offsetHeight===100;$.support.selectstart="onselectstart"in div;body.removeChild(div).style.display="none";});$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false;}
var scroll=(a&&a==="left")?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);}});})(jQuery);(function($,undefined){if($.cleanData){var _cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){$(elem).triggerHandler("remove");}
_cleanData(elems);};}else{var _remove=$.fn.remove;$.fn.remove=function(selector,keepData){return this.each(function(){if(!keepData){if(!selector||$.filter(selector,[this]).length){$("*",this).add([this]).each(function(){$(this).triggerHandler("remove");});}}
return _remove.call($(this),selector,keepData);});};}
$.widget=function(name,base,prototype){var namespace=name.split(".")[0],fullName;name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget;}
$.expr[":"][fullName]=function(elem){return!!$.data(elem,name);};$[namespace]=$[namespace]||{};$[namespace][name]=function(options,element){if(arguments.length){this._createWidget(options,element);}};var basePrototype=new base();basePrototype.options=$.extend(true,{},basePrototype.options);$[namespace][name].prototype=$.extend(true,basePrototype,{namespace:namespace,widgetName:name,widgetEventPrefix:$[namespace][name].prototype.widgetEventPrefix||name,widgetBaseClass:fullName},prototype);$.widget.bridge(name,$[namespace][name]);};$.widget.bridge=function(name,object){$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.charAt(0)==="_"){return returnValue;}
if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false;}});}else{this.each(function(){var instance=$.data(this,name);if(instance){instance.option(options||{})._init();}else{$.data(this,name,new object(options,this));}});}
return returnValue;};};$.Widget=function(options,element){if(arguments.length){this._createWidget(options,element);}};$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(options,element){$.data(element,this.widgetName,this);this.element=$(element);this.options=$.extend(true,{},this.options,this._getCreateOptions(),options);var self=this;this.element.bind("remove."+this.widgetName,function(){self.destroy();});this._create();this._trigger("create");this._init();},_getCreateOptions:function(){return $.metadata&&$.metadata.get(this.element[0])[this.widgetName];},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled");},widget:function(){return this.element;},option:function(key,value){var options=key;if(arguments.length===0){return $.extend({},this.options);}
if(typeof key==="string"){if(value===undefined){return this.options[key];}
options={};options[key]=value;}
this._setOptions(options);return this;},_setOptions:function(options){var self=this;$.each(options,function(key,value){self._setOption(key,value);});return this;},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget()
[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",value);}
return this;},enable:function(){return this._setOption("disabled",false);},disable:function(){return this._setOption("disabled",true);},_trigger:function(type,event,data){var callback=this.options[type];event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();data=data||{};if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};})(jQuery);(function($,undefined){$.widget("ui.mouse",{options:{cancel:':input,option',distance:1,delay:0},_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(true===$.data(event.target,self.widgetName+'.preventClickEvent')){$.removeData(event.target,self.widgetName+'.preventClickEvent');event.stopImmediatePropagation();return false;}});this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;}
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);event.preventDefault();event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!(document.documentMode>=9)&&!event.button){return this._mouseUp(event);}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target==this._mouseDownEvent.target){$.data(event.target,this.widgetName+'.preventClickEvent',true);}
this._mouseStop(event);}
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}});})(jQuery);(function($,undefined){$.ui=$.ui||{};var horizontalPositions=/left|center|right/,verticalPositions=/top|center|bottom/,center="center",_position=$.fn.position,_offset=$.fn.offset;$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments);}
options=$.extend({},options);var target=$(options.of),targetElem=target[0],collision=(options.collision||"flip").split(" "),offset=options.offset?options.offset.split(" "):[0,0],targetWidth,targetHeight,basePosition;if(targetElem.nodeType===9){targetWidth=target.width();targetHeight=target.height();basePosition={top:0,left:0};}else if(targetElem.setTimeout){targetWidth=target.width();targetHeight=target.height();basePosition={top:target.scrollTop(),left:target.scrollLeft()};}else if(targetElem.preventDefault){options.at="left top";targetWidth=targetHeight=0;basePosition={top:options.of.pageY,left:options.of.pageX};}else{targetWidth=target.outerWidth();targetHeight=target.outerHeight();basePosition=target.offset();}
$.each(["my","at"],function(){var pos=(options[this]||"").split(" ");if(pos.length===1){pos=horizontalPositions.test(pos[0])?pos.concat([center]):verticalPositions.test(pos[0])?[center].concat(pos):[center,center];}
pos[0]=horizontalPositions.test(pos[0])?pos[0]:center;pos[1]=verticalPositions.test(pos[1])?pos[1]:center;options[this]=pos;});if(collision.length===1){collision[1]=collision[0];}
offset[0]=parseInt(offset[0],10)||0;if(offset.length===1){offset[1]=offset[0];}
offset[1]=parseInt(offset[1],10)||0;if(options.at[0]==="right"){basePosition.left+=targetWidth;}else if(options.at[0]===center){basePosition.left+=targetWidth/2;}
if(options.at[1]==="bottom"){basePosition.top+=targetHeight;}else if(options.at[1]===center){basePosition.top+=targetHeight/2;}
basePosition.left+=offset[0];basePosition.top+=offset[1];return this.each(function(){var elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseInt($.curCSS(this,"marginLeft",true))||0,marginTop=parseInt($.curCSS(this,"marginTop",true))||0,collisionWidth=elemWidth+marginLeft+
(parseInt($.curCSS(this,"marginRight",true))||0),collisionHeight=elemHeight+marginTop+
(parseInt($.curCSS(this,"marginBottom",true))||0),position=$.extend({},basePosition),collisionPosition;if(options.my[0]==="right"){position.left-=elemWidth;}else if(options.my[0]===center){position.left-=elemWidth/2;}
if(options.my[1]==="bottom"){position.top-=elemHeight;}else if(options.my[1]===center){position.top-=elemHeight/2;}
position.left=Math.round(position.left);position.top=Math.round(position.top);collisionPosition={left:position.left-marginLeft,top:position.top-marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:offset,my:options.my,at:options.at});}});if($.fn.bgiframe){elem.bgiframe();}
elem.offset($.extend(position,{using:options.using}));});};$.ui.position={fit:{left:function(position,data){var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft();position.left=over>0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left);},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top);}},flip:{left:function(position,data){if(data.at[0]===center){return;}
var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0;},top:function(position,data){if(data.at[1]===center){return;}
var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0;}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if('using'in options){options.using.call(elem,props);}else{curElem.css(props);}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null;}
if(options){return this.each(function(){$.offset.setOffset(this,options);});}
return _offset.call(this);};}}(jQuery));(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options;this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");if(o.disabled){this.element.addClass("ui-slider-disabled ui-disabled");}
this.range=$([]);if(o.range){if(o.range===true){this.range=$("<div></div>");if(!o.values){o.values=[this._valueMin(),this._valueMin()];}
if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]];}}else{this.range=$("<div></div>");}
this.range.appendTo(this.element).addClass("ui-slider-range");if(o.range==="min"||o.range==="max"){this.range.addClass("ui-slider-range-"+o.range);}
this.range.addClass("ui-widget-header");}
if($(".ui-slider-handle",this.element).length===0){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");}
if(o.values&&o.values.length){while($(".ui-slider-handle",this.element).length<o.values.length){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");}}
this.handles=$(".ui-slider-handle",this.element).addClass("ui-state-default"+" ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(event){event.preventDefault();}).hover(function(){if(!o.disabled){$(this).addClass("ui-state-hover");}},function(){$(this).removeClass("ui-state-hover");}).focus(function(){if(!o.disabled){$(".ui-slider .ui-state-focus").removeClass("ui-state-focus");$(this).addClass("ui-state-focus");}else{$(this).blur();}}).blur(function(){$(this).removeClass("ui-state-focus");});this.handles.each(function(i){$(this).data("index.ui-slider-handle",i);});this.handles.keydown(function(event){var ret=true,index=$(this).data("index.ui-slider-handle"),allowed,curVal,newVal,step;if(self.options.disabled){return;}
switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:ret=false;if(!self._keySliding){self._keySliding=true;$(this).addClass("ui-state-active");allowed=self._start(event,index);if(allowed===false){return;}}
break;}
step=self.options.step;if(self.options.values&&self.options.values.length){curVal=newVal=self.values(index);}else{curVal=newVal=self.value();}
switch(event.keyCode){case $.ui.keyCode.HOME:newVal=self._valueMin();break;case $.ui.keyCode.END:newVal=self._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=self._trimAlignValue(curVal+((self._valueMax()-self._valueMin())/numPages));break;case $.ui.keyCode.PAGE_DOWN:newVal=self._trimAlignValue(curVal-((self._valueMax()-self._valueMin())/numPages));break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===self._valueMax()){return;}
newVal=self._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===self._valueMin()){return;}
newVal=self._trimAlignValue(curVal-step);break;}
self._slide(event,index,newVal);return ret;}).keyup(function(event){var index=$(this).data("index.ui-slider-handle");if(self._keySliding){self._keySliding=false;self._stop(event,index);self._change(event,index);$(this).removeClass("ui-state-active");}});this._refreshValue();this._animateOff=false;},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-slider-disabled"+" ui-widget"+" ui-widget-content"+" ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();return this;},_mouseCapture:function(event){var o=this.options,position,normValue,distance,closestHandle,self,index,allowed,offset,mouseOverHandle;if(o.disabled){return false;}
this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;self=this;this.handles.each(function(i){var thisDistance=Math.abs(normValue-self.values(i));if(distance>thisDistance){distance=thisDistance;closestHandle=$(this);index=i;}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index]);}
allowed=this._start(event,index);if(allowed===false){return false;}
this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-
(closestHandle.height()/2)-
(parseInt(closestHandle.css("borderTopWidth"),10)||0)-
(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+
(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue);}
this._animateOff=true;return true;},_mouseStart:function(event){return true;},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false;},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false;},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal";},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0);}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0);}
percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1;}
if(percentMouse<0){percentMouse=0;}
if(this.orientation==="vertical"){percentMouse=1-percentMouse;}
valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse);},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
return this._trigger("start",event,uiHash);},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal<otherVal))){newVal=otherVal;}
if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal,true);}}}else{if(newVal!==this.value()){allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal);}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._trigger("stop",event,uiHash);},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._trigger("change",event,uiHash);}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);}
return this._value();},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);}
if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i);}
this._refreshValue();}else{if(this.options.values&&this.options.values.length){return this._values(index);}else{return this.value();}}}else{return this._values();}},_setOption:function(key,value){var i,valsLength=0;if($.isArray(this.options.values)){valsLength=this.options.values.length;}
$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"disabled":if(value){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled");}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled");}
break;case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i);}
this._animateOff=false;break;}},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val;},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val;}else{vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i]);}
return vals;}},_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin();}
if(val>=this._valueMax()){return this._valueMax();}
var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step;alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step);}
return parseFloat(alignValue.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=(!this._animateOff)?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate);}
if(i===1){self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate);}
if(i===1){self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}}
lastValPercent=valPercent;});}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate});}
if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate});}}}});$.extend($.ui.slider,{version:"1.8.9"});}(jQuery));(function($,undefined){$.widget("ui.draggable",$.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper=='original'&&!(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position='relative';(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable"
+" ui-draggable-dragging"
+" ui-draggable-disabled");this._mouseDestroy();return this;},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is('.ui-resizable-handle'))
return false;this.handle=this._getHandle(event);if(!this.handle)
return false;return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager)
$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));if(o.containment)
this._setContainment();if(this._trigger("start",event)===false){this._clear();return false;}
this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true;},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger('drag',event,ui)===false){this._mouseUp({});return false;}
this.position=ui.position;}
if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);return false;},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)
dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false;}
if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")
return false;if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(self._trigger("stop",event)!==false){self._clear();}});}else{if(this._trigger("stop",event)!==false){this._clear();}}
return false;},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({});}else{this._clear();}
return this;},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true;});return handle;},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=='clone'?this.element.clone():this.element);if(!helper.parents('body').length)
helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position")))
helper.css("position","absolute");return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj=='string'){obj=obj.split(' ');}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if('left'in obj){this.offset.click.left=obj.left+this.margins.left;}
if('right'in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if('top'in obj){this.offset.click.top=obj.top+this.margins.top;}
if('bottom'in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[(o.containment=='document'?0:$(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(o.containment=='document'?0:$(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(o.containment=='document'?0:$(window).scrollLeft())+$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,(o.containment=='document'?0:$(window).scrollTop())+($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else if(o.containment.constructor==Array){this.containment=o.containment;}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type=="drag")this.positionAbs=this._convertPositionTo("absolute");return $.Widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs};}});$.extend($.ui.draggable,{version:"1.8.9"});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,'sortable');if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable._refreshItems();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper=='original')
this.instance.currentItem.css({top:'auto',left:'auto'});}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;var itemHeight=o.height,itemWidth=o.width;var itemTop=o.top,itemLeft=o.left;return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth);};$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst;}
if(this.instance.currentItem)this.instance._mouseDrag(event);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger('out',event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst._trigger("fromSortable",event);inst.dropped=false;}};});}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$('body'),o=$(this).data('draggable').options;if(t.css("cursor"))o._cursor=t.css("cursor");t.css("cursor",o.cursor);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._cursor)$('body').css("cursor",o._cursor);}});$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data('draggable').options;$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data('draggable').options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css('opacity',o.opacity);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._opacity)$(ui.helper).css('opacity',o._opacity);}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML')i.overflowOffset=i.scrollParent.offset();},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML'){if(!o.axis||o.axis!='x'){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity)
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed;}
if(!o.axis||o.axis!='y'){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity)
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(!o.axis||o.axis!='x'){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(!o.axis||o.axis!='y'){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(i,event);}});$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!=String?(o.snap.items||':data(draggable)'):o.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=i.element[0])i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;var d=o.snapTolerance;var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d))){if(inst.snapElements[i].snapping)(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=false;continue;}
if(o.snapMode!='inner'){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;}
var first=(ts||bs||ls||rs);if(o.snapMode!='outer'){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;}
if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first))
(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0);});if(!group.length){return;}
var min=parseInt(group[0].style.zIndex)||0;$(group).each(function(i){this.style.zIndex=min+i;});this[0].style.zIndex=min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($,undefined){$.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:'*',activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:'default',tolerance:'intersect'},_create:function(){var o=this.options,accept=o.accept;this.isover=0;this.isout=1;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept);};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables[o.scope]=$.ui.ddmanager.droppables[o.scope]||[];$.ui.ddmanager.droppables[o.scope].push(this);(o.addClasses&&this.element.addClass("ui-droppable"));},destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];for(var i=0;i<drop.length;i++)
if(drop[i]==this)
drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this;},_setOption:function(key,value){if(key=='accept'){this.accept=$.isFunction(value)?value:function(d){return d.is(value);};}
$.Widget.prototype._setOption.apply(this,arguments);},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.addClass(this.options.activeClass);(draggable&&this._trigger('activate',event,this.ui(draggable)));},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.removeClass(this.options.activeClass);(draggable&&this._trigger('deactivate',event,this.ui(draggable)));},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass)this.element.addClass(this.options.hoverClass);this._trigger('over',event,this.ui(draggable));}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger('out',event,this.ui(draggable));}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope==draggable.options.scope&&inst.accept.call(inst.element[0],(draggable.currentItem||draggable.element))&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection)return false;if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.activeClass)this.element.removeClass(this.options.activeClass);if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger('drop',event,this.ui(draggable));return this.element;}
return false;},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,offset:c.positionAbs};}});$.extend($.ui.droppable,{version:"1.8.9"});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset)return false;var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;switch(toleranceMode){case'fit':return(l<=x1&&x2<=r&&t<=y1&&y2<=b);break;case'intersect':return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);break;case'pointer':var draggableLeft=((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left),draggableTop=((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top),isOver=$.ui.isOver(draggableTop,draggableLeft,t,l,droppable.proportions.height,droppable.proportions.width);return isOver;break;case'touch':return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:{'default':[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope]||[];var type=event?event.type:null;var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();droppablesLoop:for(var i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].accept.call(m[i].element[0],(t.currentItem||t.element))))continue;for(var j=0;j<list.length;j++){if(list[j]==m[i].element[0]){m[i].proportions.height=0;continue droppablesLoop;}};m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};if(type=="mousedown")m[i]._activate.call(m[i],event);}},drop:function(draggable,event){var dropped=false;$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(!this.options)return;if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance))
dropped=dropped||this._drop.call(this,event);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=1;this.isover=0;this._deactivate.call(this,event);}});return dropped;},drag:function(draggable,event){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,event);$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var intersects=$.ui.intersect(draggable,this,this.options.tolerance);var c=!intersects&&this.isover==1?'isout':(intersects&&this.isover==0?'isover':null);if(!c)return;var parentInstance;if(this.options.greedy){var parent=this.element.parents(':data(droppable):eq(0)');if(parent.length){parentInstance=$.data(parent[0],'droppable');parentInstance.greedyChild=(c=='isover'?1:0);}}
if(parentInstance&&c=='isover'){parentInstance['isover']=0;parentInstance['isout']=1;parentInstance._out.call(parentInstance,event);}
this[c]=1;this[c=='isout'?'isover':'isout']=0;this[c=="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c=='isout'){parentInstance['isout']=0;parentInstance['isover']=1;parentInstance._over.call(parentInstance,event);}});}};})(jQuery);(function($,undefined){$.widget("ui.sortable",$.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:'auto',cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:'> *',opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)
this.items[i].item.removeData("sortable-item");return this;},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget()
[value?"addClass":"removeClass"]("ui-sortable-disabled");}else{$.Widget.prototype._setOption.apply(this,arguments);}},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;}
if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;}
this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();}
this._createPlaceholder();if(o.containment)
this._setContainment();if(o.cursor){if($('body').css("cursor"))this._storedCursor=$('body').css("cursor");$('body').css("cursor",o.cursor);}
if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity);}
if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex);}
if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML')
this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions)
this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this));}}
if($.ui.ddmanager)
$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}
if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML'){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity)
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity)
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);}
this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=='semi-dynamic'?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
this._trigger("change",event,this._uiHash());break;}}
this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger('sort',event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour)
$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event);});}else{this._clear(event,noPropagation);}
return false;},cancel:function(){var self=this;if(this.dragging){this._mouseUp({target:null});if(this.options.helper=="original")
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else
this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(this.placeholder){if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}}
return this;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1]+'[]')+'='+(o.key&&o.expression?res[1]:res[2]));});if(!str.length&&o.key){str.push(o.key+'=');}
return str.join('&');},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||'id')||'');});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)<b&&(x1+dxClick)>l&&(x1+dxClick)<r;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var isOverElementHeight=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement)
return false;return this.floating?(((horizontalDirection&&horizontalDirection=="right")||verticalDirection=="down")?2:1):(verticalDirection&&(verticalDirection=="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return((horizontalDirection=="right"&&isOverRightHalf)||(horizontalDirection=="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection=="down"&&isOverBottomHalf)||(verticalDirection=="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!=0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this;},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),inst]);}};};}
queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this);});};return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i<this.items.length;i++){for(var j=0;j<list.length;j++){if(list[j]==this.items[i].item[0])
this.items.splice(i,1);};};},_refreshItems:function(event){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]];var connectWith=this._connectWith();if(connectWith){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}
for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j<queriesLength;j++){var item=$(_queries[j]);item.data('sortable-item',targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});};};},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
for(var i=this.items.length-1;i>=0;i--){var item=this.items[i];var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
var p=t.offset();item.left=p.left;item.top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}
return this;},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className)
el.style.visibility="hidden";return el;},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css('paddingTop')||0,10)-parseInt(self.currentItem.css('paddingBottom')||0,10));};if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css('paddingLeft')||0,10)-parseInt(self.currentItem.css('paddingRight')||0,10));};}};}
self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder);},_contactContainers:function(event){var innermostContainer=null,innermostIndex=null;for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.currentItem[0],this.containers[i].element[0]))
continue;if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.ui.contains(this.containers[i].element[0],innermostContainer.element[0]))
continue;innermostContainer=this.containers[i];innermostIndex=i;}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(!innermostContainer)return;if(this.containers.length===1){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}else if(this.currentContainer!=this.containers[innermostIndex]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[innermostIndex].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[innermostIndex].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[innermostIndex].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty)
return;this.currentContainer=this.containers[innermostIndex];itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper=='clone'?this.currentItem.clone():this.currentItem);if(!helper.parents('body').length)
$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);if(helper[0]==this.currentItem[0])
this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(helper[0].style.width==''||o.forceHelperSize)helper.width(this.currentItem.width());if(helper[0].style.height==''||o.forceHelperSize)helper.height(this.currentItem.height());return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj=='string'){obj=obj.split(' ');}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if('left'in obj){this.offset.click.left=obj.left+this.margins.left;}
if('right'in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if('top'in obj){this.offset.click.top=obj.top+this.margins.top;}
if('bottom'in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);},_clear:function(event,noPropagation){this.reverting=false;var delayedTriggers=[],self=this;if(!this._noFinalSort&&this.currentItem[0].parentNode)this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS){if(this._storedCSS[i]=='auto'||this._storedCSS[i]=='static')this._storedCSS[i]='';}
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
if(this.fromOutside&&!noPropagation)delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!noPropagation)delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});if(!$.ui.contains(this.element[0],this.currentItem[0])){if(!noPropagation)delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.containers[i]));}};};for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this));};}).call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this));};}).call(this,this.containers[i]));this.containers[i].containerCache.over=0;}}
if(this._storedCursor)$('body').css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=='auto'?'':this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
return false;}
if(!noPropagation)this._trigger("beforeStop",event,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0])this.helper.remove();this.helper=null;if(!noPropagation){for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
this.fromOutside=false;return true;},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(inst){var self=inst||this;return{helper:self.helper,placeholder:self.placeholder||$([]),position:self.position,originalPosition:self.originalPosition,offset:self.positionAbs,item:self.currentItem,sender:inst?inst.element:null};}});$.extend($.ui.sortable,{version:"1.8.9"});})(jQuery);(function($,undefined){$.widget("ui.autocomplete",{options:{appendTo:"body",delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var self=this,doc=this.element[0].ownerDocument,suppressKeyPress;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(event){if(self.options.disabled||self.element.attr("readonly")){return;}
suppressKeyPress=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:self._move("previousPage",event);break;case keyCode.PAGE_DOWN:self._move("nextPage",event);break;case keyCode.UP:self._move("previous",event);event.preventDefault();break;case keyCode.DOWN:self._move("next",event);event.preventDefault();break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(self.menu.active){suppressKeyPress=true;event.preventDefault();}
case keyCode.TAB:if(!self.menu.active){return;}
self.menu.select(event);break;case keyCode.ESCAPE:self.element.val(self.term);self.close(event);break;default:clearTimeout(self.searching);self.searching=setTimeout(function(){if(self.term!=self.element.val()){self.selectedItem=null;self.search(null,event);}},self.options.delay);break;}}).bind("keypress.autocomplete",function(event){if(suppressKeyPress){suppressKeyPress=false;event.preventDefault();}}).bind("focus.autocomplete",function(){if(self.options.disabled){return;}
self.selectedItem=null;self.previous=self.element.val();}).bind("blur.autocomplete",function(event){if(self.options.disabled){return;}
clearTimeout(self.searching);self.closing=setTimeout(function(){self.close(event);self._change(event);},150);});this._initSource();this.response=function(){return self._response.apply(self,arguments);};this.menu=$("<ul></ul>").addClass("ui-autocomplete").appendTo($(this.options.appendTo||"body",doc)[0]).mousedown(function(event){var menuElement=self.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){setTimeout(function(){$(document).one('mousedown',function(event){if(event.target!==self.element[0]&&event.target!==menuElement&&!$.ui.contains(menuElement,event.target)){self.close();}});},1);}
setTimeout(function(){clearTimeout(self.closing);},13);}).menu({focus:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("focus",event,{item:item})){if(/^key/.test(event.originalEvent.type)){self.element.val(item.value);}}},selected:function(event,ui){var item=ui.item.data("item.autocomplete"),previous=self.previous;if(self.element[0]!==doc.activeElement){self.element.focus();self.previous=previous;setTimeout(function(){self.previous=previous;self.selectedItem=item;},1);}
if(false!==self._trigger("select",event,{item:item})){self.element.val(item.value);}
self.term=self.element.val();self.close(event);self.selectedItem=item;},blur:function(event,ui){if(self.menu.element.is(":visible")&&(self.element.val()!==self.term)){self.element.val(self.term);}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if($.fn.bgiframe){this.menu.element.bgiframe();}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();$.Widget.prototype.destroy.call(this);},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="source"){this._initSource();}
if(key==="appendTo"){this.menu.element.appendTo($(value||"body",this.element[0].ownerDocument)[0])}
if(key==="disabled"&&value&&this.xhr){this.xhr.abort();}},_initSource:function(){var self=this,array,url;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term));};}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(self.xhr){self.xhr.abort();}
self.xhr=$.ajax({url:url,data:request,dataType:"json",success:function(data,status,xhr){if(xhr===self.xhr){response(data);}
self.xhr=null;},error:function(xhr){if(xhr===self.xhr){response([]);}
self.xhr=null;}});};}else{this.source=this.options.source;}},search:function(value,event){value=value!=null?value:this.element.val();this.term=this.element.val();if(value.length<this.options.minLength){return this.close(event);}
clearTimeout(this.closing);if(this._trigger("search",event)===false){return;}
return this._search(value);},_search:function(value){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:value},this.response);},_response:function(content){if(!this.options.disabled&&content&&content.length){content=this._normalize(content);this._suggest(content);this._trigger("open");}else{this.close();}
this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading");}},close:function(event){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",event);}},_change:function(event){if(this.previous!==this.element.val()){this._trigger("change",event,{item:this.selectedItem});}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items;}
return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item};}
return $.extend({label:item.label||item.value,value:item.value||item.label},item);});},_suggest:function(items){var ul=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(ul,items);this.menu.deactivate();this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth(),this.element.outerWidth()));},_renderMenu:function(ul,items){var self=this;$.each(items,function(index,item){self._renderItem(ul,item);});},_renderItem:function(ul,item){return $("<li></li>").data("item.autocomplete",item).append($("<a></a>").text(item.label)).appendTo(ul);},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return;}
if(this.menu.first()&&/^previous/.test(direction)||this.menu.last()&&/^next/.test(direction)){this.element.val(this.term);this.menu.deactivate();return;}
this.menu[direction](event);},widget:function(){return this.menu.element;}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value);});}});}(jQuery));(function($){$.widget("ui.menu",{_create:function(){var self=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(event){if(!$(event.target).closest(".ui-menu-item a").length){return;}
event.preventDefault();self.select(event);});this.refresh();},refresh:function(){var self=this;var items=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");items.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(event){self.activate(event,$(this).parent());}).mouseleave(function(){self.deactivate();});},activate:function(event,item){this.deactivate();if(this.hasScroll()){var offset=item.offset().top-this.element.offset().top,scroll=this.element.attr("scrollTop"),elementHeight=this.element.height();if(offset<0){this.element.attr("scrollTop",scroll+offset);}else if(offset>=elementHeight){this.element.attr("scrollTop",scroll+offset-elementHeight+item.height());}}
this.active=item.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",event,{item:item});},deactivate:function(){if(!this.active){return;}
this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null;},next:function(event){this.move("next",".ui-menu-item:first",event);},previous:function(event){this.move("prev",".ui-menu-item:last",event);},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},move:function(direction,edge,event){if(!this.active){this.activate(event,this.element.children(edge));return;}
var next=this.active[direction+"All"](".ui-menu-item").eq(0);if(next.length){this.activate(event,next);}else{this.activate(event,this.element.children(edge));}},nextPage:function(event){if(this.hasScroll()){if(!this.active||this.last()){this.activate(event,this.element.children(".ui-menu-item:first"));return;}
var base=this.active.offset().top,height=this.element.height(),result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base-height+$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(".ui-menu-item:last");}
this.activate(event,result);}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"));}},previousPage:function(event){if(this.hasScroll()){if(!this.active||this.first()){this.activate(event,this.element.children(".ui-menu-item:last"));return;}
var base=this.active.offset().top,height=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base+height-$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(".ui-menu-item:first");}
this.activate(event,result);}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"));}},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight");},select:function(event){this._trigger("selected",event,{item:this.active});}});}(jQuery));(function($,undefined){var tabId=0,listId=0;function getNextTabId(){return++tabId;}
function getNextListId(){return++listId;}
$.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true);},_setOption:function(key,value){if(key=="selected"){if(this.options.collapsible&&value==this.options.selected){return;}
this.select(value);}else{this.options[key]=value;this._tabify();}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+getNextTabId();},_sanitizeSelector:function(hash){return hash.replace(/:/g,"\\:");},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+getNextListId());return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)));},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)};},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var el=$(this);el.html(el.data("label.tabs")).removeData("label.tabs");});},_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=$(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return $("a",this)[0];});this.panels=$([]);this.anchors.each(function(i,a){var href=$(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=$("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href;}
if(fragmentId.test(href)){self.panels=self.panels.add(self.element.find(self._sanitizeSelector(href)));}else if(href&&href!=="#"){$.data(a,"href.tabs",href);$.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);$panel.data("destroy.tabs",true);}
self.panels=self.panels.add($panel);}else{o.disabled.push(i);}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});}
if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10);}
if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));}
o.selected=o.selected||(this.lis.length?0:-1);}else if(o.selected===null){o.selected=-1;}
o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1);}
this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash))[0]));});this.load(o.selected);}
$(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null;});}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));}
this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie);}
for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");}
if(o.cache===false){this.anchors.removeData("cache.tabs");}
this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state);}};var removeState=function(state,el){el.removeClass("ui-state-"+state);};this.lis.bind("mouseover.tabs",function(){addState("hover",$(this));});this.lis.bind("mouseout.tabs",function(){removeState("hover",$(this));});this.anchors.bind("focus.tabs",function(){addState("focus",$(this).closest("li"));});this.anchors.bind("blur.tabs",function(){removeState("focus",$(this).closest("li"));});}
var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];}else{hideFx=showFx=o.fx;}}
function resetStyle($el,fx){$el.css("display","");if(!$.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter");}}
var showTab=showFx?function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs");};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=$(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=self.element.find(self._sanitizeSelector(el.hash));if(($li.hasClass("ui-tabs-selected")&&!o.collapsible)||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false;}
o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);}
self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;}else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);}
self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}}
if(o.cookie){self._cookie(o.selected,o.cookie);}
if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});}
self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));}else{throw"jQuery UI Tabs: Mismatching fragment identifier.";}
if($.browser.msie){this.blur();}});this.anchors.bind("click.tabs",function(){return false;});},_getIndex:function(index){if(typeof index=="string"){index=this.anchors.index(this.anchors.filter("[href$="+index+"]"));}
return index;},destroy:function(){var o=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var href=$.data(this,"href.tabs");if(href){this.href=href;}
var $this=$(this).unbind(".tabs");$.each(["href","load","cache"],function(i,prefix){$this.removeData(prefix+".tabs");});});this.lis.unbind(".tabs").add(this.panels).each(function(){if($.data(this,"destroy.tabs")){$(this).remove();}else{$(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "));}});if(o.cookie){this._cookie(null,o.cookie);}
return this;},add:function(url,label,index){if(index===undefined){index=this.anchors.length;}
var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf("#")?url.replace("#",""):this._tabId($("a",$li)[0]);$li.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).data("destroy.tabs",true);}
$panel.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode);}else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index]);}
o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n;});this._tabify();if(this.anchors.length==1){o.selected=0;$li.addClass("ui-tabs-selected ui-state-active");$panel.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[0],self.panels[0]));});this.load(0);}
this._trigger("add",null,this._ui(this.anchors[index],this.panels[index]));return this;},remove:function(index){index=this._getIndex(index);var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(index+(index+1<this.anchors.length?1:-1));}
o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n;});this._tabify();this._trigger("remove",null,this._ui($li.find("a")[0],$panel[0]));return this;},enable:function(index){index=this._getIndex(index);var o=this.options;if($.inArray(index,o.disabled)==-1){return;}
this.lis.eq(index).removeClass("ui-state-disabled");o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger("enable",null,this._ui(this.anchors[index],this.panels[index]));return this;},disable:function(index){index=this._getIndex(index);var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass("ui-state-disabled");o.disabled.push(index);o.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[index],this.panels[index]));}
return this;},select:function(index){index=this._getIndex(index);if(index==-1){if(this.options.collapsible&&this.options.selected!=-1){index=this.options.selected;}else{return this;}}
this.anchors.eq(index).trigger(this.options.event+".tabs");return this;},load:function(index){index=this._getIndex(index);var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,"load.tabs");this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,"cache.tabs")){this.element.dequeue("tabs");return;}
this.lis.eq(index).addClass("ui-state-processing");if(o.spinner){var span=$("span",a);span.data("label.tabs",span.html()).html(o.spinner);}
this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){self.element.find(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,"cache.tabs",true);}
self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s);}
catch(e){}},error:function(xhr,s,e){self._cleanup();self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.error(xhr,s,index,a);}
catch(e){}}}));self.element.dequeue("tabs");return this;},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr;}
this._cleanup();return this;},url:function(index,url){this.anchors.eq(index).removeData("cache.tabs").data("load.tabs",url);return this;},length:function(){return this.anchors.length;}});$.extend($.ui.tabs,{version:"1.8.9"});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0);},ms);if(e){e.stopPropagation();}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null);}}:function(e){t=o.selected;rotate();});if(ms){this.element.bind("tabsshow",rotate);this.anchors.bind(o.event+".tabs",stop);rotate();}else{clearTimeout(self.rotation);this.element.unbind("tabsshow",rotate);this.anchors.unbind(o.event+".tabs",stop);delete this._rotate;delete this._unrotate;}
return this;}});})(jQuery);;(function($){$.fn.indexer=function(name){return this[0]&&indexer(this[0],name)||null;};$.indexer=function(name){return indexer(document,name);};var $event=$.event,$special=$event.special,$listen=$.listen=function(name,listener,selector,handler){if(typeof listener!='object'){handler=selector;selector=listener;listener=document;}
each(name.split(/\s+/),function(ev){ev=$listen.fixes[ev]||ev;var idxer=indexer(listener,ev)||indexer(listener,ev,new Indexer(ev,listener));idxer.append(selector,handler);idxer.start();});},indexer=function(elem,name,val){return $.data(elem,name+'.indexer',val);};$.extend($listen,{regex:/^((?:\w*?|\*))(?:([#.])([\w-]+))?$/,fixes:{focus:'focusin',blur:'focusout'},cache:function(on){this.caching=on;}});$.each($listen.fixes,function(original,fix){$special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$special[fix].handler,true);},handler:function(e){arguments[0]=e=$event.fix(e);e.type=fix;return $event.handle.apply(this,arguments);}};});$.fn.listen=function(name,selector,handler){return this.each(function(){$listen(name,this,selector,handler);});};function Indexer(name,listener){$.extend(this,{ids:{},tags:{},listener:listener,event:name});this.id=Indexer.instances.push(this);};Indexer.instances=[];Indexer.prototype={constructor:Indexer,handle:function(e){var sp=e.stopPropagation;e.stopPropagation=function(){e.stopped=true;sp.apply(this,arguments);};indexer(this,e.type).parse(e);e.stopPropagation=sp;sp=e.data=null;},on:false,bubbles:false,start:function(){if(!this.on){$event.add(this.listener,this.event,this.handle);this.on=true;}},stop:function(){if(this.on){$event.remove(this.listener,this.event,this.handle);this.on=false;}},cache:function(node,handlers){return $.data(node,'listenCache_'+this.id,handlers);},parse:function(e){var node=e.data||e.target,args=arguments,handlers;if(!$listen.caching||!(handlers=this.cache(node))){handlers=[];if(node.id&&this.ids[node.id])
push(handlers,this.ids[node.id]);each([node.nodeName,'*'],function(tag){var klasses=this.tags[tag];if(klasses)
each((node.className+' *').split(' '),function(klass){if(klass&&klasses[klass])
push(handlers,klasses[klass]);});},this);if($listen.caching)
this.cache(node,handlers);}
if(handlers[0]){each(handlers,function(handler){if(handler.apply(node,args)===false){e.preventDefault();e.stopPropagation();}});}
if(!e.stopped&&(node=node.parentNode)&&(node.nodeName=='A'||this.bubbles&&node!=this.listener)){e.data=node;this.parse(e);}
handlers=args=node=null;},append:function(selector,handler){each(selector.split(/\s*,\s*/),function(selector){var match=$listen.regex.exec(selector);if(!match)
throw'$.listen > "'+selector+'" is not a supported selector.';var
id=match[2]=='#'&&match[3],tag=match[1].toUpperCase()||'*',klass=match[3]||'*';if(id)
(this.ids[id]||(this.ids[id]=[])).push(handler);else if(tag){tag=this.tags[tag]=this.tags[tag]||{};(tag[klass]||(tag[klass]=[])).push(handler);}},this);}};function each(arr,fn,scope){for(var i=0,l=arr.length;i<l;i++)
fn.call(scope,arr[i],i);};function push(arr,elems){arr.push.apply(arr,elems);return arr;};$(window).unload(function(){if(typeof Indexer=='function')
each(Indexer.instances,function(idxer){idxer.stop();$.removeData(idxer.listener,idxer.event+'.indexer');idxer.ids=idxer.names=idxer.listener=null;});});})(jQuery);(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);;(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);;if(window.jQuery)(function($){$.extend({xml2json:function(xml,extended){if(!xml)return{};function parseXML(node,simple){if(!node)return null;var txt='',obj=null,att=null;var nt=node.nodeType,nn=jsVar(node.localName||node.nodeName);var nv=node.text||node.nodeValue||'';if(node.childNodes){if(node.childNodes.length>0){$.each(node.childNodes,function(n,cn){var cnt=cn.nodeType,cnn=jsVar(cn.localName||cn.nodeName);var cnv=cn.text||cn.nodeValue||'';if(cnt==8){return;}
else if(cnt==3||cnt==4||!cnn){if(cnv.match(/^\s+$/)){return;};txt+=cnv.replace(/^\s+/,'').replace(/\s+$/,'');}
else{obj=obj||{};if(obj[cnn]){if(!obj[cnn].length)obj[cnn]=myArr(obj[cnn]);obj[cnn][obj[cnn].length]=parseXML(cn,true);obj[cnn].length=obj[cnn].length;}
else{obj[cnn]=parseXML(cn);};};});};};if(node.attributes){if(node.attributes.length>0){att={};obj=obj||{};$.each(node.attributes,function(a,at){var atn=jsVar(at.name),atv=at.value;att[atn]=atv;if(obj[atn]){if(!obj[atn].length)obj[atn]=myArr(obj[atn]);obj[atn][obj[atn].length]=atv;obj[atn].length=obj[atn].length;}
else{obj[atn]=atv;};});};};if(obj){obj=$.extend((txt!=''?new String(txt):{}),obj||{});txt=(obj.text)?(typeof(obj.text)=='object'?obj.text:[obj.text||'']).concat([txt]):txt;if(txt)obj.text=txt;txt='';};var out=obj||txt;if(extended){if(txt)out={};txt=out.text||txt||'';if(txt)out.text=txt;if(!simple)out=myArr(out);};return out;};var jsVar=function(s){return String(s||'').replace(/-/g,"_");};var isNum=function(s){return(typeof s=="number")||String((s&&typeof s=="string")?s:'').test(/^((-)?([0-9]*)((\.{0,1})([0-9]+))?$)/);};var myArr=function(o){if(!o.length)o=[o];o.length=o.length;return o;};if(typeof xml=='string')xml=$.text2xml(xml);if(!xml.nodeType)return;if(xml.nodeType==3||xml.nodeType==4)return xml.nodeValue;var root=(xml.nodeType==9)?xml.documentElement:xml;var out=parseXML(root,true);xml=null;root=null;return out;},text2xml:function(str){var out;try{var xml=($.browser.msie)?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser();xml.async=false;}catch(e){throw new Error("XML Parser could not be instantiated")};try{if($.browser.msie)out=(xml.loadXML(str))?xml:false;else out=xml.parseFromString(str,"text/xml");}catch(e){throw new Error("Error parsing XML string")};return out;}});})(jQuery);if(jQuery)(function(jQuery){jQuery.extend(jQuery.fn,{uploadify:function(options){jQuery(this).each(function(){var settings=jQuery.extend({id:jQuery(this).attr('id'),uploader:'uploadify.swf',script:'uploadify.php',expressInstall:null,folder:'',height:30,width:120,cancelImg:'cancel.png',wmode:'opaque',scriptAccess:'sameDomain',fileDataName:'Filedata',method:'POST',queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:'percentage',removeCompleted:true,onInit:function(){},onSelect:function(){},onSelectOnce:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onClearQueue:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},options);jQuery(this).data('settings',settings);var pagePath=location.pathname;pagePath=pagePath.split('/');pagePath.pop();pagePath=pagePath.join('/')+'/';var data={};data.uploadifyID=settings.id;data.pagepath=pagePath;if(settings.buttonImg)data.buttonImg=escape(settings.buttonImg);if(settings.buttonText)data.buttonText=escape(settings.buttonText);if(settings.rollover)data.rollover=true;data.script=settings.script;data.folder=escape(settings.folder);if(settings.scriptData){var scriptDataString='';for(var name in settings.scriptData){scriptDataString+='&'+name+'='+settings.scriptData[name];}
data.scriptData=escape(scriptDataString.substr(1));}
data.width=settings.width;data.height=settings.height;data.wmode=settings.wmode;data.method=settings.method;data.queueSizeLimit=settings.queueSizeLimit;data.simUploadLimit=settings.simUploadLimit;if(settings.hideButton)data.hideButton=true;if(settings.fileDesc)data.fileDesc=settings.fileDesc;if(settings.fileExt)data.fileExt=settings.fileExt;if(settings.multi)data.multi=true;if(settings.auto)data.auto=true;if(settings.sizeLimit)data.sizeLimit=settings.sizeLimit;if(settings.checkScript)data.checkScript=settings.checkScript;if(settings.fileDataName)data.fileDataName=settings.fileDataName;if(settings.queueID)data.queueID=settings.queueID;if(settings.onInit()!==false){jQuery(this).css('display','none');jQuery(this).after('<div id="'+jQuery(this).attr('id')+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+'Uploader',settings.width,settings.height,'9.0.24',settings.expressInstall,data,{'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess},{},function(event){if(typeof(settings.onSWFReady)=='function'&&event.success)settings.onSWFReady();});if(settings.queueID==false){jQuery("#"+jQuery(this).attr('id')+"Uploader").after('<div id="'+jQuery(this).attr('id')+'Queue" class="uploadifyQueue"></div>');}else{jQuery("#"+settings.queueID).addClass('uploadifyQueue');}}
if(typeof(settings.onOpen)=='function'){jQuery(this).bind("uploadifyOpen",settings.onOpen);}
jQuery(this).bind("uploadifySelect",{'action':settings.onSelect,'queueID':settings.queueID},function(event,ID,fileObj){if(event.data.action(event,ID,fileObj)!==false){var byteSize=Math.round(fileObj.size/1024*100)*.01;var suffix='KB';if(byteSize>1000){byteSize=Math.round(byteSize*.001*100)*.01;suffix='MB';}
var sizeParts=byteSize.toString().split('.');if(sizeParts.length>1){byteSize=sizeParts[0]+'.'+sizeParts[1].substr(0,2);}else{byteSize=sizeParts[0];}
if(fileObj.name.length>20){fileName=fileObj.name.substr(0,20)+'...';}else{fileName=fileObj.name;}
queue='#'+jQuery(this).attr('id')+'Queue';if(event.data.queueID){queue='#'+event.data.queueID;}
jQuery(queue).append('<div id="'+jQuery(this).attr('id')+ID+'" class="uploadifyQueueItem">\
        <div class="cancel">\
         <a href="javascript:jQuery(\'#'+jQuery(this).attr('id')+'\').uploadifyCancel(\''+ID+'\')"><img src="'+settings.cancelImg+'" border="0" /></a>\
        </div>\
        <span class="fileName">'+fileName+' ('+byteSize+suffix+')</span><span class="percentage"></span>\
        <div class="uploadifyProgress">\
         <div id="'+jQuery(this).attr('id')+ID+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
        </div>\
       </div>');}});jQuery(this).bind("uploadifySelectOnce",{'action':settings.onSelectOnce},function(event,data){event.data.action(event,data);if(settings.auto){if(settings.checkScript){jQuery(this).uploadifyUpload(null,false);}else{jQuery(this).uploadifyUpload(null,true);}}});jQuery(this).bind("uploadifyQueueFull",{'action':settings.onQueueFull},function(event,queueSizeLimit){if(event.data.action(event,queueSizeLimit)!==false){alert('The queue is full.  The max size is '+queueSizeLimit+'.');}});jQuery(this).bind("uploadifyCheckExist",{'action':settings.onCheck},function(event,checkScript,fileQueueObj,folder,single){var postData=new Object();postData=fileQueueObj;postData.folder=(folder.substr(0,1)=='/')?folder:pagePath+folder;if(single){for(var ID in fileQueueObj){var singleFileID=ID;}}
jQuery.post(checkScript,postData,function(data){for(var key in data){if(event.data.action(event,data,key)!==false){var replaceFile=confirm("Do you want to replace the file "+data[key]+"?");if(!replaceFile){document.getElementById(jQuery(event.target).attr('id')+'Uploader').cancelFileUpload(key,true,true);}}}
if(single){document.getElementById(jQuery(event.target).attr('id')+'Uploader').startFileUpload(singleFileID,true);}else{document.getElementById(jQuery(event.target).attr('id')+'Uploader').startFileUpload(null,true);}},"json");});jQuery(this).bind("uploadifyCancel",{'action':settings.onCancel},function(event,ID,fileObj,data,remove,clearFast){if(event.data.action(event,ID,fileObj,data,clearFast)!==false){if(remove){var fadeSpeed=(clearFast==true)?0:250;jQuery("#"+jQuery(this).attr('id')+ID).fadeOut(fadeSpeed,function(){jQuery(this).remove()});}}});jQuery(this).bind("uploadifyClearQueue",{'action':settings.onClearQueue},function(event,clearFast){var queueID=(settings.queueID)?settings.queueID:jQuery(this).attr('id')+'Queue';if(clearFast){jQuery("#"+queueID).find('.uploadifyQueueItem').remove();}
if(event.data.action(event,clearFast)!==false){jQuery("#"+queueID).find('.uploadifyQueueItem').each(function(){var index=jQuery('.uploadifyQueueItem').index(this);jQuery(this).delay(index*100).fadeOut(250,function(){jQuery(this).remove()});});}});var errorArray=[];jQuery(this).bind("uploadifyError",{'action':settings.onError},function(event,ID,fileObj,errorObj){if(event.data.action(event,ID,fileObj,errorObj)!==false){var fileArray=new Array(ID,fileObj,errorObj);errorArray.push(fileArray);jQuery("#"+jQuery(this).attr('id')+ID).find('.percentage').text(" - "+errorObj.type+" Error");jQuery("#"+jQuery(this).attr('id')+ID).find('.uploadifyProgress').hide();jQuery("#"+jQuery(this).attr('id')+ID).addClass('uploadifyError');}});if(typeof(settings.onUpload)=='function'){jQuery(this).bind("uploadifyUpload",settings.onUpload);}
jQuery(this).bind("uploadifyProgress",{'action':settings.onProgress,'toDisplay':settings.displayData},function(event,ID,fileObj,data){if(event.data.action(event,ID,fileObj,data)!==false){jQuery("#"+jQuery(this).attr('id')+ID+"ProgressBar").animate({'width':data.percentage+'%'},250,function(){if(data.percentage==100){jQuery(this).closest('.uploadifyProgress').fadeOut(250,function(){jQuery(this).remove()});}});if(event.data.toDisplay=='percentage')displayData=' - '+data.percentage+'%';if(event.data.toDisplay=='speed')displayData=' - '+data.speed+'KB/s';if(event.data.toDisplay==null)displayData=' ';jQuery("#"+jQuery(this).attr('id')+ID).find('.percentage').text(displayData);}});jQuery(this).bind("uploadifyComplete",{'action':settings.onComplete},function(event,ID,fileObj,response,data){if(event.data.action(event,ID,fileObj,unescape(response),data)!==false){jQuery("#"+jQuery(this).attr('id')+ID).find('.percentage').text(' - Completed');if(settings.removeCompleted){jQuery("#"+jQuery(event.target).attr('id')+ID).fadeOut(250,function(){jQuery(this).remove()});}
jQuery("#"+jQuery(event.target).attr('id')+ID).addClass('completed');}});if(typeof(settings.onAllComplete)=='function'){jQuery(this).bind("uploadifyAllComplete",{'action':settings.onAllComplete},function(event,data){if(event.data.action(event,data)!==false){errorArray=[];}});}});},uploadifySettings:function(settingName,settingValue,resetObject){var returnValue=false;jQuery(this).each(function(){if(settingName=='scriptData'&&settingValue!=null){if(resetObject){var scriptData=settingValue;}else{var scriptData=jQuery.extend(jQuery(this).data('settings').scriptData,settingValue);}
var scriptDataString='';for(var name in scriptData){scriptDataString+='&'+name+'='+scriptData[name];}
settingValue=escape(scriptDataString.substr(1));}
returnValue=document.getElementById(jQuery(this).attr('id')+'Uploader').updateSettings(settingName,settingValue);});if(settingValue==null){if(settingName=='scriptData'){var returnSplit=unescape(returnValue).split('&');var returnObj=new Object();for(var i=0;i<returnSplit.length;i++){var iSplit=returnSplit[i].split('=');returnObj[iSplit[0]]=iSplit[1];}
returnValue=returnObj;}}
return returnValue;},uploadifyUpload:function(ID,checkComplete){jQuery(this).each(function(){if(!checkComplete)checkComplete=false;document.getElementById(jQuery(this).attr('id')+'Uploader').startFileUpload(ID,checkComplete);});},uploadifyCancel:function(ID){jQuery(this).each(function(){document.getElementById(jQuery(this).attr('id')+'Uploader').cancelFileUpload(ID,true,true,false);});},uploadifyClearQueue:function(){jQuery(this).each(function(){document.getElementById(jQuery(this).attr('id')+'Uploader').clearFileUploadQueue(false);});}})})(jQuery);jQuery.fn.farbtastic=function(callback){jQuery.farbtastic(this,callback);return this;};jQuery.farbtastic=function(container,callback){var container=jQuery(container).get(0);return container.farbtastic||(container.farbtastic=new jQuery._farbtastic(container,callback));}
jQuery._farbtastic=function(container,callback){var fb=this;jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');var e=jQuery('.farbtastic',container);fb.wheel=jQuery('.wheel',container).get(0);fb.radius=84;fb.square=100;fb.width=194;if(navigator.appVersion.match(/MSIE [0-6]\./)){jQuery('*',e).each(function(){if(this.currentStyle.backgroundImage!='none'){var image=this.currentStyle.backgroundImage;image=this.currentStyle.backgroundImage.substring(5,image.length-2);jQuery(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"});}});}
fb.linkTo=function(callback){if(typeof fb.callback=='object'){jQuery(fb.callback).unbind('keyup',fb.updateValue);}
fb.color=null;if(typeof callback=='function'){fb.callback=callback;}
else if(typeof callback=='object'||typeof callback=='string'){fb.callback=jQuery(callback);fb.callback.bind('keyup',fb.updateValue);if(fb.callback.get(0).value){fb.setColor(fb.callback.get(0).value);}}
return this;}
fb.updateValue=function(event){if(this.value&&this.value!=fb.color){fb.setColor(this.value);}}
fb.setColor=function(color){var unpack=fb.unpack(color);if(fb.color!=color&&unpack){fb.color=color;fb.rgb=unpack;fb.hsl=fb.RGBToHSL(fb.rgb);fb.updateDisplay();}
return this;}
fb.setHSL=function(hsl){fb.hsl=hsl;fb.rgb=fb.HSLToRGB(hsl);fb.color=fb.pack(fb.rgb);fb.updateDisplay();return this;}
fb.widgetCoords=function(event){var x,y;var el=event.target||event.srcElement;var reference=fb.wheel;if(typeof event.offsetX!='undefined'){var pos={x:event.offsetX,y:event.offsetY};var e=el;while(e){e.mouseX=pos.x;e.mouseY=pos.y;pos.x+=e.offsetLeft;pos.y+=e.offsetTop;e=e.offsetParent;}
var e=reference;var offset={x:0,y:0}
while(e){if(typeof e.mouseX!='undefined'){x=e.mouseX-offset.x;y=e.mouseY-offset.y;break;}
offset.x+=e.offsetLeft;offset.y+=e.offsetTop;e=e.offsetParent;}
e=el;while(e){e.mouseX=undefined;e.mouseY=undefined;e=e.offsetParent;}}
else{var pos=fb.absolutePosition(reference);x=(event.pageX||0*(event.clientX+jQuery('html').get(0).scrollLeft))-pos.x;y=(event.pageY||0*(event.clientY+jQuery('html').get(0).scrollTop))-pos.y;}
return{x:x-fb.width/2,y:y-fb.width/2};}
fb.mousedown=function(event){if(!document.dragging){jQuery(document).bind('mousemove',fb.mousemove).bind('mouseup',fb.mouseup);document.dragging=true;}
var pos=fb.widgetCoords(event);fb.circleDrag=Math.max(Math.abs(pos.x),Math.abs(pos.y))*2>fb.square;fb.mousemove(event);return false;}
fb.mousemove=function(event){var pos=fb.widgetCoords(event);if(fb.circleDrag){var hue=Math.atan2(pos.x,-pos.y)/6.28;if(hue<0)hue+=1;fb.setHSL([hue,fb.hsl[1],fb.hsl[2]]);}
else{var sat=Math.max(0,Math.min(1,-(pos.x/fb.square)+.5));var lum=Math.max(0,Math.min(1,-(pos.y/fb.square)+.5));fb.setHSL([fb.hsl[0],sat,lum]);}
return false;}
fb.mouseup=function(){jQuery(document).unbind('mousemove',fb.mousemove);jQuery(document).unbind('mouseup',fb.mouseup);document.dragging=false;}
fb.updateDisplay=function(){var angle=fb.hsl[0]*6.28;jQuery('.h-marker',e).css({left:Math.round(Math.sin(angle)*fb.radius+fb.width/2)+'px',top:Math.round(-Math.cos(angle)*fb.radius+fb.width/2)+'px'});jQuery('.sl-marker',e).css({left:Math.round(fb.square*(.5-fb.hsl[1])+fb.width/2)+'px',top:Math.round(fb.square*(.5-fb.hsl[2])+fb.width/2)+'px'});jQuery('.color',e).css('backgroundColor',fb.pack(fb.HSLToRGB([fb.hsl[0],1,0.5])));if(typeof fb.callback=='object'){jQuery(fb.callback).css({backgroundColor:fb.color,color:fb.hsl[2]>0.5?'#000':'#fff'});jQuery(fb.callback).each(function(){if(this.value&&this.value!=fb.color){this.value=fb.color;}});}
else if(typeof fb.callback=='function'){fb.callback.call(fb,fb.color);}}
fb.absolutePosition=function(el){var r={x:el.offsetLeft,y:el.offsetTop};if(el.offsetParent){var tmp=fb.absolutePosition(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}
return r;};fb.pack=function(rgb){var r=Math.round(rgb[0]*255);var g=Math.round(rgb[1]*255);var b=Math.round(rgb[2]*255);return'#'+(r<16?'0':'')+r.toString(16)+
(g<16?'0':'')+g.toString(16)+
(b<16?'0':'')+b.toString(16);}
fb.unpack=function(color){if(color.length==7){return[parseInt('0x'+color.substring(1,3))/255,parseInt('0x'+color.substring(3,5))/255,parseInt('0x'+color.substring(5,7))/255];}
else if(color.length==4){return[parseInt('0x'+color.substring(1,2))/15,parseInt('0x'+color.substring(2,3))/15,parseInt('0x'+color.substring(3,4))/15];}}
fb.HSLToRGB=function(hsl){var m1,m2,r,g,b;var h=hsl[0],s=hsl[1],l=hsl[2];m2=(l<=0.5)?l*(s+1):l+s-l*s;m1=l*2-m2;return[this.hueToRGB(m1,m2,h+0.33333),this.hueToRGB(m1,m2,h),this.hueToRGB(m1,m2,h-0.33333)];}
fb.hueToRGB=function(m1,m2,h){h=(h<0)?h+1:((h>1)?h-1:h);if(h*6<1)return m1+(m2-m1)*h*6;if(h*2<1)return m2;if(h*3<2)return m1+(m2-m1)*(0.66666-h)*6;return m1;}
fb.RGBToHSL=function(rgb){var min,max,delta,h,s,l;var r=rgb[0],g=rgb[1],b=rgb[2];min=Math.min(r,Math.min(g,b));max=Math.max(r,Math.max(g,b));delta=max-min;l=(min+max)/2;s=0;if(l>0&&l<1){s=delta/(l<0.5?(2*l):(2-2*l));}
h=0;if(delta>0){if(max==r&&max!=g)h+=(g-b)/delta;if(max==g&&max!=b)h+=(2+(b-r)/delta);if(max==b&&max!=r)h+=(4+(r-g)/delta);h/=6;}
return[h,s,l];}
jQuery('*',e).mousedown(fb.mousedown);fb.setColor('#000000');if(callback){fb.linkTo(callback);}}
function tree_component(){if(typeof tree_component.inst=="undefined"){tree_component.cntr=0;tree_component.inst=[];tree_component.focusInst=function(){return tree_component.inst[tree_component.focused];}}
return{cntr:tree_component.cntr++,settings:{data:{type:"predefined",async:false,url:false,json:false},dflt:false,languages:[],path:false,cookies:false,ui:{dots:true,rtl:false,animation:0,hover_mode:true},rules:{multiple:false,metadata:false,type_attr:"rel",multitree:false,createat:"bottom",use_inline:false,clickable:"all",renameable:"all",deletable:"all",creatable:"all",draggable:"none",dragrules:"none",drag_copy:false},lang:{new_node:"New folder",loading:"Loading ..."},callback:{beforechange:function(NODE,TREE_OBJ){return true},beforemove:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforecreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforerename:function(NODE,LANG,TREE_OBJ){return true},beforedelete:function(NODE,TREE_OBJ){return true},onchange:function(NODE,TREE_OBJ){},onrename:function(NODE,LANG,TREE_OBJ){},onmove:function(NODE,REF_NODE,TYPE,TREE_OBJ){},oncopy:function(NODE,REF_NODE,TYPE,TREE_OBJ){},oncreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){},ondelete:function(NODE,TREE_OBJ){},onopen:function(NODE,TREE_OBJ){},onclose:function(NODE,TREE_OBJ){},error:function(TEXT,TREE_OBJ){},ondblclk:function(NODE,TREE_OBJ){TREE_OBJ.toggle_branch.call(TREE_OBJ,NODE);TREE_OBJ.select_branch.call(TREE_OBJ,NODE);},onrgtclk:function(NODE,TREE_OBJ,EV){},onload:function(TREE_OBJ){},onfocus:function(TREE_OBJ){}}},init:function(elem,opts){var _this=this;this.container=$(elem);if(this.container.size==0){alert("Invalid container node!");return}
tree_component.inst[this.cntr]=this;if(!this.container.attr("id"))this.container.attr("id","jstree_"+this.cntr);tree_component.inst[this.container.attr("id")]=tree_component.inst[this.cntr];tree_component.focused=this.cntr;if(opts&&opts.cookies){this.settings.cookies=$.extend({},this.settings.cookies,opts.cookies);delete opts.cookies;if(!this.settings.cookies.opts)this.settings.cookies.opts={};}
if(opts&&opts.callback){this.settings.callback=$.extend({},this.settings.callback,opts.callback);delete opts.callback;}
if(opts&&opts.data){this.settings.data=$.extend({},this.settings.data,opts.data);delete opts.data;}
if(opts&&opts.ui){this.settings.ui=$.extend({},this.settings.ui,opts.ui);delete opts.ui;}
if(opts&&opts.rules){this.settings.rules=$.extend({},this.settings.rules,opts.rules);delete opts.rules;}
if(opts&&opts.lang){this.settings.lang=$.extend({},this.settings.lang,opts.lang);delete opts.lang;}
this.settings=$.extend({},this.settings,opts);if(this.settings.path==false){this.path="";$("script").each(function(){if(this.src.toString().match(/tree_component.*?js$/)){_this.path=this.src.toString().replace(/tree_component.*?js$/,"");}});}
else this.path=this.settings.path;this.current_lang=this.settings.languages&&this.settings.languages.length?this.settings.languages[0]:false;if(this.settings.languages&&this.settings.languages.length){this.sn=get_sheet_num("tree_component.css");var st=false;var id=this.container.attr("id")?"#"+this.container.attr("id"):".tree";for(var ln=0;ln<this.settings.languages.length;ln++){st=add_css(id+" ."+this.settings.languages[ln],this.sn);if(st!==false){if(this.settings.languages[ln]==this.current_lang)st.style.display="inline";else st.style.display="none";}}}
this.container.addClass("tree").css({position:"relative"});if(this.settings.ui.rtl)this.container.addClass("rtl");if(this.settings.rules.multiple)this.selected_arr=[];this.offset=this.container.offset();this.offset.top=this.offset.top+parseInt($.curCSS(this.container.get(0),"paddingTop",true),10)+parseInt($.curCSS(this.container.get(0),"borderTopWidth",true),10);this.container.css({position:""});if(this.settings.ui.dots==false)this.container.addClass("no_dots");this.hovered=false;this.locked=false;if(this.settings.rules.draggable!="none"&&this.settings.rules.dragrules!="none"){var _this=this;$("<img>").attr({id:"marker",src:_this.path+"images/marker.gif"}).css({height:"5px",width:"40px",display:"block",position:"absolute",left:"30px",top:"30px",zIndex:"1000"}).hide().appendTo("body");}
this.refresh();this.attachEvents();this.focus();},refresh:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;this.settings.dflt=(this.selected)?"#"+this.selected.attr("id"):this.settings.dflt;if(this.settings.cookies){var str=$.cookie(this.settings.cookies.prefix+'_selected');if(str)this.settings.dflt="#"+str;}
if(obj&&this.settings.data.async){this.opened=Array();obj=this.get_node(obj);obj.find("li.open").each(function(i){_this.opened.push(this.id);});this.close_branch(obj,true);obj.children("ul:eq(0)").html("");return this.open_branch(obj,true,function(){_this.reselect.apply(_this);});}
this.opened=Array();if(this.settings.cookies){var str=$.cookie(this.settings.cookies.prefix+'_open');if(str&&str.length)str=str.split(",");else str=[];if(str.length)this.opened=str;}
else{this.container.find("li.open").each(function(i){_this.opened.push(this.id);});}
if(this.settings.data.type=="xml_flat"||this.settings.data.type=="xml_nested"){this.scrtop=this.container.get(0).scrollTop;var xsl=(this.settings.data.type=="xml_flat")?"flat.xsl":"nested.xsl";this.container.getTransform(this.path+xsl,this.settings.data.url,{callback:function(){_this.reselect.apply(_this);}});return;}
else if(this.settings.data.type=="json"){if(this.settings.data.json){var str="";if(this.settings.data.json.length){for(var i=0;i<this.settings.data.json.length;i++){str+=this.parseJSON(this.settings.data.json[i]);}}else str=this.parseJSON(this.settings.data.json);this.container.html("<ul>"+str+"</ul>");this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");this.container.find("li").not(".open").not(".closed").addClass("leaf");this.reselect();}
else{var _this=this;$.getJSON(this.settings.data.url,{id:0},function(data){var str="";if(data.length){for(var i=0;i<data.length;i++){str+=_this.parseJSON(data[i]);}}else str=_this.parseJSON(data);_this.container.html("<ul>"+str+"</ul>");_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");_this.container.find("li").not(".open").not(".closed").addClass("leaf");_this.reselect.apply(_this);});}}
else{this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");this.container.find("li").not(".open").not(".closed").addClass("leaf");this.reselect();}},parseJSON:function(data){var str="";str+="<li ";var cls=false;for(i in data.attributes){if(i=="class"){str+=" class='"+data.attributes[i]+" ";if(data.state=="closed"||data.state=="open")str+=" "+data.state+" ";str+="' ";cls=true;}
else str+=" "+i+"='"+data.attributes[i]+"' ";}
if(!cls&&(data.state=="closed"||data.state=="open"))str+=" class='"+data.state+"' ";str+=">";if(this.settings.languages.length){for(var i=0;i<this.settings.languages.length;i++){str+="<a href='#' class='"+this.settings.languages[i]+"' ";if(data.icons&&data.icons[this.settings.languages[i]])
str+=" style='background-image:url(\""+data.icons[this.settings.languages[i]]+"\");' ";str+=">"+data.data[this.settings.languages[i]]+"</a>";}}
else{str+="<a href='#' ";if(data.icons)
str+=" style='background-image:url(\""+data.icons+"\");' ";str+=">"+data.data+"</a>";}
if(data.children&&data.children.length){str+='<ul>';for(var i=0;i<data.children.length;i++){str+=this.parseJSON(data.children[i]);}
str+='</ul>';}
str+="</li>";return str;},getJSON:function(nod,attrib){var _this=this;if(!nod||$(nod).size()==0){nod=this.container.children("ul").children("li");}
else nod=$(nod);if(nod.size()>1){var arr=[];nod.each(function(){arr.push(_this.getJSON(this));});return arr;}
if(!attrib)attrib=["id","rel","class"]
var obj={attributes:{},data:false,icons:false};for(i in attrib){obj.attributes[attrib[i]]=nod.attr(attrib[i]);}
var a=nod.children("a");if(a.size()>1){obj.data=[];obj.icons=[];a.each(function(){obj.data.push(this.innerHTML);obj.icons.push(this.style.backgroundImage.replace("url(","").replace(")",""));});}
else{obj.data=a.text();obj.icons=a.css("backgroundImage").replace("url(","").replace(")","");}
if(nod.children("ul").size()>0){obj.children=[];nod.children("ul").children("li").each(function(){obj.children.push(_this.getJSON(this));});}
return obj;},focus:function(){if(this.locked)return false;if(tree_component.focused!=this.cntr){tree_component.focused=this.cntr;this.settings.callback.onfocus.call(null,this);}},attachEvents:function(){var _this=this;var tmp=this.container.find("li.closed:eq(0)");if(tmp.size()==0)tmp=this.container.find("li.leaf:eq(0)");this.li_height=tmp.height();if(!this.li_height)this.li_height=18;this.container.bind("mouseup",function(event){_this.focus.apply(_this);}).bind("click",function(event){event.stopPropagation();return true;}).listen("click","li",function(event){_this.toggle_branch.apply(_this,[event.target]);event.stopPropagation();}).listen("click","a",function(event){if(_this.locked){event.preventDefault();event.target.blur();return _this.error("LOCKED");}
_this.select_branch.apply(_this,[event.target,event.ctrlKey||_this.settings.rules.multiple=="on"]);if(_this.inp){_this.inp.blur();}
event.preventDefault();event.target.blur();return false;}).listen("dblclick","a",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();event.target.blur();return _this.error("LOCKED");}
_this.settings.callback.ondblclk.call(null,_this.get_node(event.target).get(0),_this);event.preventDefault();event.stopPropagation();event.target.blur();}).listen("contextmenu","a",function(event){if(_this.locked)return _this.error("LOCKED");return _this.settings.callback.onrgtclk.call(null,_this.get_node(event.target).get(0),_this,event);}).listen("mouseover","a",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();return _this.error("LOCKED");}
if(_this.settings.ui.hover_mode&&_this.hovered!==false&&event.target.tagName=="A"){_this.hovered.children("a").removeClass("hover");_this.hovered=false;}});if(this.settings.rules.draggable!="none"&&this.settings.rules.dragrules!="none"){$(this.container).listen("mousedown","a",function(event){if(_this.locked)return _this.error("LOCKED");var obj=_this.get_node(event.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&obj.children("a:eq(0)").hasClass("clicked")){var counter=0;for(i in _this.selected_arr){if(_this.check("draggable",_this.selected_arr[i])){_this.selected_arr[i].addClass("dragged");counter++;}}
if(counter>0){if(_this.check("draggable",obj))_this._drag=obj;else _this._drag=_this.container.find("li.dragged:eq(0)");_this.isdown=true;_this.drag=_this._drag.get(0).cloneNode(true);_this.drag.id="dragged";$(_this.drag).children("a").html("Multiple selection").end().children("ul").remove();}}
else{if(_this.check("draggable",obj)){_this._drag=obj;_this.drag=obj.get(0).cloneNode(true);_this.drag.id="dragged";_this.isdown=true;obj.addClass("dragged");}}
obj.blur();event.preventDefault();event.stopPropagation();return false;});$(document).bind("mousedown",function(event){event.stopPropagation();return true;}).bind("mouseup",function(event){if(tree_component.to)clearTimeout(tree_component.to);if(tree_component.sto)clearTimeout(tree_component.sto);if(_this.drag&&_this.drag.parentNode&&_this.drag.parentNode==$(_this.container).get(0)){$(_this.drag).remove();if(_this.moveType)_this.moved(_this.container.find("li.dragged"),_this.moveRef,_this.moveType,false,(_this.settings.rules.drag_copy=="on"||(_this.settings.rules.drag_copy=="ctrl"&&event.ctrlKey)));_this.moveType=false;_this.moveRef=false;}
$("#marker").hide();_this._drag=false;_this.drag=false;_this.isdown=false;_this.appended=false;_this.container.find("li.dragged").removeClass("dragged");event.preventDefault();event.stopPropagation();return false;}).bind("mousemove",function(event){if(_this.locked)return _this.error("LOCKED");if(_this.isdown){if(tree_component.to)clearTimeout(tree_component.to);if(!_this.appended){_this.container.append(_this.drag);var tmp=$(_this.drag).offsetParent();if(tmp.is("html"))tmp=$("body");_this.po=tmp.offset();_this.appended=true;}
$(_this.drag).css({"left":(event.pageX-_this.po.left-(_this.settings.ui.rtl?$(_this.drag).width():-5)),"top":(event.pageY-_this.po.top+($.browser.opera?_this.container.scrollTop():0)+15)});var cnt=$(event.target).parents(".tree:eq(0)");if(cnt.size()==0){if(tree_component.sto)clearTimeout(tree_component.sto);return false;}
if(cnt.get(0)!=_this.container.get(0)&&(!_this.settings.rules.multitree||!tree_component.inst[cnt.attr("id")].settings.rules.multitree)){if($(_this.drag).children("IMG").size()==0){$(_this.drag).append("<img style='position:absolute; "+(_this.settings.ui.rtl?"right":"left")+":4px; top:0px; background:#ffffff; padding:2px;' src='"+_this.path+"images/remove.png' />");}
_this.moveType=false;_this.moveRef=false;$("#marker").hide();return false;}
if(tree_component.sto)clearTimeout(tree_component.sto);tree_component.sto=setTimeout(function(){tree_component.inst[cnt.attr("id")].scrollCheck(event.pageX,event.pageY);},50);var mov=false;var st=cnt.scrollTop();if(event.target.tagName=="A"){var goTo={x:($(event.target).offset().left-1),y:(event.pageY-tree_component.inst[cnt.attr("id")].offset.top)}
if(cnt.hasClass("rtl")){goTo.x+=$(event.target).width()-8;}
if((goTo.y+st)%_this.li_height<_this.li_height/3+1){mov="before";goTo.y=event.pageY-(goTo.y+st)%_this.li_height-2;}
else if((goTo.y+st)%_this.li_height>_this.li_height*2/3-1){mov="after";goTo.y=event.pageY-(goTo.y+st)%_this.li_height+_this.li_height-2;}
else{mov="inside";goTo.x-=2;if(cnt.hasClass("rtl")){goTo.x+=36;}
goTo.y=event.pageY-(goTo.y+st)%_this.li_height+Math.floor(_this.li_height/2)-2;if(_this.get_node(event.target).hasClass("closed")){tree_component.to=setTimeout(function(){_this.open_branch(_this.get_node(event.target));},500);}}
if(tree_component.inst[cnt.attr("id")].checkMove(_this.container.find("li.dragged"),$(event.target),mov)){if(mov=="inside")$("#marker").attr("src",_this.path+"images/plus.gif").width(11);else{if(cnt.hasClass("rtl")){$("#marker").attr("src",_this.path+"images/marker_rtl.gif").width(40);}
else{$("#marker").attr("src",_this.path+"images/marker.gif").width(40);}}
_this.moveType=mov;_this.moveRef=event.target;$(_this.drag).children("IMG").remove();$("#marker").css({"left":goTo.x,"top":goTo.y}).show();}
else{if($(_this.drag).children("IMG").size()==0){$(_this.drag).append("<img style='position:absolute; "+(_this.settings.ui.rtl?"right":"left")+":4px; top:0px; background:#ffffff; padding:2px;' src='"+_this.path+"images/remove.png' />");}
_this.moveType=false;_this.moveRef=false;$("#marker").hide();}}
else if(event.target.tagName=="IMG"&&event.target.id=="marker"){;}
else{_this.moveType=false;_this.moveRef=false;$("#marker").hide();}
event.preventDefault();event.stopPropagation();return false;}
return true;});}},checkMove:function(NODES,REF_NODE,TYPE){if(this.locked)return this.error("LOCKED");var _this=this;if(REF_NODE.parents("li.dragged").size()>0||REF_NODE.is(".dragged"))return this.error("MOVE: NODE OVER SELF");if(NODES.size()==1){var NODE=NODES.eq(0);if(!this.check("dragrules",[NODE,TYPE,REF_NODE.parents("li:eq(0)")]))return this.error("MOVE: AGAINST DRAG RULES");}
else{var ok=true;NODES.each(function(i){if(ok==false)return false;if(i>0){var ref=NODES.eq((i-1));var mv="after";}
else{var ref=REF_NODE;var mv=TYPE;}
if(!_this.check.apply(_this,["dragrules",[$(this),mv,ref]]))ok=false;});if(ok==false)return this.error("MOVE: AGAINST DRAG RULES");}
if(this.settings.rules.use_inline&&this.settings.rules.metadata){var nd=false;if(TYPE=="inside")nd=REF_NODE.parents("li:eq(0)");else nd=REF_NODE.parents("li:eq(1)");if(nd.size()){if(typeof nd.metadata()["valid_children"]!="undefined"){var tmp=nd.metadata()["valid_children"];var ok=true;NODES.each(function(i){if(ok==false)return false;if($.inArray(_this.get_type(this),tmp)==-1)ok=false;});if(ok==false)return this.error("MOVE: NOT A VALID CHILD");}
if(typeof nd.metadata()["max_children"]!="undefined"){if((nd.children("ul:eq(0)").children("li").not(".dragged").size()+NODES.size())>nd.metadata().max_children)return this.error("MOVE: MAX CHILDREN REACHED");}
var incr=0;NODES.each(function(i){var i=1;var t=$(this);while(i<100){t=t.children("ul:eq(0)");if(t.size()==0)break;i++}
incr=Math.max(i,incr);});var ok=true;nd.parents("li").each(function(i){if(ok==false)return false;if($(this).metadata().max_depth){if((i+incr)>=$(this).metadata().max_depth)ok=false;}});if(ok==false)return this.error("MOVE: MAX_DEPTH REACHED");}}
return true;},reselect:function(){var _this=this;if(this.opened&&this.opened.length){var opn=false;for(var j=0;j<this.opened.length;j++){if(this.settings.data.async){if(this.get_node("#"+this.opened[j]).size()>0){opn=true;var tmp=this.opened[j];delete this.opened[j];this.open_branch("#"+tmp,true,function(){_this.reselect.apply(_this);})}}
else this.open_branch("#"+this.opened[j],true);}
if(this.settings.data.async&&opn)return;delete this.opened;}
if(this.scrtop){this.container.scrollTop(_this.scrtop);delete this.scrtop;}
if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){var tmp=this.selected_arr;this.selected_arr=[];for(i in tmp){this.select_branch("#"+tmp[i].attr("id"),true);}}
else if(this.settings.dflt&&$(this.settings.dflt).size()==1){this.selected=$(this.settings.dflt);this.settings.dflt=false;this.select_branch(this.selected);}
this.settings.callback.onload.call(null,_this);},get_node:function(obj){var obj=$(obj);return obj.is("li")?obj:obj.parents("li:eq(0)");},get_type:function(obj){obj=!obj?this.selected:this.get_node(obj);if(!obj)return;if(this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);return obj.metadata().type;}
else return obj.attr(this.settings.rules.type_attr);},scrollCheck:function(x,y){var _this=this;var cnt=_this.container;var off=_this.offset;if(y-off.top<20){cnt.scrollTop(Math.max(cnt.scrollTop()-4,0));}
var h_cor=(cnt.get(0).scrollWidth>cnt.width())?40:20;if(cnt.height()-(y-off.top)<h_cor){cnt.scrollTop(cnt.scrollTop()+4);}
if(x-off.left<20){cnt.scrollLeft(cnt.scrollLeft()-4);}
if(cnt.width()-(x-off.left)<40){cnt.scrollLeft(cnt.scrollLeft()+4);}
tree_component.sto=setTimeout(function(){_this.scrollCheck(x,y);},50);},check:function(rule,nodes){if(this.locked)return this.error("LOCKED");if(rule!="dragrules"&&this.settings.rules.use_inline&&this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);if(typeof this.get_node(nodes).metadata()[rule]!="undefined")return this.get_node(nodes).metadata()[rule];}
if(!this.settings.rules[rule])return false;if(this.settings.rules[rule]=="none")return false;if(this.settings.rules[rule]=="all")return true;if(rule=="dragrules"){var nds=[];nds[0]=this.get_type(nodes[0]);nds[1]=nodes[1];nds[2]=this.get_type(nodes[2]);for(var i=0;i<this.settings.rules.dragrules.length;i++){var tmp=this.settings.rules.dragrules[i].split(" ");for(var j=0;j<3;j++){if(tmp[j]==nds[j]||tmp[j]=="*")tmp[j]=true;}
if(tmp[0]===true&&tmp[1]===true&&tmp[2]===true)return true;}
return false;}
else
return($.inArray(this.get_type(nodes),this.settings.rules[rule])!=-1)?true:false;},hover_branch:function(obj){if(this.locked)return this.error("LOCKED");if(this.settings.ui.hover_mode==false)return this.select_branch(obj);var _this=this;var obj=_this.get_node(obj);if(!obj.size())return this.error("HOVER: NOT A VALID NODE");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(this.hovered)this.hovered.children("A").removeClass("hover");this.hovered=obj;this.hovered.children("a").removeClass("hover").addClass("hover");var off_t=this.hovered.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t));},select_branch:function(obj,multiple,do_callback){if(this.locked)return this.error("LOCKED");if(!obj&&this.hovered!==false)obj=this.hovered;var _this=this;obj=_this.get_node(obj);if(!obj.size())return this.error("SELECT: NOT A VALID NODE");obj.children("a").removeClass("hover");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(_this.settings.callback.beforechange.call(null,obj.get(0),_this)===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&multiple&&obj.children("a.clicked").size()>0){return this.deselect_branch(obj);}
if(this.settings.rules.multiple!=false&&multiple){this.selected_arr.push(obj);}
if(this.settings.rules.multiple!=false&&!multiple){for(i in this.selected_arr){this.selected_arr[i].children("A").removeClass("clicked");}
this.selected_arr=[];this.selected_arr.push(obj);if(this.selected)this.selected.children("A").removeClass("clicked");}
if(!this.settings.rules.multiple){if(this.selected)this.selected.children("A").removeClass("clicked");}
this.selected=obj;if(this.settings.ui.hover_mode&&this.hovered!==false){this.hovered.children("A").removeClass("hover");this.hovered=obj;}
this.selected.children("a").removeClass("clicked").addClass("clicked").end().parents("li.closed").each(function(){_this.open_branch(this,true);});var off_t=this.selected.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t));this.set_cookie("selected");if(do_callback==false)return;this.settings.callback.onchange.call(null,this.selected.get(0),_this);},deselect_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);obj.children("a").removeClass("clicked");if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this));});if(obj.get(0)==this.selected.get(0)){this.selected=this.selected_arr[0];this.set_cookie("selected");}}
else{if(this.settings.rules.multiple!=false)this.selected_arr=[];this.selected=false;this.set_cookie("selected");}
if(this.selected)this.settings.callback.onchange.call(null,this.selected.get(0),_this);else this.settings.callback.onchange.call(null,false,_this);},toggle_branch:function(obj){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(obj.hasClass("closed"))
{return this.select_branch(obj);}
if(obj.hasClass("open"))return this.close_branch(obj);},open_branch:function(obj,disable_animation,callback){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(!obj.size())return this.error("OPEN: NO SUCH NODE");if(this.settings.data.async&&obj.find("li").size()==0){var _this=this;obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a style='background-image:url("+_this.path+"images/throbber.gif)' href='#'>"+(_this.settings.lang.loading||"Loading ...")+"</a></li></ul>");obj.removeClass("closed").addClass("open");if(this.settings.data.type=="xml_flat"||this.settings.data.type=="xml_nested"){var xsl=(this.settings.data.type=="xml_flat")?"flat.xsl":"nested.xsl";var str=(this.settings.data.url.indexOf("?")==-1)?"?id="+encodeURIComponent(obj.attr("id")):"&id="+encodeURIComponent(obj.attr("id"));obj.children("ul:eq(0)").getTransform(this.path+xsl,this.settings.data.url+str,{repl:true,callback:function(str,json){if(str.length<10){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return;}
_this.open_branch.apply(_this,[obj]);if(callback)callback.call();}});}
else{$.getJSON(this.settings.data.url,{id:obj.attr("id")},function(data,textStatus){if(!data||data.length==0){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return;}
var str="";if(data.length){for(var i=0;i<data.length;i++){str+=_this.parseJSON(data[i]);}}
else str=_this.parseJSON(data);obj.children("ul:eq(0)").replaceWith("<ul>"+str+"</ul>");obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");obj.find("li").not(".open").not(".closed").addClass("leaf");_this.open_branch.apply(_this,[obj]);if(callback)callback.call();});}
return true;}
else{if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&!($.browser.msie&&$.browser.version<7)){obj.children("ul:eq(0)").css("display","none");obj.removeClass("closed").addClass("open");obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){$(this).css("display","");if(callback)callback.call();});}else{obj.removeClass("closed").addClass("open");if(callback)callback.call();}
this.set_cookie("open");this.settings.callback.onopen.call(null,obj.get(0),this);return true;}},close_branch:function(obj,disable_animation){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&!($.browser.msie&&$.browser.version<7)&&obj.children("ul:eq(0)").size()==1){obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){obj.removeClass("open").addClass("closed");_this.set_cookie("open");$(this).css("display","");});}
else{obj.removeClass("open").addClass("closed");this.set_cookie("open");}
if(this.selected&&obj.children("ul:eq(0)").find("a.clicked").size()>0){obj.find("li:has(a.clicked)").each(function(){_this.deselect_branch(this);});}
this.settings.callback.onclose.call(null,obj.get(0),this);},open_all:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?$(obj):this.container;obj.find("li.closed").each(function(){var __this=this;_this.open_branch.apply(_this,[this,true,function(){_this.open_all.apply(_this,[__this]);}]);});},close_all:function(){if(this.locked)return this.error("LOCKED");var _this=this;$(this.container).find("li.open").each(function(){_this.close_branch(this);});},show_lang:function(i){if(this.locked)return this.error("LOCKED");if(this.settings.languages[i]==this.current_lang)return true;var st=false;var id=this.container.attr("id")?"#"+this.container.attr("id"):".tree";st=get_css(id+" ."+this.current_lang,this.sn);if(st!==false)st.style.display="none";st=get_css(id+" ."+this.settings.languages[i],this.sn);if(st!==false)st.style.display="block";this.current_lang=this.settings.languages[i];return true;},cycle_lang:function(){if(this.locked)return this.error("LOCKED");var i=$.inArray(this.current_lang,this.settings.languages);i++;if(i>this.settings.languages.length-1)i=0;this.show_lang(i);},create:function(type,obj,data,icon){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.selected;if(!obj||!obj.size())return this.error("CREATE: NO NODE SELECTED");if(!this.check("creatable",obj))return this.error("CREATE: CANNOT CREATE IN NODE");var t=type||this.get_type(obj);if(this.settings.rules.use_inline&&this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);if(typeof obj.metadata()["valid_children"]!="undefined"){if($.inArray(t,obj.metadata()["valid_children"])==-1)return this.error("CREATE: NODE NOT A VALID CHILD");}
if(typeof obj.metadata()["max_children"]!="undefined"){if((obj.children("ul:eq(0)").children("li").size()+1)>obj.metadata().max_children)return this.error("CREATE: MAX_CHILDREN REACHED");}
var ok=true;obj.parents("li").each(function(i){if($(this).metadata().max_depth){if((i+1)>=$(this).metadata().max_depth){ok=false;}}});if(!ok)return this.error("CREATE: MAX_DEPTH REACHED");}
if(obj.hasClass("closed")){var _this=this;return this.open_branch(obj,true,function(){_this.create.apply(_this,[type,obj]);});}
$li=$("<li />");if(this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);$li.attr(this.settings.rules.metadata,"type: '"+t+"'");}
else{$li.attr(this.settings.rules.type_attr,t)}
var icn=(typeof icon).toLowerCase()=="string"?icon:"";if(this.settings.languages.length){for(i=0;i<this.settings.languages.length;i++){if((typeof data).toLowerCase()=="string")val=data;else if(data&&data[i]){val=data[i];}
else if(this.settings.lang.new_node){if((typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[i])
val=this.settings.lang.new_node[i];else
val=this.settings.lang.new_node;}
else{val="New folder";}
if((typeof icon).toLowerCase()!="string"&&icon[i])icn=icon[i];$li.append("<a href='#'"+(icn.length?" style='background-image:url(\""+icn+"\");' ":" ")+"class='"+this.settings.languages[i]+"'>"+val+"</a>");}}
else{$li.append("<a href='#'"+(icn.length?" style='background-image:url(\""+icn+"\");' ":" ")+">"+(data||this.settings.lang.new_node||"New folder")+"</a>");}
$li.addClass("leaf");if(this.settings.rules.createat=="top"||obj.children("ul").size()==0){this.moved($li,obj.children("a:eq(0)"),"inside",true);}
else{this.moved($li,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);}
this.select_branch($li.children("a:eq(0)"));if(!data)this.rename();return $li;},rename:function(){if(this.locked)return this.error("LOCKED");if(this.selected){var _this=this;if(!this.check("renameable",this.selected))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.settings.callback.beforerename.call(null,this.selected.get(0),_this.current_lang,_this))return this.error("RENAME: STOPPED BY USER");var obj=this.selected;if(this.current_lang)obj=obj.find("a."+this.current_lang).get(0);else obj=obj.find("a:first").get(0);last_value=obj.innerHTML;_this.inp=$("<input type='text' />");_this.inp.val(last_value).bind("mousedown",function(event){event.stopPropagation();}).bind("mouseup",function(event){event.stopPropagation();}).bind("click",function(event){event.stopPropagation();}).bind("keyup",function(event){var key=event.keyCode||event.which;if(key==27){this.value=last_value;this.blur();return}
if(key==13){this.blur();return}});_this.inp.blur(function(event){if(this.value=="")this.value==last_value;$(obj).html($(obj).parent().find("input").eq(0).attr("value")).get(0).style.display="";$(obj).prevAll("span").remove();if(this.value!=last_value)_this.settings.callback.onrename.call(null,_this.get_node(obj).get(0),_this.current_lang,_this);_this.inp=false;});var spn=$("<span />").addClass(obj.className).append(_this.inp);spn.attr("style",$(obj).attr("style"));obj.style.display="none";$(obj).parent().prepend(spn);_this.inp.get(0).focus();_this.inp.get(0).select();}
else return this.error("RENAME: NO NODE SELECTED");},remove:function(obj){if(this.locked)return this.error("LOCKED");if(obj){obj=this.get_node(obj);if(obj.size()){if(!this.check("deletable",obj))return this.error("DELETE: NODE NOT DELETABLE");if(!this.settings.callback.beforedelete.call(null,obj.get(0),_this))return this.error("DELETE: STOPPED BY USER");$parent=obj.parent();obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();this.set_cookie("open");}
this.settings.callback.ondelete.call(null,obj,this);}}
else if(this.selected){if(!this.check("deletable",this.selected))return this.error("DELETE: NODE NOT DELETABLE");if(!this.settings.callback.beforedelete.call(null,this.selected.get(0),_this))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();var obj=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1){var stop=true;this.get_prev(true);}
obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();this.set_cookie("open");}
this.selected=false;this.settings.callback.ondelete.call(null,obj,this);if(this.settings.rules.multiple!=false&&!stop){var _this=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this));});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove();}}}
else return this.error("DELETE: NO NODE SELECTED");},get_next:function(force){var obj=this.hovered||this.selected;if(obj){if(obj.hasClass("open"))return force?this.select_branch(obj.find("li:eq(0)")):this.hover_branch(obj.find("li:eq(0)"));else if($(obj).nextAll("li").size()>0)return force?this.select_branch(obj.nextAll("li:eq(0)")):this.hover_branch(obj.nextAll("li:eq(0)"));else return force?this.select_branch(obj.parents("li").next("li").eq(0)):this.hover_branch(obj.parents("li").next("li").eq(0));}},get_prev:function(force){var obj=this.hovered||this.selected;if(obj){if(obj.prev("li").size()){var obj=obj.prev("li").eq(0);while(obj.hasClass("open"))obj=obj.children("ul:eq(0)").children("li:last");return force?this.select_branch(obj):this.hover_branch(obj);}
else{return force?this.select_branch(obj.parents("li:eq(0)")):this.hover_branch(obj.parents("li:eq(0)"));}}},get_left:function(force,rtl){if(this.settings.ui.rtl&&!rtl)return this.get_right(force,true);var obj=this.hovered||this.selected;if(obj){if(obj.hasClass("open"))this.close_branch(obj);else{return force?this.select_branch(obj.parents("li:eq(0)")):this.hover_branch(obj.parents("li:eq(0)"));}}},get_right:function(force,rtl){if(this.settings.ui.rtl&&!rtl)return this.get_left(force,true);var obj=this.hovered||this.selected;if(obj){if(obj.hasClass("closed"))this.open_branch(obj);else{return force?this.select_branch(obj.find("li:eq(0)")):this.hover_branch(obj.find("li:eq(0)"));}}},toggleDots:function(){this.container.toggleClass("no_dots");},set_cookie:function(type){if(this.settings.cookies===false)return false;switch(type){case"selected":var val=this.selected?this.selected.attr("id"):false;$.cookie(this.settings.cookies.prefix+'_selected',val,this.settings.cookies.opts);break;case"open":var str="";this.container.find("li.open").each(function(i){str+=this.id+",";});$.cookie(this.settings.cookies.prefix+'_open',str.replace(/,$/ig,""),this.settings.cookies.opts);break;}},moved:function(what,where,how,is_new,is_copy){var what=$(what);var $parent=$(what).parents("ul:eq(0)");var $where=$(where);if(what.size()>1){var _this=this;var tmp=this.moved(what.eq(0),where,how,false,is_copy);what.each(function(i){if(i==0)return;tmp=_this.moved(this,tmp.children("a:eq(0)"),"after",false,is_copy);})
return;}
if(is_copy){what=what.clone();what.each(function(i){this.id=this.id+"_copy";$(this).find("li").each(function(){this.id=this.id+"_copy";})
$(this).find("a.clicked").removeClass("clicked");});}
if(is_new){if(!this.settings.callback.beforecreate.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this))return;}
else{if(!this.settings.callback.beforemove.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this))return;}
var tmp=$(where).parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];if(this.settings.languages.length){var res=[];if(tmp.settings.languages.length==0)res.push("."+this.current_lang);else{for(i in this.settings.languages){for(j in tmp.settings.languages){if(this.settings.languages[i]==tmp.settings.languages[j])res.push("."+this.settings.languages[i]);}}}
if(res.length==0)return this.error("MOVE: NO COMMON LANGUAGES");what.find("a").removeClass("clicked").not(res.join(",")).remove();}}
switch(how){case"before":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().before(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"after":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().after(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"inside":if(this.settings.data.async){var obj=this.get_node($where);if(obj.hasClass("closed")){var _this=this;return this.open_branch(obj,true,function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy]);})}}
if($where.parent().children("ul:first").size()){if(this.settings.rules.createat=="top")$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");else $where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last");}
else{what.addClass("last");$where.parent().append("<ul/>").removeClass("leaf").addClass("closed");$where.parent().children("ul:first").prepend(what);}
if(!this.settings.data.async){this.open_branch($where);}
break;default:break;}
if($parent.find("li").size()==0){var $li=$parent.parent();$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last");this.set_cookie("open");}
else{$parent.children("li.last").removeClass("last");$parent.children("li:last").addClass("last");}
if(is_new&&how!="inside")where=this.get_node(where).parents("li:eq(0)");if(is_copy)this.settings.callback.oncopy.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this)
else if(is_new)this.settings.callback.oncreate.call(null,this.get_node(what).get(0),this.get_node(where).get(0),this.settings.insertAt,this);else this.settings.callback.onmove.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this);return what;},error:function(code){this.settings.callback.error.call(null,code,this);return false;},lock:function(state){this.locked=state;if(this.locked)this.container.addClass("locked");else this.container.removeClass("locked");},cut:function(){if(this.locked)return this.error("LOCKED");if(!this.selected)return this.error("CUT: NO NODE SELECTED");this.copy_nodes=false;this.cut_nodes=this.container.find("a.clicked").filter(":first-child").parent();},copy:function(){if(this.locked)return this.error("LOCKED");if(!this.selected)return this.error("COPY: NO NODE SELECTED");this.copy_nodes=this.container.find("a.clicked").filter(":first-child").parent();this.cut_nodes=false;},paste:function(){if(this.locked)return this.error("LOCKED");if(!this.selected)return this.error("PASTE: NO NODE SELECTED");if(!this.copy_nodes&&!this.cut_nodes)return this.error("PASTE: NOTHING TO DO");if(this.copy_nodes&&this.copy_nodes.size()){if(!this.checkMove(this.copy_nodes,this.selected.children("a:eq(0)"),"inside"))return false;this.moved(this.copy_nodes,this.selected.children("a:eq(0)"),"inside",false,true);this.copy_nodes=false;}
if(this.cut_nodes&&this.cut_nodes.size()){if(!this.checkMove(this.cut_nodes,this.selected.children("a:eq(0)"),"inside"))return false;this.moved(this.cut_nodes,this.selected.children("a:eq(0)"),"inside");this.cut_nodes=false;}}}}
(function($){$.fn.dashboard=function(options){var dashboard={};dashboard.element=this.empty();dashboard.ready=false;dashboard.columns=Array();dashboard.widgets=Array();dashboard.init=function(widgets,status){throbber.remove();var markup='<li class="empty-placeholder">'+opts.emptyPlaceholderInner+'</li>';for(var c=0;c<opts.columns;c++){var col=dashboard.columns[c]={initialWidgets:Array(),element:$('<ul id="column-'+c+'" class="column"></ul>').appendTo(dashboard.element)};col.emptyPlaceholder=$(markup).appendTo(col.element).hide();}
invokeCallback(opts.callbacks.initDashboard,dashboard);};dashboard.setWidgetContent=function(id,content){if(dashboard.widgets[id]){dashboard.widgets[id].content=content;$(dashboard.widgets[id].element).html(content);}};dashboard.addWidget=function(column,id,title,content){var col=dashboard.columns[column];if(col){col.initialWidgets[id]=dashboard.widgets[id]=widget({id:id,element:$('<li class="widget"></li>').appendTo(col.element),initialColumn:col,minimized:false,locked:false,content:content,title:title});col.initialWidgets[id].init();}};dashboard.saveColumns=function(){for(var c in dashboard.columns){if(typeof(dashboard.columns[c])=="object"){var col=dashboard.columns[c];if(col.element.children(':visible').not(col.emptyPlaceholder).length>0){col.emptyPlaceholder.hide();}else{col.emptyPlaceholder.show();}}}
if(!dashboard.ready){return;}
var params={};for(var c in dashboard.columns){if(typeof(dashboard.columns[c])=="object"){var ids=dashboard.columns[c].element.sortable('toArray');for(var w in ids){if(typeof(ids[w])=="string"){var id=ids[w].substring('widget-'.length);params['columns['+c+']['+id+']']={minimized:dashboard.widgets[id].minimized,locked:dashboard.widgets[id].locked};}}}}
invokeCallback(opts.callbacks.saveLayout,dashboard,params);};var currentReSortEvent=null;var opts=$.extend({},$.fn.dashboard.defaults,options);var throbber=$(opts.throbberMarkup).appendTo(dashboard.element);return dashboard;function completeInit(){dashboard.sortableElement=$('.column').sortable({connectWith:['.column'],handle:'.widget-header',placeholder:'placeholder',items:'> .widget',forcePlaceholderSize:true,update:resorted,revert:true,start:hideEmptyPlaceholders,stop:stopDrag,helper:function(){return'<div style="width:300px;height:300px;border: 3px dashed #cccccc;"></div>';}});dashboard.saveColumns();dashboard.ready=true;invokeCallback(opts.callbacks.ready,dashboard);}
function resorted(e,ui){if(!currentReSortEvent||e.originalEvent!=currentReSortEvent){currentReSortEvent=e.originalEvent;dashboard.saveColumns();}}
function stopDrag(e,ui){}
function hideEmptyPlaceholders(e,ui){for(var c in dashboard.columns){if(typeof(dashboard.columns[c])=="object"){dashboard.columns[c].emptyPlaceholder.hide();}}}
function invokeCallback(callback,theThis,parameterOne){if(callback){callback.call(theThis,parameterOne);}}
function widget(widget){widget=$.extend({},$.fn.dashboard.widget.defaults,widget);widget.init=function(data,status){$.extend(widget,data);widget.element.attr('id','widget-'+widget.id).addClass(widget.classes);throbber.remove();$(widgetHTML()).appendTo(widget.element);widget.contentElement=$('.widget-content',widget.element);$.each(widget.controls,widget.addControl);widget.minimized=!widget.minimized;widget.toggleMinimize();widget.locked=!widget.locked;widget.toggleLock();invokeCallback(opts.widgetCallbacks.get,widget);completeInit();}
widget.showSettings=function(){invokeCallback(opts.widgetCallbacks.showSettings,widget);};widget.toggleMinimize=function(){if(widget.minimized){widget.maximize();}else{widget.minimize();}
dashboard.saveColumns();};widget.toggleLock=function(){if(widget.locked){widget.unlock();}else{widget.lock();}
dashboard.saveColumns();};widget.minimize=function(){$('.widget-content',widget.element).slideUp(opts.animationSpeed);var img=$('img',widget.controls.minimize.element);img.attr('src',img.attr('src').replace('minimize','maximize'));widget.minimized=true;};widget.maximize=function(){$('.widget-content',widget.element).slideDown(opts.animationSpeed);var img=$('img',widget.controls.minimize.element);img.attr('src',img.attr('src').replace('maximize','minimize'));widget.minimized=false;};widget.lock=function(){var img=$('img',widget.controls.locked_widget.element);img.attr('src',img.attr('src').replace('unlocked','locked'));widget.locked=true;};widget.unlock=function(){var img=$('img',widget.controls.locked_widget.element);img.attr('src',img.attr('src').replace('locked','unlocked'));widget.locked=false;};widget.addControl=function(id,control){var markup='<a class="widget-icon '+id+'-icon"><img src="../images/'+id+'.gif" title="'+control.description+'" alt="'+control.description+'" /></a>';control.element=$(markup).prependTo($('.widget-controls',widget.element)).click(control.callback);};widget.reloadContent=function(){alert("reloading");};widget.remove=function(){invokeCallback(opts.widgetCallbacks.remove,widget);widget.element.fadeOut(opts.animationSpeed,function(){$(this).remove();dashboard.saveColumns();});};widget.controls={settings:{description:'View settings for this widget',callback:widget.showSettings},minimize:{description:'Show & hide this widget',callback:widget.toggleMinimize},locked_widget:{description:'Lock/Unlock this widget - when unlocked it will dynamically update to display data for the selected Vehicles,Drivers etc.',callback:widget.toggleLock},close:{description:'Remove this widget',callback:widget.remove}};return widget;function widgetHTML(){var html='';html+='<div class="widget-wrapper">';html+='  <div class="widget-controls"></div>';html+='  <div class="widget-header">'+widget.title+'</div>';html+='  <div class="widget-content">'+widget.content+'</div>';html+='</div>';return html;}
function initThrobber(){if(!widget.throbber){widget.throbber=$(opts.throbberMarkup).appendTo($('.widget-wrapper',widget.element));}}};};$.fn.dashboard.defaults={columns:3,emptyPlaceholderInner:'There are no widgets in this column of your dashboard.',throbberMarkup:'<div class="throbber"><img alt="Loading, please wait" src="../images/throbber.gif" /><p>Loading...</p></div>',animationSpeed:500,callbacks:{},widgetCallbacks:{}};$.fn.dashboard.widget={defaults:{minimized:false,locked:false}};})($);;(function($){var rotateLeft=function(lValue,iShiftBits){return(lValue<<iShiftBits)|(lValue>>>(32-iShiftBits));}
var addUnsigned=function(lX,lY){var lX4,lY4,lX8,lY8,lResult;lX8=(lX&0x80000000);lY8=(lY&0x80000000);lX4=(lX&0x40000000);lY4=(lY&0x40000000);lResult=(lX&0x3FFFFFFF)+(lY&0x3FFFFFFF);if(lX4&lY4)return(lResult^0x80000000^lX8^lY8);if(lX4|lY4){if(lResult&0x40000000)return(lResult^0xC0000000^lX8^lY8);else return(lResult^0x40000000^lX8^lY8);}else{return(lResult^lX8^lY8);}}
var F=function(x,y,z){return(x&y)|((~x)&z);}
var G=function(x,y,z){return(x&z)|(y&(~z));}
var H=function(x,y,z){return(x^y^z);}
var I=function(x,y,z){return(y^(x|(~z)));}
var FF=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(F(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);};var GG=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(G(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);};var HH=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(H(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);};var II=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(I(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);};var convertToWordArray=function(string){var lWordCount;var lMessageLength=string.length;var lNumberOfWordsTempOne=lMessageLength+8;var lNumberOfWordsTempTwo=(lNumberOfWordsTempOne-(lNumberOfWordsTempOne%64))/64;var lNumberOfWords=(lNumberOfWordsTempTwo+1)*16;var lWordArray=Array(lNumberOfWords-1);var lBytePosition=0;var lByteCount=0;while(lByteCount<lMessageLength){lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=(lWordArray[lWordCount]|(string.charCodeAt(lByteCount)<<lBytePosition));lByteCount++;}
lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=lWordArray[lWordCount]|(0x80<<lBytePosition);lWordArray[lNumberOfWords-2]=lMessageLength<<3;lWordArray[lNumberOfWords-1]=lMessageLength>>>29;return lWordArray;};var wordToHex=function(lValue){var WordToHexValue="",WordToHexValueTemp="",lByte,lCount;for(lCount=0;lCount<=3;lCount++){lByte=(lValue>>>(lCount*8))&255;WordToHexValueTemp="0"+lByte.toString(16);WordToHexValue=WordToHexValue+WordToHexValueTemp.substr(WordToHexValueTemp.length-2,2);}
return WordToHexValue;};var uTF8Encode=function(string){string=string.replace(/\x0d\x0a/g,"\x0a");var output="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){output+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){output+=String.fromCharCode((c>>6)|192);output+=String.fromCharCode((c&63)|128);}else{output+=String.fromCharCode((c>>12)|224);output+=String.fromCharCode(((c>>6)&63)|128);output+=String.fromCharCode((c&63)|128);}}
return output;};$.extend({md5:function(string){var x=Array();var k,AA,BB,CC,DD,a,b,c,d;var S11=7,S12=12,S13=17,S14=22;var S21=5,S22=9,S23=14,S24=20;var S31=4,S32=11,S33=16,S34=23;var S41=6,S42=10,S43=15,S44=21;string=uTF8Encode(string);x=convertToWordArray(string);a=0x67452301;b=0xEFCDAB89;c=0x98BADCFE;d=0x10325476;for(k=0;k<x.length;k+=16){AA=a;BB=b;CC=c;DD=d;a=FF(a,b,c,d,x[k+0],S11,0xD76AA478);d=FF(d,a,b,c,x[k+1],S12,0xE8C7B756);c=FF(c,d,a,b,x[k+2],S13,0x242070DB);b=FF(b,c,d,a,x[k+3],S14,0xC1BDCEEE);a=FF(a,b,c,d,x[k+4],S11,0xF57C0FAF);d=FF(d,a,b,c,x[k+5],S12,0x4787C62A);c=FF(c,d,a,b,x[k+6],S13,0xA8304613);b=FF(b,c,d,a,x[k+7],S14,0xFD469501);a=FF(a,b,c,d,x[k+8],S11,0x698098D8);d=FF(d,a,b,c,x[k+9],S12,0x8B44F7AF);c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);a=FF(a,b,c,d,x[k+12],S11,0x6B901122);d=FF(d,a,b,c,x[k+13],S12,0xFD987193);c=FF(c,d,a,b,x[k+14],S13,0xA679438E);b=FF(b,c,d,a,x[k+15],S14,0x49B40821);a=GG(a,b,c,d,x[k+1],S21,0xF61E2562);d=GG(d,a,b,c,x[k+6],S22,0xC040B340);c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);b=GG(b,c,d,a,x[k+0],S24,0xE9B6C7AA);a=GG(a,b,c,d,x[k+5],S21,0xD62F105D);d=GG(d,a,b,c,x[k+10],S22,0x2441453);c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);b=GG(b,c,d,a,x[k+4],S24,0xE7D3FBC8);a=GG(a,b,c,d,x[k+9],S21,0x21E1CDE6);d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);c=GG(c,d,a,b,x[k+3],S23,0xF4D50D87);b=GG(b,c,d,a,x[k+8],S24,0x455A14ED);a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);d=GG(d,a,b,c,x[k+2],S22,0xFCEFA3F8);c=GG(c,d,a,b,x[k+7],S23,0x676F02D9);b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);a=HH(a,b,c,d,x[k+5],S31,0xFFFA3942);d=HH(d,a,b,c,x[k+8],S32,0x8771F681);c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);a=HH(a,b,c,d,x[k+1],S31,0xA4BEEA44);d=HH(d,a,b,c,x[k+4],S32,0x4BDECFA9);c=HH(c,d,a,b,x[k+7],S33,0xF6BB4B60);b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);d=HH(d,a,b,c,x[k+0],S32,0xEAA127FA);c=HH(c,d,a,b,x[k+3],S33,0xD4EF3085);b=HH(b,c,d,a,x[k+6],S34,0x4881D05);a=HH(a,b,c,d,x[k+9],S31,0xD9D4D039);d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);b=HH(b,c,d,a,x[k+2],S34,0xC4AC5665);a=II(a,b,c,d,x[k+0],S41,0xF4292244);d=II(d,a,b,c,x[k+7],S42,0x432AFF97);c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);b=II(b,c,d,a,x[k+5],S44,0xFC93A039);a=II(a,b,c,d,x[k+12],S41,0x655B59C3);d=II(d,a,b,c,x[k+3],S42,0x8F0CCC92);c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);b=II(b,c,d,a,x[k+1],S44,0x85845DD1);a=II(a,b,c,d,x[k+8],S41,0x6FA87E4F);d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);c=II(c,d,a,b,x[k+6],S43,0xA3014314);b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);a=II(a,b,c,d,x[k+4],S41,0xF7537E82);d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);c=II(c,d,a,b,x[k+2],S43,0x2AD7D2BB);b=II(b,c,d,a,x[k+9],S44,0xEB86D391);a=addUnsigned(a,AA);b=addUnsigned(b,BB);c=addUnsigned(c,CC);d=addUnsigned(d,DD);}
var tempValue=wordToHex(a)+wordToHex(b)+wordToHex(c)+wordToHex(d);return tempValue.toLowerCase();}});})(jQuery);(function($){var chrsz=8;var safe_add=function(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}
var S=function(X,n){return(X>>>n)|(X<<(32-n));}
var R=function(X,n){return(X>>>n);}
var Ch=function(x,y,z){return((x&y)^((~x)&z));}
var Maj=function(x,y,z){return((x&y)^(x&z)^(y&z));}
var Sigma0256=function(x){return(S(x,2)^S(x,13)^S(x,22));}
var Sigma1256=function(x){return(S(x,6)^S(x,11)^S(x,25));}
var Gamma0256=function(x){return(S(x,7)^S(x,18)^R(x,3));}
var Gamma1256=function(x){return(S(x,17)^S(x,19)^R(x,10));}
var core_sha256=function(m,l){var K=new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);var HASH=new Array(0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A,0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19);var W=new Array(64);var a,b,c,d,e,f,g,h,i,j;var T1,T2;m[l>>5]|=0x80<<(24-l%32);m[((l+64>>9)<<4)+15]=l;for(var i=0;i<m.length;i+=16){a=HASH[0];b=HASH[1];c=HASH[2];d=HASH[3];e=HASH[4];f=HASH[5];g=HASH[6];h=HASH[7];for(var j=0;j<64;j++){if(j<16){W[j]=m[j+i];}else{W[j]=safe_add(safe_add(safe_add(Gamma1256(W[j-2]),W[j-7]),Gamma0256(W[j-15])),W[j-16]);}
T1=safe_add(safe_add(safe_add(safe_add(h,Sigma1256(e)),Ch(e,f,g)),K[j]),W[j]);T2=safe_add(Sigma0256(a),Maj(a,b,c));h=g;g=f;f=e;e=safe_add(d,T1);d=c;c=b;b=a;a=safe_add(T1,T2);}
HASH[0]=safe_add(a,HASH[0]);HASH[1]=safe_add(b,HASH[1]);HASH[2]=safe_add(c,HASH[2]);HASH[3]=safe_add(d,HASH[3]);HASH[4]=safe_add(e,HASH[4]);HASH[5]=safe_add(f,HASH[5]);HASH[6]=safe_add(g,HASH[6]);HASH[7]=safe_add(h,HASH[7]);}
return HASH;}
var str2binb=function(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz){bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(24-i%32);}
return bin;}
var binb2hex=function(binarray){var hex_tab="0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF);}
return str;}
var core_hmac_sha256=function(key,data){var bkey=str2binb(key);if(bkey.length>16){bkey=core_sha1(bkey,key.length*chrsz);}
var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=core_sha256(ipad.concat(str2binb(data)),512+data.length*chrsz);return core_sha256(opad.concat(hash),512+256);}
var prep=function(string){string=typeof string=='object'?$(string).val():string.toString();return string;}
$.extend({sha256:function(string){string=prep(string);return binb2hex(core_sha256(str2binb(string),string.length*chrsz));},sha256hmac:function(key,data){key=prep(key);data=prep(data);return binb2hex(core_hmac_sha256(key,data));},sha256config:function(bits){chrsz=parseInt(bits)||8;}});$.fn.sha256=function(bits){$.sha256config(bits);var string=prep($(this).val());var val=$.sha256(string);$.sha256config(8);return val;};})(jQuery);/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
