var inmenu=0
var curArr
var allArr=new Array;

var x=0
var y=1

var i=0

newsArr=new Array;
newsArr[newsArr.length]={news:"New Finngulf 331 and 43 now available to demonstrate from Hamble Point Marina",expiry:"20101231"}
newsArr[newsArr.length]={news:"Jersey Boat Show 2-4th May. More details available at www.jerseyboatshow.com",expiry:"20090505"}
newsArr[newsArr.length]={news:"Unfortunately, we are experiencing problems with our email. We are in contact with our suppliers to sort out the problem. Our apologies for any incovenience caused.",expiry:"20080830"}
newsArr[newsArr.length]={news:"Come and see us at the Southampton Boat Show berths 320 and 321.",expiry:"20080921"}
newsArr[newsArr.length]={news:"David Walter's in a Finngulf 33 1st in class 1st overall in the first leg of the Round Mull Race.",expiry:"20080930"}
newsArr[newsArr.length]={news:"NEW Bruce Farr Finngulf 43 announced. More details by clicking on new 43 below.",expiry:"201000101"}
newsArr[newsArr.length]={news:"See us at the London Boat Show on Stand 16A inside and a water berth outside with the New Finngulf 46.",expiry:"20080120"}
newsArr[newsArr.length]={news:"Welcome to Finngulf Yachts",expiry:"29991231"}

picArr=new Array;
picArr[0]={picture:"img0009a.jpg"}
picArr[1]={picture:"fg46_29.jpg"}
picArr[2]={picture:"opening1.jpg"}
picArr[3]={picture:"opening2.jpg"}
picArr[4]={picture:"sm_273.jpg"}
picArr[5]={picture:"opening3.jpg"}

Arr28=new Array;
Arr28[Arr28.length]={type:"gallery",data:"fg28a",description:""}
Arr28[Arr28.length]={type:"gallery",data:"fg28b",description:""}
Arr28[Arr28.length]={type:"gallery",data:"fg28c",description:""}
Arr28[Arr28.length]={type:"gallery",data:"fg28d",description:""}
Arr28[Arr28.length]={type:"gallery",data:"fg28e",description:""}
Arr28[Arr28.length]={type:"dimensions",data:"L.O.A.",description:"8.60 m"}
Arr28[Arr28.length]={type:"dimensions",data:"Mainsail",description:"23.00 m&sup2;"}
Arr28[Arr28.length]={type:"dimensions",data:"Jib 100%",description:"19.00 m&sup2;"}
Arr28[Arr28.length]={type:"dimensions",data:"Beam Max",description:"2.90 m"}
Arr28[Arr28.length]={type:"dimensions",data:"Draft Max",description:"1.65 m"}
Arr28[Arr28.length]={type:"dimensions",data:"Displacement",description:"2600 Kg"}
Arr28[Arr28.length]={type:"dimensions",data:"Keel",description:"900 Kg"}
Arr28[Arr28.length]={type:"dimensions",data:"Engine",description:"VP MD 2010/S 9HP"}

