function is_int(s){return!isNaN(parseInt(s));}
window.size=function()
{var w=0;var h=0;if(!window.innerWidth)
{if(!(document.documentElement.clientWidth==0))
{w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}
else
{w=document.body.clientWidth;h=document.body.clientHeight;}}
else
{w=window.innerWidth;h=window.innerHeight;}
return{width:w,height:h};}
window.center=function()
{var hWnd=(arguments[0]!=null)?arguments[0]:{width:0,height:0};var _x=0;var _y=0;var offsetX=0;var offsetY=0;if(!window.pageYOffset)
{if(!(document.documentElement.scrollTop==0))
{offsetY=document.documentElement.scrollTop;offsetX=document.documentElement.scrollLeft;}
else
{offsetY=document.body.scrollTop;offsetX=document.body.scrollLeft;}}
else
{offsetX=window.pageXOffset;offsetY=window.pageYOffset;}
_x=((this.size().width-hWnd.width)/2)+offsetX;_y=((this.size().height-hWnd.height)/2)+offsetY;return{x:_x,y:_y};}
function reDirMemberList(choose,path)
{switch(choose)
{case"view":window.location=path+"view.html";break;case"moderators":window.location=path+"moderators.html";break;case"users":window.location=path+"users.html";break;case"banned":window.location=path+"banned.html";break;}}
function clearTextField(id){document.getElementById(id).value='';}
function showMessage(content){var msgBox=$("#message");var pos=window.center({width:300,height:50});msgBox.css({top:pos.y,left:pos.x,display:'block',visibility:'visible'}).html(content);setTimeout("hideMessage()",5000);}
function hideMessage(){$("#message").css({display:'none',visibility:'hidden'}).html('');}
function getElementTop(Elem)
{if(document.getElementById){var elem=document.getElementById(Elem);}else if(document.all){var elem=document.all[Elem];}
yPos=elem.offsetTop;tempEl=elem.offsetParent;while(tempEl!=null){yPos+=tempEl.offsetTop;tempEl=tempEl.offsetParent;}
return yPos;}
function getElementLeft(Elem)
{var elem;if(document.getElementById){var elem=document.getElementById(Elem);}else if(document.all){var elem=document.all[Elem];}
xPos=elem.offsetLeft;tempEl=elem.offsetParent;while(tempEl!=null){xPos+=tempEl.offsetLeft;tempEl=tempEl.offsetParent;}
return xPos;}
var IE=document.all?true:false
var mouseX=0;var mouseY=0;function getMouseXY(e){if(IE)
{mouseX=event.clientX+document.body.scrollLeft;mouseY=event.clientY+document.body.scrollTop;}
else
{mouseX=e.pageX;mouseY=e.pageY;}
if(mouseX<0){mouseX=0}
if(mouseY<0){mouseY=0}
return true;}
function confirmRemove(url){if(confirm('Removing user. Are you sure?')){window.location=url;}}
var blinkingError={maxBlinks:6,Blinks:0,State:0,Frequency:4,TextInput:null,ValueStr:null,ErrorStr:null,Inter:null,TextStyleColor:null,ErrorStyleColor:"#ff0000",ErrorStyleBold:true,InputClassName:"fontWeightNormal",ErrorClassName:"fontWeightBold",TriggerObj:null,Start:function(error,obj,button_obj){blinkingError.Blinks=0;blinkingError.State=0;blinkingError.ValueStr=obj.value;blinkingError.ErrorStr=error;blinkingError.TextInput=obj;blinkingError.TextStyleColor=obj.style.color;blinkingError.TriggerObj=button_obj;button_obj.disabled=true;var IntervalMethod=function(){blinkingError.Blinking();}
blinkingError.Inter=setInterval(IntervalMethod,Math.round((1/blinkingError.Frequency)*1000));},Blinking:function(){if(blinkingError.Blinks<blinkingError.maxBlinks){blinkingError.TextInput.value=blinkingError.Animate(blinkingError.Blinks,blinkingError.State);}
else{blinkingError.Stop();}},Animate:function(b,s){if(s==0){if(blinkingError.ErrorStyleBold==true){blinkingError.TextInput.className=blinkingError.ErrorClassName;}
blinkingError.TextInput.style.color=blinkingError.ErrorStyleColor;blinkingError.State=1;return blinkingError.ErrorStr;}
if(s==1){blinkingError.State=0;blinkingError.Blinks+=1;return"";}},Stop:function(){clearInterval(blinkingError.Inter);blinkingError.Inter=null;blinkingError.TextInput.value=blinkingError.ValueStr;blinkingError.TextInput.style.color=blinkingError.TextStyleColor;blinkingError.TextInput.className=blinkingError.InputClassName;blinkingError.TriggerObj.disabled=false;}};var enter_targets={possibleTargetsIds:['video_list_new','video_edit','add2list_new_list','ql_add2list_new_list'],possibleTriggersIds:['video_list_new_create_button','video_edit_button','add2list_new_list_ok_button','ql_add2list_new_list_ok_button'],searchedIndex:null,allowedTarget:function(obj){function equals(a,b){return(a===b);}
for(var i in this.possibleTargetsIds)
{if(equals(this.possibleTargetsIds[i],obj.id))
{this.searchedIndex=i;return true;}}
this.searchedIndex=null;return false;},triggerAction:function(){if(this.searchedIndex==null){return false;}
var el=document.getElementById(this.possibleTriggersIds[this.searchedIndex]);el.click();}};function handleEnterKey(event){var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;if(keyCode==13)
{var target=event.target||event.srcElement;if(enter_targets.allowedTarget(target)){enter_targets.triggerAction();}
return false;}
if(!(keyCode<32||(keyCode>=37&&keyCode<=40)||(keyCode>=48&&keyCode<=57))){return false;}
return true;}
function getCookie(name){var start=document.cookie.indexOf(name+"=");var len=start+name.length+1;if((!start)&&(name!=document.cookie.substring(0,name.length))){return null;}
if(start==-1)return null;var end=document.cookie.indexOf(';',len);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(len,end));}
function SetCookie(cookieName,cookieValue,nDays,path){var today=new Date();var expire=new Date();if(nDays==null||nDays==0)nDays=1;expire.setTime(today.getTime()+3600000*24*nDays);document.cookie=cookieName+"="+escape(cookieValue)
+";expires="+expire.toGMTString()
+';path='+path
+';domain='+cookie_domain}
function getVisitorsTimezone()
{var visitortime=new Date();if(visitortime){timeOffset=-(visitortime.getTimezoneOffset()*60);SetCookie('t_offset',timeOffset,10,'/');}}
function html_entity_decode(string){return $("<textarea/>").html(string).val()}
function htmlentities(s){var div=document.createElement('div');var text=document.createTextNode(s);div.appendChild(text);return div.innerHTML;}
function toggle_description(state)
{if(state==1)
{$("#desc_whole").show();$("#desc_short").hide();}
else
{$("#desc_whole").hide();$("#desc_short").show();}}
function trim_last_characters(str,numchars){new_str=str.substr(0,(str.length-parseInt(numchars)));return new_str;}
function select_redirect(select){if(select==null){return;}
var str=window.location.href;if(select.id.match(/channel_filter/)){str=str.replace(/(\?ch=[0-9]+)|(&ch=[0-9]+)/g,"");if(0==parseInt(select.value)){window.location=str;return;}
else{window.location=str+'?ch='+select.value;}}
if(select.id.match(/category_filter/)){str=str.replace(/(\?cat=\d+)|(&cat=\d+)/g,"");if(0==parseInt(select.value)){window.location=str;return;}
else{window.location=str+'?cat='+select.value;}}}
function hoverBrowserList(obj,click){if(obj.className=="normal"){obj.className="hover";}
else if(obj.className=="hover"){obj.className="normal";}
if(click){var a=obj.getElementsByTagName('a');window.location=a[0].href;return;}}