/* (c) Hagen Software Inc. */var sb_lock;var didInitSideBars;Event.observe(window,'load',function(){var el=$('newslettersubmit');if(el&&el.form){el.form.observe('submit',function(ev){var el=$('newsletteremail');if(!el||!el.value.match(/^[a-z0-9_.-]+@(?:[a-z0-9-]+\.)+[a-z]{2,}$/i)){ev.stop();if(el.value===el.defaultValue)
return;return alert('Invalid e-mail address');}});}
$$('.sidebarimage a').each(function(el){el.observe('mouseover',sbMouseOver);});el=$('sblogon');if(el){el.observe('submit',logonFormQuickCheck);initSBFields();}
$$('.fpsection').each(function(sec){var s=sec.getAttribute('id').replace('^section_','');sec.select('a').each(function(anc){anc.observe('mouseover',function(ev){setOp(s,1);})
.observe('mouseout',function(ev){setOp(s,0);});});});$$('.sclvm').invoke('observe','viewmore:show',readjustMain)
.invoke('observe','viewmore:hide',readjustMain);$$('.fptbl').each(function(fptbl){fptbl.select('tr').each(function(fprow){fprow.observe('click',fptabrowClick);});});setTimeout('balanceSidebars',500);sb_lock=new Hash();initSideBars();});function balanceSidebars(){balanceHeight($w('fpc1 fpc2 fpc3'));};function sbMouseOver(ev){var img=Event.element(ev);if(img.nodeName==='A')
img=img.down('img');var imgsrc=img.getAttribute('src');imgsrc=imgsrc.replace(/^https?:\/\/[^\/]+/,'');for(var i=0;i<imgdata.length;i+=2){if(imgdata[i][0]===imgsrc&&imgdata[i+1][0]){new Tip(img,'<img src="'+imgdata[i+1][0]+'" '
+'width="'+imgdata[i+1][1]+'" '
+'height="'+imgdata[i+1][2]+'"/>'
+'<h1 id="sidebarpopup-caption">'
+Element.up(img,'a').getAttribute('title').replace(/^View [^0-9]+/,'')
+'</h1>');break;}}};function logonFormQuickCheck(ev){var errors=new Array();var un=$('auth_user_name');if(un&&un.value){if(!un.value.match(/^[a-z0-9_A-Z]{1,20}$/))
errors.push('An Invalid Username was entered.');}else{errors.push('No Username was entered.');}
var pw=$('auth_password');if(!pw||!pw.value){errors.push('No Password was entered.');}
if(errors.length){ev.stop();var txt='';errors.each(function(e){if(txt)txt+="\n";txt+='* '+e;});alert(txt);}}
function initSBFields(){inputAsLabel('auth_user_name');inputAsLabel('auth_password');var remLogin=GetCookie('remember_login');var el=$('auth_user_name');if(el){showAdminRow=function(ev){var admRow=$('adminrow');if(!admRow){return;}
if($F('auth_user_name')==='admin'){admRow.show();}else{admRow.hide();}}
el.observe('keyup',showAdminRow).observe('keyup',showAdminRow);if(remLogin&&GetCookie('username')){el.value=GetCookie('username');}}
if(remLogin){el=$('auth_password');if(el&&GetCookie('password')){el.value=GetCookie('password');}
el=$('admin_button');if(el&&GetCookie('admin_button')){el.checked=true;}}}
function setOp(which,opaque){if(opaque){$(which).addClassName('opacity2');}else{$(which).removeClassName('opacity2');}}
function fixup_sidebars(col_id){if(!col_id)return;var asortable=$(col_id);if(!asortable)return;if(typeof(Sortable)!=='undefined'){Sortable.create(asortable,{tag:'div',only:'sidebaritem',constraint:'vertical',onChange:function(){SBPos.save();}});}
asortable.select('.sidebaritem .boxbutton').each(function(minbutton){minbutton.observe('click',opencloseSBW);});}
function opencloseSBW(ev){ev.stop();var el=Event.element(ev);if(el.tagName==='IMG');el=el.up('A');var sb_box=el.up('.sidebaritem');var div_content=sb_box.select('.sidebarcontent')[0];var div_bottom=sb_box.select('.sidebarbottom')[0];if(sb_lock.get(el.id))return;if(div_content.getStyle('display')==='none'){Effect.BlindDown(div_content,{afterUpdate:function(){if(balanceSidebars)
balanceSidebars();},beforeStart:function(){sb_lock.set(el.id,1);},afterFinish:function(){sb_lock.unset(el.id);var img=el.down('img');if(!img.src.match(/\/graphics\/minimize.gif/))
img.src='/graphics/minimize.gif';SBPos.save();}});Effect.BlindDown(div_bottom);}
else{Effect.BlindUp(div_bottom,{afterFinish:function(){if(balanceSidebars)
balanceSidebars();},beforeStart:function(){sb_lock.set(el.id,1);}});Effect.BlindUp(div_content,{afterFinish:function(){sb_lock.unset(el.id);var img=el.down('img');if(!img.src.match(/\/graphics\/maximize.gif/))
img.src='/graphics/maximize.gif';SBPos.save();}});}
return true;}
var SBPos={save:function(){var pos=new Hash();var hidden=new Hash();[1,3].each(function(col){var i=1;$$('#fpc'+col+' .sidebaritem').each(function(el){pos.set(el.id,i++);var content=el.select('.sidebarcontent');if(content&&content[0]&&content[0].getStyle('display')==='none')
hidden.set(el.id,1);});});if(pos.size()){Cookie.set('position',Object.toJSON(pos));}else{Cookie.erase('position');}
if(hidden.size()){Cookie.set('hidden',Object.toJSON(hidden));}else{Cookie.erase('hidden');}},load:function(){var hpos=Cookie.get('position');var hhid=Cookie.get('hidden');SBPos.hpos=new Hash(hpos?hpos.evalJSON():{});SBPos.hhid=new Hash(hhid?hhid.evalJSON():{});},process:function(){[1,3].each(function(col_id){var arr=new Array(10);var col=$('fpc'+col_id);if(!col)return;col.select('.sidebaritem').each(function(el){var pos=SBPos.hpos.get(el.id);el=el.remove();if(pos)
arr[pos]=el;else
arr.push(el);});arr.each(function(el){if(el){var ishidden=SBPos.hhid.get(el.id);var cont=el.select('.sidebarcontent')[0];var bot=el.select('.sidebarbottom')[0];var boxbut=el.select('.boxbutton img');if(boxbut&&boxbut.length)boxbut=boxbut[0];if(ishidden){if(bot)bot.hide();if(cont)cont.hide();if(boxbut&&!boxbut.src.match(/\/maximize.gif/))
boxbut.src='/graphics/minimize.gif';}else{if(bot)bot.show();if(cont)cont.show();if(!boxbut)alert(el.id);if(boxbut&&!boxbut.src.match(/\/minimize.gif/))
boxbut.src='/graphics/maximize.gif';};col.appendChild(el);}});});}};function initSideBars(){if(didInitSideBars)return;didInitSideBars=1;if(!$('fpbody'))return;fixup_sidebars('fpc1');fixup_sidebars('fpc3');SBPos.load();SBPos.process();if(balanceSidebars)
balanceSidebars();}
function readjustMain(ev){var el=$('fpc2');el.setStyle({height:'auto'});var nHeight=parseInt(el.getHeight());el.setStyle({height:nHeight+'px'});balanceSidebars();}
balanceSidebars();function fptabrowClick(ev){var el=ev.element?Event.element(ev):ev;if(el.nodeName==='A'){return;}
if(el.nodeName!=='TR'){el=el.up('tr');if(!el)return;}
var alink=el.select('a').grep({match:function(rec){return rec.href&&!rec.rel.match('nofollow');}});if(alink.length){ev.stop();if(ev.shiftKey||ev.ctrlKey){window.open(alink[0].href);}else{window.location=alink[0].href;}
return false;}}
