$(document).ready(function()
{      
    
    $('.large_col img').each(function()
    {
        var sFloat = $(this).css('float');  
        
        if(sFloat == 'left')
        {
            $(this).css('margin-right', '10px');
        } 
        else if(sFloat == 'right')
        {
            $(this).css('margin-left', '10px');
        }  
    });
    
    $('.large_col a.colorbox').each(function()
    {
        if($(this).attr('rel') == '')
        {
            $(this).attr('rel','colorbox'); 
        }
    });

    $('a.external').each(function()
    {
        $(this).attr('target', '_blank');
    }); 
    
    $('a').click(function()
    {
        var sHref = $(this).attr('href'); 

        if(sHref.substring(0,7) == 'http://' || sHref.substring(0,8) == 'https://' || sHref.substring(0,9) == '/uploads/' || sHref.substring(0,12) == '/images/fck/')
        {     
            $(this).attr('target', '_blank');
        
            $.ajax(
            {
                type: "POST",
                url: "/nl/ajax/redirect/",
                data: "url=" + sHref,
                success: function()
                {
                    //alert('succes!');          
                }
            });           
        }       
    }); 
    
    $('a.colorbox').colorbox();                                             
    
});

function showHide(id)
{
	oElement = document.getElementById(id);
	
	if(oElement.style.display == 'block')
	{
		oElement.style.display = 'none';
	}
	else
	{
		oElement.style.display = 'block';
	}
}

startList = function()
{
	if (document.all&&document.getElementById)
	{
		navRoot = document.getElementById("menu");
		for (i=0; i<navRoot.childNodes.length; i++)
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI")
			{
				node.onmouseover=function()
				{
					this.className+=" over";
			  	}
			  	node.onmouseout=function()
			  	{
			  		this.className=this.className.replace(" over", "");
			   	}
			}
		}
	}
}

function replaceUrl()
{
	var arr = document.getElementsByTagName('a');
	
	for (i = 0; i < arr.length; i++)
	{
		menuClass = false;
		
		classArray = arr[i].className.split(" ");
		
		for(a = 0; a < classArray.length; a++)
		{
			if(classArray[a] != 'menu')
			{
				menuClass = false;
			}
            if(classArray[a] == 'menu')
            {
                menuClass = true;
            }
        }
		
		if(menuClass == false)
		{
			arr[i].href = 'redirect.php?link=' + arr[i].href;
		}
	}
}

function init()
{
	startList();
	//replaceUrl();
}

window.onload=init;

$(document).ready(function()
{
    $('#image_rotator').innerfade(
    {
        speed: 750,
        timeout: 4000
    }); 
});
