// For slideshow background
$(function(){
	$.fn.supersized.options = {  
		startwidth: 640,  
		startheight: 480,
		vertical_center: 1,
		slideshow: 1,
		navigation: 0,
		transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
		pause_hover: 0,
		slide_counter: 1,
		slide_captions: 1,
		slide_interval: 5000  
	};
	$('#supersize').supersized(); 
});

// Load Function
//window.onload = function(){
//	
//};

$(document).ready(function(){         
		
	// jquery cycle: ticker Lavorazioni Speciali 
	 $('.ticker ul').cycle({ 
		fx: 'scrollDown',
		requeueOnImageNotLoaded: true,
		speed:    2000, 
		timeout:  6000 
	});
	
});

// for dropdown select

//$(document).ready(function() {

//        try {
//		    oHandler = $("body select").msDropDown().data("dd");
//		    //alert($.msDropDown.version);
//		    //$.msDropDown.create("body select");
//		    $("#ver").html($.msDropDown.version);
//		} catch(e) {
//			//alert("Error: "+e.message);
//		}
//});




//$(function() {
//    adjustStyle($(this).width());
//    $(window).resize(function() {
//        adjustStyle($(this).width());
//    });
//});

/* shadowbox =================================================================== */

$(document).ready(function(){
	Shadowbox.init();
});

/* JSTarget function by Roger Johansson, www.456bereastreet.com =============== */

var JSTarget = {
    init: function(att,val,warning) {
        if (document.getElementById && document.createElement && document.appendChild) {
            var strAtt = ((typeof att == 'undefined') || (att == null)) ? 'class' : att;
            var strVal = ((typeof val == 'undefined') || (val == null)) ? 'non-html' : val;
            var strWarning = ((typeof warning == 'undefined') || (warning == null)) ? ' (opens in a new window)' : warning;
            var oWarning;
            var arrLinks = document.getElementsByTagName('a');
            var oLink;
            var oRegExp = new RegExp("(^|\\s)" + strVal + "(\\s|$)");
            for (var i = 0; i < arrLinks.length; i++) {
                oLink = arrLinks[i];
                if ((strAtt == 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(strAtt)))) {
                    oWarning = document.createElement("em");
                    oWarning.appendChild(document.createTextNode(strWarning));
                    oLink.appendChild(oWarning);
                    oLink.onclick = JSTarget.openWin;
                }
            }
            oWarning = null;
        }
    },
    openWin: function(e) {
        var event = (!e) ? window.event : e;
        if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
        else {
            var oWin = window.open(this.getAttribute('href'), '_blank');
            if (oWin) {
                if (oWin.focus) oWin.focus();
                return false;
            }
            oWin = null;
            return true;
        }
    }

};

$(document).ready(function(){
    JSTarget.init("rel","external","");
});

	window.onload = setScreenClass; 
	window.onresize = setScreenClass;
