var globalH=15;var adjHeight=globalH;function bob(dobj,h,force){var objDiv=document.getElementById(dobj);if(!force){var force=0}if((objDiv.style.display==='none'||objDiv.style.display==='')&&force!==1){objDiv.style.display='block';objDiv.style.overflow='hidden';objDiv.style.height=globalH+'px';intervalID=setInterval("fadeIt("+h+",'"+dobj+"')",8)}else{objDiv.style.display='none'}}function fadeIt(elmHeight,obj){var currentfr=document.getElementById(obj);currentfr.style.height=adjHeight+'px';if(adjHeight<elmHeight){adjHeight+=adjHeight/10}else{adjHeight=globalH;clearInterval(intervalID);}}
function insertAtCaret(areaId,text){var txtarea=document.getElementById(areaId);var scrollPos=txtarea.scrollTop;var strPos=0;var br=((txtarea.selectionStart||txtarea.selectionStart=='0')?"ff":(document.selection?"ie":false));if(br=="ie"){txtarea.focus();var range=document.selection.createRange();range.moveStart('character',-txtarea.value.length);strPos=range.text.length;}else if(br=="ff")strPos=txtarea.selectionStart;var front=(txtarea.value).substring(0,strPos);var back=(txtarea.value).substring(strPos,txtarea.value.length);txtarea.value=front+text+back;strPos=strPos+text.length;if(br=="ie"){txtarea.focus();var range=document.selection.createRange();range.moveStart('character',-txtarea.value.length);range.moveStart('character',strPos);range.moveEnd('character',0);range.select();}else if(br=="ff"){txtarea.selectionStart=strPos;txtarea.selectionEnd=strPos;txtarea.focus();}txtarea.scrollTop=scrollPos;}
function createAjaxObj(){var httprequest=false;if(window.XMLHttpRequest){httprequest=new XMLHttpRequest();if(httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml');}
else if(window.ActiveXObject){try{httprequest=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{httprequest=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}
return httprequest;}
var ajaxpack=new Object();ajaxpack.basedomain="http://"+window.location.hostname;ajaxpack.ajaxobj=createAjaxObj();ajaxpack.filetype="txt";ajaxpack.addrandomnumber=0;ajaxpack.getAjaxRequest=function(url,parameters,callbackfunc,filetype){ajaxpack.ajaxobj=createAjaxObj();if(ajaxpack.addrandomnumber==1)
var parameters=parameters+"&ajaxcachebust="+new Date().getTime();if(this.ajaxobj){this.filetype=filetype;this.ajaxobj.onreadystatechange=callbackfunc;this.ajaxobj.open('GET',url+"?"+parameters,true);this.ajaxobj.send(null);}}
function processGetPost(){var myajax=ajaxpack.ajaxobj;var myfiletype=ajaxpack.filetype;var postBut=document.getElementById('commentForm').postComment;if(myajax.readyState===1){postBut.value='Just a sec...';}
if(myajax.readyState===4){if(myajax.status===200){var msgDiv=document.getElementById('msgArea');switch(myajax.responseText){case'empty':msgDiv.innerHTML='<p class="error">Please fill in all fields.</p>';postBut.value='Post comment';break;case'invalid':msgDiv.innerHTML='<p class="error">Invalid site ID.</p>';postBut.value='Post comment';break;case'msglong':msgDiv.innerHTML='<p class="error">Please keep your message to 500 characters or less.</p>';postBut.value='Post comment';break;case'namelong':msgDiv.innerHTML='<p class="error">Please keep your name to 30 characters or less.</p>';postBut.value='Post comment';break;case'nopost':msgDiv.innerHTML='<p class="error">That user isn\'t accepting comments at the moment. Please try again soon!</p>';postBut.value='Post comment';break;case'1':msgDiv.innerHTML='<p class="success">Your comment has been posted. If this Moodsite owner has opted to approve comments, it might be a bit before your comment goes live.</p>';document.getElementById('commentForm').style.display='none';document.getElementById('emoticons').style.display='none';break;default:msgDiv.innerHTML='<p class="error">Sorry, there was an error creating your post. Please try again.</p>';postBut.value='Post comment';}}}}
function adjStuff(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
if(document.getElementById('topBar')&&document.getElementById('widgetHello')){var widgHello=document.getElementById('widgetHello');if(myWidth<1200){document.getElementById('topBar').style.marginBottom='105px';widgHello.src='/images/widget-hello2.png';widgHello.height='47';widgHello.width='98';widgHello.style.left='110px';widgHello.style.top='160px';}
else if(myWidth>1200){document.getElementById('topBar').style.marginBottom='0';widgHello.src='/images/widget-hello.png';widgHello.height='52';widgHello.width='85';widgHello.style.left='10px';widgHello.style.top='230px';}}}
function getCommentData(){var msg=document.getElementById("commentForm").msg.value;if(msg.length>500){document.getElementById('msgArea').innerHTML='<p class="error">Please keep your message to 500 characters or less.</p>';return false;}
else{var name=document.getElementById("commentForm").name.value;if(name.length>30){document.getElementById('msgArea').innerHTML='<p class="error">Please keep your name to 30 characters or less.</p>';return false;}
else{var siteId=document.getElementById("commentForm").id.value;var n2=document.getElementById("commentForm").noFill.value;var poststr="name="+encodeURI(name)+"&msg="+encodeURI(msg)+"&id="+encodeURI(siteId)+"&name2="+encodeURI(n2);return poststr;}}}
function goMoodEvent(func){if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){alreadyrunflag=true;eval(func);},false);}
else if(document.all&&!window.opera){document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>');var contentloadtag=document.getElementById("contentloadtag");contentloadtag.onreadystatechange=function(){if(this.readyState=="complete"){alreadyrunflag=true;eval(func);}}}
window.onload=function(){setTimeout("if(alreadyrunflag===false){"+func+"}",0)}}
function loginDisplay(){if(document.getElementById('dispLogin')){document.getElementById('dispLogin').onclick=function(){bob('login',25);return false;};}
if(document.getElementById('emoticons')){var emotis=document.getElementById('emoticons').getElementsByTagName('img');for(c=0;c<emotis.length;c++){emotis[c].onclick=function(){insertAtCaret('msg',' :'+this.alt+': ');return(false);};}
var commentButton=document.getElementById('postComment');commentButton.onclick=function(){var commentData=getCommentData();if(commentData){ajaxpack.getAjaxRequest('/postComment.php',commentData,processGetPost,'txt');}};}
adjStuff();}
goMoodEvent('loginDisplay()');window.onresize=function(){adjStuff();};
