function initPage()
{var navRoot=document.getElementById("log-block");if(navRoot)
{navRoot.onmouseover=function()
{this.className="hover";};navRoot.onmouseout=function()
{this.className="";};}
navRoot=document.getElementById("searchmenu");if(navRoot)
{navRoot.onmouseover=function()
{this.className="hover";};navRoot.onmouseout=function()
{this.className="";};}}
function rediectToExpresurl(){window.location.replace($('#exp_url').val());}
function closeFBTB(){$('#TB_FB').removeClass('show');$('#TB_FBIN').removeClass('show');$('#TB_FB').addClass('hide');$('#TB_FBIN').addClass('hide');}
var d,dom,ie,ie4,ie5x,moz,mac,win,lin,old,ie5mac,ie5xwin,op,na,n,nua;d=document;n=navigator;na=n.appVersion;nua=n.userAgent;win=(na.indexOf('Win')!==-1);mac=(na.indexOf('Mac')!==-1);lin=(nua.indexOf('Linux')!==-1);var red_url="http://www.paltalk.com/download.shtml";function getUrlParam(name)
{var regexS,regex,tmpURL,results;regexS="[\\?&]"+name+"=([^&#]*)";regex=new RegExp(regexS);tmpURL=window.location.href;results=regex.exec(tmpURL);if(results===null){return"";}
else
{return results[1];}}
function addFunc(){var refc,advc,pagc,gid,downurl;if(getUrlParam('refc')===107571){$('#TB_FB').removeClass('hide');$('#TB_FBIN').removeClass('hide');$('#TB_FB').addClass('show');$('#TB_FBIN').addClass('show');$('#fblink').attr('href',$('#fblink').attr('href')+'&refc=107571');$('#close-fbtb').click(closeFBTB);refc=getUrlParam('refc');advc=getUrlParam('advc');pagc=getUrlParam('pagc');gid=jQuery("#FB_GID").val();downurl=" http://www.paltalk.com/g2/group/"+gid+"/Download.wmt?";if(refc!==""&&isNaN(refc)){refc="";}
if(advc!==""&&isNaN(advc)){advc="";}
if(pagc!==""&&isNaN(pagc)){pagc="";}
if($('#hid_fb_room').val()){if(gid!==""){downurl=downurl+"gid="+gid;}}
else{downurl="http://www.paltalk.com/download.shtml?";}
if(advc!==""){downurl=downurl+"&advc="+advc;}
if(refc!==""){downurl=downurl+"&refc="+refc;}
if(pagc!==""){downurl=downurl+"&pagc="+pagc;}
if(mac){jQuery("#fblink").attr("href","http://express.paltalk.com/index.html?gid="+gid);}
else if(win){if(!isPaltalkInstalled()){jQuery("#fblink").attr("href",downurl);}
else{jQuery("#fblink").attr("href","paltalk://groups/"+gid);}}}
if(fetch_cookie('postLogoutMessage')!==null){showLoginOnAutoLogout();}
if(fetch_cookie("loginrequrl")!==null){showLoginOnAutoLogout(fetch_cookie("loginrequrl"));}
if(fetch_cookie("chkUserLogin")!==null&&isUserLoggedIn()===false){generateLoginBox();delete_cookie('username','paltalk.com');}
delete_cookie('chkUserLogin','paltalk.com');}
function selectedState()
{var mainNavLists=document.getElementById("nav-states").getElementsByTagName("ul"),i,dropDownLists,j,selectedTab;for(i=0;i<mainNavLists.length;i++){if(mainNavLists[i].className==='nav'){dropDownLists=mainNavLists[i].getElementsByTagName("ul");for(j=0;j<dropDownLists.length;j++){dropDownLists[j].onmouseover=function(){selectedTab=this.parentNode.firstChild;selectedTab.className+=" tab-hover";}
dropDownLists[j].onmouseout=function(){selectedTab=this.parentNode.firstChild;selectedTab.className=selectedTab.className.replace(new RegExp("tab-hover\\b"),"");}}}}
if(document.getElementById("userinfo-menu")!==null){var userNavLists=document.getElementById("userinfo-menu").getElementsByTagName("ul");for(i=0;i<userNavLists.length;i++){userNavLists[i].onmouseover=function(){selectedTab=this.parentNode.firstChild;selectedTab.className+=" usermenu-selected";}
userNavLists[i].onmouseout=function(){selectedTab=this.parentNode.firstChild;selectedTab.className=selectedTab.className.replace(new RegExp("usermenu-selected\\b"),"");}}}}
function toggleVisibility(elem){if(elem!==null&&elem.className==="show"){elem.className=elem.className.replace("show","hide");}else if(elem!==null&&elem.className==="hide"){elem.className=elem.className.replace("hide","show");}}
function hideClass(elem){if(elem!==null&&elem.className==="show")
elem.className=elem.className.replace("show","hide");}
function showClass(elem){if(elem!==null&&elem.className==="hide")
elem.className=elem.className.replace("hide","show");}
function checkSignIn(){var username=fetch_cookie('username');if(username===null||username===''){}else{var hasProfile=fetch_cookie('profile');var hasGroup=fetch_cookie('group');if(hasProfile==='Y'){if(document.getElementById('logdCreateProfile')!==null){document.getElementById('logdCreateProfile').style.display="none";}
if(document.getElementById('logdViewProfile')!==null){document.getElementById('logdViewProfile').style.display="";}
if(document.getElementById('logdEditProfile')!==null){document.getElementById('logdEditProfile').className="";}
if(document.getElementById('createProfile')!==null){document.getElementById('createProfile').style.display="none";}
if(document.getElementById('viewProfile')!==null){document.getElementById('viewProfile').style.display="";}
if(document.getElementById('editProfile')!==null){document.getElementById('editProfile').className="";}
if(document.getElementById('profSettings')!==null){document.getElementById('profSettings').className="";}}else{if(document.getElementById('logdCreateProfile')!==null){document.getElementById('logdCreateProfile').style.display="";}
if(document.getElementById('logdViewProfile')!==null){document.getElementById('logdViewProfile').style.display="none";}
if(document.getElementById('logdEditProfile')!==null){document.getElementById('logdEditProfile').className="not-available";}
if(document.getElementById('logdEditProfile')!==null){document.getElementById('logdEditProfile').href="#";}
if(document.getElementById('createProfile')!==null){document.getElementById('createProfile').style.display="";}
if(document.getElementById('viewProfile')!==null){document.getElementById('viewProfile').style.display="none";}
if(document.getElementById('editProfile')!==null){document.getElementById('editProfile').className="not-available";}
if(document.getElementById('profSettings')!==null){document.getElementById('profSettings').className="not-available";}
if(document.getElementById('editProfile')!==null){document.getElementById('editProfile').href="#";}
if(document.getElementById('profSettings')!==null){document.getElementById('profSettings').href="#";}}
if(hasGroup==='Y'){if(document.getElementById('logdCreateGrp')!==null){document.getElementById('logdCreateGrp').style.display="none";}
if(document.getElementById('logdViewGrp')!==null){document.getElementById('logdViewGrp').style.display="";}
if(document.getElementById('logdEditGrp')!==null){document.getElementById('logdEditGrp').className="";}
if(document.getElementById('createGrp')!==null){document.getElementById('createGrp').style.display="none";}
if(document.getElementById('viewGrp')!==null){document.getElementById('viewGrp').style.display="";}
if(document.getElementById('editGrp')!==null){document.getElementById('editGrp').className="";}}else{if(document.getElementById('logdCreateGrp')!==null){document.getElementById('logdCreateGrp').style.display="";}
if(document.getElementById('logdViewGrp')!==null){document.getElementById('logdViewGrp').style.display="none";}
if(document.getElementById('logdEditGrp')!==null){document.getElementById('logdEditGrp').className="not-available";}
if(document.getElementById('logdEditGrp')!==null){document.getElementById('logdEditGrp').href="#";}
if(document.getElementById('createGrp')!==null){document.getElementById('createGrp').style.display="";}
if(document.getElementById('viewGrp')!==null){document.getElementById('viewGrp').style.display="none";}
if(document.getElementById('editGrp')!==null){document.getElementById('editGrp').className="not-available";}
if(document.getElementById('editGrp')!==null){document.getElementById('editGrp').href="#";}}
if(document.getElementById("log-out")!==null){var logoutLink;logoutLink=document.getElementById("log-out");logoutLink.onclick=function(){delete_cookie('adult','paltalk.com');delete_cookie('adult_access','paltalk.com');setLoggedOutFlag();document.logout.submit();}}
return;}}
function setLoggedOutFlag(){var myDate=new Date();myDate.setDate(myDate.getDate()+5);set_cookie('userLoggedOut','User logged out.',myDate,'paltalk.com');}
function changeMenu(){var temp,i,domainSelect,chatSearch,memberSearch,newsSearch;domainSelect=document.getElementById('drop-arrow');chatSearch=document.getElementById('searchChat');memberSearch=document.getElementById('searchMembers');newsSearch=document.getElementById('searchNews');if(fetch_cookie('search_type')===null||fetch_cookie('search_type')===""){}
else{document.frmMenu.searchTarget.value=fetch_cookie('search_type');if(fetch_cookie('search_type')===0){temp='Chat Rooms';}
else if(fetch_cookie('search_type')===1){temp='Members';}
else{temp='Support';}
for(i=0;i<domainSelect.childNodes.length;i++){if(domainSelect.childNodes[i].nodeType===1&&domainSelect.childNodes[i].firstChild.nodeValue===temp){showClass(domainSelect.childNodes[i]);}
else
{hideClass(domainSelect.childNodes[i]);}}
document.frmMenu.mainsearch.value=fetch_cookie('search_text')
delete_cookie('search_type','paltalk.com');delete_cookie('search_text','paltalk.com');}
chatSearch.onclick=function(){document.frmMenu.searchTarget.value=0;for(i=0;i<domainSelect.childNodes.length;i++){if(domainSelect.childNodes[i].nodeType===1&&domainSelect.childNodes[i].firstChild.nodeValue==='Chat Rooms')
showClass(domainSelect.childNodes[i]);else
hideClass(domainSelect.childNodes[i]);}};memberSearch.onclick=function(){document.frmMenu.searchTarget.value=1;for(i=0;i<domainSelect.childNodes.length;i++){if(domainSelect.childNodes[i].nodeType===1&&domainSelect.childNodes[i].firstChild.nodeValue==='Members'){showClass(domainSelect.childNodes[i]);}
else{hideClass(domainSelect.childNodes[i]);}}};newsSearch.onclick=function(){document.frmMenu.searchTarget.value=2;for(i=0;i<domainSelect.childNodes.length;i++){if(domainSelect.childNodes[i].nodeType===1&&domainSelect.childNodes[i].firstChild.nodeValue==='Support')
{showClass(domainSelect.childNodes[i]);}
else
{hideClass(domainSelect.childNodes[i]);}}}}
function SelectSearchType(val){var myDate=new Date();myDate.setDate(myDate.getDate()+5);set_cookie('search_type',val,myDate,'paltalk.com');set_cookie('search_text',document.frmMenu.mainsearch.value,myDate,'paltalk.com');}
function isMetaCharacter(p_val){var validchars="<>",flilteredString="",parm1=p_val,i,temp;for(i=0;i<parm1.length;i++){temp=""+parm1.substring(i,i+1);if(validchars.indexOf(temp)>=0&&temp!==" "){}
else{flilteredString=flilteredString+temp;}}
return flilteredString;}
function searchSubmit(){var checkInput,clickDetect,submitDetect;checkInput=document.getElementById('mainsearch');clickDetect=document.getElementById('go');submitDetect=document.frmMenu;checkInput.onfocus=function(){if(this.value==='Enter search term(s)')this.value='';}
clickDetect.onclick=function(){SelectSearchType(document.frmMenu.searchTarget.value);setSearchTarget();}
submitDetect.onsubmit=function(){setSearchTarget();return false;}}
function setSearchTarget(){var search_type,search_val
search_type=document.frmMenu.searchTarget.value;if(search_type===null||search_type===""){search_type=0;}
search_val=isMetaCharacter(document.frmMenu.mainsearch.value);;if(isWhitespace(search_val)||search_val==="Enter search term(s)"){Highlight("mainsearch");return;}else if(search_val!==null&&search_val<3){alert("please enter minimum of 3 characters");return;}
if(search_type===0){document.groups_search.searchkey.value=search_val;document.groups_search.submit();}else if(search_type===1){document.people_search.tag.value=search_val;document.people_search.submit();}else if(search_type===2){document.support_search.q.value=search_val;document.support_search.submit();}}
var FadeInterval=600;var StartFadeAt=7;var FadeSteps=new Array();FadeSteps[1]="ff";FadeSteps[2]="ee";FadeSteps[3]="dd";FadeSteps[4]="cc";FadeSteps[5]="bb";FadeSteps[6]="aa";FadeSteps[7]="99";function Highlight(target){DoFade(StartFadeAt,target);}
function DoFade(colorId,targetId){if(colorId>=1){document.getElementById(targetId).style.background="#ffff"+FadeSteps[colorId];if(colorId===1){document.getElementById(targetId).style.background="#fff";}
colorId--;setTimeout("DoFade("+colorId+",'"+targetId+"')",FadeInterval);}}
function download_sniff(){var jsurl="/en/start_chatting.shtml"
if(navigator.appVersion.indexOf("Mac")!==-1)jsurl="/express/";window.location.href=jsurl;}
function gotoChat(){document.location="/en/download_auto.shtml";}
function doChat(){window.setTimeout('gotoChat()',1000);document.download.submit();}
function download_sniff_auto(){var jsurl="javascript:doChat();"
if(navigator.appVersion.indexOf("Mac")!==-1)jsurl="/express/";window.location.href=jsurl;}
function checkOS(){var sniffer,i;sniffer=document.getElementsByTagName('a');for(i=0;i<sniffer.length;i++){if(sniffer[i].getAttribute("rel")==="os-sniff"){sniffer[i].onclick=function(){download_sniff();}}
else if(sniffer[i].getAttribute("rel")==="os-sniff-auto"){sniffer[i].onclick=function(){download_sniff_auto();}}}}
function checkref(){var refc,advc,pmid,downurl;refc=getUrlParam('refc');advc=getUrlParam('advc');pmid=getUrlParam('pmid');if(refc!==""&&isNaN(refc)){refc="";}
if(advc!==""&&isNaN(advc)){advc="";}
if(refc===""&&advc===""&&pmid===""){return;}
downurl="http://www.paltalk.com/download/0.x/pal_install";if(pmid!==""){downurl=downurl+"_pmid"+pmid;}else{if(advc!==""){downurl=downurl+"_a"+advc;}
if(refc!==""){downurl=downurl+"_r"+refc;}}
downurl=downurl+".exe";if(document.getElementById('dlu1')!==null){document.getElementById('dlu1').href=downurl;}
if(document.getElementById('dlu2')!==null){document.getElementById('dlu2').href=downurl;return;}}
function newWin(){if(!document.getElementsByTagName)return false;var links=document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if(links[i].getAttribute("rel")==="external"){links[i].onclick=function(){return!window.open(this.href);}}}}
