
 var pngfixOff = true;
 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
 var cookie_options = { path: '/', expires: 300 };
 
 $(function() {
	afterload("body");
	if(!ajaxOff) { 
		if(location.hash!='') loadIt(location.hash.replace('#',''),'ajax body'); else scrollCenter(activeURL);
	}
	$(window).bind('resize', afterResize); afterResize();
 	if(!ajaxOff) $(window).bind('hashchange', function(){ loadIt(location.hash.replace('#',''),'ajax body'); });
});


function afterResize() {
    $('body').css("display","none"); 
    $('body').css("display","block"); 
    if(($(window).width()>1000)&&($(window).height()>640)) $('body').css('overflow','hidden'); else $('body').css('overflow','auto');
    if(!pngfixOff) DD_belatedPNG.fix('.png_bg, img, *');
}

function afterload(prefix) {
 	$(prefix+' .imgREPLACE').each(function (i) { if($(this).attr('class')!='') {
 		imgname=$(this).attr('class').split(" ")[1];
 		img=imgname.split("*");
 		if(img.length==1) {	$(this).html('<img src="img/'+img[0]+'.png" alt="'+$(this).html()+'"/>'); }
 		if(img.length==3) {	$(this).html('<img src="img/'+img[0]+'.png" style="width:'+img[1]+'px;height:'+img[2]+'px" alt="'+$(this).html()+'"/>'); }
 	}});
 	$(prefix+' a.ajax').each(function (i) { 
	 	if(!ajaxOff) {
 			$(this).attr('href','#'+$(this).attr('href').replace('#','').replace('http://www.antico.cz','')).click(function() { 
 					$(this).attr('onclick'); 
 					loadIt($(this).attr('href').replace('#',''),$(this).attr('class')); 
 			}); 
	 	} else {
		 	$(this).click(function() { return true;	}); 
	 	}
 	});
 	if(!pngfixOff) DD_belatedPNG.fix(prefix+' .png_bg,'+prefix+' img,'+prefix+' *');
	$(prefix+' a.lightbox').lightBox({fixedNavigation:true});
}

function loadIt(url,css) {
	tmpcss=css.split(" ");
	tmpurl=url.split("/"); 
	i=1; while(tmpcss[i-1]!='ajax'&&i<tmpcss.length) i=i+1; 
	for(;i<tmpcss.length;i++) {
		if($('#'+tmpurl[1]+'-'+tmpcss[i]).has('.content').length==1 && $('#'+tmpurl[1]+'-'+tmpcss[i]).has('.content').parent().attr('id')==tmpurl[1]+'-'+tmpcss[i]) temp='#'+tmpurl[1]+'-'+tmpcss[i]+' > .content'; else temp='#'+tmpurl[1]+'-'+tmpcss[i];
		$(temp+' *').remove();
		$(temp).load('/null.php?trg='+tmpcss[i]+'&get='+url,{},function () { afterload('#'+$(this).attr('id')); });
	}
}


function oldBrowser() {
	if((navigator.appName=="Microsoft Internet Explorer") && (parseFloat(navigator.appVersion)<5)) return true;
	else return false;
}

function CorrectIE6(sender) {
	if($(sender).width()>0) {
		$(sender).width($(sender).width()+1);
		$(sender).width($(sender).width()-1);
	}
}

function ChangeMainImg(trg) {
	$('#mainbgimg').attr('src','img.php?file='+encodeURI(trg)+'&crop=true&width=980&height=550').show();
	$('#mainimg').fadeOut(1500,function () { 
		$('#mainbgimg').attr('id','mainimg');
		$(this).attr('id','mainbgimg').attr('src','').show(); 
	});
}

