var this_domain = new String(document.location);
var test_domain = /^(http:\/\/forum.tecnozoom.it|http:\/\/forum.qnm.it)/gi;

try {
        if(iphone_image_bar=='undefined')
                iphone_image_bar='nano_iphone_app_970x230.png';
} catch(e) {
        iphone_image_bar='nano_iphone_app_970x230.png';
}



if (this_domain.match(test_domain)) {
	// "BANNER" DISABILITATO COME DA RICHIESTA DI MASSI DEL 11/08/2010
} else {

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {

function init_ua_iphone() {
	var nameEQ = "ua_iphone=";
	var ca = document.cookie.split(';');
	var contatore = 0;

	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) { 
			//return 0;
			contatore = new String(c).replace(nameEQ, "");
		}
	}

	contatore = parseInt(contatore)+1;
	if(contatore >= 4) return 0;

	var scadenza = new Date();
	scadenza.setDate(scadenza.getDate() + 1);

	document.cookie = nameEQ+contatore+'; path=/; expires='+ scadenza.toGMTString() + ';';

	//document.cookie = nameEQ+'1; path=/; expires='+ scadenza.toGMTString() + ';';
	return 1;
}

var show_ua_iphone = init_ua_iphone();

function posiziona_div_iphone() {
   var iphone_el = document.getElementById("iphone_div");
   if(show_ua_iphone == 1) {
	iphone_el.style.display = "none";
	var xwx = window.innerHeight + window.pageYOffset - 282 + "px";
	iphone_el.style.top = xwx;
	iphone_el.style.display = "block";
   } else {
	iphone_el.style.display = "none";
   }
}
document.body.ontouchend = function () {
   if(show_ua_iphone == 1) {
   setTimeout(function () {
	posiziona_div_iphone();
   }, 300);
   }
};
document.body.ontouchmove = function () {
   if(show_ua_iphone == 1) {
   var iphone_el = document.getElementById("iphone_div");
   iphone_el.style.display = "none";
   }
};

iphone_down_url = ((!window.iphone_down_url) ? 'http://www.tuttogratis.it/gol.tg?13247' : window.iphone_down_url);

function chiudi_adv_iphone() {
	show_ua_iphone = 0;
	var iphone_el = document.getElementById("iphone_div");
	iphone_el.style.display = "none";
}

if(show_ua_iphone == 1) {

document.write('<div id="iphone_div" style="background: transparent; width: 100%; position: absolute; bottom: 0pt; z-index: 2000; left:0; cursor: pointer; margin:0; padding:0;"><div style="width: 100%; text-align: right; top: 92pt; position: relative; margin-right: 20pt;"><a href="javascript:chiudi_adv_iphone();" style="text-decoration: none;"><img src="http://commons.nanopress.it/wp-images/chiudi_big.png" border="0"></a>&nbsp;&nbsp;</div><div><a href="'+iphone_down_url+'"><img src="http://commons.nanopress.it/wp-images/'+ iphone_image_bar +'" border="0"></a></div></div>');


}

}

}


