/*
 Webmail 4
 Vincent Fiduccia, David Koopman, Anoakie Turner, Amy Tencza
 Copyright (c) 2003-2007 Starfield Technologies

 Generated: 2009-11-21 05:53:57
 On: gem-wbe40.prod.mesa1.secureserver.net
*/

function Utils()
{}
Utils.lastTimer=0;Utils.timer=function(name)
{var tmp=new Date();tmp=tmp.getTime();Debug.write(tmp+" :: "+(Utils.lastTimer?Utils.lastTimer-tmp:0)+" :: "+name);Utils.lastTimer=tmp;}
Utils.getVar=function(name)
{return eval(name);}
Utils.runInnerJS=function(lyr)
{lyr=Layer.get(lyr);if(!lyr)
return;var scripts=lyr.getElementsByTagName('script');var i;for(i=0;i<scripts.length;i++)
{try
{Utils.safeEval(scripts[i].innerHTML);}
catch(e)
{Debug.write('Failed to run: '+scripts[i].innerHTML);}}}
Utils.safeEval=function(code)
{eval(code);}
Utils.array_merge=function()
{var ret=[];var i,a,j;for(i=0;i<arguments.length;i++)
{a=arguments[i];if(Utils.is_array(a))
{for(j=0;j<a.length;j++)
ret[ret.length]=a[j];}
else
ret[ret.length]=a;}
return ret;}
Utils.is_array=function(ary)
{if(typeof(ary.join)=='function')
return true;if(typeof ary.constructor=='undefined'||!ary.constructor)
return false;return(ary.constructor.toString().indexOf('Array')>=0);}
Utils.in_array=function(needle,haystack)
{var i;for(i=0;i<haystack.length;i++)
{if(haystack[i]==needle)
return true;}
return false;}
Utils.arrayKey=function(needle,haystack)
{for(var i=0;i<haystack.length;i++)
if(haystack[i]==needle)
return i;return false;}
Utils.array_value_count=function(needle,haystack)
{var counter=0;for(var i=0;i<haystack.length;i++)
{if(haystack[i]==needle)
counter=counter+1;}
return counter;}
Utils.array_string_clean=function(inputArray)
{var x=0;var outputArray=new Array();while(x<inputArray.length)
{if(typeof inputArray[x]==='string')
outputArray[outputArray.length]=inputArray[x];x++;}
return outputArray;}
Utils.hash_merge=function()
{var ret=arguments[0];var i,h,j;for(i=1;i<arguments.length;i++)
{h=arguments[i];for(j in h)
{ret[j]=h[j];}}
return ret;}
Utils.hash_key_exists=function(needle,haystack)
{return(haystack[needle]==undefined);}
Utils.hash_keys=function(hash)
{var keys=[];var k;for(k in hash)
{keys[keys.length]=k;}
return keys;}
Utils.is_obj=function(obj)
{if(!obj)
return false;if(typeof obj.prototype!='undefined')
return(obj.prototype.toString().indexOf('Object')>=0);if(typeof obj.constructor!='undefined')
return(obj.constructor.toString().indexOf('Object')>=0);return false;}
Utils.PAD_LEFT='left';Utils.PAD_RIGHT='right';Utils.str_pad=function(string,to,withChar,side)
{if(side==null)
side=Utils.PAD_LEFT;if(withChar==null)
withChar=' ';if(to==null)
to=0;string=""+string;while(string.length<to)
{if(side==Utils.PAD_LEFT)
string=withChar+string;else
string=string+withChar;}
return string;}
Utils.className=function(obj)
{if(obj&&obj.constructor&&obj.constructor.toString)
{var match=obj.constructor.toString().match(/function\s*(\w+)/);return match&&match.length==2?match[1]:undefined;}
return undefined;}
Utils.displaySize=function(size,labellen,round,power)
{var labels=Array();labels['short']=['B','KB','MB','GB','TB'];labels['medium']=['bytes','kbytes','mbytes','gbytes','tbytes'];labels['long']=['bytes','kilobytes','megabytes','gigabytes','terabytes'];var auto_round=[0,1,2,2,2];if(labellen==null)
labellen='short';if(power==null)
power=0;if(round==null)
round=auto_round[power];if(size>1024)
return Utils.displaySize(size/1024,labellen,round,power+1);return Math.round(size*Math.pow(10,round))/Math.pow(10,round)+" "+labels[labellen][power];}
Utils.displayTime=function(sec,format)
{if(format==null)
format="short";var hrs=0,min=0
if(sec>3600)
{hrs=Math.floor(sec/3600);sec-=3600*hrs;}
if(sec>60)
{min=Math.floor(sec/60);sec-=60*min;}
if(format=="short")
{return(hrs>0?hrs+":":"")+
(min>10?"":"0")+min+":"+
(sec>10?"":"0")+sec;}
if(format=="medium")
{return(hrs>0?hrs+"h:":"")+
(min>0?((min>10?"":"0")+min+"m:"):"")+
sec+"s";}}
Utils.randomHexString=function(count)
{var chars=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];if(count==null)
count=32;var str="";for(var i=0;i<count;i++)
{str+=chars[Math.floor(Math.random()*16)];}
return str;}
Utils.randomInt=function(min,max)
{if(min==null)min=0;if(max==null)max=2*1024*1024*1024-1
return Math.floor((Math.random()*(max-min)))+min;}
Utils.htmlspecialchars=function(input)
{input=input.replace(/&/g,'&amp;');input=input.replace(/</g,'&lt;');input=input.replace(/>/g,'&gt;');input=input.replace(/"/g,'&quot;');input=input.replace(/'/g,'&#039;');return input;}
Utils.unhtmlspecialchars=function(input)
{input=input.replace(/&lt;/g,'<');input=input.replace(/&gt;/g,'>');input=input.replace(/&quot;/g,'"');input=input.replace(/&#0*39;/g,"'");input=input.replace(/&amp;/g,"&");input=input.replace(/&nbsp;/g," ");return input;}
Utils.striphtml=function(input)
{if(input&&typeof input.replace=='function')
return input.replace(/<[^>]*>/g,'');else
return input;}
Utils.usleep=function(ms)
{var d=new Date();var end=d.getTime()+ms;while(d.getTime()<end)
d=new Date();}
Utils.getMillitime=function()
{return(new Date().getTime())/1000;}
Utils.makeDateObj=function(datestr,timestr)
{if(!datestr)
datestr='0000-00-00';if(!timestr)
{if(datestr.indexOf(' ')>0)
{var dt=datestr.split(' ');datestr=dt[0];timestr=dt[1];}
else
{timestr='00:00:00';}}
var date=datestr.split('-');var time=timestr.split(':');var obj=new Date(date[0],date[1]-1,date[2],time[0],time[1],time[2]);return obj;}
Utils.days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];Utils.months=['January','February','March','April','May','June','July','August','September','October','November','December'];Utils.dateFormat='m/d/Y';Utils.timeFormat='h:i a';Utils.constructDate=function(y,m,d,t,format)
{var thisDate=new Date(y,m-1,d);var dayOffset=thisDate.getDay();if(dayOffset<0)dayOffset+=7;if(format!=null)
sTmp=format;else
sTmp=Utils.dateFormat;sTmp=sTmp.replace('d',Utils.padZero(d));sTmp=sTmp.replace('j',d);sTmp=sTmp.replace('w',dayOffset);sTmp=sTmp.replace('m',Utils.padZero(m));sTmp=sTmp.replace('n',m);sTmp=sTmp.replace('Y',y);sTmp=sTmp.replace('y',Utils.padZero(y%100));sTmp=sTmp.replace('l','<fullday>');sTmp=sTmp.replace('D','<shortday>');sTmp=sTmp.replace('S','<ordinal>');sTmp=sTmp.replace('F','<fullmonth>');sTmp=sTmp.replace('M','<shortmonth>');sTmp=sTmp.replace('<shortday>',Utils.days[dayOffset].substr(0,3));sTmp=sTmp.replace('<fullday>',Utils.days[dayOffset]);sTmp=sTmp.replace('<fullmonth>',Utils.months[m-1]);sTmp=sTmp.replace('<shortmonth>',Utils.months[m-1].substr(0,3));sTmp=sTmp.replace('<ordinal>',Utils.ordinal(d));return sTmp;}
Utils.constructTime=function(h,m,s,format)
{if(format=="NoonMidnight"&&h==0&&m==0)
return"Midnight";else if(format=="NoonMidnight"&&h==12&&m==0)
return"Noon";else if(format=="NoonMidnight")
format=null;var as12hr=Utils.to12Hour(h);sTmp=(format==null?Utils.timeFormat:format);sTmp=sTmp.replace('A','<A>');sTmp=sTmp.replace('a','<a>');sTmp=sTmp.replace('g',as12hr.hour);sTmp=sTmp.replace('G',h);sTmp=sTmp.replace('h',Utils.padZero(as12hr.hour));sTmp=sTmp.replace('H',Utils.padZero(h));sTmp=sTmp.replace('i',Utils.padZero(m));sTmp=sTmp.replace('s',Utils.padZero(s));sTmp=sTmp.replace('<a>',as12hr.ampm?'pm':'am');sTmp=sTmp.replace('<A>',as12hr.ampm?'PM':'AM');return sTmp;}
Utils.fromTimestamp=function(ts)
{var d=new Date();d.setTime(ts*1000);return d;}
Utils.doSearch=function(query,type)
{var f=document.frm_quicksearch;if(type=='web')
{f.searchType.value='web';f.showquery.value='1';f.newSearch.value='0';f.searchStr.value=query;}
else
{f.searchType.value='basic';f.showquery.value='1';f.newSearch.value='1';f.searchStr.value=query;}
f.submit();}
Utils.padZero=function(num)
{if(num.toString().length<2)
return'0'+num;else
return num;}
Utils.to12Hour=function(h)
{if(h==0||h==12)
return{hour:12,ampm:(h==12?1:0)};else if(h>0&&h<12)
return{hour:h,ampm:false};else
return{hour:h-12,ampm:true};}
Utils.from12Hour=function(hour,ampm)
{hour=parseInt(hour,10);if(hour==12&&!ampm)
return 0;else if(hour==12&&ampm)
return 12;else if(!ampm)
return hour;else
return hour+12;}
Utils.ordinal=function(num)
{if((num%100)==11||(num%100)==12||(num%100)==13)
return"th";if(num%10==1)
return"st";if(num%10==2)
return"nd";if(num%10==3)
return"rd";return"th";}
Utils.queryStringToAssoc=function(qs)
{if(qs.length==0)
return[];qs=qs.replace(/\+/g,' ')
var args=qs.split('&')
var pair;var name;var value;var qs_assoc=[];for(var i=0;i<args.length;i++)
{pair=args[i].split('=');name=unescape(pair[0]);if(pair.length==2)
value=unescape(pair[1]);else
value=''
if(name.match(/\[\]$/))
{name=name.replace(/\[\]$/,'');if(!qs_assoc[name])
qs_assoc[name]=[];qs_assoc[name][qs_assoc[name].length]=value;}
else
qs_assoc[name]=value;}
return qs_assoc;}
Utils.http_host=function()
{if(location.href.match(/^https?:\/\/([^\/]+)/))
{return RegExp.$1;}
return'';}
Utils.ssl=function()
{return location.href.match(/^https/);}
Utils.logmeout=function()
{location.href='/logout.php?inactivity_timeout=1';}
Utils.nl2br=function(str)
{return str.replace(/\r?\n/g,"<br>");}
Utils._dPrint=function(elem,out)
{var s='';for(var i in elem)
{if(typeof elem[i]=='function')
s+=i+" function\n";else
s+=i+" "+elem[i]+"\n";};if(out==null||out==true)
{alert(s);}
else
{return s;}}
Utils.aImgForRpcSignal=[];Utils.signal=function(URL)
{var randNum1=Math.floor(Math.random()*10000000);var modURL=URL+(URL.indexOf("?")>=0?"&":"?")+"rand="+randNum1;Utils.aImgForRpcSignal[Utils.aImgForRpcSignal.length]=new Image();Utils.aImgForRpcSignal[Utils.aImgForRpcSignal.length-1].src=modURL;}
Utils.click=function()
{}
Utils.clickyDelivered=0;Utils.clickyRegistered=0;Utils.clickySound=function(force)
{try{if(navigator.userAgent.toLowerCase().indexOf("msie")==-1)
return;if(document.readyState!='complete')
return;if(!Utils.clickyRegistered&&typeof(GDEvent)=='function')
{GDEvent.add('mousedown','Utils.clickyDelivered = 0;');GDEvent.add('keydown','Utils.clickyDelivered = 0;');Utils.clickyRegistered=1;}
if(Utils.clickyDelivered&&!force)
return;if(typeof(GDEvent)=='function')
Utils.clickyDelivered=1;clickyIFrame=Layer.get('iframe_clickyIFrame');if(!clickyIFrame)
{Layer.makeIframe('clickyIFrame',null,null);clickyIFrame=Layer.get('iframe_clickyIFrame');}
if(clickyIFrame)
{clickyIFrame.src='/blank.htm';}}catch(e){}}
Utils.getSelection=function()
{if(window.getSelection)
return window.getSelection();if(document.getSelection)
return document.getSelection();if(document.selection)
return document.selection.createRange().text;}
Utils.trim=function(str)
{return str.toString().replace(/^\s+/g,'').replace(/\s+$/g,'');}
Utils.clone=function(obj)
{var attr=null;var clone={};for(attr in obj)
{if(typeof attr=='object')
clone[attr]=Utils.clone(attr);else
clone[attr]=obj[attr];}
return clone;}
Utils.activateFlash=function()
{var objs=document.getElementsByTagName("object");for(var i=0;i<objs.length;i++)
if(objs[i].id!='newfeature')
objs[i].outerHTML=objs[i].outerHTML;}
Utils.numbersOnly=function(str)
{var retStr="";for(var i=0;i<str.length;i++)
if(str.charAt(i).match(/[0-9]/))
retStr+=str.charAt(i);return retStr;}
Function.prototype.inheritFrom=function(parent)
{if(parent.constructor==Function)
{this.prototype=new parent;this.prototype.constructor=this;this.prototype.parent=parent.prototype;}
else
{this.prototype=parent;this.prototype.constructor=this;this.prototype.parent=parent;}
return this;}
Utils.wordWrapper=function(inputString,wrapCharLength)
{if(!wrapCharLength||wrapCharLength==null)
wrapChars=80;var x=0;var charsSinceSpace=0;var outputString='';while(x<inputString.length)
{if(inputString.substr(x,1)==' ')
charsSinceSpace=0;else
charsSinceSpace++;if(charsSinceSpace>wrapCharLength)
{outputString=outputString+inputString.substr(x,1)+'<br/>';charsSinceSpace=0;}
else
{outputString=outputString+inputString.substr(x,1);}
x++;}
return outputString;}
Utils.truncator=function(inputString,stringLength)
{if(inputString.length<=stringLength)
return inputString;return inputString.substring(0,stringLength)+'...';}
Utils.ellipsifyFilename=function(inputString,wrapCharLength)
{if(!wrapCharLength||wrapCharLength==null)
wrapChars=25;if(inputString.length<wrapChars)
return inputString;var lastPart=inputString.substr(inputString.length-7,inputString.length);var firstPart=inputString.substr(0,wrapChars-10);outputString=firstPart+'...'+lastPart;return outputString;}
Utils._imageCache=[];Utils.imagePath=function(image,ver)
{if(Utils._imageCache[image])return Utils._imageCache[image];var val=0;for(var i=0;i<image.length;i++)
val+=image.charCodeAt(i);var server=Globals.IMAGE_SERVERS[val%Globals.IMAGE_SERVERS.length];var url=document.location.protocol+'//'+server+'/'+image;if(typeof ver=='undefined'||ver)
url+='?v='+Globals.IMAGE_VERSION;Utils._imageCache[image]=url;return url;}

if ( typeof(loaded) == 'undefined' ) var loaded = {};
loaded['/js.js?file=Utils&r=5.1.24&gzip=0'] = 1;
