﻿var Type = 'Z';
function StartFloat() 
{
    f = Get_Cookie('AdminFloater');
    //
	if(document.all) 
	{
	    switch(f)
	    {
	        case 'Left':
	            document.all.AdFloater.style.pixelLeft = 1;
	            break;
	        default :
		        document.all.AdFloater.style.pixelLeft = document.body.clientWidth - document.all.AdFloater.offsetWidth;
		};
		document.all.AdFloater.style.visibility = 'visible';
		Type = 'A';
	}
	else if(document.layers) 
	{
		document.AdFloater.left = window.innerWidth - document.AdFloater.clip.width - 16;
		document.AdFloater.visibility = 'show';
		Type = 'B';
	}
	else if(document.getElementById) 
	{
	    w = document.getElementById('AdFloater').offsetWidth + 16;
	    switch(f)
	    {
	        case 'Left':
	            document.getElementById('AdFloater').style.left = 1;
	            break;
	        default :
	            document.getElementById('AdFloater').style.left = (window.innerWidth - w) + 'px';
	    };
		document.getElementById('AdFloater').style.visibility = 'visible';
		Type = 'C';
	}
	if (document.all) { window.onscroll = Float; }
	else { setInterval('Float()', 100); }
}

function Float() 
{
	if (Type == 'A') 
	{ 
		document.all.AdFloater.style.pixelTop = document.documentElement.scrollTop; 
	}
	else if (Type == 'B') 
	{ 
	    document.AdFloater.top = window.pageYOffset; 
	}
	else if (Type == 'C') 
	{ 
	    document.getElementById('AdFloater').style.top = window.pageYOffset + 'px'; 
	}
} 
function LeftAlignFloat()
{
    Set_Cookie('AdminFloater', 'Left', '1', '/', "", "" );
 	if (Type == 'A') 
	{ 
        document.all.AdFloater.style.pixelLeft = 1;
    };
    if (Type == 'B') 
	{ 
	    document.AdFloater.left = 1;
	};
	if (Type == 'C') 
    { 
        document.getElementById('AdFloater').style.left = '1px';
	};
}
function RightAlignFloat()
{
    Set_Cookie('AdminFloater', 'Right', '1', '/', "", "" );
    if (Type == 'A') 
	{ 
        document.all.AdFloater.style.pixelLeft = document.body.clientWidth - document.all.AdFloater.offsetWidth;
    };
    if (Type == 'B') 
	{ 
	    document.AdFloater.left = window.innerWidth - document.AdFloater.clip.width - 16;
	};
	if (Type == 'C') 
    { 
        w = document.getElementById('AdFloater').offsetWidth + 16;
		document.getElementById('AdFloater').style.left = (window.innerWidth - w) + 'px';
	};    
}