InviteMasterObj=function(){

this.CreateLayers=function()
{
document.write('<style type="text/css">');
document.write('#invitemaster_block{position:absolute;top:0px;left:0px;margin:0px;width:640px;height:460px;border:0;display:none;z-index:'+invitemaster_zindex+';}');
document.write('#invitemaster_fader{background-color:#000000;position:absolute;width:100%;height:100%;left:0px;top:0px;right:0px;bottom:0;z-index:'+(invitemaster_zindex-1)+';opacity:0.6;-moz-opacity:0.6;-khtml-opacity:0.6;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60)}');
document.write('</style>');
document.write('<div id="invitemaster_fader" style="display:none;"></div>');
document.write('<div id="invitemaster_block" style="display:none;"></div>');

if(invitemaster_imgtype=="tab"){this.CreateTabLayer()}
}

this.CreateTabLayer=function()
{
var telltab_pos=0;
var invitemaster_tab_image='http://static.invitemaster.ru/images/telltab_'+invitemaster_tab_color+'_'+invitemaster_tab_orientation+'.png';
if(invitemaster_tab_orientation=='left'||invitemaster_tab_orientation=='right'){telltab_img_w=30;telltab_img_h=190}else{telltab_img_w=190;telltab_img_h=30}
if(invitemaster_tab_orientation=='left'){telltab_pos='left:0px;top:'+invitemaster_tab_offset+'px'}
if(invitemaster_tab_orientation=='right'){telltab_pos='right:0px;top:'+invitemaster_tab_offset+'px'}
if(invitemaster_tab_orientation=='top'){telltab_pos='top:0px;left:'+invitemaster_tab_offset+'px'}
if(invitemaster_tab_orientation=='bottom'){telltab_pos='bottom:0px;left:'+invitemaster_tab_offset+'px'}

document.write('<style type="text/css">.invitetab{position:fixed;z-index:'+(invitemaster_zindex-2)+';'+telltab_pos+'}* html .invitetab{position:absolute}</style>\n');
document.write('<div class="invitetab">\n');
document.write('<a href="javascript:void(0);" onclick="InviteMaster.ShowInviteForm();return false;">\n');
document.write('<image src="'+invitemaster_tab_image+'" border="0" alt="расскажи другу о сайте и получи подарок" style="margin:0;padding:0">\n');
document.write('</a></div>');
}

this.getScrollPos=function(){return self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop)}
this.getWindowWidth=function(){return document.compatMode=='CSS1Compat'&&!window.opera?document.documentElement.clientWidth:document.body.clientWidth}
this.getWindowHeight=function(){return window.innerHeight||(document.documentElement && document.documentElement.clientHeight)||(document.body.clientHeight)}

this.ShowInviteForm=function()
{
var invitemaster_url='http://www.invitemaster.ru';
var invitemaster_imgpath='http://static.invitemaster.ru/images';

//if(document.getElementById('invitemaster_block').innerHTML==""){
var invitemaster_contents='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>\n'+
'<td align="left"><a href="'+invitemaster_url+'" target="_blank"><img src="'+invitemaster_imgpath+'/title_w.png" width="260" height="40" border="0"></a></td>\n'+
'<td align="right"><img src="'+invitemaster_imgpath+'//close_w.png" width="35" height="40" alt="close" border="0" onclick="InviteMaster.CloseInviteForm()" style="cursor:pointer"></td></tr></table>\n'+
'<iframe src="'+invitemaster_url+'/widget/'+invitemaster_user+'_'+invitemaster_form+'_'+invitemaster_form_refid+'/?id='+invitemaster_form_linkid+'" style="width:640px;height:460px;border:0;" marginwidth="0" marginheight="0" frameborder="0" align="left">error</iframe>'
document.getElementById('invitemaster_block').innerHTML=invitemaster_contents
//}

var use_fader=1;
if(typeof invitemaster_fader=='string'){if(invitemaster_fader=='off'){use_fader=0}}
if(use_fader==1)
{
document.getElementById('invitemaster_fader').style.top=this.getScrollPos()+'px';
document.getElementById('invitemaster_fader').style.display="block"
}

var tellafriend_block=document.getElementById('invitemaster_block');
tellafriend_block.style.left=Math.round(this.getWindowWidth()/2-320)+'px';
tellafriend_block.style.top=Math.round(this.getWindowHeight()/2-270+this.getScrollPos())+'px';
tellafriend_block.style.display='block';
}

this.CloseInviteForm=function()
{
document.getElementById('invitemaster_block').style.display="none";
document.getElementById('invitemaster_fader').style.display="none";
}

}

var InviteMaster=new InviteMasterObj();
InviteMaster.CreateLayers();

function ShowInviteForm(){InviteMaster.ShowInviteForm()}