currentLang='eng';function navigateTo(evt,tg){if(Ext.get(tg).getAttribute('navi'))
window.location.href='/'+Ext.get(tg).getAttribute('navi')+'.aspx';}
function setNewLang(cObj,newV,oldV)
{showWait();Ext.getCmp('langSelForm').getForm().submit();}
var focusUsername=new Ext.util.DelayedTask(function(){if(Ext.get("tomUsername"))
Ext.get("tomUsername").focus();else
focusUsername.delay(500);});function expColCnt(evt,tg)
{try{var ctid=Ext.get(tg).getAttribute('imgExpCol');var tgRow=Ext.get('rowCnt'+ctid);if(tgRow.getStyle('display')=='table-row'){tgRow.setStyle('display','none');tg.src='/picts/nd_titleplus.png';}
else{tgRow.setStyle('display','table-row');tg.src='/picts/nd_titleminus.png';}}
catch(ex){}}
function loginTom(pnl,ev){var inval=false;var invalText="";if(Ext.get('tomUsername').getValue().trim()=='')
{inval=true;invalText='Please enter your Tomattrick username here';dispFormError(Ext.get('tomUsername'),invalText);}
else if(Ext.get('tomPassword').getValue().trim()=='')
{inval=true;invalText='Please enter your Tomattrick password here';dispFormError(Ext.get('tomPassword'),invalText);}
if(!inval){showWait();Ext.get('loginForm').dom.submit();}}
function dispFormError(fObj,eTxt)
{if(Ext.getCmp('errTT')!=null)
Ext.getCmp('errTT').destroy();var errTT=new Ext.ToolTip({id:'errTT',width:300,autoHeight:true,title:'Invalid',autoHeight:false,autoWidth:false,autoScroll:false,draggable:false,anchor:'left',border:true,autoHide:true,dismissDelay:30000,closable:true,bodyStyle:'padding:5px',items:[{xtype:'panel',bodyStyle:'padding:10px;background:#fff url(/picts/ext/window/icon-warning.gif) no-repeat 10px 10px;',html:'
'}]});errTT.showAt([fObj.getX()+190,fObj.getY()]);}
function loginSuccess(form,action){var redirect='default.aspx';window.location=redirect;}
wPWlnk='
Forgot password & bad email address |
';function loginFailure(errTitle,errTxt){var wTitle='Login';var wTxt=errTitle;var wAddTxt=wPWlnk;if(errTxt){wTitle=errTitle;wTxt=errTxt;wAddTxt="";}
var stsWidth=400;var stsHeight=200;var stsX=(Ext.getBody().getViewSize().width/2)-(stsWidth/2);var stxY=(Ext.getBody().getViewSize().height/2)-(stsHeight/2);var iconPath="/picts/ext/window/icon-error.gif";var stsBlendMsg=new Ext.Window({title:wTitle,height:stsHeight,width:stsWidth,id:'logFailureWin',bodyStyle:'padding:10px;background:#fff url('+iconPath+') no-repeat 10px 10px;',html:'
',closable:true,draggable:false,resizable:false,shadow:false,modal:false,floating:true,shim:true,x:stsX,y:stxY});if(Ext.getCmp('plzWaitWin'))
Ext.getCmp('plzWaitWin').destroy();stsBlendMsg.show();stsBlendMsg.getEl().fadeIn({endOpacity:1.0,duration:1});var delTask=new Ext.util.DelayedTask();delTask.delay(20000,function(){try{stsBlendMsg.getEl().fadeOut({endOpacity:0,duration:1,remove:true});}catch(er){}});}
function showWait(){var stsWidth=230;var stsHeight=80;var stsX=(Ext.getBody().getViewSize().width/2)-(stsWidth/2);var stxY=(Ext.getBody().getViewSize().height/2)-(stsHeight/2);var iconPath="/picts/large-loading.gif";var stsBlendMsg=new Ext.Window({title:'Requesting data',height:stsHeight,width:stsWidth,id:'plzWaitWin',bodyStyle:'padding:10px;background:#fff url('+iconPath+') no-repeat 10px 10px;',html:'',closable:false,draggable:false,resizable:false,shadow:false,modal:true,floating:true,shim:true,x:stsX,y:stxY});stsBlendMsg.show();}
function showAddCommunityLink(evt,btn)
{var fObj=Ext.get(btn);if(Ext.getCmp('addCommWin')!=null)
Ext.getCmp('addCommWin').destroy();var commWin=new Ext.ToolTip({id:'addCommWin',width:500,autoHeight:true,title:'Add website to community section',autoHeight:false,autoWidth:false,autoScroll:false,draggable:false,anchor:'right',border:true,autoHide:true,dismissDelay:0,closable:true,bodyStyle:'padding:5px',items:[{xtype:'form',id:'communityForm',hideLabels:true,hideLabel:true,layout:'table',bodyStyle:'padding:10px',defaults:{xtype:'panel',border:false,bodyStyle:'background-color:transparent'},layoutConfig:{columns:2},url:'/loginAction.aspx',items:[{colspan:2,html:'You\'re running a website for Hattrick users? We are happy to show your link here in the community section if you return the favour. Use this form to submit a request for flag exchange.
'},{html:'Your email address: '},{xtype:'textfield',name:'communityEmail',id:'communityEmail',allowBlank:false,cls:'comment',vtype:'email',width:200,maxLength:50},{xtype:'spacer',height:10,colspan:2},{html:'URL of your website: '},{xtype:'textfield',name:'communityUrl',id:'communityUrl',allowBlank:false,cls:'comment',vtype:'url',width:200,maxLength:100},{xtype:'spacer',height:10,colspan:2},{html:'Message to us: '},{xtype:'textarea',name:'communityMessage',id:'communityMessage',allowBlank:false,cls:'comment',width:200,maxLength:2000},{xtype:'spacer',height:10,colspan:2},{xtype:'button',colspan:2,id:'btn_CommSubmit',text:' OK ',icon:'/picts/okButton.gif',scale:'medium',handler:communitySubmit}]}]});commWin.showAt([fObj.getX()-510,fObj.getY()]);}
function communitySubmit()
{if(Ext.getCmp('communityForm').getForm().isValid()){showWait();Ext.getCmp('communityForm').getForm().submit({success:communitySuccess,failure:communityFailure});}
else{if(!Ext.getCmp('communityEmail').isValid()){dispFormError(Ext.get('communityEmail'),'Please check if you have entered a valid email address.');return;}
if(!Ext.getCmp('communityUrl').isValid()){dispFormError(Ext.get('communityUrl'),'Please make sure this field is valid.');return;}
if(!Ext.getCmp('communityMessage').isValid()){dispFormError(Ext.get('communityMessage'),'Please make sure this field is valid.');return;}}}
function communityFailure(form,action){if(Ext.getCmp('plzWaitWin'))
Ext.getCmp('plzWaitWin').destroy();dispFormError(Ext.get(action.result.errorField),action.result.error);}
function communitySuccess(form,action){if(Ext.getCmp('plzWaitWin'))
Ext.getCmp('plzWaitWin').destroy();if(Ext.getCmp('addCommWin'))
Ext.getCmp('addCommWin').destroy();var compBackPnl=new Ext.Window({title:'Thank you for your message.',height:170,autoHeight:500,renderTo:Ext.getBody(),id:'commWinSuccess',bodyStyle:'padding:10px;background-color:transparent',cls:'normCnt',html:'
Thank you for your message. We will get back to you asap.
'});compBackPnl.show();}