Arr33=new Array;
Arr33[Arr33.length]={type:"gallery",data:"fg33a",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33b",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33c",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33d",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33e",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33f",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33g",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33h",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33i",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33j",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33k",description:""}
Arr33[Arr33.length]={type:"gallery",data:"fg33l",description:""}
Arr33[Arr33.length]={type:"download",data:"http://www.ybw.com/ybw/reprints/pbo/finngulf33.html",description:"PBO Test on the Finngulf 33"}
Arr33[Arr33.length]={type:"download",data:"pdf/FG331spec_10-2008.pdf",description:"Specification (pdf)"}
Arr33[Arr33.length]={type:"download",data:"pdf/Finngulf33%20Deck%20plan.PDF",description:"Deck Plan (pdf)"}
Arr33[Arr33.length]={type:"download",data:"pdf/Finngulf33%20Interior.PDF",description:"Interior (pdf)"}
Arr33[Arr33.length]={type:"download",data:"pdf/Finngulf33%20Sailplan.PDF",description:"Sailplan (pdf)"}
Arr33[Arr33.length]={type:"download",data:"pdf/Finngulf331_Brochure2009.pdf",description:"Brochure (pdf)"}
Arr33[Arr33.length]={type:"download",data:"pdf/076-079 BOAT TEST FINNGULF.pdf",description:"Test (pdf)"}
Arr33[Arr33.length]={type:"download",data:"http://www.zinio.com/express2?issue=235015389",description:"Yachting Monthly Test on the Finngulf 33"}
Arr33[Arr33.length]={type:"download",data:"http://uk.youtube.com/watch?v=zOd-kXkBzlA",description:"You Tube Video of the Finngulf 33"}
Arr33[Arr33.length]={type:"dimensions",data:"L.O.A.",description:"10.13 m"}
Arr33[Arr33.length]={type:"dimensions",data:"Mainsail",description:"34.20 m&sup2;"}
Arr33[Arr33.length]={type:"dimensions",data:"Genoa 140%",description:"36.90 m&sup2;"}
Arr33[Arr33.length]={type:"dimensions",data:"Jib 100%",description:"25.40 m&sup2;"}
Arr33[Arr33.length]={type:"dimensions",data:"Beam Max",description:"3.30 m"}
Arr33[Arr33.length]={type:"dimensions",data:"Draft Max",description:"1.80 m"}
Arr33[Arr33.length]={type:"dimensions",data:"Spinnaker",description:"84.70 m&sup2;"}
Arr33[Arr33.length]={type:"dimensions",data:"Displacement",description:"4500 Kg"}
Arr33[Arr33.length]={type:"dimensions",data:"Tanks",description:"fuel 80 fresh water 120"}
Arr33[Arr33.length]={type:"dimensions",data:"Keel",description:"1850 Kg"}
Arr33[Arr33.length]={type:"dimensions",data:"Engine",description:"VP MD 2030/S 18HP"}

