function pengerSize() {
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	}
	
	$("#okvir_hold").css({'height' : myHeight});
	
	
	var holdd = document.getElementById('okvir');
	var holddw = holdd.offsetHeight; //sirina sajta
	
	if (myHeight > holddw) {
		var sredina = (myHeight-holddw)/2;
	} else {
		sredina = 100;
	}
	
	      $("#cv_img").click(function () {
        $("#cv_img_BS").fadeIn("slow");
      })
		 $(".close, #hold_back").click(function () {
        $("#cv_img_BS").fadeOut("slow");
      })
	$("#okvir").css({'padding-top' : sredina});
	$("#hold").css({'margin-top' : sredina+20});
	
	//window.alert(sredina);
  
}




function lightview_options(pagewidth, page) {
	
	pagewidth = 725;
	
	var d = document.getElementById('okvir_hold');
  	var dh = d.offsetHeight;
  
  	$("#hold_back").css({'height' : dh, 'opacity' : 0.2});	
	
	var margin_left = -pagewidth/2;

	$("#hold").css({'width' : pagewidth-0, 'margin-left' : margin_left});
	$(".close").css({'margin-left' : pagewidth-50});
	
 	$("#hold_back").fadeIn("slow");
	$("#hold").fadeIn("slow");
	
	//$('body').css('overflow', 'hidden');
	
	$.getScript("java/jquery.ajax.js", function(){
		$('#load_ajax').load(page);			
	});
  
}


PEPS = {};
      
PEPS.rollover =
{
 init: function()
 {
	this.preload();
	
	$(".ro").hover(
	   function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
	   function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
	);
 },
 
 preload: function()
 {
	$(window).bind('load', function() {
	   $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
	});
 },
 
 newimage: function( src ) { return src.substring( 0, src.search(/(\.[a-z]+)/) ) + '_o' + src.match(/(\.[a-z]+)/)[0]; },
 oldimage: function( src ){ return src.replace(/_o/, ''); }
};


$(document).ready(function(){
	
	pengerSize()
	
	PEPS.rollover.init();

	//zatvara lightview
	$('.close, #hold_back')
	.click(function(){
		$("#hold_back").fadeOut("slow");
		$("#hold").fadeOut("slow");
		$('body').css('overflow', 'auto');
	});
	
	//lightbox
	$('#galerija a').lightBox();
	
	//lightview_options('', 'ja_sve_upropastim.html')


});





