
var popupWnd=null;var rulezShown=0;function doPopup(xs,ys,url,resizable)
{if(popupWnd!=null&&!popupWnd.closed&&popupWnd.focus)popupWnd.focus();if(xs<=0||xs>window.screen.width-20)xs=window.screen.width-20;if(ys<=0||ys>window.screen.height-60)ys=window.screen.height-60;x=window.screen.width;y=window.screen.height;if(x!=0&&y!=0){x=(x-(xs+20))/2;y=(y-(ys+60))/2;}
coords=",screenx="+100+",screeny="+50+",left="+100+",top="+50;popupWnd=window.open(url,"gameplayer","dependent=yes,toolbar=no,directories=no,menubar=no,width="+xs+",height="+ys+",scrollbars=yes,resizable="+(resizable?"yes":"no")+coords);popupWnd.focus();}
function doPopupRulez()
{rulezShown=1;doPopup(812,600,"rulez.php?popup=1",true);}
function doPopupAbuse(link)
{doPopup(450,300,"abuse_add.php?"+link,true);}
function doPopupMpoll(mpoll,view)
{doPopup(400,500,"mpoll.php?mpoll_id="+mpoll+(view>0?'&view=1':''),true);}
function img_over(obj,file)
{obj.old_src=obj.src;obj.src=file;}
function img_out(obj)
{obj.src=obj.old_src;}
var image_load_obj=new Array();var image_load_cnt=new Array();function img_onload(id,max_w)
{img=getHtmlElement('imgLoad'+id);xsrc=img.getAttribute('xsrc');if(xsrc=='')return;if(xsrc.indexOf('_file.php?')>0)xsrc=xsrc+'&xsrc';obj=image_load_obj[id];if(obj==null)
{obj=new Image();obj.src=xsrc;image_load_obj[id]=obj;image_load_cnt[id]=0;}
if(!obj.complete)
{count=0+image_load_cnt[id];if(count<20)
{image_load_cnt[id]=count+1;setTimeout('img_onload('+id+','+max_w+')',(count?1500:500));return;}
else
{img.setAttribute('xsrc','');img.src='/gfx/img_error.gif';img.style.width='14px';img.style.height='14px';return;}}
max_h=max_w*0.75;new_w=obj.width;new_h=obj.height;if(new_w>max_w||new_h>max_h)
{ratio_w=(new_w/max_w);ratio_h=(new_h/max_h);if(ratio_w>ratio_h)
{new_w=max_w;new_h=(new_h*(1/ratio_w));}
else
{new_w=(new_w*(1/ratio_h));new_h=max_h;}}
if(new_w&&new_h)
{img.setAttribute('xsrc','');img.src=xsrc;img.style.width=parseInt(new_w)+'px';img.style.height=parseInt(new_h)+'px';}
else
{img.setAttribute('xsrc','');img.src='/gfx/img_error.gif';img.style.width='14px';img.style.height='14px';}}
function img_onerror(img)
{img.setAttribute('xsrc','');img.src='/gfx/img_error.gif';img.style.width='14px';img.style.height='14px';}
function formTrim(field)
{field.value=field.value.replace(/[ ]/g,' ');field.value=field.value.replace(/(^\s*)|(\s*$)/g,'');}
function formUpperCase(field)
{field.value=field.value.toUpperCase();}
function formLowerCase(field)
{field.value=field.value.toLowerCase();}
function getHtmlElement(id)
{return(document.getElementById?document.getElementById(id):(document.all?document.all[id]:null));}
function getHtmlStyle(element)
{return element.style;}
function vh_slide(id,speed)
{if($('#'+id).is(":hidden"))
$('#'+id).slideDown(speed);else
$('#'+id).slideUp(speed);}
function vh_fade(id,speed)
{if($('#'+id).is(":hidden"))
$('#'+id).fadeIn(speed);else
$('#'+id).fadeOut(speed);}
function vh(id)
{elemObj=getHtmlElement(id);styleObj=getHtmlStyle(elemObj);if(styleObj.display=='block')
{styleObj.display='none';return false;}
else
{styleObj.display='block';return true;}}
function vhPm(pm_id)
{elemObj=getHtmlElement('pm'+pm_id);if(elemObj==null)return;styleObj=getHtmlStyle(elemObj);if(styleObj.display=='block')
{styleObj.display='none';return false;}
else
{styleObj.display='block';unread=elemObj.getAttribute('unread');if(unread!=null&&unread!='')
{elemObj.removeAttribute('unread');iconObj=getHtmlElement('icon'+pm_id);iconObj.title='Läst';iconObj.src='pm_read.php?pm_id='+pm_id;}
return true;}}
function go_to(url)
{window.location=url;}
var videoWnd;function videoplayer(publication_id,width,height)
{if(videoWnd!=null&&!videoWnd.closed&&videoWnd.focus)videoWnd.focus();xs=width+500;ys=height+208;if(xs>window.screen.width-20)xs=window.screen.width-20;if(ys>window.screen.height-60)ys=window.screen.height-60;x=window.screen.width;y=window.screen.height;if(x!=0&&y!=0){x=(x-(xs+20))/2;y=(y-(ys+60))/2;}
coords=",screenx="+x+",screeny="+y+",left="+x+",top="+y;videoWnd=window.open("videoplayer.php?publication_id="+publication_id+"","gptv","scrollbars=no,menubar=no,width="+xs+",height="+ys+",resizable=yes,toolbar=no,location=no,status=no,titlebar=no"+coords);videoWnd.focus();}
function do_download(arg,type)
{url='';if(type==0)
url='game_file.php?file_id='+arg;else if(type==1)
url='http://data.gameplayer.se/videodownload.php?fc='+arg;doPopup(800,600,url,true);}
function enableSubmit(id)
{$("#"+id).slideDown();}