/* ciclo immagini */
$(document).ready(function(){

$('#flashcontentHome').cycle({
				fx:'fade',
				speed:8000,
				timeout:4000,
				pause:1
			});
});


/* ridimensionamento immagini */
//var lastUrl="";
$(document).ready(function(){

var winW = 0, winH = 0;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}
winW = document.body.offsetWidth;
if (winW<960){
winW=960;
}
  winH = document.body.offsetHeight;
//alert($('#flashcontent img').attr("src"));
lastUrl=$('#flashcontent img').attr("src");
	$('#flashcontent img').attr("src","/ThumbImage.aspx?image="+$('#flashcontent img').attr("src")+"&width="+winW+"&height="+winW+"&mode=scale&quality=high");
	//alert($('#flashcontent img').attr("src"));
});


//$(window).resize(function(){
//	var winW = 0, winH = 0;

//if (parseInt(navigator.appVersion)>3) {
// if (navigator.appName=="Netscape") {
//  winW = window.innerWidth;
//  winH = window.innerHeight;
// }
// if (navigator.appName.indexOf("Microsoft")!=-1) {
//  winW = document.body.offsetWidth;
//  winH = document.body.offsetHeight;
// }
//}
//winW = document.body.offsetWidth;
//  winH = document.body.offsetHeight;
//	$('#flashcontent img').attr("src","/ThumbImage.aspx?image="+lastUrl+"&width="+winW+"&height="+winW+"&mode=scale&quality=high");
//});




/* sfondi png via css trasparenti */

//	$(document).ready(function(){	
//	$('h1.trasp, #nav a, .leftProd h3').cssPNGFix();
//});

/* ifix png */

$(document).ready(function(){
	$.ifixpng('/App_Themes/argo_tractors/img/pixel.gif');
	$('.rightBanner a img, #homeSpot img, .mcc #nav').ifixpng();
});

/* accordion menu Landini/McCormick (RICHIEDE JQUERY) */

$(document).ready(function(){
$("#leftNav li ul").hide();
$("#leftNav li.active ul").show();
$("#leftNav li a").click(function(){
$(this).next("ul").slideToggle("fast")
.siblings("ul:visible").slideUp("fast");
});
});

/* effetto lente sui prodotti */

$(document).ready(function(){
	$(".prodThumb img").mouseover(function(){
	//alert ($(this).parent().parent().parent().html());	
 //$(this).parent().parent().parent().css({ position: "relative"});	
 $(this).parent().parent().parent().parent().css({ 'z-index': '100'});	
 $(this).parent().parent().parent().css({ 'z-index': '100'});	
$(this).parent().parent().css({ 'z-index': '100'});
$(this).parent().css({ 'z-index': '100'});
      $(this).parent().parent().parent().animate({ 
       width: "165",
		height: "171",
		left: "-17",
		top:"-10"
        //marginLeft: "-12px",
		//marginTop: "-6px"
      }, 200 );
       $(this).animate({ 
        width: "165",
		height: "125"
        //marginLeft: "-12px",
		//marginTop: "-6px"
      }, 200 );
    }).mouseout(function(){
  $(this).parent().parent().parent().parent().css({ 'z-index': '1'});	
 $(this).parent().parent().parent().css({ 'z-index': '1'});	
$(this).parent().parent().css({ 'z-index': '1'});
$(this).parent().css({ 'z-index': '1'});
      $(this).parent().parent().parent().animate({
	  	width:"130", 
		height:"142",
		left: "0",
		top:"0"
		//marginLeft: "0px",
		//marginTop: "0px"
		}, 200);
       $(this).animate({
	  	width:"130", 
		height:"98"
		//marginLeft: "0px",
		//marginTop: "0px"
		}, 200);
    });
});

/* popup accessibile by SF 2007 - arscolor.com ========================================= */

// funzione per aprire la finestra
function popUp(destination){
var poppedUp = window.open(destination, "popWin", "height=480, width=510");
poppedUp.focus();
}
// esegue la funzione principale solo quando il DOM è completo
window.onload = prepareLinks;

// funzione principale che chiama la funzione popup
function prepareLinks(){
var links = document.getElementsByTagName("a");
for (var i=0; i<links.length; i++){
if (links[i].className == "popWindow"){
links[i].onclick = function (){
popUp(this.getAttribute("href"));
return false;}
		}
	}
}

//parte script scroll===========================================================  





$(document).ready(function() {
    $(".scroll").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		speed:1000
		//,auto:3000
    });
});



// fine scroll======================================================================= -->



/* 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;
		}
	},
	/*
	addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	*/
	addEvent: function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn]( window.event );}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
JSTarget.addEvent(window, 'load', function(){JSTarget.init("rel","external","");});