
function go(url)
{window.location=url;}
function deleteComment(id)
{$.get(root_url+"api/deleteComment.php",{id:id});$('#comment-'+id).slideUp();return false;}
function boxHTML(title,html)
{return"<div><div class='block'><ul class='tabs_container'><li class='tabactive'><span>"+title+"</span></li></ul><div class='tabs_box'></div><div class='body' style='padding:20px;'>"+html+"</div></div></div>";}
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=new Array('',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=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
function msg_popup(title,html,width,height,overlayClose)
{try
{if(overlayClose)
{title+="<img onclick='closePopup();' src='"+root_url+"public/images/close.png' alt='X' style='z-index:3;cursor: pointer;margin-top:-15px;margin-right:-15px;float:right;' />";}
html=boxHTML(title,html);jsOverlay(true);if($('#js_o_popup'))
{var objLightbox=$('#js_o_popup');}
else
{var objLightbox=document.createElement('div');objLightbox.id='js_o_popup';objLightbox.className='popup';$('#js_html').appendChild(objLightbox);}
objLightbox=$(objLightbox);objLightbox.html(html);objLightbox.fadeIn('slow');objLightbox.css('position','fixed');objLightbox.css('z-index','3');if(width!='')
{objLightbox.width(width);}
if(height!='')
{objLightbox.height(height);}
var arrayPageSize=getPageSize();var arrayPageScroll=getPageScroll();my_height=objLightbox.height();my_width=objLightbox.width();objLightbox.centerOnScreen();}
catch(e)
{alert(e);}}
function closePopup()
{try
{var objLightbox=$('#js_o_popup');objLightbox.fadeOut('slow');objLightbox.hide();jsOverlay(false);if(typeof this.onPopupClose=='function')
{this.onPopupClose();}}
catch(e)
{}}
function jsOverlay(d)
{if(d)
{$('#js_overlay').show();$('#js_overlay').css('height','100%');$('#js_overlay').css('width','100%');$('#js_overlay').css('position','fixed');$('#js_overlay').css('top','0');$('#js_overlay').css('left','0');}
else
{$('#js_overlay').hide();}}
function changeEmbedSize(parameter)
{if(parameter==0)
{$('#chat_container').css('height','480px');}
else if(parameter==1||parameter==2)
{$('#chat_container').css('height','630px');}
else if(parameter==3)
{$('#chat_container').css('height','550px');}
else if(parameter==4)
{$('#chat_container').css('height','520px');}
else if(parameter>=5&&parameter<=8)
{$('#chat_container').css('height','630px');}
else if(parameter>8)
{$('#chat_container').css('height','740px');}}
function popPreview(url)
{var preview=window.open(url,url,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=700');return false;}
$(document).ready(function()
{$('#globalSearchBox').focus(function(){$('#globalSearchBox').css('opacity',1);});$('#globalSearchBox').blur(function(){$('#globalSearchBox').css('opacity',.45);});$('#globalSearchBox').css('opacity',.45);});function tcinit()
{}
function hovercards()
{var s=document.createElement('script'),e=document.getElementsByTagName('script')[0];s.src=root_url+"public/js/jquery.qtip.js";s.type='text/javascript';s.async=true;if(e){e.parentNode.insertBefore(s,e);}
$('.hovercard').each(function()
{$(this).qtip({content:{url:root_url+'api/hovercard.php?username='+$(this).attr('rel')},show:'mouseover',hide:{fixed:true,delay:50},position:{corner:{target:'topMiddle',tooltip:'bottomMiddle'}},style:{background:'#fff',tip:true,name:'blue',border:{width:2,radius:5},width:230}});});}
$(document).ready(tcinit);function delete_status(id)
{if(typeof context!='undefined'&&context=='private'){return false;}
$.post(root_url+'api/remove_status.php',{status:id},function(result)
{if(result=='true')
{if(typeof inSingleStatus!='undefined'&&inSingleStatus==true)
{window.location=root_url;}
$('.status_row').each(function()
{if($(this).attr('rel')==id&&!$(this).hasClass('is_pm'))
{$(this).fadeOut(function(){$(this).remove();});}});}});return false;}
function select_language(lang)
{$.post(root_url+'api/select_lang.php',{lang:lang},function(result)
{if(result.indexOf("tinychat.com")>=0)
{var url=window.location.toString();url=url.replace(window.location.host,result);window.location=url;}});return false;}
function checkProxy()
{if(typeof ANCHORFREE_VERSION!="undefined")
{$('#container').html("<div class='errorAlert' style='padding: 30px;'>"+locale['proxy_detected']+"</div>");$('#userlinks').html('');}}
var menu_open=false;$(document).ready(function()
{checkProxy();setTimeout(checkProxy,1000);$('.ui_menu_container').click(function()
{$(this).addClass('selected');var obj=this;window.setTimeout(function()
{var close=function()
{$(obj).removeClass('selected');window.setTimeout(function()
{$(document).unbind('click.menuClose');$(obj).unbind('click.menuClose');},0);}
$(document).bind('click.menuClose',close);$(obj).bind('click.menuClose',close);},0);});var menu_toggle=function()
{if(menu_open)
{$('#userDropdown').hide();$('#user_button').removeClass('active');}
else
{$('#user_button').addClass('active');$('#userDropdown').slideDown();$('#userDropdown').css('width',$('#user_button').width()+19);window.setTimeout(function()
{$(document).bind("click.menuClick",function()
{$(document).unbind('click.menuClick');menu_toggle();});});}
menu_open=!menu_open;};$('#user_button').click(menu_toggle);});function sign_up(open)
{if(open)
{$('#js_overlay').hide();$('#sign_up').remove();}
else
{$('#js_overlay').hide();$('#login').remove();$.get(root_url+"start.php",{random:new Date().getTime()},function(data){var data="<div id='sign_up'>"+data+"</div>";jsOverlay(true);$("#js_html").append(data);window.scroll(0,0);$('#sign_up').centerOnScreen();});return false;}}
function login(open)
{if(open)
{jsOverlay(false);$('#login').remove();}
else
{jsOverlay(false);$('#sign_up').remove();$.get(root_url+"login",{random:new Date().getTime()},function(data){var data="<div id='login'>"+data+"</div>";jsOverlay(true);$("#js_html").append(data);window.scroll(0,0);$('#login').centerOnScreen();});return false;}}
(function($){$.fn.defaultValue=function(val)
{if($(this).val()=="")
{$(this).val(val);}
$(this).data("defaultValue",val);$(this).focus(function()
{if($(this).val()==val)
{$(this).val("");}});$(this).blur(function()
{if($(this).val()=="")
{$(this).val(val);}});}})(jQuery);

function beta_client(enable)
{
	$.post(root_url + "api/beta_client.php", {enable: enable ? "true" : "false"}, function(result)
	{
		if(result == "ok")
		{
			window.location.reload();
		}
	});
}


//Frame Breaker
$(document).ready(function()
{
	if(parent.location != location && parent.location.href.indexOf("tinychat.com") === false)
	{
		parent.location.href = document.location.href ;
	}

});

