$(document).ready(function(){
		h=$('.contentitem').height(); if (h>0) TOPPAD=TOPPADO+TOPPADS+h;
			main_boxes.init();
						   });
$(window).load(function(){
		h=$('.contentitem').height(); if (h>0) TOPPAD=TOPPADO+TOPPADS+h;
			main_boxes.init();

			 $('.footer').css('visibility','visible');
			 $('#footerbar').css('top',$(document).height()+150);
			cibvsjsf.init();
				window.setTimeout("checkRightBoxes()",200);
			
	$(window).resize(function(){
		h=$('.contentitem').height(); if (h>0) TOPPAD=TOPPADO+TOPPADS+h;
				window.setTimeout("checkRightBoxes()",200);
				window.setTimeout("shiftPosition()",200);
				window.setTimeout("setFooter()",200);
				window.setTimeout("checkRightBoxes()",200);
			});
		});


var cibvsjsf = {
init: function() {
      },

submitSearchForm: function (form,urlForSearch)
		  {
			  var input=$("#q").val();
			  var query=encodeURIComponent(input.replace(/-/g,'%2D').replace(/ /g,'-').replace(/\//g,'#2F'));
			  urlForSearch=[urlForSearch,query].join('/').replace('//','/');
			  ionseClick('cibvs2','internal-search',input);
			  location.href=urlForSearch ;return false;
		  }

};

function r1pSelectAll(id)
{
	document.getElementById(id).focus();
	document.getElementById(id).select();
}



function setFooter(){
		$('#footerbar').css('top',0);
		$('#footerbar').css('top',$(document).height()+150);
	}



var main_boxes={
	nr_items : 0,
	init : function(){
			main_boxes.nr_items=$('#container>.item').length;
			$('#container>.item').each(function(i){
									$(this).attr('id','item_'+i);
									$(this).find('a').attr('title','');
									if(i==main_boxes.nr_items-1){
										shiftPosition(i);
										}
									});
			checkRightBoxes();	
		}
}

Array.max = function(array){
   		 return Math.max.apply( Math, array );
		}; 
var leftpos=[];
function checkBlogStyle(){
		maxLeft=Array.max(leftpos);
		$('.blogstyle').css({ width: maxLeft-19 });
		}

function checkRightBoxes(){
		h=$('.contentitem').height(); if (h>0) TOPPAD=TOPPADO+TOPPADS+h;
		maxLeft=Array.max(leftpos);
		$('.blogstyle').css({ width: maxLeft-19 });
		
			$('#nav_top_right').css('left',maxLeft-32);
		leftpos=[];
}



