function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

$(document).ready(function(){

	// RSS Telecom headlines
	$('ul#rss-headlines').innerfade({ 
		animationtype: 'fade',
		speed: 750,
		timeout: 4000,
		type: 'random'
	});

			
	// Slide up home banner index2
	if($('div#banner_talkpool').length)
	{
		
		$(".btn-slide").click(function()
		{
			$("div#banner_talkpool").slideToggle("slow");
			$(this).toggleClass("hidden");
			
			if($(this).html() == 'show banner')
			{
				createCookie('banner_state','visible',1);
				$(this).html('hide banner');
			}
			else {
				createCookie('banner_state','hidden',1);
				$(this).html('show banner');
			}
		});
	}
	
	// TalkPool Clients
	$("#slider").easySlider({
		auto: true, 
		continuous: true,
		numeric: false
	});
		
	// Countries
	$('a.country-default').click(function(){
		$('ul.country-menu').slideToggle('medium');
    });
    
    // IE6 warning
    if($.browser.msie && $.browser.version == '6.0') { ie6Notice(); }
    
    // Tabs
    if($('#tabMenu').length)
    {
		$('#tabMenu > li').click(function()
		{		    
			$('#tabMenu > li').removeClass('selected');
			$(this).addClass('selected');
			
			$('.boxBody div').slideUp('1500');
			//Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
			$('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');
		});
    }
    
    // vacancies sidebar
    if($('div.vacature').length)
    {
    	$('div#sidebar div.vacature:last').addClass('last');
    }
        
});
