
var putItThere = null; 

var chasm = screen.availWidth;
var mount = screen.availHeight;


var w = 0;
var h = 0;


function deadCenter(u,w,h) {
  putItThere = window.open(u,'posB','width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 10) * .5));
}

var pagina=null;
function apri (url,w,h,x,y){
if (pagina != null)
	pagina.close();
	pagina=window.open(url,null,"fullscreen=no,status=no,resizable=yes,toolbar=no,scrollbars=yes,width="+w+",height="+h+",top="+x+",left="+y);
}
//////////////////////////////////////////////////////////////////////
(function(){

	/*Use Object Detection to detect IE6*/
	var  m = document.uniqueID /*IE*/
	&& document.compatMode  /*>=IE6*/
	&& !window.XMLHttpRequest /*<=IE6*/
	&& document.execCommand ;
	
	try{
		if(!!m){
			m("BackgroundImageCache", false, true) /* = IE6 only */ 
		}
		
	}catch(oh){};
})();




/*//////////////////////////////////////////////////////////////////////////////////////*/
var pagina=null;
function apriPopup(url,w,h){
	x=screen.width/2-w/2;
	y=screen.height/2-h/2;
	if (pagina != null)
		pagina.close();
	pagina=window.open(url,"","fullscreen=no,status=no,toolbar=no,scrollbars=yes,width="+w+",height="+h+",top="+y+",left="+x);
}








/*// ANTI-SPAM ////////////////////////////////////////////////////////////////////////////////////*/
function DisplayMail(Server, Login, Display){
if ((Display.length == 0) || (Display.indexOf('@')+1)) {
document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Login + "@" + Server + "</a>"); }
else {
document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Display + "</a>"); }
}







/*// CHECK FORM ////////////////////////////////////////////////////////////////////////////////////*/
function agree(){
 var IE=(window.navigator.userAgent.indexOf('MSIE')>-1)?1:0; 
 if (document.getElementById('agreeFrm').checked){
  document.getElementById('button_form_send').style.display=(IE)?'block':'block';
  document.getElementById('button_form_send_disabled').style.display='none';
 }else{
  document.getElementById('button_form_send').style.display='none';
  document.getElementById('button_form_send_disabled').style.display=(IE)?'block':'block';
 }
}
 
/*/////////////////////////////////////////////////////////////////////////////////////*/
var whitespace = " \t\n\r";
function isEmail (s)
{
	if (isEmpty(s)) 
	   if (isEmail.arguments.length == 1) return defaultEmptyOK;
	   else return (isEmail.arguments[1] == true);
	if (isWhitespace(s)) return false;
	var i = 1;
	var sLength = s.length;
	while ((i < sLength) && (s.charAt(i) != "@")){ 
		i++
	}
	if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	else i += 2;
	while ((i < sLength) && (s.charAt(i) != ".")){ 
		i++
	}
	if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	else return true;
}
function isEmpty(s){
	return ((s == null) || (s.length == 0))
}
function isWhitespace (s){
	var i;
	if (isEmpty(s)) return true;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
	return true;
}

/*/////////////////////////////////////////////////////////////////////////////////////*/

// APRI CHIUDI SUBNAV
	$(document).ready(function(){
		$("#subnav ul li.primo_nodo strong a").click(function(){
				$(this).parent().parent().find("ul").slideToggle('slow', function() {
				});
			}
		);
	});
	
/*/////////////////////////////////////////////////////////////////////////////////////*/

// APRI CHIUDI NEWS CATEGORY
	$(document).ready(function(){
		$("#news_category").click(function(){
				$(this).find("ul").slideToggle('normal', function() {
				});
			}
		);
		$("#news_category ul").hover(function(){
				//
			},function(){
			  $(this).slideUp('normal', function() {
				});
			}
		);
	});
	
/*/////////////////////////////////////////////////////////////////////////////////////*/

// CAMPI FORM
	$(document).ready(function(){
		
		// REPLACE SELECT
		$("select").change(function () {
			var str_select_option = "";
			$(this).find("option:selected").each(function () {
				str_select_option += $(this).text() + " ";
			});
			$(this).prev("span.select_replace").text(str_select_option);
		})
		.change();
		$("select").keyup(function () {
			var str_select_option = "";
			$(this).find("option:selected").each(function () {
				str_select_option += $(this).text() + " ";
			});
			$(this).prev("span.select_replace").text(str_select_option);
		});
		$("select").focus(function () {
			$(this).prev("span.select_replace").addClass("selected");
		});
		$("select").blur(function () {
			$(this).prev("span.select_replace").removeClass("selected");
		});
		
		// REPLACE INPUT FILE
		$("input[type='file']").change(function () {
			var str_inputfile = $(this).val();
			var tmp = str_inputfile.split("\\");
			$(this).prev("span.inputfile_replace").text(tmp[tmp.length-1]);
		})
		.change();
		
		// FOCUS INPUT
		/*var tmp_value_input;
		$("input").focus(function(){
			tmp_value_input = $(this).val();
            $(this).val("");
        });
		$("input").blur(function(){ 
			if ($(this).val()==""){
            	$(this).val(tmp_value_input);
			}
        });*/
		
	});
	
/*/////////////////////////////////////////////////////////////////////////////////////*/

// TAB SCHEDA PRODOTTO
	$(document).ready(function(){
		$("#tabs_item ul li:first").addClass("attivo");
		$("#tabs_item div:first").show();
		$("#tabs_item ul li").click(function(){
				$(this).parent().parent().find("div:visible").hide();
				$(this).parent().parent().find("div").eq($(this).index()).show();
				$(this).parent().find("li.attivo").removeClass("attivo");
				$(this).addClass("attivo");
			}
		);
	});
	
/*/////////////////////////////////////////////////////////////////////////////////////*/
