var lan;
function revert(){
document.cookie = 'lang=; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/';
location.reload(true);
}


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;
}


lan=readCookie('lang');

function trans(){
$('#translateit').translate( lan, {
not: 'select, pre'
})
}


$(document).ready(function(){
$.getScript('javascript/jquery.translate-1.3.2.min.js', function()
{ 
$.translate(function(){

if(lan)
	trans()

/*$('#trans2').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','fr', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){$('#translationProgress').hide()}
});

})

$('#trans3').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','de', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){$('#translationProgress').hide()}
});

})

$('#trans4').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','sv', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=sv; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})


$('#trans5').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','it', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=it; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans6').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','nl', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=nl; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans7').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','es', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=es; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans8').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','fr', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=fr; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans9').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','zh', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=zh; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans10').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','de', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=de; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans11').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','de', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=de; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})

$('#trans12').click(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre',
start:function(){$('#translationProgress').show()}
})

.translate( 'en','cs', {
not: 'select, pre',
async:  true,
toggle: true,
walk: false,
complete: function(){document.cookie = 'lang=cs; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',$('#translationProgress').hide()}
});

})*/

$('#trans4').click(function(){
document.cookie = 'lang=fr; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans5').click(function(){
document.cookie = 'lang=de; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans6').click(function(){
document.cookie = 'lang=it; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans7').click(function(){
document.cookie = 'lang=fr-be; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans8').click(function(){
document.cookie = 'lang=fr-ch; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans9').click(function(){
document.cookie = 'lang=sv; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans10').click(function(){
document.cookie = 'lang=es; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans11').click(function(){
document.cookie = 'lang=nl; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

$('#trans12').click(function(){
document.cookie = 'lang=ja; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})
$('#trans13').click(function(){
document.cookie = 'lang=es; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})
$('#trans14').click(function(){
document.cookie = 'lang=pt-PT; expires=Thu, 2 Aug 2098 20:00:00 UTC; path=/',
location.reload(true)
})

});
});
});