Arr37=new Array;
Arr37[Arr37.length]={type:"gallery",data:"fg37a",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37b",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37c",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37d",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37e",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37f",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37g",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37h",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37i",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37j",description:""}
Arr37[Arr37.length]={type:"gallery",data:"fg37k",description:""}
Arr37[Arr37.length]={type:"download",data:"http://www.ybw.com/ybw/reprints/pbo/finngulf37.html",description:"PBO Test on the Finngulf 37"}
Arr37[Arr37.length]={type:"download",data:"pdf/FG37draw.pdf",description:"Drawings (pdf)"}
Arr37[Arr37.length]={type:"download",data:"pdf/FG37spec_03-2007.pdf",description:"Specification (pdf)"}
Arr37[Arr37.length]={type:"download",data:"pdf/Finngulf%2037%20Interiors.PDF",description:"Interior (pdf)"}
Arr37[Arr37.length]={type:"download",data:"pdf/Finngulf%2037%20Sail%20plan.PDF",description:"Sail Plan (pdf)"}
Arr37[Arr37.length]={type:"download",data:"pdf/Finngulf37_Brochure2009.pdf",description:"Brochure (pdf)"}
Arr37[Arr37.length]={type:"download",data:"pdf/YWsept2006_FG.pdf",description:"Test Report (pdf)"}
Arr37[Arr37.length]={type:"dimensions",data:"L.O.A.",description:"11.30 m"}
Arr37[Arr37.length]={type:"dimensions",data:"Mainsail",description:"41 m&sup2;"}
Arr37[Arr37.length]={type:"dimensions",data:"Genoa 137%",description:"45.00 m&sup2;"}
Arr37[Arr37.length]={type:"dimensions",data:"Beam Max",description:"3.50 m"}
Arr37[Arr37.length]={type:"dimensions",data:"Draft Max",description:"2.10 / 1.80 m"}
Arr37[Arr37.length]={type:"dimensions",data:"Spinnaker",description:"100 m&sup2;"}
Arr37[Arr37.length]={type:"dimensions",data:"Displacement",description:"6000 Kg"}
Arr37[Arr37.length]={type:"dimensions",data:"Engine",description:"VP MD 2030/S 29HP"}

Arr41=new Array;
Arr41[Arr41.length]={type:"gallery",data:"fg41a",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41b",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41c",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41d",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41e",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41f",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41g",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41h",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41i",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41j",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41k",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41l",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41m",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41n",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41o",description:""}
Arr41[Arr41.length]={type:"gallery",data:"fg41p",description:""}
Arr41[Arr41.length]={type:"download",data:"pdf/FG41spec_03-2007.pdf",description:"Specification (pdf)"}
Arr41[Arr41.length]={type:"download",data:"pdf/Finngulf41_Brochure2009.pdf",description:"Brochure (pdf)"}
Arr41[Arr41.length]={type:"download",data:"pdf/YWsept2006_FG.pdf",description:"Test Report (pdf)"}
Arr41[Arr41.length]={type:"dimensions",data:"L.O.A.",description:"12.50 m"}
Arr41[Arr41.length]={type:"dimensions",data:"Mainsail",description:"52.70 m&sup2;"}
Arr41[Arr41.length]={type:"dimensions",data:"Genoa 140%",description:"53.80 m&sup2;"}
Arr41[Arr41.length]={type:"dimensions",data:"Beam Max",description:"3.86 m"}
Arr41[Arr41.length]={type:"dimensions",data:"Draft Max",description:"2.20 / 1.80 m"}
Arr41[Arr41.length]={type:"dimensions",data:"Spinnaker",description:"117 m&sup2;"}
Arr41[Arr41.length]={type:"dimensions",data:"Foretriangle",description:"38 m&sup2;"}
Arr41[Arr41.length]={type:"dimensions",data:"Displacement",description:"7500/8500 Kg"}
Arr41[Arr41.length]={type:"dimensions",data:"Engine",description:"VP MD 2040/S 40HP"}
Arr41[Arr41.length]={type:"dimensions",data:"Tanks",description:"fuel 144 fresh water 150 +95"}

Arr43=new Array;
Arr43[Arr43.length]={type:"gallery",data:"fg43a",description:""}
Arr43[Arr43.length]={type:"gallery",data:"fg43b",description:""}
Arr43[Arr43.length]={type:"gallery",data:"fg43c",description:""}
Arr43[Arr43.length]={type:"gallery",data:"fg43d",description:""}
Arr43[Arr43.length]={type:"gallery",data:"fg43e",description:""}
Arr43[Arr43.length]={type:"gallery",data:"fg43f",description:""}
Arr43[Arr43.length]={type:"download",data:"pdf/Finngulf43_Brochure2009.pdf",description:"Brochure (pdf)"}
Arr43[Arr43.length]={type:"download",data:"pdf/FG43_Specification_05-2009.pdf",description:"Specification (pdf)"}
Arr43[Arr43.length]={type:"dimensions",data:"L.O.A.",description:"13.10 m"}
Arr43[Arr43.length]={type:"dimensions",data:"L.W.L.",description:"11.58 m"}
Arr43[Arr43.length]={type:"dimensions",data:"Displacement",description:"7900 Kg"}
Arr43[Arr43.length]={type:"dimensions",data:"Ballast",description:"3772 Kg"}

Arr46=new Array;
Arr46[Arr46.length]={type:"gallery",data:"fg46a",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46b",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46c",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46d",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46e",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46f",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46g",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46h",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46i",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46j",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46k",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46l",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46m",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46n",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46o",description:""}
Arr46[Arr46.length]={type:"gallery",data:"fg46p",description:""}
Arr46[Arr46.length]={type:"download",data:"pdf/FG46spec_03-2007.pdf",description:"Specifications (pdf)"}
Arr46[Arr46.length]={type:"download",data:"pdf/Finngulf46_Brochure2009.pdf",description:"Brochure (pdf)"}
Arr46[Arr46.length]={type:"download",data:"pdf/YWsept2006_FG.pdf",description:"Test Report (pdf)"}
Arr46[Arr46.length]={type:"dimensions",data:"L.O.A.",description:"14.00 m"}
Arr46[Arr46.length]={type:"dimensions",data:"Mainsail",description:"62.00 m&sup2;"}
Arr46[Arr46.length]={type:"dimensions",data:"L.W.L.",description:"12.10 m"}
Arr46[Arr46.length]={type:"dimensions",data:"Genoa 137%",description:"65.00 m&sup2;"}
Arr46[Arr46.length]={type:"dimensions",data:"Beam Max",description:"4.17 m"}
Arr46[Arr46.length]={type:"dimensions",data:"Foretriangle",description:"44.50 m&sup2;"}
Arr46[Arr46.length]={type:"dimensions",data:"Draft Max",description:"2.55/2.20 m"}
Arr46[Arr46.length]={type:"dimensions",data:"Spinnaker",description:"149.00 m&sup2;"}
Arr46[Arr46.length]={type:"dimensions",data:"Displacement",description:"11500/9500 Kg"}
Arr46[Arr46.length]={type:"dimensions",data:"Tanks",description:"fuel 240 l fresh water 220 l +130"}
Arr46[Arr46.length]={type:"dimensions",data:"Keel",description:"31300 Kg"}
Arr46[Arr46.length]={type:"dimensions",data:"Engine",description:"VP MD D2-55/S 55HP"}

function loadmenu(){
	try{document.getElementById("menu1").style.display="inline"}catch(err){}
	try{document.getElementById("menu2").style.display="inline"}catch(err){}
	try{document.getElementById("menu3").style.display="inline"}catch(err){}
	try{document.getElementById("menu4").style.display="inline"}catch(err){}
	try{document.getElementById("menu5").style.display="inline"}catch(err){}
	try{document.getElementById("menu1fg").style.display="inline"}catch(err){}
	try{document.getElementById("menu2fg").style.display="inline"}catch(err){}
	try{document.getElementById("menu3fg").style.display="inline"}catch(err){}
	try{document.getElementById("menu4fg").style.display="inline"}catch(err){}
	try{document.getElementById("menu5fg").style.display="inline"}catch(err){}
	document.getElementById("nav").style.height="150px"
}

function resetmenu(){
	inmenu=0
	setTimeout("resetmenutimer()", 500)
}

function resetmenutimer(){
	if(inmenu==0){
		try{document.getElementById("menu1").style.display="none"}catch(err){}
		try{document.getElementById("menu2").style.display="none"}catch(err){}
		try{document.getElementById("menu3").style.display="none"}catch(err){}
		try{document.getElementById("menu4").style.display="none"}catch(err){}
		try{document.getElementById("menu5").style.display="none"}catch(err){}
		try{document.getElementById("menu1fg").style.display="none"}catch(err){}
		try{document.getElementById("menu2fg").style.display="none"}catch(err){}
		try{document.getElementById("menu3fg").style.display="none"}catch(err){}
		try{document.getElementById("menu4fg").style.display="none"}catch(err){}
		try{document.getElementById("menu5fg").style.display="none"}catch(err){}
		document.getElementById("nav").style.height="25px"
	}
}

function chooseImage(){
	var currDate=new Date()
	var currSecs=0
	with(currDate){
		currSecs=getSeconds()
	}
	
	var pic=0
	
	if(currSecs<=10){
		pic=0
	}else if(currSecs<=20){
		pic=1
	}else if(currSecs<=30){
		pic=2
	}else if(currSecs<=40){
		pic=3
	}else if(currSecs<=50){
		pic=4
	}else{
		pic=5
	}
	imageURL="images/"+picArr[pic].picture
	document.getElementById("imgreplace").style.backgroundImage=imageURL=='none' ? 'none' : 'url(' + imageURL + ')';
}

function loadpic(imageURL){
	parent.window.document.getElementById("imgreplace").style.backgroundImage=imageURL=='none' ? 'none' : 'url(' + imageURL + ')';
}

function loadiframe(strsrc){
	document.getElementById("fgiframe").src=strsrc
}

function loadMail(location){
	window.open('formmail.htm?location='+location, 'formMail', 'toolbar=no, directories=no, location=no, status=no, menubar2=no, resizable=no, scrollbars=no, width=500, height=500');
}

function getArr(page){
	if(page=="28"){
		curArr=Arr28
	}
	if(page=="33"){
		curArr=Arr33
	}
	if(page=="37"){
		curArr=Arr37
	}
	if(page=="41"){
		curArr=Arr41
	}
	if(page=="43"){
		curArr=Arr43
	}
	if(page=="46"){
		curArr=Arr46
	}
}

function loadGal(page){
	var html=""
	getArr(page)

	for(i=0;i<curArr.length;i++){
		if(curArr[i].type=="gallery"){
			html=html+"<tr height=\"30\"><td width=\"250\" class=\"fftext\"><a href=\"#"+curArr[i].data+"\" name=\""+curArr[i].data+"\"><img src=\"images/"+page+"/"+curArr[i].data+"s.jpg\" border=\"0\" onclick=\"loadpic('images/"+page+"/"+curArr[i].data+".jpg')\"></a></td></tr>"
		}
	}
	return html
}

function loadDownloads(page){
	var html=""
	getArr(page)

	for(i=0;i<curArr.length;i++){
		if(curArr[i].type=="download"){
			html=html+"<tr height=\"30\"><td width=\"230\"><a href=\""+curArr[i].data+"\" target=\"_blank\" class=\"fftext\">"+curArr[i].description+"</a></td></tr>"
		}
	}
	return html
}

function loadDimensions(page){
	var html=""
	getArr(page)

	for(i=0;i<curArr.length;i++){
		if(curArr[i].type=="dimensions"){
			html=html+"<tr height=\"30\"><td width=\"100\" class=\"fftext\">"+curArr[i].data+"</td><td width=\"130\" class=\"fftext\">"+curArr[i].description+"</td></tr>"
		}
	}
	return html
}

function loadallArr(){
	for(x=0;x<Arr28.length;x++){
		if(Arr28[x].type=="gallery"){
			allArr[allArr.length]={page:"28",data:Arr28[x].data}
		}
	}
	for(x=0;x<Arr33.length;x++){
		if(Arr33[x].type=="gallery"){
			allArr[allArr.length]={page:"33",data:Arr33[x].data}
		}
	}
	for(x=0;x<Arr37.length;x++){
		if(Arr37[x].type=="gallery"){
			allArr[allArr.length]={page:"37",data:Arr37[x].data}
		}
	}
	for(x=0;x<Arr41.length;x++){
		if(Arr41[x].type=="gallery"){
			allArr[allArr.length]={page:"41",data:Arr41[x].data}
		}
	}
	for(x=0;x<Arr46.length;x++){
		if(Arr46[x].type=="gallery"){
			allArr[allArr.length]={page:"46",data:Arr46[x].data}
		}
	}
	var whichPic=Math.round((allArr.length-1)*Math.random())
	imageURL="images/"+allArr[whichPic].page+"/"+allArr[whichPic].data+".jpg"
	document.getElementById("imgreplace").style.backgroundImage=imageURL=='none' ? 'none' : 'url(' + imageURL + ')';
}

function newsalert() {
	if(x>newsArr.length-1){
		x=0
	}

	var strLength=""
	var strValue=""
	var strChar=""
	var strDate=""
	var iMonth=0	
	dDate=new Date()
	strDate=dDate.getFullYear().toString()
	iMonth=dDate.getMonth()+1
	if(iMonth.toString().length==1){
		strDate=strDate+"0"+iMonth.toString()
	}else{
		strDate=strDate+iMonth.toString()
	}
	if(dDate.getDate().toString().length==1){
		strDate=strDate+"0"+dDate.getDate().toString()
	}else{
		strDate=strDate+dDate.getDate().toString()
	}

	if(newsArr[x].expiry<strDate){
		x++
		newsalert()
		return
	}
	
	strValue=newsArr[x].news
	strLength=strValue.length

	if(strLength==y||strValue.substring(0,4)=="<img"){
		document.getElementById("idnews").innerHTML=strValue
		y=1
		if(x<newsArr.length-1){
			x++
		}else{
			x=0
		}
		setTimeout("newsalert()", 5000)
	}else{
		strChar=strValue.substring(0,y)
		if(strChar==" "){
			y++
			strChar=strValue.substring(0,y)
		}
		document.getElementById("idnews").innerHTML=strChar
		y++
		setTimeout("newsalert()", 100)
	}
}
