document.write('<scr'+'ipt src="include/worinclude/library.js"></scr'+'ipt>')

function openCompanyInfo()
{
  window.open('companyinfo.html','CompanyInfo','menubar=0,resizable=0,width=400,height=250');
  return false;
}

function hideDiv(v_strDivId)
{
	var objDiv = document.getElementById(v_strDivId);
	objDiv.style.display = "none";
}
function showDiv(v_strDivId)
{
	var objDiv = document.getElementById(v_strDivId);
	objDiv.style.display = "block";
}


function openWin(v_strPage, v_strWidth, v_strHeight){
	window.open(v_strPage,"oprnWin","dependent=yes,Height=404,Width=393,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no");
}

function RedirectTimeout(){	
	setTimeout("document.location = 'http://www.husqvarna-motorcycles.com'", 5000); 
}

function OpenZoomWindow(sImg,sTitle,sWidth,sHeight,sClose,sDescription){
	if(sClose==null) sClose = "close";
	var sTotHeight;
	if(sDescription!=null && sDescription!='')
		sTotHeight = (sHeight/1+40);
	else
		sTotHeight = (sHeight/1+17);
	var oWin = window.open('','','status=0,scrollbars=0,height=' + sTotHeight + 'px,width='+sWidth+'px');
	sTitle = 'Husqvarna';
	
	var sHtml = '<html>\n';
	sHtml += '<head><title>' + sTitle + '</title>\n';
	sHtml += '<style type=\"text/css\">\n';
	sHtml += '.fntDefault { text-decoration: none; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #514C3C }\n';
	sHtml += '</style>\n</head>\n';
	sHtml += '<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n';
	sHtml += '<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
	sHtml += '<tr><td align=\"center\" valign=\"middle\"><img border=\"0\" src=\"'+sImg+'\"></td></tr>\n';
	if(sDescription!=null && sDescription!=''){
		sHtml += '<tr height=\"15\" style=\"padding:4px\"><td align=\"left\" valign=\"top\" class=\"fntDefault\">' + sDescription + '</td></tr>\n';
	}
	sHtml += '<tr height=\"2\"><td bgcolor=\"#EBEAE5\"><img src=\"img/shared/np.gif\" height=\"2\"></td></tr>\n';	
	sHtml += '<tr height=\"15\"><td bgcolor=\"#F8F7F1\" align=\"right\" valign=\"middle\" class=\"fntDefault\"><a class=\"fntDefault\" href=\"javascript:window.close()\">' + sClose + '</a>&nbsp;&nbsp;</td></tr>\n';
	sHtml += '</table>\n';
	sHtml += '</body>\n';
	sHtml += '</html>';
	oWin.document.write(sHtml);
}
function voidFunction(){
	//ie bug
}
function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
/*function changeImageBox(v_strImageBoxName,v_strImage){
	var myElement = $(v_strImageBoxName);
	

	myElement.set('tween', {
				duration: 800,
				transition: Fx.Transitions.Quart.easeOut // This could have been also 'bounce:out'
			}).tween('height', contentHeight+20);
}*/

function changeImageBox(imgId, imgPath){
	var curImg = document.getElementById(imgId);
	curImg.src = imgPath;
}
function npwidthmax(){
	//calcola width della pagina, toglie larghezza menu sinistra e larghezza menu destra return (la differenza)
	size = parseInt(window.innerWidth) - 440;
	return size;
}
function credits(){
	window.open("credits.htm","credits","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=140");
}
function PopUpWindow(v_strFile,v_strWidth,v_strHeight){
	window.open(v_strFile,"","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + v_strWidth + ",height=" + v_strHeight);
}

function redirectLang() {
    url = document.selectLang.languages.value;
    if (url != "")
		window.location=url;
}

function redirectWebsite() {
    url = document.selectWebsite.website.value;
    //if (url != "")
		//window.location=url;
		window.open(url);
}


/*
function createMedia(mediaType,src,width,height,bgcolor,wmode,swliveConn,embedMovie){
    //si tratta di flash
    if (mediaType == 0){
		if (navigator.appVersion.indexOf("MSIE") != -1){
			var strContent = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
			//se non sono definiti width e height ==> non li setto
			if (width != "") strContent += 'width="' + width + '" ';
			if (height != "") strContent += 'height="' + height + '"';
			strContent += '>';
			strContent += '<param name="movie" value="'+src+'">';
			strContent += '<param name="quality" value="high">';
			strContent += '<param name="bgcolor" value="'+bgcolor+'" />';
			strContent += '<param name="wmode" value="'+wmode+'">';
			
			if (swliveConn != "") strContent += '<param name="SwLiveConnect" value="'+swliveConn+'">';
			if (embedMovie != "") strContent += '<param name="EmbedMovie" value="'+embedMovie+'">';
			
			strContent += 'Flash plug-in not installed.';
			strContent += '</object>';
			document.write(strContent);
		}else{
			document.write('<object type="application/x-shockwave-flash" data="'+src+'" ');
			
			//se non sono definiti width e height ==> non li setto
			if (width != "") document.write('width="'+width+'" ');
			if (height != "") document.write('height="'+height+'" ');
			
			document.write('wmode="'+wmode+'" bgcolor="'+bgcolor+'" ');
			
			if (swliveConn != "") document.write('SwLiveConnect="'+swliveConn+'" ');
			if (embedMovie != "") document.write('EmbedMovie="'+embedMovie+'"');
			
			document.write('>Flash plug-in not installed.</object>');
		}
	}
}

*/


/* MooTools - START */

function showMenu(strIdDiv){
	var myElement = $(strIdDiv);
	
	//calcolo height
	var contentHeight = 0;
	var objChildrens = myElement.getChildren();
	for(i=0;i<objChildrens.length;i++){
		contentHeight += objChildrens[i].getSize().y;
	}
/*myElement.set('tween', {
				duration: 0,
				transition: Fx.Transitions.Quart.easeIn // This could have been also 'bounce:out'
			}).tween('display', 'block');
	*/		
	myElement.set('tween', {
				duration: 800,
				transition: Fx.Transitions.Quart.easeOut // This could have been also 'bounce:out'
			}).tween('height', contentHeight+20);
}

function hideMenu(strIdDiv){
	var myElement = $(strIdDiv);
	var contentHeight = 0;
	var objChildrens = myElement.getChildren();
	for(i=0;i<objChildrens.length;i++){
		contentHeight += objChildrens[i].getSize().y;
	}

	myElement.set('tween', {
				duration: 600,
				transition: Fx.Transitions.Quart.easeIn // This could have been also 'bounce:out'
			}).tween('height', 1);
}

function gateOnLoad()
{
// Tasto company
	$('item_company').addEvents({
		'mouseenter': function(){
			showMenu('item_company_menu');
		},
		'mouseleave': function(){
			hideMenu('item_company_menu');
		}
	});
	// Tasto racing
	$('item_racing').addEvents({
		'mouseenter': function(){
			showMenu('item_racing_menu');
		},
		'mouseleave': function(){
			hideMenu('item_racing_menu');
		}
	});
	// Tasto models
	$('item_models').addEvents({
		'mouseenter': function(){
			showMenu('item_models_menu');
		},
		'mouseleave': function(){
			hideMenu('item_models_menu');
		}
	});	
	// Tasto people
	$('item_people').addEvents({
		'mouseenter': function(){
			showMenu('item_people_menu');
		},
		'mouseleave': function(){
			hideMenu('item_people_menu');
		}
	});
	
	//var onw = window.open('/popup/husky.swf', 'Husqvarna','width=714,height=424,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');

}

/* MooTools - END */
