$(document).ready(function(){


	//$(".morebtn").button();
	
	$("#socicons p").hover(
			  function () {		$(this).animate({ 	opacity: 1		}, 300 );	 },
			  function () {		$(this).animate({ 	opacity: 0.3	}, 300 );	 }
			);
	
	$("#dateprevicon, #datenexticon").hover(
			  function () {		$(this).animate({ 	opacity: 1		}, 300 );	 },
			  function () {		$(this).animate({ 	opacity: 0.5	}, 300 );	 }
			);
	
	$(".lngs").hover(
			  function () {	$(this).addClass("lngs_sel"); 	 },
			  function () {	$(this).removeClass("lngs_sel"); }
			);
	
	$(".topmenu").hover(
			  function () {	$(this).addClass("topmenu_sel"); 	},
			  function () {	$(this).removeClass("topmenu_sel"); }
			);
			
	$(".rightmenu").hover(
			  function () {	$(this).addClass("rightmenu_sel");		},
			  function () {	$(this).removeClass("rightmenu_sel");   }
			);		
	
	
	$("#homeico").hover(
			  function () {	$(this).attr('src', rootPath+'/pic/xar/home_over.gif')	},
			  function () {	$(this).attr('src', rootPath+'/pic/xar/home.gif')		}
			);	
	
	
	
	
	/* correcting other headline heights */
	$(".headlineright").each(function(index) {		
		$(this).parent().height($(this).innerHeight()+16);								  
	})
	
	/* correcting other headline heights */
	$(".headlinetopnews").each(function(index) {		
		$(this).parent().height((($(this).innerHeight()+16)>$(this).parent().innerHeight())?($(this).innerHeight()+16):$(this).parent().innerHeight());								  
	})
	
	/* correcting right panel height */
	if($("#sitebody").innerHeight()>$("#rightpanel").innerHeight()) 
		$("#rightpanel").height($("#sitebody").innerHeight()+20);
	
	get_partnernews();
	get_currency();
	get_weather();	
});

function get_currency()	{
	$.post(rootPath+"/ajaxcore.php", {curlang:curLang, xdo:"currency"},
	  function(data){
		$('#currency').html(data);
	  });		
}

function get_weather()	{
	$.post(rootPath+"/ajaxcore.php", {curlang:curLang, xdo:"weather"},
	  function(data){
		$('#topweather').html(data);
	  });		
}




function doVote()	{
	
	checkedId=$('form[name=voteform] input:radio:checked').val();
	
	if(checkedId) {
		loading('show', 'voting');
		$.post(rootPath+"/ajaxcore.php", {curlang:curLang, xdo:"voting", xaction:'dovoting', ids:checkedId},
		  function(data){
			$('#voting').html(data);
			loading('hide', 'voting');
		  });		
	}
	
}
// loads an other poll
function otherPolls(curId)	{
	loading('show', 'voting');
	$.post(rootPath+"/ajaxcore.php", {curlang:curLang, xdo:"voting", xaction:'otherpoll', curpollid:curId},
	  function(data){
		  $('#voting').html(data);
			loading('hide', 'voting');
	  });		
}

// show poll result
function pollResults(pId)	{
	loading('show', 'voting');
	$.post(rootPath+"/ajaxcore.php", {curlang:curLang, xdo:"voting", xaction:'pollresult', pid:pId},
	  function(data){
		  $('#voting').html(data);
			loading('hide', 'voting');
	  });		
}


function loading(act, container)	{

	if(act=='show') {
		
		$('#'+container).prepend('<div class="loadingDiv"></div>');
		var loadDiv=$('#'+container+' > .loadingDiv');
		
		var h=$('#'+container).innerHeight();
		var w=$('#'+container).innerWidth();
		
		loadDiv.css({"visibility":"visible", 'height':h, 'width':w});	
		
	}
	
	if(act=='hide')	{
		$('#'+container+' > .loadingDiv').remove();
	}
	
}






