function reg_btn_down(btn)
{
    btn.style.backgroundImage = 'url(/images/btn_reg_down.gif)';
}

function reg_btn_up(btn)
{
    btn.style.backgroundImage = 'url(/images/btn_reg.gif)';
}

function absPosition(obj) { 
	var x = y = 0; 
	while(obj) { 
	    x += obj.offsetLeft; 
	    y += obj.offsetTop; 
	    obj = obj.offsetParent; 
	} 
	x += 0;
	y += 0;
	return {x:x, y:y}; 
}

function showM(a)
{
	var d = document.getElementById('d');
	if(d.style.display == 'none')
	{
		d.style.display = 'block';
        if(a)
        {
    		var c = absPosition(a);
    		d.style.top = c.y+15;  
    		d.style.left = c.x;
        }
	}
}

function hideM(id)
{
	document.getElementById('d').style.display = 'none';
}

function checkResolution()
{
    var j = ($('#sm').length > 0 ? 1 : 0);
    
    //alert(document.body.clientWidth);
    var w = 7;
    if(document.body.clientWidth < 1100)
        w = 5;
    else if (document.body.clientWidth < 1200)
        w = 6;
    
    var h = '';
    $('.m').each( function(i ,e) {
        if(i+j > w)
        {
            $(e).hide(); 
            h += $(e).html()+'<br />';
        }   
    }); 
    
    $('#d').html(h);   
}

$(document).ready(function() {
    
    checkResolution();
    $(document).mouseup(function(handler) {
        $("div.p").css('display', 'none');        
    });
});
