function getLoader(divId,bool)
{
    var loaderMini = new dl.loader();
    if(bool==1)
    {
        loaderMini.init(
            {
                'wrapperId':divId,
                'position':'global',
                'content':'&nbsp;'
            }
        );
    }
    else
    {  
        loaderMini.close();
    }
}  

function checkUserSession()
{
    dl.send(
    {
        url :liveSite + "/objects/authorize/checkSession.php?part=frontend",
        method:'GET',
        success : function(responce)
        {
            if (response=='0')
            {
                var urlLogout = liveSite + "/index2.php?obj=authorize&task=setLogoutSession";
                redirectUrl(urlLogout);
            }
        }
    });
}

function windowOpen(url,title,width,height)
{
    if (typeof(width)=="undefined") width = 800;
    if (typeof(height)=="undefined") height = 600;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    newwindow=window.open(url,title,'left='+left+',top='+top+',height='+height+',width='+width);
    if (window.focus) {newwindow.focus()}
    return false;
}

function showLightImage(idCont)
{
    lightbox.init(
    {
        'id':'lightBox',
        'wrapper':'shadowBox',
        'slideStep':30,
        'slidePause':0,
        /*'width':'200px',*/
        'content':idCont,
        'events':function()
        {
        
        }                
    });
}

function showMap(idCont,idContact)
{
    lightbox.init(
    {
        'id':'lightBox',
        'wrapper':'shadowBox',
        'slideStep':30,
        'slidePause':0,
        'width':'462px',
        'height':'390px',
        'content':idCont,
        'events':function()
        {        
            var map = new GMap2(document.getElementById("gMap"));
            map.setCenter(new GLatLng(40.962450,-74.597250),18);
            map.addControl(new GLargeMapControl());
            var mapControl = new GMapTypeControl();
            map.addControl(mapControl);

            var baseIcon = new GIcon();
            baseIcon.iconSize = new GSize(135, 65);
            baseIcon.iconAnchor = new GPoint(0, 0);
            baseIcon.infoWindowAnchor = new GPoint(135, 65);
            function createMarker(point, index) 
            {
                var letteredIcon = new GIcon(baseIcon);
                letteredIcon.image = liveSite+"/templates/default/images/marker.png";
                markerOptions = { icon:letteredIcon };
                var marker = new GMarker(point, markerOptions);
                return marker;
            }
            var latlng = new GLatLng(40.962650,-74.597600);
            map.addOverlay(createMarker(latlng, 0));
        }                
    });
}

function showMasBox(curA, id)     
{ 
    var a = document.getElementById('tabs').getElementsByTagName("LI");
    var b = document.getElementById('tabsBlock').getElementsByTagName("DIV");
    for (var i=0; i<a.length; i++)
    {
       if (a[i].className=='active') a[i].className = '';    
    }
    curA.className += 'active';
    
    for (var i=0; i<b.length; i++)
    {
        if(b[i].style.display == 'block') b[i].style.display = 'none';
    }
    document.getElementById('tab_'+id).style.display = 'block';
}
