
function getBrowserSize(){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;}return{x:myWidth,y:myHeight};}function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}return{x:scrOfX,y:scrOfY};}function setStyleByClass(t,c,p,v){var ie=(document.all)?true:false;var elements;if(t=='*'){elements=(ie)?document.all:document.getElementsByTagName('*');}else{elements=document.getElementsByTagName(t);}for(var i=0;i<elements.length;i++){var node=elements.item(i);for(var j=0;j<node.attributes.length;j++){if(node.attributes.item(j).nodeName=='class'){if(node.attributes.item(j).nodeValue==c){eval('node.style.'+p+" = '"+v+"'");}}}}}function getPageScroll(){var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;}arrayPageScroll=['',yScroll];return arrayPageScroll;}function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}arrayPageSize=[pageWidth,pageHeight,windowWidth,windowHeight];return arrayPageSize;}function getElementsByClassName(classname){if(document.getElementsByTagName){var els=document.getElementsByTagName("*");var c=new RegExp('/b^|'+classname+'|$/b');finale=new Array();var n=0;for(var i=0;i<els.length;i++){if(els[i].className){if(c.test(els[i].className)){finale[n]=els[i];n++;}}}return finale;}return false;}function checkKeycode(e){var askform=document.getElementById('askform');var keycode;if(window.event){keycode=window.event.keyCode;}else if(e){keycode=e.which;}if(keycode==13){document.askform.submit();}else{keychar=String.fromCharCode(keycode);return keychar;}}function check_submit(elementid,msg){var textarea=document.getElementById(elementid);if(!textarea.value||textarea.value=='<br>'){alert(msg);textarea.focus();return false;}else{return true;}}function toggleCommentModerator(divid){div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='commentvisible'?'commenthidden':'commentvisible';if(curclass=='commentvisible'){var els=getElementsByClassName('commentvisible');if(els){for(el in els){el=els[el];el.className='commenthidden';}}}div.className=curclass;}}function addEvent(obj,type,fn){if(obj.attachEvent){obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event);};obj.attachEvent('on'+type,obj[type+fn]);}else{obj.addEventListener(type,fn,false);}}function poprequest(url){var newwindow;newwindow=window.open(url,'name','height=500,width=300,left=40,top=40,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');if(window.focus){newwindow.focus();}}function getXmlHttpRequestObject(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){var XmlHttpVersions=["MSXML2.XMLHTTP.7.0","MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(var i=0;i<XmlHttpVersions.length&&!xmlHttp;i++){try{xmlHttp=new ActiveXObject(XmlHttpVersions[i]);}catch(e){}}}if(!xmlHttp){alert("Error creating the XMLHttpRequest object.");}else{return xmlHttp;}}var xmlhttp=getXmlHttpRequestObject();function load(id,url,post){msgdiv=document.getElementById(id);if(msgdiv){msgdiv.innerHTML='Loading...';}var method=post?'POST':'GET';xmlhttp.open(method,url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){var statustxt='';if(xmlhttp.status==200){statustxt=xmlhttp.responseText;}else if(xmlhttp.status==500){}else{}if(msgdiv){msgdiv.innerHTML=statustxt;if(match=/<script[^>]*>(.*)<\/script>/gi.exec(statustxt)){eval(match[1]);}}}};if(post){xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");xmlhttp.send(post);}else{xmlhttp.send(null);}}function load_textarea(id,url,post){msgdiv=document.getElementById(id);if(msgdiv){}if(document.all){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}else{xmlhttp=new XMLHttpRequest();}xmlhttps.push(xmlhttp);var method=post?'POST':'GET';xmlhttp.open(method,url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){var statustxt='';if(xmlhttp.status==200){statustxt=xmlhttp.responseText;}else if(xmlhttp.status==500){}else{}if(msgdiv){msgdiv.value=statustxt;if(match=/<script[^>]*>(.*)<\/script>/gi.exec(statustxt)){eval(match[1]);}}}};if(post){xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");xmlhttp.send(post);}else{xmlhttp.send(null);}}function winClose(){if(self.opener){self.opener.window.focus();}window.close();}function moveOn(){if(self.opener){self.setTimeout('winClose()',5000);}}function loginregistersubmit(form,str){if(str=='login'){form.action='/login.php';}else{form.action='/register.php';}form.submit();}function toggleAnswer(atag,divid,textid,msg1,msg2){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='answervisible'?'answerhidden':'answervisible';if(curclass=='answervisible'){var els=getElementsByClassName('answervisible');if(els){for(el in els){el=els[el];el.className='answerhidden';}}div.className=curclass;texta.focus();oTop=div.offsetTop;bSize=getBrowserSize();sPos=getScrollXY();oPos=oTop-sPos.y;if(bSize.y-oPos<266){window.scrollTo(0,oTop-200);}}else{texta.value='';div.className=curclass;}}}function toggleQuestionEditor(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editqvisible'?'editqhidden':'editqvisible';if(curclass=='editqvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleQuestionEditor2(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editq2visible'?'editq2hidden':'editq2visible';if(curclass=='editq2visible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleAnswerEditor(atag,divid,textid,msg1,msg2){if(atag){atxt=atag.innerHTML;atag.innerHTML=atxt==msg1?msg2:msg1;}div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editavisible'?'editahidden':'editavisible';if(curclass=='editavisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleCommentEditor(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editcvisible'?'editchidden':'editcvisible';if(curclass=='editcvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleSubjectEditor(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editqvisible'?'editqhidden':'editqvisible';if(curclass=='editqvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleResponseEditor(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editqvisible'?'editqhidden':'editqvisible';if(curclass=='editqvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleRichTextEditor(divid,richtexteditordiv,script,width,height,resource_type,resource_id,page,uploaderdiv,editing_text){var xmlhttp=getXmlHttpRequestObject();var div=document.getElementById(divid);richtexteditordiv=document.getElementById(richtexteditordiv);if(div){curclass=div.className;curclass=curclass=='editvisible'?'edithidden':'editvisible';if(curclass=='editvisible'&&richtexteditordiv){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/res/richtexteditor_ajax.php?script='+script+'&width='+width+'&height='+height+'&resource_type='+resource_type+'&resource_id='+resource_id+'&page='+page+'&uploaderdiv='+uploaderdiv+'&editing_text='+escape(editing_text),true);richtexteditordiv.innerHTML='<span style=\"color:#ffffff\">Loading...</span>';xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){richtexteditordiv.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}div.className=curclass;}}function toggleRichTextEditorFF(divid){var div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='editvisible'?'edithidden':'editvisible';div.className=curclass;}}function toggleSectionEditor(divid,textid){div=document.getElementById(divid);texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='editsectionvisible'?'editsectionhidden':'editsectionvisible';if(curclass=='editsectionvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleSearchIntLink(divid,query,ignore,listid,contentid){var xmlhttp=getXmlHttpRequestObject();var div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='searchlinkvisible'?'searchlinkhidden':'searchlinkvisible';if(curclass=='searchlinkvisible'){div.className=curclass;if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listsearchqs.php?query='+query+'&ignore='+ignore,true);var related=document.getElementById(listid);related.innerHTML='<span style=\"color:#ffffff\">Loading...</span>';xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){related.innerHTML='';var str=xmlhttp.responseText.split("¡");for(i=0;i<str.length-1;i++){var substr=str[i].split("±");var relatedqs='<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-bottom: 10px;\">';relatedqs+='<tr><td width=\"130\" style="color:#ffffff">';relatedqs+='<input type=\"radio\" id=\"radioq'+contentid+'\" name=\"radioq'+contentid+'\" value=\"'+substr[0]+'\"> '+substr[0]+'</td>';relatedqs+='<td><textarea id=\"text'+substr[0]+'\" name=\"text'+substr[0]+'\" style=\"width:220px;height:35px;\">'+substr[1]+'</textarea></td>';relatedqs+='</tr>';relatedqs+='</table>';related.innerHTML+=relatedqs;}}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}else{div.className=curclass;}}}function toggleIntLink(divid){div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='intlinkvisible'?'intlinkhidden':'intlinkvisible';if(curclass=='intlinkvisible'){div.className=curclass;}else{div.className=curclass;}}}function toggleIntLink2(divid){div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='intlink2visible'?'intlink2hidden':'intlink2visible';if(curclass=='intlink2visible'){div.className=curclass;}else{div.className=curclass;}}}function toggleExtLink(divid,textid){var div=document.getElementById(divid);var texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='extlinkvisible'?'extlinkhidden':'extlinkvisible';if(curclass=='extlinkvisible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleExtLink2(divid,textid){var div=document.getElementById(divid);var texta=document.getElementById(textid);if(div){curclass=div.className;curclass=curclass=='extlink2visible'?'extlink2hidden':'extlink2visible';if(curclass=='extlink2visible'){div.className=curclass;texta.focus();}else{div.className=curclass;}}}function toggleVideoLink(divid){var div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='extlinkvisible'?'extlinkhidden':'extlinkvisible';if(curclass=='extlinkvisible'){div.className=curclass;}else{div.className=curclass;}}}function showOverlay(){var objBody=document.getElementsByTagName("body").item(0);var objOverlay=document.createElement("div");objOverlay.setAttribute('id','overlay');objOverlay.style.display='none';objOverlay.style.position='absolute';objOverlay.style.top='0';objOverlay.style.left='0';objOverlay.style.zIndex='90';objOverlay.style.width='100%';objBody.insertBefore(objOverlay,objBody.firstChild);var objOverlay=document.getElementById('overlay');var arrayPageSize=getPageSize();var arrayPageScroll=getPageScroll();objOverlay.style.height=(arrayPageSize[1]+'px');objOverlay.style.display='block';}function hideOverlay(){var objOverlay=document.getElementById('overlay');objOverlay.style.display='none';}function toggleAvatarUploader(uploaderdivid,iframedivid,newuploader){var udiv=document.getElementById(uploaderdivid);var idiv=document.getElementById(iframedivid);if(udiv){ucurclass=udiv.className;ucurclass=ucurclass=='qa_imageuploadervisible'?'qa_imageuploaderhidden':'qa_imageuploadervisible';udiv.className=ucurclass;if(idiv){var iframewidth=640;var iframeheight=480;icurclass=idiv.className;icurclass=icurclass=='qa_loadervisible'?'qa_loaderhidden':'qa_loadervisible';idiv.className=icurclass;}}}function toggleImageUploader(uploaderdivid,iframedivid){var udiv=document.getElementById(uploaderdivid);var idiv=document.getElementById(iframedivid);if(udiv){ucurclass=udiv.className;ucurclass=ucurclass=='imageuploadervisible'?'imageuploaderhidden':'imageuploadervisible';if(ucurclass=='imageuploadervisible'){oTop=udiv.offsetTop;bSize=getBrowserSize();sPos=getScrollXY();oPos=oTop-sPos.y;if(bSize.y-oPos<300){window.scrollTo(0,oTop-300);}}udiv.className=ucurclass;if(idiv){icurclass=idiv.className;icurclass=icurclass=='loadervisible'?'loaderhidden':'loadervisible';idiv.className=icurclass;}}}function toggleQAImageUploader(uploaderdivid,iframedivid,newuploader){var udiv=document.getElementById(uploaderdivid);var idiv=document.getElementById(iframedivid);if(udiv){ucurclass=udiv.className;ucurclass=ucurclass=='qa_imageuploadervisible'?'qa_imageuploaderhidden':'qa_imageuploadervisible';udiv.className=ucurclass;if(idiv){var iframewidth=640;var iframeheight=480;icurclass=idiv.className;icurclass=icurclass=='qa_loadervisible'?'qa_loaderhidden':'qa_loadervisible';idiv.className=icurclass;}}}function toggleQAImageUploader2(uploaderdivid,iframedivid,newuploader){var udiv=document.getElementById(uploaderdivid);var idiv=document.getElementById(iframedivid);if(udiv){ucurclass=udiv.className;ucurclass=ucurclass=='qa_imageuploadervisible2'?'qa_imageuploaderhidden2':'qa_imageuploadervisible2';udiv.className=ucurclass;if(idiv){icurclass=idiv.className;icurclass=icurclass=='qa_loadervisible'?'qa_loaderhidden':'qa_loadervisible';idiv.className=icurclass;}}}function toggleFileUploader(divid){div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='imageuploadervisible'?'imageuploaderhidden':'imageuploadervisible';if(curclass=='imageuploadervisible'){div.className=curclass;}else{div.className=curclass;}}}function toggleSearch(divid){div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='intlinkvisible'?'intlinkhidden':'intlinkvisible';if(curclass=='intlinkvisible'){div.className=curclass;}else{div.className=curclass;}}}function toggleSearchQuestions(divid,query,ignore,listid,contentid){var xmlhttp=getXmlHttpRequestObject();var div=document.getElementById(divid);url='/modules/listsearchquestions.php?query='+query+'&ignore='+ignore;if(div){curclass=div.className;curclass=curclass=='searchlinkvisible'?'searchlinkhidden':'searchlinkvisible';if(curclass=='searchlinkvisible'){div.className=curclass;if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listsearchquestions.php?query='+query+'&ignore='+ignore,true);var related=document.getElementById(listid);related.innerHTML='<span style=\"color:#ffffff\">Loading...</span>';xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){related.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}else{div.className=curclass;}}}function toggleSearchDebatesOrGroups(divid,type,query,listid){var xmlhttp=getXmlHttpRequestObject();var div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='searchlinkvisible'?'searchlinkhidden':'searchlinkvisible';if(curclass=='searchlinkvisible'){div.className=curclass;if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listsearchdebatesorgroups.php?type='+type+'&query='+query,true);var listd=document.getElementById(listid);listd.innerHTML='<span style=\"color:#ffffff\">Loading...</span>';xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}else{div.className=curclass;}}}function toggleAjaxAllGroups(listid,display_by,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listallgroups.php?display_by='+display_by+'&page='+page,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function toggleAjaxAllThreads(listid,grouppage,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listgroupthreads.php?grouppage='+grouppage+'&p='+page,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function toggleAjaxNewDebates(listid,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listnewdebates.php?page='+page,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function toggleAjaxSearchedDebates(listid,zone_id,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listsearcheddebates.php?page='+page+'&zone_id='+zone_id,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function toggleAjaxSearchedGroups(listid,zone_id,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listsearchedgroups.php?page='+page+'&zone_id='+zone_id,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function toggleAjaxAllDebates(listid,display_by,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listalldebates.php?display_by='+display_by+'&page='+page,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function makeItMyFavourite(div_id,type,resource,action){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listmyfavdebatesorgroups.php?type='+type+'&resource='+resource+'&action='+action,true);var div_id=document.getElementById(div_id);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){div_id.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function makeItRelatedGroup(div_id,grouppage,resource,action){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listrelatedgroups.php?grouppage='+grouppage+'&resource='+resource+'&action='+action,true);var div_id=document.getElementById(div_id);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){div_id.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function selectText(textid){var ie=(document.all)?true:false;var texta=document.getElementById(textid);if(!texta){return false;}txtstr=new String(texta.value);if(ie){if(document.selection){var range=document.selection.createRange();var stored_range=range.duplicate();stored_range.moveToElementText(texta);stored_range.setEndPoint('EndToEnd',range);texta.selectionStart=stored_range.text.length-range.text.length;texta.selectionEnd=texta.selectionStart+range.text.length;}else{return;}}else{if(!(txtstr&&texta.selectionEnd)){return;}}txtstr=txtstr.substring(texta.selectionStart,texta.selectionEnd);return txtstr;}function toggleExtLinkForComment(divid){var div=document.getElementById(divid);if(div){curclass=div.className;curclass=curclass=='commentextlinkvisible'?'extlinkhidden':'commentextlinkvisible';if(curclass=='commentextlinkvisible'){div.className=curclass;}else{div.className=curclass;}}}function toggleShare(iframedivid,resource_type,resource_id){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();var idiv=document.getElementById(iframedivid);if(idiv){var iframeheight=490;var iframewidth=500;icurclass=idiv.className;icurclass=icurclass=='sharevisible'?'sharehidden':'sharevisible';if(icurclass=='sharevisible'){idiv.src='/share_it1.php?resource_id='+resource_id+'&resource_type='+resource_type;idiv.style.top=(arrayPageScroll[1]+((arrayPageSize[3]-200-iframeheight)/2)+'px');idiv.style.left=(((arrayPageSize[0]-200-iframewidth)/2)+'px');idiv.style.display='block';idiv.className=icurclass;}else{idiv.className=icurclass;}}}function loading(){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();if($('img.loading_img').is(':hidden')){var divheight=22;var divwidth=126;div_top=(arrayPageScroll[1]+((arrayPageSize[3]-300-divheight)/2)+'px');$('img.loading_img').css('top',div_top);div_left=(((arrayPageSize[0]-200-divwidth)/2)+'px');$('img.loading_img').css('left',div_left);$('img.loading_img').css('display','block');$('img.loading_img').show();}else{$('img.loading_img').hide();}}function cat_pop_up(data){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();if($('div.cat_pop_up').is(':hidden')){var divheight=300;var divwidth=850;$('div.cat_pop_up .content').html(data);div_top=(arrayPageScroll[1]+((arrayPageSize[3]-300-divheight)/2)+'px');$('div.cat_pop_up').css('top',div_top);div_left=(((arrayPageSize[0]-225-divwidth)/2)+'px');$('div.cat_pop_up').css('left',div_left);$('div.cat_pop_up').css('display','block');$('img.loading_img').hide();$('div.cat_pop_up').fadeIn(1000);}else{$('div.cat_pop_up').fadeOut(1000);}}function list_pop_up(data){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();if($('div.list_pop_up').is(':hidden')){var divheight=300;var divwidth=500;$('div.list_pop_up').html(data);div_top=(arrayPageScroll[1]+((arrayPageSize[3]-300-divheight)/2)+'px');$('div.list_pop_up').css('top',div_top);div_left=(((arrayPageSize[0]-500-divwidth)/2)+'px');$('div.list_pop_up').css('left',div_left);$('div.list_pop_up').css('display','block');$('img.loading_img').hide();$('div.list_pop_up').fadeIn(1000);}else{$('div.list_pop_up').fadeOut(1000);}}function error_pop_up(data){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();if($('div#error_pop_up').is(':hidden')){var divheight=200;var divwidth=350;if(data){$('div.cat_pop_up .content').html(data);}div_top=(arrayPageScroll[1]+((arrayPageSize[3]-300-divheight)/2)+'px');$('div#error_pop_up').css('top',div_top);div_left=(((arrayPageSize[0]-225-divwidth)/2)+'px');$('div#error_pop_up').css('left',div_left);$('div#error_pop_up').css('display','block');$('img.loading_img').hide();$('div#error_pop_up').fadeIn(1000);}else{$('div.pop_up').fadeOut(1000);}}function pop_up(data,head_title){arrayPageScroll=getPageScroll();arrayPageSize=getPageSize();if($('div.pop_up').is(':hidden')){var divheight=200;var divwidth=350;$('td.pop_up_content').html(data);if(head_title){$('div#pop_up div.head').html(head_title);}div_top=(arrayPageScroll[1]+((arrayPageSize[3]-300-divheight)/2)+'px');$('div.pop_up').css('top',div_top);div_left=(((arrayPageSize[0]-200-divwidth)/2)+'px');$('div.pop_up').css('left',div_left);$('div.pop_up').css('display','block');$('img.loading_img').hide();$('div.pop_up').fadeIn(1000);}else{$('div.pop_up').fadeOut(1000);}}function setAdCode(divid,adcode){divid=document.getElementById(divid);divid.innerHTML=adcode;return true;}function toggleAjaxMyShouts(username,listid,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){xmlhttp.open('GET','/modules/listmyshouts.php?username='+username+'&page='+page,true);var listd=document.getElementById(listid);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){listd.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function actionOnQuestion(div_id,type,resource_id,action,page){if(xmlhttp.readyState==4||xmlhttp.readyState==0){alert(div_id+' '+type+' '+resource_id+' '+action+' '+page);xmlhttp.open('GET','/modules/'+type+'.php?resource_id='+resource_id+'&action='+action+'page'+page,true);div_id=document.getElementById(div_id);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){div_id.innerHTML=xmlhttp.responseText;}else{alert("Problem retrieving XML data:"+xmlhttp.statusText);}}};xmlhttp.send(null);}}function changeTo(resource,tadivid,divid,aid,regex,misspell,suggested){var text=document.getElementById(tadivid).innerHTML;var textarea=$('textarea#'+resource).attr('value');if(misspell!=suggested){if(text.match(regex)){document.getElementById(tadivid).innerHTML=text.replace(regex,suggested);document.getElementById(resource).value=textarea.replace(regex,suggested);$('#'+aid).attr("class","suggested");}}else{if(text.match(regex)){document.getElementById(tadivid).innerHTML=text.replace(regex,suggested);document.getElementById(resource).value=textarea.replace(regex,suggested);$('#'+aid).attr("class","");}}}function spellSuggestion(resource,tadivid,divid,aid,misspell){var div=document.getElementById(divid);var changed_spell=document.getElementById(aid).innerHTML;if(div){curclass=div.className;curclass=curclass=='spellsuggestion_visible'?'spellsuggestion_hidden':'spellsuggestion_visible';if(curclass=='spellsuggestion_visible'){div.className=curclass;div.innerHTML='<span style=\"color:#blue\">Loading...</span>';$('#'+divid).load('/modules/listspellingsuggestions.php',{resource:resource,tadivid:tadivid,divid:divid,aid:aid,misspell:misspell,changed_spell:changed_spell});}else{div.className=curclass;}}}function changeTo_RTE(resource,tadivid,divid,aid,regex,misspell,suggested,rteid){var text=document.getElementById(tadivid).innerHTML;if(document.all){var textarea=$('div#'+rteid).html();}else{var textarea=$('iframe#'+rteid).contents().find('body').html();}if(misspell!=suggested){if(text.match(regex)){document.getElementById(tadivid).innerHTML=text.replace(regex,suggested);if(document.all){document.getElementById(rteid).innerHTML=textarea.replace(regex,suggested);}else{document.getElementById(rteid).contentWindow.document.body.innerHTML=textarea.replace(regex,suggested);}$('#'+aid).attr("class","suggested");}}else{if(text.match(regex)){document.getElementById(tadivid).innerHTML=text.replace(regex,suggested);if(document.all){document.getElementById(rteid).innerHTML=textarea.replace(regex,suggested);}else{document.getElementById(rteid).contentWindow.document.body.innerHTML=textarea.replace(regex,suggested);}$('#'+aid).attr("class","");}}}function spellSuggestion_RTE(resource,tadivid,divid,aid,misspell,rteid){var div=document.getElementById(divid);var changed_spell=document.getElementById(aid).innerHTML;if(div){curclass=div.className;curclass=curclass=='spellsuggestion_visible'?'spellsuggestion_hidden':'spellsuggestion_visible';if(curclass=='spellsuggestion_visible'){div.className=curclass;div.innerHTML='<span style=\"color:#blue\">Loading...</span>';$('#'+divid).load('/modules/listspellingsuggestions_rte.php',{resource:resource,tadivid:tadivid,divid:divid,aid:aid,misspell:misspell,changed_spell:changed_spell,rteid:rteid});}else{div.className=curclass;}}}function hideSpellingSuggestions(divid){var div=document.getElementById(divid);if(div){div.className='spellsuggestion_hidden';}}function hideAllSpellingSuggestions(tadivid){var text=document.getElementById(tadivid).innerHTML;var regex=/spellsuggestion_visible/g;if(text.match(/spellsuggestion_visible/g)){document.getElementById(tadivid).innerHTML=text.replace(regex,"spellsuggestion_hidden ");}}function character_count(textarea,displayobj,max_count){var textarea_value=textarea.value;max_count=max_count?max_count:500;var character_count=(max_count-textarea_value.length);var character_or_characters="";if(character_count==1){character_or_characters="character";}else{character_or_characters="characters";}if(character_count<0){character_count=0;}if(textarea.value.length>max_count){textarea.value=textarea.value.substring(0,max_count);}displayobj.innerHTML=character_count+character_or_characters+' left';}var badRatingReq=getXmlHttpRequestObject();function toggleResourceUser(divid,remote_user,resource_user,datefrom,dateto,goodorbad,action){div=document.getElementById(divid);if(div){div.className=div.className=='resource_users_visible'?'resource_users_hidden':'resource_users_visible';if(action){div.className='resource_users_visible';}if(div.className=='resource_users_visible'){if(badRatingReq.readyState==4||badRatingReq.readyState==0){badRatingReq.open('GET','/modules/listbadratingsgroupbyuser.php?_inline=1&remote_user='+remote_user+'&resource_user='+resource_user+'&datefrom='+datefrom+'&dateto='+dateto+'&goodorbad='+goodorbad+'&action='+action,true);badRatingReq.onreadystatechange=function(){if(badRatingReq.readyState==4){div.innerHTML='';if(badRatingReq.status==200){div.innerHTML=badRatingReq.responseText;}else{alert("Problem retrieving XML data:"+badRatingReq.statusText);}}};badRatingReq.send(null);}}}}var clientPC=navigator.userAgent.toLowerCase();var is_gecko=((clientPC.indexOf('gecko')!=-1)&&(clientPC.indexOf('spoofer')==-1)&&(clientPC.indexOf('khtml')==-1)&&(clientPC.indexOf('netscape/7.0')==-1));var is_safari=((clientPC.indexOf('applewebkit')!=-1)&&(clientPC.indexOf('spoofer')==-1));var is_khtml=(navigator.vendor=='KDE'||(document.childNodes&&!document.all&&!navigator.taintEnabled));var is_ff2_win=(clientPC.indexOf('firefox/2')!=-1||clientPC.indexOf('minefield/3')!=-1)&&clientPC.indexOf('windows')!=-1;var is_ff2_x11=(clientPC.indexOf('firefox/2')!=-1||clientPC.indexOf('minefield/3')!=-1)&&clientPC.indexOf('x11')!=-1;if(clientPC.indexOf('opera')!=-1){var is_opera=true;var is_opera_preseven=(window.opera&&!document.childNodes);var is_opera_seven=(window.opera&&document.childNodes);}function insertTags(txtareaid,tagOpen,tagClose,sampleText){var txtarea=document.getElementById(txtareaid);if(!txtarea){return false;}if(!document.selection&&txtarea.selectionStart===null){return false;}if(document.selection&&!is_gecko){var theSelection=document.selection.createRange().text;if(!theSelection){theSelection=sampleText;}txtarea.focus();if(theSelection.charAt(theSelection.length-1)==" "){theSelection=theSelection.substring(0,theSelection.length-1);document.selection.createRange().text=tagOpen+theSelection+tagClose+" ";}else{document.selection.createRange().text=tagOpen+theSelection+tagClose;}}else if(txtarea.selectionStart||txtarea.selectionStart=='0'){var replaced=false;var startPos=txtarea.selectionStart;var endPos=txtarea.selectionEnd;if(endPos-startPos){replaced=true;}var scrollTop=txtarea.scrollTop;var myText=(txtarea.value).substring(startPos,endPos);if(!myText){myText=sampleText;}var subst;if(myText.charAt(myText.length-1)==" "){subst=tagOpen+myText.substring(0,(myText.length-1))+tagClose+" ";}else{subst=tagOpen+myText+tagClose;}txtarea.value=txtarea.value.substring(0,startPos)+subst+txtarea.value.substring(endPos,txtarea.value.length);txtarea.focus();if(replaced){var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);txtarea.selectionStart=cPos;txtarea.selectionEnd=cPos;}else{txtarea.selectionStart=startPos+tagOpen.length;txtarea.selectionEnd=startPos+tagOpen.length+myText.length;}txtarea.scrollTop=scrollTop;}if(txtarea.createTextRange){txtarea.caretPos=document.selection.createRange().duplicate();}}function insertTagsForExternalLink(txtareaid,tagOpen,tagClose,sampleText){var txtarea=document.getElementById(txtareaid);if(!txtarea){return false;}if(!document.selection&&txtarea.selectionStart===null){return false;}if(document.selection&&!is_gecko){var theSelection=document.selection.createRange().text;if(!theSelection){theSelection=sampleText;}txtarea.focus();if(theSelection.charAt(theSelection.length-1)==" "){theSelection=sampleText.substring(0,sampleText.length-1);document.selection.createRange().text=tagOpen+theSelection+tagClose+" ";}else{document.selection.createRange().text=tagOpen+sampleText+tagClose;}}else if(txtarea.selectionStart||txtarea.selectionStart=='0'){var replaced=false;var startPos=txtarea.selectionStart;var endPos=txtarea.selectionEnd;if(endPos-startPos){replaced=true;}var scrollTop=txtarea.scrollTop;var myText=(txtarea.value).substring(startPos,endPos);if(!myText){myText=sampleText;}var subst;if(myText.charAt(myText.length-1)==" "){subst=tagOpen+sampleText.substring(0,(sampleText.length-1))+tagClose+" ";}else{subst=tagOpen+sampleText+tagClose;}txtarea.value=txtarea.value.substring(0,startPos)+subst+txtarea.value.substring(endPos,txtarea.value.length);txtarea.focus();if(replaced){var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);txtarea.selectionStart=cPos;txtarea.selectionEnd=cPos;}else{txtarea.selectionStart=startPos+tagOpen.length;txtarea.selectionEnd=startPos+tagOpen.length+myText.length;}txtarea.scrollTop=scrollTop;}if(txtarea.createTextRange){txtarea.caretPos=document.selection.createRange().duplicate();}}function setText(textid,linknameid){var ie=(document.all)?true:false;var texta=document.getElementById(textid);var linkname=document.getElementById(linknameid);if(!texta){return false;}txtstr=new String(texta.value);if(ie){if(document.selection){var range=document.selection.createRange();var stored_range=range.duplicate();stored_range.moveToElementText(texta);stored_range.setEndPoint('EndToEnd',range);texta.selectionStart=stored_range.text.length-range.text.length;texta.selectionEnd=texta.selectionStart+range.text.length;}else{return;}}else{if(!(txtstr&&texta.selectionEnd)){return;}}txtstr=txtstr.substring(texta.selectionStart,texta.selectionEnd);linkname.value=txtstr;return true;}function setCaretPosition(elemId,caretPos){var elem=document.getElementById(elemId);if(elem!=null){var range=elem.createTextRange();range.move('character',caretPos);range.select();}}function wordcount(textobj,displayobj){var fullStr=textobj.value+" ";var initial_whitespace_rExp=/^[^A-Za-z0-9]+/gi;var left_trimmedStr=fullStr.replace(initial_whitespace_rExp,"");var non_alphanumerics_rExp=/[^A-Za-z0-9]+/gi;var cleanedStr=left_trimmedStr.replace(non_alphanumerics_rExp," ");var splitString=cleanedStr.split(" ");var word_count=splitString.length-1;if(fullStr.length<2){word_count=0;}if(word_count==1){wordOrWords=' word';}else{wordOrWords=' words';}displayobj.innerHTML=word_count+wordOrWords;}function commentwordcount(textobj,displayobj){var fullStr=textobj.value+" ";var initial_whitespace_rExp=/^[^A-Za-z0-9]+/gi;var left_trimmedStr=fullStr.replace(initial_whitespace_rExp,"");var non_alphanumerics_rExp=/[^A-Za-z0-9]+/gi;var cleanedStr=left_trimmedStr.replace(non_alphanumerics_rExp," ");var splitString=cleanedStr.split(" ");var word_count=splitString.length-1;if(fullStr.length<2){word_count=0;}if(1000-word_count==1){wordOrWords=' word';}else{wordOrWords=' words';}if(1000-word_count<0){alert('You have reached max words!');}displayobj.innerHTML=(1000-word_count)+wordOrWords+' left';}function countwords(textobj){var fullStr=textobj.value+" ";var initial_whitespace_rExp=/^[^A-Za-z0-9]+/gi;var left_trimmedStr=fullStr.replace(initial_whitespace_rExp,"");var non_alphanumerics_rExp=/[^A-Za-z0-9]+/gi;var cleanedStr=left_trimmedStr.replace(non_alphanumerics_rExp," ");var splitString=cleanedStr.split(" ");var word_count=splitString.length-1;if(fullStr.length<2){word_count=0;}if(word_count==1){wordOrWords=' word';}else{wordOrWords=' words';}return word_count;}var clientPC=navigator.userAgent.toLowerCase();var is_gecko=((clientPC.indexOf('gecko')!=-1)&&(clientPC.indexOf('spoofer')==-1)&&(clientPC.indexOf('khtml')==-1)&&(clientPC.indexOf('netscape/7.0')==-1));var is_safari=((clientPC.indexOf('applewebkit')!=-1)&&(clientPC.indexOf('spoofer')==-1));var is_khtml=(navigator.vendor=='KDE'||(document.childNodes&&!document.all&&!navigator.taintEnabled));var is_ff2_win=(clientPC.indexOf('firefox/2')!=-1||clientPC.indexOf('minefield/3')!=-1)&&clientPC.indexOf('windows')!=-1;var is_ff2_x11=(clientPC.indexOf('firefox/2')!=-1||clientPC.indexOf('minefield/3')!=-1)&&clientPC.indexOf('x11')!=-1;if(clientPC.indexOf('opera')!=-1){var is_opera=true;var is_opera_preseven=(window.opera&&!document.childNodes);var is_opera_seven=(window.opera&&document.childNodes);}function setTextareaValue(editorid,textareaid){var textarea=document.getElementById(textareaid);if(document.all){var val=document.getElementById(editorid).innerHTML;}else{var val=document.getElementById(editorid).contentWindow.document.body.innerHTML;}textarea.value=val;return true;}function getTextareaValue(textareaid){var textarea=document.getElementById(textareaid);return textarea.value;}function insertImage(editorid,imagePath){if((imagePath!=null)&&(imagePath!="")){if(document.all){document.getElementById(editorid).innerHTML+='<img src=\"'+imagePath+'\">';}else{document.getElementById(editorid).contentWindow.document.execCommand('insertimage',false,imagePath);}}}function insertImage2(editorid,imagePath,position,caption){if((imagePath!=null)&&(imagePath!="")){if(document.all){document.getElementById(editorid).focus();document.execCommand('insertimage',false,imagePath);}else{document.getElementById(editorid).contentWindow.document.execCommand('insertimage',false,imagePath);}}}function insertImageWithStyle(editorid,imagePath,position,caption){if(imagePath!=null&&imagePath!=""){var captionpart=caption?caption:'';var imgTag;if(document.all){var text=document.getElementById(editorid).innerHTML;if(position=='float'){imgTag='<img src="'+imagePath+'" class="floatimage" title="'+captionpart+'"/>';}else{imgTag='<img src="'+imagePath+'" class="image" title="'+captionpart+'"/>';}if(text.match(/~~/)){document.getElementById(editorid).innerHTML=text.replace(/~~/,imgTag);}}else{document.getElementById(editorid).contentWindow.document.execCommand('insertimage',false,imagePath);var text=document.getElementById(editorid).contentWindow.document.body.innerHTML;var re=new RegExp(imagePath);if(position=='float'){var regex=new RegExp(imagePath,"g");imgTag=imagePath+"\""+" class=\"floatimage\" title=\""+captionpart;document.getElementById(editorid).contentWindow.document.body.innerHTML=text.replace(regex,imgTag);}else{var regex=new RegExp(imagePath,"g");imgTag=imagePath+"\""+" class=\"image\" title=\""+captionpart;document.getElementById(editorid).contentWindow.document.body.innerHTML=text.replace(regex,imgTag);}}}}function insertImageAndThumb(editorid,imagePath,thumbPath,position,caption){if(imagePath!==null&&imagePath!=""&&thumbPath!==null&&thumbPath!=""){if(document.all){if(position=='float'){document.getElementById(editorid).innerHTML+='<div class="answerImageFloat" style="padding:0 5px 5px 0;margin:0 5px 0 0;float:left;border:1px solid #333;"><img src="'+imagePath+'" /><p>'+caption+'</p></div><br />';}else{document.getElementById(editorid).innerHTML+='<div class="answerImage" style="padding:0 5px 5px 0;margin:0 5px 0 0;border:1px solid #333;"><img src="'+imagePath+'" /><p>'+caption+'</p></div><br />';}}else{if(position=='float'){document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div class="answerImageFloat" style="padding:0 5px 5px 0;margin:0 5px 0 0;float:left;border:1px solid #333;"><img src="'+imagePath+'" /><p>'+caption+'</p></div><br />';}else{document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div class="answerImage" style="padding:0 5px 5px 0;margin:0 5px 0 0;border:1px solid #333;"><img src="'+imagePath+'" /><p>'+caption+'</p></div><br />';}}}}function insertImageUpload(editorid,imagePath,thumbPath,position){if(imagePath!==null&&imagePath!=""&&thumbPath!==null&&thumbPath!=""){if(document.all){if(position=='float'){document.getElementById(editorid).innerHTML+='<div class="answerImageFloat" style="padding:0 5px 5px 0;margin:0 5px 0 0;float:left;border:1px solid #333;"><img src="'+thumbPath+'" /></div><br />';}else{document.getElementById(editorid).innerHTML+='<div class="answerImage" style="padding:0 5px 5px 0;margin:0 5px 0 0;border:1px solid #333;"><img src="'+thumbPath+'" /></div><br />';}}else{if(position=='float'){document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div class="answerImageFloat" style="padding:0 5px 5px 0;margin:0 5px 0 0;float:left;border:1px solid #333;"><img src="'+thumbPath+'" /></div><br />';}else{document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div class="answerImage" style="padding:0 5px 5px 0;margin:0 5px 0 0;border:1px solid #333;"><img src="'+thumbPath+'" /></div><br />';}}}}function insertHyperLink(editorid){var httpURL=prompt("Enter a Hyper Link URL:","http://");if((httpURL!==null)&&(httpURL!="")){document.getElementById(editorid).contentWindow.document.execCommand("CreateLink",false,httpURL);}}function iePrompt(str){var settings="dialogWidth: 400px; dialogHeight: 150px; center: yes; edge: raised; scroll: no; status: no; resizable: no;";return window.showModalDialog('/res/InsertVideo.html',str,settings);}function insertVideo(editorid,videoURL){if(!is_gecko){videoURL=iePrompt("Enter a Video Link:");}else{videoURL=prompt("Enter a Video Link:","");}if((videoURL!==null)&&(videoURL!="")){videoURL=videoURL.replace(/^.*\bsrc=\"(.+)\"\b.*/g,"$1");videoURL=videoURL.replace(/\b\".+/g,"");if(document.all){document.getElementById(editorid).innerHTML+='<div style=\"padding:10px 10px 10px 0;\"><iframe src=\"'+videoURL+'\" frameborder=\"0\" style=\"width:425px;height:344px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe></div><br />';}else{document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div style=\"padding:10px 10px 10px 0;\"><iframe src=\"'+videoURL+'\" frameborder=\"0\" style=\"width:425px;height:344px\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe></div><br />';}}}function embedVideo(editorid,videoURL){if((videoURL!==null)&&(videoURL!="")){videoURL=videoURL.replace(/^.*\bsrc=\"(.+)\"\b.*/g,"$1");videoURL=videoURL.replace(/\b\".+/g,"");if(document.all){document.getElementById(editorid).innerHTML+='<iframe src=\"'+videoURL+'\" name=\"video\" frameborder=\"0\" style=\"width:425px;height:344px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe>';}else{document.getElementById(editorid).contentWindow.document.body.innerHTML+='<iframe src=\"'+videoURL+'\" name=\"video\" frameborder=\"0\" style=\"width:425px;height:344px\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe>';}}}function insertAudio(editorid){if(!is_gecko){audioURL=iePrompt("Enter a Audio Link:");}else{audioURL=prompt("Enter a Audio Link:","");}if((audioURL!==null)&&(audioURL!="")){audioURL=audioURL.replace(/^.*\bsrc=\"(.+)\"\b.*/g,"$1");audioURL=audioURL.replace(/\b\".+/g,"");if(document.all){document.getElementById(editorid).innerHTML+='<div style=\"padding:10px 10px 10px 0;\"><embed src=\"/res/dewplayer-multi.swf\" quality=\"high\" width=\"250\" height=\"20\" allowScriptAccess=\"always\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" flashvars=\"mp3='+audioURL+'\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed></div>';}else{document.getElementById(editorid).contentWindow.document.body.innerHTML+='<div style=\"padding:10px 10px 10px 0;\"><iframe src=\"/res/dewplayer-multi.swf?mp3='+audioURL+'\" frameborder=\"0\" style=\"width:250px;height:20px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe></div>';}}}function setHTML(editorid,html){var frameHtml="<html id=\""+editorid+"\">";frameHtml+="<head>";frameHtml+="<style>";frameHtml+="body{font-family:Arial,sans-serif;color:#595959;font-size:14px;line-height:1.5em;}";frameHtml+="h1{font-size:22px;margin-bottom:5px;color:#595959;} h2{font-size:18px;margin-bottom:5px;color:#595959;} h3{border-bottom:1px solid #b4b4b4;font-size:18px;margin-bottom:5px;color:#595959;}";frameHtml+="h4{font-size:16px;background:#FFFFA0 none repeat scroll 0 0;border:1px solid #E5E597;margin:0.9em 0;padding:0.571em 0.786em;color:#595959;}";frameHtml+="h5{font-size:13px;background:#F5F5F5 none repeat scroll 0 0;border:1px solid #DDDDDD;margin:0.9em 0;padding:0.571em 0.786em;color:#595959;}";frameHtml+="blockquote{color:#696969;font-size:18px;margin:10px;padding-left:20px;padding-right:20px;text-indent:-20px;background:url('/css/common/closequote.gif') no-repeat right bottom;} blockquote:first-letter {background:url('/css/common/openquote.gif') no-repeat left top; padding-left: 20px;}";frameHtml+=".image{margin:5px 5px 5px 0;display:block;} .floatimage{float:left;margin:5px 5px 5px 0;}";frameHtml+="</style>";frameHtml+="</head>";frameHtml+="<body>";frameHtml+=html;frameHtml+="</body>";frameHtml+="</html>";var div=document.getElementById(editorid).contentWindow.document;div.open();div.write(frameHtml);div.close();}function enableDesignMode(editorid,editdiv){var iframe=document.getElementById(editorid);var div=document.getElementById(editdiv);if(iframe.contentDocument&&div){div.onmouseover=function(){setTimeout(function(){iframe.contentDocument.designMode="on";},10);};}else{iframe.contentDocument.designMode="on";}}function initIFrame(editorid){var ffiFrame=document.createElement("IFRAME");ffiFrame.id=editorid;ffiFrame.src="blank.html";document.body.appendChild(ffiFrame);}function toggleHighLight(div){if(div){curclass=div.className;curclass=curclass=='highlightvisible'?'highlighthidden':'highlightvisible';div.className=curclass;}}function showImage(imagediv,imagePath){document.getElementById(imagediv).innerHTML='';document.getElementById(imagediv).innerHTML='<img src=\"'+imagePath+'\" width=\"100\" height=\"75\" style=\"border:1px solid #007EB3;\" title=\"Preview\"><br>Preview';}function showImage_small(imagediv,imagePath){document.getElementById(imagediv).innerHTML='';document.getElementById(imagediv).innerHTML='<img src=\"'+imagePath+'\" width=\"55\" height=\"41.25\" style=\"border:1px solid #007EB3;margin-right:10px;\" title=\"Preview\">';}function showImagePreviewSmall(imagediv,imagePath){document.getElementById(imagediv).innerHTML='';document.getElementById(imagediv).innerHTML='<img src=\"'+imagePath+'\" width=\"24\" height=\"18\" style=\"border:1px solid #007EB3;margin-right:10px;vertical-align:middle;\" title=\"Preview\">Preview';}function doBlockQuotes(editorid){document.execCommand('formatblock',false,'<ADDRESS>');document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<(\/?)ADDRESS>/gi,"<$1BLOCKQUOTE>");document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<BLOCKQUOTE>\s*?<BLOCKQUOTE>/gi,"<BLOCKQUOTE>");document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<\/BLOCKQUOTE>\s*?<\/BLOCKQUOTE>/gi,"<\/BLOCKQUOTE>");document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<BLOCKQUOTE>\s*?<\/BLOCKQUOTE>/gi,"");}function unBlockQuotes(editorid){if(document.all){document.execCommand('formatblock',false,'<p>');document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<BLOCKQUOTE>\s*?<P>/gi,"<p>");document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<\/P>s*?<\/BLOCKQUOTE>/gi,"<\/p>");document.getElementById(editorid).innerHTML=document.getElementById(editorid).innerHTML.replace(/<BLOCKQUOTE>\s*?<\/BLOCKQUOTE>/gi,"");}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<p>');document.getElementById(editorid).contentWindow.document.body.innerHTML=document.getElementById(editorid).contentWindow.document.body.innerHTML.replace(/<BLOCKQUOTE>\s*?<P>/gi,"<p>");document.getElementById(editorid).contentWindow.document.body.innerHTML=document.getElementById(editorid).contentWindow.document.body.innerHTML.replace(/<\/P>s*?<\/BLOCKQUOTE>/gi,"<\/p>");document.getElementById(editorid).contentWindow.document.body.innerHTML=document.getElementById(editorid).contentWindow.document.body.innerHTML.replace(/<BLOCKQUOTE>\s*?<\/BLOCKQUOTE>/gi,"");}}function setFormat(editorid,style){switch(style){case"heading1":if(document.all){document.execCommand('formatblock',false,'<h1>');}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<h1>');}break;case"heading2":if(document.all){document.execCommand('formatblock',false,'<h2>');}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<h2>');}break;case"heading3":if(document.all){document.execCommand('formatblock',false,'<h3>');}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<h3>');}break;case"bodytext":unBlockQuotes(editorid);break;case"alert":if(document.all){document.execCommand('formatblock',false,'<h4>');}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<h4>');}break;case"note":if(document.all){document.execCommand('formatblock',false,'<h5>');}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<h5>');}break;case"blockquote":if(document.all){doBlockQuotes(editorid);}else{document.getElementById(editorid).contentWindow.document.execCommand('formatblock',false,'<blockquote>');}break;}}function insertCharAtCaretPos(editorid){if(document.selection&&!is_gecko){var theSelection=document.selection.createRange().text;document.getElementById(editorid).focus();if(theSelection.charAt(theSelection.length-1)==" "){theSelection=theSelection.substring(0,theSelection.length-1);document.selection.createRange().text=theSelection+" "+"~~";}else{document.selection.createRange().text=theSelection+"~~";}}if(document.getElementById(editorid).createTextRange){document.getElementById(editorid).caretPos=document.selection.createRange().duplicate();}}function removeCharAtCaretPos(editorid){if(document.all){var text=document.getElementById(editorid).innerHTML;if(text.match(/~~/)){document.getElementById(editorid).innerHTML=text.replace(/~~/,"");}}}function strip_tags(str,allowed_tags){var key='',allowed=false;var matches=[];var allowed_array=[];var allowed_tag='';var i=0;var k='';var html='';str=str.replace(/\//gi,"\/");str=str.replace(/<script\b[^>]*>[\w|\t|\r|\W]*?<\/script>/gi,"");str=str.replace(/<style\b[^>]*>[\w|\t|\r|\W]*?<\/style>/gi,"");var replacer=function(search,replace,str){return str.split(search).join(replace);};if(allowed_tags){allowed_array=allowed_tags.match(/([a-zA-Z]+)/gi);}str+='';matches=str.match(/(<\/?[\S][^>]*>)/gi);for(key in matches){if(isNaN(key)){continue;}html=matches[key].toString();allowed=false;for(k in allowed_array){allowed_tag=allowed_array[k];i=-1;if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+'>');}if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+' ');}if(i!=0){i=html.toLowerCase().indexOf('</'+allowed_tag);}if(i==0){allowed=true;break;}}if(!allowed){str=replacer(html,"",str);}}return str;}$(document).bind("fbConnectLoginForm",null,function(){var A=$(".fbConnectLogin");A.attr("disabled","disabled").unbind().click(function(){FB_RequireFeatures(["Connect"],function(){FB.Facebook.init(blurtit_fb.apiKey,"/third_party/facebook/xd_receiver.php",null);FB.Connect.requireSession();FB.Facebook.get_sessionState().waitUntilReady(function(B){var C='uid='+B.uid+'&expires='+B.expires+'&session_key='+B.session_key+'&return='+currentPage+'&resource='+resource;window.location="/third_party/facebook/?"+C;});});});FB_RequireFeatures(["Connect"],function(){A.removeAttr("disabled");});});function facebook_prompt_permission(permission){FB.ensureInit(function(){FB.Connect.showPermissionDialog(permission);});}function publishToStream(message,attachment,action_links){FB.Connect.streamPublish(message,attachment,action_links);}

/**
 * Cluetip.js
 */

$(function(){$('embed').attr('wmode','transparent');$('div#answer_questions div.head_link, div#answer_questions li.inactive').css({display:'block'});$('div#qa_question div.qa_buttons a').css({display:'inline'});});$(function(){$('.share_it, a.share_btn').click(function(){href=$(this).attr('href').split(/_/);resource_type=href[0].replace(/#resourceType/i,'');resource_id=href[1].replace(/resourceId/i,'');$(this).modalWindow('large','/share_it.php',{resource_type:resource_type,resource_id:resource_id},null,null,null);return false;});$('#cancel_share').live("click",function(){$('#overlay').overlay(true);$('#large_modal_wrapper, #medium_modal_wrapper, #small_modal_wrapper').hide();});});$(function(){$('a.pop_up_text').click(function(){var id=$(this).attr('id');if(id.match("_shoutbox")){id=id.replace('_shoutbox','');link="_link_shoutbox";}else{link="_link";}var username=id.replace('addFriend_','');$('span#'+id+link).html('|  Loading...');$('span#'+id+link).addClass('add_friend_link');scrollTop=$(window).scrollTop();height=$(window).height();pop_height=125;top_addition=(height-pop_height)/2;top_offset=scrollTop+top_addition;if(!$('#small_modal_wrapper').length){$('#small_modal').css({height:pop_height+'px'}).html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load("/who_addme.php",{return_page:"who.php?username="+username,theirname:username,wannabe:"yes"}).wrap('<div id="small_modal_wrapper"><div class="body"></div></div>').fadeIn(500).parent().prepend('<div class="head relative"><h2>Add a Friend</h2></div>').after('<div class="foot"><a class="close" href="#" onclick="return false;"><img src="/res/common/pop_up_close.gif" width="26" height="26" /></a></div>').parents().find('div#small_modal_wrapper').css({top:top_offset,marginTop:'0'});}$('div#small_modal_wrapper div.foot a.close, div#small_modal_wrapper input#close_button_pop_up, div#header, div#content, div#content_lower, div#footer').click(function(){$(this).parents().find('div#small_modal_wrapper').fadeOut(500);$('span.add_friend_link').html('').removeClass('add_friend_link');});return false;});$('a.addFriend').click(function(){$$=$(this);var href=$(this).attr('href').split(/&/);var username=href[1].replace(/theirname=/i,'');$.get("/who_addme.php",{return_page:"who.php?username="+username,theirname:username,wannabe:"yes"},function(data){$$.html('Added');});return false;});});$(function(){report_ready();});function report_ready(id){if(id){id='#'+id+' ';}else{id='';}$(id+'a.report').click(function(){href=$(this).attr('href').split(/_/);resource_type=href[0].replace(/#resourceType/i,'');resource_id=href[1].replace(/resourceId/i,'');$(this).modalWindow('small','/modules/report_it.php',{resource_type:resource_type,resource_id:resource_id},null,250,null);return false;});}$(function(){$('a.thumbsDown, a.thumbsUp').live("click",function(){answer_id=$(this).attr('id').replace(/thumbsUp|thumbsDown/i,'');if($(this).hasClass('thumbsUp')){$('#vote'+answer_id).attr('value','1');}else if($(this).hasClass('thumbsDown')){$('#vote'+answer_id).attr('value','-1');}$(this).parent().ajaxSubmit({success:function(data){if(data.match(/positive/i)){if(data.match(/update/i)){$('a#thumbsDown'+answer_id).html(''+parseInt($("a#thumbsDown"+answer_id).html().replace(/ Unhelpful/i,''))-1);data=data.replace(/update /i,'');}original_score=parseInt($('a#thumbsUp'+answer_id).html().replace(/ Helpful/i,''));new_score=parseInt(data.replace(/positive /i,''));$('a#thumbsUp'+answer_id).html(original_score+new_score);}else if(data.match(/negative/i)){if(data.match(/update/i)){$('a#thumbsUp'+answer_id).html(''+parseInt($('a#thumbsUp'+answer_id).html().replace(/ Helpful/i,''))-1);data=data.replace(/update /i,'');}original_score=parseInt($('a#thumbsDown'+answer_id).html().replace(/ Unhelpful/i,''));new_score=parseInt(data.replace(/negative /i,''));$('a#thumbsDown'+answer_id).html(original_score+new_score);}getNext=$('a#thumbsDown'+answer_id).attr('getNext');if(getNext=="getNext"){next_rate();}}});return false;});});function online_status_change(){$('form#mini_me_status select#online_status').change(function(){$select=$(this);$(this).parents().find('form#mini_me_status').ajaxSubmit({success:function(data){$('div#mini_me').html(data);}});});}$(function(){$('a.watch_this, a.watch_btn').click(function(){href=$(this).attr('href').split(/_/);resource_type=href[0].replace(/#resourceType/i,'');resource_id=href[1].replace(/resourceId/i,'');$.post("/watchit.php",{resource_type:resource_type,resource_id:resource_id},function(data){$('a.watch_this, a.watch_btn').html('Watching');});return false;});});function comment_character_count(textarea,answer_id,max_count){var textarea_value=textarea.value;max_count=max_count?max_count:500;var character_count=(max_count-textarea_value.length);var character_or_characters="";if(character_count==1){character_or_characters="character";}else{character_or_characters="characters";}if(character_count<0){character_count=0;}$('div#commentwordcount'+answer_id).html(character_count+' '+character_or_characters+' left.');if(textarea.value.length>max_count){textarea.value=textarea.value.substring(0,max_count);}}$(function(){$('textarea.comment_textarea').keydown(function(event){comment_character_count(this,$(this).attr('answer_id'),500);}).keyup(function(event){comment_character_count(this,$(this).attr('answer_id'),500);}).keypress(function(event){comment_character_count(this,$(this).attr('answer_id'),500);}).click(function(event){comment_character_count(this,$(this).attr('answer_id'),500);return false;}).focus(function(event){comment_character_count(this,$(this).attr('answer_id'),500);}).blur(function(event){comment_character_count(this,$(this).attr('answer_id'),500);});});(function(jQuery){$.fn.loading=function(height){if(!height){height='200';}$(this).html('<div style="position:relative;height:'+height+'px;"><div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div></div>');return $(this);};})(jQuery);(function(jQuery){$.fn.msgModal=function(msg,pop_height){size='small';var modal=$('div#'+size+'_modal');var modalWrapper=$('div#'+size+'_modal_wrapper');var pop_height=pop_height?pop_height:0;var scrollTop=$(window).scrollTop();var height=$(window).height();if(!pop_height){pop_height=450;}var top_addition=(height-pop_height)/2;var top_offset=scrollTop+top_addition;if(modal.length){if(modalWrapper.length==0){$('div#overlay').overlay(false);modal.html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load('/modules/message_modal.php',{msg:msg}).wrap('<div id="'+size+'_modal_wrapper"><div class="body"></div></div>').fadeIn(500).parent().after('<div class="foot"><a class="close" href="#" onclick="return false;"><img src="/res/common/pop_up_close.gif" width="26" height="26" /></a></div>').parents().find('div#'+size+'_modal_wrapper').css({top:top_offset,marginTop:'0'});}else if(modalWrapper.is(':hidden')){$('div#overlay').overlay(false);modal.css({height:'auto'});modal.html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load('/modules/message_modal.php',{msg:msg}).fadeIn(500).parents().find('div#'+size+'_modal_wrapper').css({top:top_offset,marginTop:'0'}).fadeIn(500);}}return $(this);};})(jQuery);(function(jQuery){$.fn.overlay=function(hide){if(hide==true){$(this).hide();}else{$(this).css({width:$(document).width(),height:$(document).height()}).show();}return $(this);};})(jQuery);(function(jQuery){$.fn.modalWindow=function(size,href,post,head,pop_height,className){var modal=$('div#'+size+'_modal');var modalWrapper=$('div#'+size+'_modal_wrapper');var pop_height=pop_height?pop_height:0;post['heading']='';var scrollTop=$(window).scrollTop();var height=$(window).height();if(!pop_height){pop_height=450;}var top_addition=(height-pop_height)/2;var top_offset=scrollTop+top_addition;if(className&&(className.match('catChooser')||className.match('qaCatChooser'))){top_offset=top_offset+35;}if(modal.length){if(className&&className.match('qaCatChooser')&&post['divid']==0&&post['href']==0){catChooser='qaCatChooser';qaPage=className.replace(/qaCatChooser_\//i,'');qaPage=qaPage.replace(/\.html/,'');modal.addClass(catChooser).addClass(qaPage);}if(modalWrapper.length==0){$('div#overlay').overlay(false);if($(this).hasClass('star')||$(this).hasClass('reg_recommendedq')){post['heading']='Sorry You Need To Sign-Up To Do That';pop_height=500;}if(className&&(className.match('catChooser')||className.match('qaCatChooser'))){if(parseInt(pop_height-100)<500){modalHeight=500;}else{modalHeight=parseInt(pop_height-100);}modal.css({height:modalHeight+'px'});}modal.html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load(href,post,function(){if(className&&(className.match('catChooser')||className.match('qaCatChooser'))){if(parseInt(pop_height-100)<500){modalHeight=500;}else{modalHeight=parseInt(pop_height-100);}modal.css({height:modalHeight+'px',overflow:'hidden'});$('#exploreCats').css({height:(modalHeight-375),overflowY:'scroll'});if($('#exploreCats input[checked]').position()){pos=$('#exploreCats').css({position:'relative'}).find('input[checked]').position();$("#exploreCats").scrollTop((pos.top-(parseInt($("#exploreCats").css('height'))/2))).css({position:'static'});}}}).wrap('<div id="'+size+'_modal_wrapper"><div class="body"></div></div>').fadeIn(500).parent().after('<div class="foot"><a class="close" href="#" onclick="return false;"><img src="/res/common/pop_up_close.gif" width="26" height="26" /></a></div>').parents().find('div#'+size+'_modal_wrapper').css({top:top_offset,marginTop:'0'});if(head){modal.parent().prepend('<div class="head relative">'+head+'</div>');}}else if(modalWrapper.is(':hidden')){$('div#overlay').overlay(false);if($(this).hasClass('star')||$(this).hasClass('reg_recommendedq')){heading='Sorry You Need To Sign-Up To Do That';pop_height=500;}if(className&&(className.match('catChooser')||className.match('qaCatChooser'))){if(parseInt(pop_height-100)<500){modalHeight=500;}else{modalHeight=parseInt(pop_height-100);}modal.css({height:modalHeight+'px'});}else{modal.css({height:'auto'});}modal.html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load(href,post,function(){if(className&&(className.match('catChooser')||className.match('qaCatChooser'))){if(parseInt(pop_height-100)<500){modalHeight=500;}else{modalHeight=parseInt(pop_height-100);}modal.css({height:modalHeight+'px',overflow:'hidden'});$('#exploreCats').css({height:(modalHeight-375),overflowY:'scroll'});if($('#exploreCats input[checked]').position()){pos=$('#exploreCats').css({position:'relative'}).find('input[checked]').position();$("#exploreCats").scrollTop((pos.top-(parseInt($("#exploreCats").css('height'))/2))).css({position:'static'});}}}).fadeIn(500).parents().find('div#'+size+'_modal_wrapper').css({top:top_offset,marginTop:'0'}).fadeIn(500);if(head){modal.parent().find('div.head').html(head);}else if(modalWrapper.find('div.head').length>0){modalWrapper.find('div.head').remove();}}}return $(this);};})(jQuery);$(function(){$('div#questions a.reg_recommendedq, div#answer_questions a.reg_recommendedq, a#calltoaction_signup2, a#answer_box_reg, a#answer_register, img.star, button#calltoaction_signup, a.watch_this_guest, a.share_it_guest, a.guest_register, span.thumbsUp, span.thumbsDown, #answer_questions .register').click(function(){$(this).modalWindow('large','/modules/pop_register.php',{returnPage:$('div#large_modal').attr('qpage'),script:$('div#large_modal').attr('script'),resource_type:$('div#large_modal').attr('contribution_type'),resource_id:$('div#large_modal').attr('contribution_id')},null,0,false);return false;});$('a#answer_box_login, button#calltoaction_login, a#answer_login, #answer_questions .login').click(function(){$(this).modalWindow('large','/modules/pop_login.php',{returnPage:$('div#large_modal').attr('qpage'),resource_type:$('div#large_modal').attr('contribution_type'),resource_id:$('div#large_modal').attr('contribution_id')},'<h2>Login to Blurtit</h2><p class="headRight">Not a member of blurtit? <a href="/register.php" class="pop_reg">Register now</a></p>',0,false);return false;});$('a.email_q, a.email_guest, a.email_btn').click(function(){$(this).modalWindow('large','/modules/email.php',{page:$('div#large_modal').attr('qpage'),pop_up:true},null,0,false);return false;});$('a.qa_popup').click(function(){$(this).modalWindow('medium','/modules/question_popup.php',{page:$(this).attr('href')},null,600,false);return false;});$('a#select_similar').click(function(){var text=$('textarea#question').attr('value');$(this).modalWindow('large','/modules/listsimilars.php',{txt:text},null,600,false);return false;});$('form.contributionsEmailForm').attr('action','/modules/emailRegister.php').ajaxForm({success:function(data){if(data=='email exists'){document.location.href='/login.php?exists=true';}else{if($('div#small_modal').attr('id')){if(!$('div#small_modal_wrapper').attr('id')){$('div#overlay').overlay(false);scrollTop=$(window).scrollTop();height=$(window).height();pop_height=450;top_addition=(height-pop_height)/2;top_offset=scrollTop+top_addition;$('div#small_modal').html(data).wrap('<div id="small_modal_wrapper"><div class="body"></div></div>').fadeIn(500).parent().prepend('<div class="head relative"><h2>Sign Up To Blurtit For Free</h2></div>').after('<div class="foot"><a class="close" href="#" onclick="return false;"><img src="/res/common/pop_up_close.gif" width="26" height="26" /></a></div>').parents().find('div#small_modal_wrapper').css({top:top_offset,marginTop:'0'});}else if($('div#small_modal_wrapper').is(':hidden')){$('div#overlay').overlay(false);pop_up_obj=$(this);scrollTop=$(window).scrollTop();height=$(window).height();pop_height=450;top_addition=(height-pop_height)/2;top_offset=scrollTop+top_addition;$('div#small_modal').html(data).fadeIn(500).parent().find('div.head').html('<h2>Sign Up To Blurtit For Free </h2>').parents().find('div#small_modal_wrapper').css({top:top_offset,marginTop:'0'}).fadeIn(500);}}}},beforeSubmit:function(formData,jqForm,options){inputs=new Array();$.each(formData,function(i,obj){inputs[obj.name]=obj.value;});if(inputs['emailAddy']==='Enter your email here'){$('input.emailAddy').css({color:'#e73939'}).attr('value','You must enter an email address');return false;}if(!email_check(inputs['emailAddy'])){$('input.emailAddy').css({color:'#e73939'}).attr('value','That email address is invalid');return false;}return true;}});$('div#small_modal_wrapper a.pop_login, div#large_modal_wrapper a.pop_login').live("click",function(){if($('div#large_modal').is(':visible')){modal_popLogin=$('div#large_modal');}else{modal_popLogin=$('div#small_modal');}modal_popLogin.html('<div style="position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;"><img src="/res/common/ajax-loader.gif" width="54" height="55" /></div>').load('/modules/pop_login.php',{returnPage:modal_popLogin.attr('qpage'),script:modal_popLogin.attr('script')}).parent().find('div.head').html('<h2>Login to Blurtit</h2>');return false;});$('a#header_signUp').live("click",function(){$(this).modalWindow('medium','/modules/pop_register.php',{returnPage:$('#large_modal').attr('return'),resource:$('#large_modal').attr('resource')},null,500,false);return false;});$('div#small_modal_wrapper div.foot a.close, div#medium_modal_wrapper div.foot a.close, div#large_modal_wrapper div.foot a.close, div#overlay, button#skip_cat_chooser').live("click",function(ev){var el=$(ev.target);if(el.hasClass('goBtn')){return;}if($('div#small_modal, div#large_modal, div#medium_modal').hasClass('qaCatChooser')){question_page=$('div#small_modal, div#large_modal, div#medium_modal').removeClass('qaCatChooser').attr('class');$.post('/modules/cat_chooser.php',{skip:'true',question:'/'+question_page+'.html'},function(data){if($('div#contributions a.dismiss').length>0){$('div#contributions a.dismiss').click();}});}if($('#answerit_div').length){$('#answerit_div').css({height:parseInt($('#answerit_div').attr('height'))+'px'});if($('#answerit_div').is(':visible')){removeCharAtCaretPos('answerit_div');}}$('div#small_modal_wrapper, div#medium_modal_wrapper, div#large_modal_wrapper').fadeOut(500);$('div#overlay').overlay(true);});$('#topicsCallToAction #hideTopicCall').click(function(){$('#topicsCallToAction').fadeOut('slow');$.post('/tab_store.php',{hideEinstein:true});return false;});$('a.hide_it').live('click',function(){$$=$(this);href=$(this).attr('href').split(/_/);resource_type=href[0].replace(/#resourceType/i,'');resource_id=href[1].replace(/resourceId/i,'');$.post('/choose_topics.php',{resource_type:resource_type,resource_id:resource_id,hide_it:true},function(data){if(data=='ok'){var i=1;$$.parents().find('div#myTopicsQ_'+resource_id).hide().parent().find('div.list_question_wrap:visible,div.answer_question_wrap:visible').each(function(){if(i%2==0){$(this).css({backgroundColor:'#effaff'});}else{$(this).css({backgroundColor:'#ffffff'});}i++;});}});return false;});$('a#gotoShouts').live("click",function(){if($('#who_tabs').length){main_who_menu('shouts',false);}document.location.href='#who_tabs';return false;});});$(function(){$('a#entice_edit_category, a#change_category').click(function(){cat_chooser($(this));return false;});});function report_list(id){if(id){id='#'+id+' ';}else{id='';}$(id+'a.report_list').click(function(){var ahref=$(this).attr('href');if(ahref.match(/php/)){url=ahref.split(/php/);href=url[1].split(/_/);}else{href=ahref.split(/_/);}resource_type=href[0].replace(/#resourceType/i,'');resource_id=href[1].replace(/resourceId/i,'');if($(this).attr('head_title')!='undefined'){head_title=$(this).attr('head_title');}else{head_title='';}$(this).modalWindow('small','/modules/report_it.php',{resource_type:resource_type,resource_id:resource_id,head_title:head_title},head_title,250,false);return false;});}function cat_chooser_click(id){$('#'+id+' .edit_cat a').click(function(){cat_chooser($(this));return false;});}function cat_chooser(cat_object){if(cat_object.attr('question')){question_page=cat_object.attr('question');}else{question_page=$('div#small_modal').attr('qpage');}if(cat_object.attr('href')&&cat_object.attr('divid')){var divid=cat_object.attr('divid');var href=cat_object.attr('href');var usermoderation_id=cat_object.attr('resource_id');var disputing=cat_object.attr('disputing');}else{var divid=0,href=0;}$(this).modalWindow('medium','/modules/cat_chooser.php',{question:question_page,divid:divid,href:href,usermoderation_id:usermoderation_id,disputing:disputing},'Select a Category',$(window).height(),'qaCatChooser_'+question_page);}function question_action(divids){$(divids).each(function(){$(this).bind('mouseenter',function(){$(this).find('div.question_action').filter(':first').show();});$(this).bind('mouseleave',function(){$(this).find('div.question_action').filter(':first').hide();});});}function list_question_action(divids){$(divids).each(function(){$(this).bind('mouseenter',function(){$(this).find('div.list_question_action').filter(':first').show();});$(this).bind('mouseleave',function(){$(this).find('div.list_question_action').filter(':first').hide();});});}function question_disapproval_reason(){$('a.qchange_status').click(function(){$('input#questioncomment_approval_status').attr('value',$(this).attr('approval_status'));toggleCommentModerator('questioncomment');return false;});}function answer_disapproval_reason(){$('a.achange_status').click(function(){answer_id=$(this).attr('answer_id');$('input#answercomment'+answer_id+'_approval_status').attr('value',$(this).attr('approval_status'));toggleCommentModerator('answercomment'+answer_id);return false;});}function sidebar_height(){if($('div.sidebar').length&&$('div.sidebar_content').length){content_height=(parseInt($('div.sidebar_content').height())-175);if(content_height>0){$('div.sidebar_middle').css('height',content_height+'px');$('div.sidebar_bottom').css('top',content_height+'px');}}}$(function(){sidebar_height();});function email_check(email_addy){var at="@";var dot=".";var lat=email_addy.indexOf(at);var lstr=email_addy.length;var ldot=email_addy.indexOf(dot);if(email_addy.indexOf(at)==-1){return false;}if(email_addy.indexOf(at)==-1||email_addy.indexOf(at)==0||email_addy.indexOf(at)==lstr){return false;}if(email_addy.indexOf(dot)==-1||email_addy.indexOf(dot)==0||email_addy.indexOf(dot)==lstr){return false;}if(email_addy.indexOf(at,(lat+1))!=-1){return false;}if(email_addy.substring(lat-1,lat)==dot||email_addy.substring(lat+1,lat+2)==dot){return false;}if(email_addy.indexOf(dot,(lat+2))==-1){return false;}if(email_addy.indexOf(" ")!=-1){return false;}return true;}function check_username(){if(confirm_reg){username_complete=true;return;}if(!$('#username').attr('value')){username="";}else{username=$('#username').attr('value');}$.post('/register.php',{checkuser:username},function(data){user_status=data.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');if(user_status!='Username available!'){$('#checkuser_text').css('color','red').html(data);$('#checkuser_img').attr("src","/res/en/error_ic.png");$('#user_span').show();username_complete=false;}else{$('#checkuser_text').css('color','green').html(data);$('#checkuser_img').attr("src","/res/en/success_ic.png");$('#user_span').show();username_complete=true;}});}function check_passwords(){if(confirm_reg){pw_complete=true;return;}pw1=$('#password').attr('value');if(!pw1){$('#checkpw_text').css('color','red').html("Please enter a password");$('#checkpw_img').attr("src","/res/en/error_ic.png");pw_complete=false;}else{$('#checkpw_text').css('color','green').html('Passwords OK');$('#checkpw_img').attr("src","/res/en/success_ic.png");$('#password_span').show();pw_complete=true;}}function check_email(){email_addy=$('#email').attr('value');if(!email_addy||email_check(email_addy)==false){$('#checkemail_text').css('color','red').html('Your email address is invalid');$('#checkemail_img').attr("src","/res/en/error_ic.png");$('#email_span').show();email_complete=false;}else{$('#checkemail').hide();$('#checkemail_text').css('color','green').html('Email appears valid');$('#checkemail_img').attr("src","/res/en/success_ic.png");$('#email_span').show();email_complete=true;}}function check_age(){dob_complete=$('input#dob').attr('checked');return dob_complete;}function logout(){if(blurtit_user.type=='facebook'){FB_RequireFeatures(["Connect"],function(){FB.Facebook.init(blurtit_fb.apiKey,"/third_party/facebook/xd_receiver.php",null);FB.Facebook.get_sessionState().waitUntilReady(function(session){$.post('/me/logout.php',{ajax:true},function(data){FB.Connect.logoutAndRedirect(data);});});});}else{document.location.href='/me/logout.php';}return false;}function questionShareWidget(){var facebookShare=document.createElement('script');facebookShare.setAttribute("type","text/javascript");facebookShare.setAttribute("src","http://static.ak.fbcdn.net/connect.php/js/FB.Share");if(typeof facebookShare!="undefined"){document.getElementById("facebookSharing").appendChild(facebookShare);}}
