var tid=0;function closeSession()
{clearTimeout(tid);var out=$.cookie('out')
var offset=out-new Date().getTime();if(offset>1000)
{tid=setTimeout(closeSession,offset);}
else
{Confirm(_sessionExpired,function()
{window.location.href='index.php';});}};function GET(url,params,fok,ferr)
{$('#operacion').css('visibility','visible');params.r=Math.random()
$.get(url,params,function(ms)
{$('#operacion').css('visibility','hidden');if(ms.ERROR!=undefined)
{if(ferr!=undefined)
ferr(ms.error);else
Alert(ms.ERROR.text);}
else if(ms.result!=undefined)
fok(ms.result);},'json');}
function POST(url,params,fok,ferr)
{$('#operacion').css('visibility','visible');$.post(url,params,function(ms)
{$('#operacion').css('visibility','hidden');$('#operacion').hide();if(ms.ERROR!=undefined)
{if(ferr!=undefined)
ferr(ms.ERROR);else
Alert(ms.ERROR.text);}
else if(ms.result!=undefined)
fok(ms.result);},'json');}
function flipflop(button,element)
{if($(button).hasClass('active')==true)
return;if($("#"+element).attr("checked"))
{$('#'+element).removeAttr('checked');$('#'+element+'ON').removeClass('active')
$('#'+element+'OFF').addClass('active')}
else
{$('#'+element).attr("checked","checked");$('#'+element+'ON').addClass('active')
$('#'+element+'OFF').removeClass('active')}}
var _localEngine={Confirm:function(text,fOK,fCANCEL)
{if(confirm(text)===true)
{if(typeof fOK=='function')
fOK();}
else
{if(typeof fCANCEL=='function')
fCANCEL();}},Alert:function(text,callback)
{alert(text)
if(typeof callback=='function')
callback();}};var _dialogEngine={Confirm:function(text,fOK,fCANCEL)
{$("#dialog:ui-dialog").dialog("destroy");var aux=$("#dialog-message p.dialog-text").text()
$("#dialog-message p.dialog-text").text(text)
$("#dialog-message").dialog({modal:true,height:220,buttons:{Ok:function(){$(this).dialog("close");$("#dialog-message p.dialog-text").text(aux)
if(typeof fOK=='function')
fOK();},Cancel:function(){$(this).dialog("close");if(typeof fCANCEL=='function')
fCANCEL()}},close:function()
{if(typeof fCANCEL=='function')
fCANCEL()}});},Alert:function(text,callback)
{$("#dialog:ui-dialog").dialog("destroy");var aux=$("#dialog-message p.dialog-text").text()
$("#dialog-message p.dialog-text").text(text)
$("#dialog-message").dialog({modal:true,buttons:{Ok:function(){$(this).dialog("close");$("#dialog-message p.dialog-text").text(aux)
if(typeof callback=='function')
callback()}}});}};function getNotificationEngine()
{if($.browser.msie)
{if($.browser.version.indexOf('6')==0)
return _localEngine;}
return _dialogEngine;}
function Confirm(text,fOK,fCANCEL)
{getNotificationEngine().Confirm(text,fOK,fCANCEL);}
function Alert(text,callback)
{getNotificationEngine().Alert(text,callback);}
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1;}
if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}
value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};function supports_input_placeholder(){var i=document.createElement('input');return'placeholder'in i;}
$(document).ready(function()
{function hideNext(t)
{$(t).nextAll().each(function(i)
{if($(this).is(':hidden'))
$(this).show();else
$(this).hide();});}
$('.funds').click(function()
{var html=$('span',this).html()
var label=this;GET('proxie.php?op=setuserflag',{flag:1024,value:html=='...'?'on':'off'},function()
{if(html=='...')
$('span',label).html($(label).attr('title'))
else
{$('span',label).attr('title',html);$('span',label).html('...')}});});$('.autofocus').each(function(i)
{var v=$(this)
if(v.hasClass('unintrusive'))
{if(v.val().length!=0)
return;}
$(this).focus()});$('.number').bind('keypress',function(evt)
{var charCode=(evt.which)?evt.which:event.keyCode
if(charCode!=46&&charCode>31&&(charCode<48||charCode>57))
return false;return true;});if(supports_input_placeholder()==false)
{$('.autohint').each(function(i)
{if($(this).val().length==0)
{$(this).val($(this).attr('placeholder'))
$(this).attr('autohint',true)
$(this).css('color','#999')}
$(this).focusin(function()
{if($(this).attr('autohint')=='true')
{$(this).val('')
$(this).css('color','')}});$(this).focusout(function()
{if($(this).val().length==0)
{$(this).val($(this).attr('placeholder'))
$(this).attr('autohint',true)
$(this).css('color','#999')}});});}
$('.hidenext').click(function()
{if($(this).attr('flag')!=null)
{var el=$(this)
var flag=$(this).attr('flag');var value=$(this).next().is(':hidden')?'on':'off';GET('proxie.php?op=setuserflag',{flag:flag,value:value},function(res)
{var $icon=el.find('span.ui-icon')
if(value=='on')
$icon.removeClass('ui-icon-circle-arrow-s').addClass('ui-icon-circle-arrow-n')
else
$icon.removeClass('ui-icon-circle-arrow-n').addClass('ui-icon-circle-arrow-s')});}
hideNext(this);});if(_ts!=0)
{tid=setTimeout(closeSession,_ts);$.cookie('out',new Date().getTime()+_ts);}})
