// initialise vars
pipeSecNo=0;
swfAppend='';
//
window.onload=init;
//
function init() {
P7_initPM(1,7,0,0,0);
pdnv1=document.getElementById("nav1"); 
pdnv2=document.getElementById('nav2'); 
pdnv3=document.getElementById('nav3'); 
pdnv4=document.getElementById('nav4'); 
pdnv5=document.getElementById('nav5'); 
hmOFF="url('/_scr/p7pm/img/pipesHoff.jpg')"; 
hmON="url('/_scr/p7pm/img/pipesHon.jpg')";
genON="url('/_scr/p7pm/img/pipeson.jpg')"; 
genONplus="url('/_scr/p7pm/img/pipesonplus.jpg')";
genOFF="url('/_scr/p7pm/img/pipesoff.jpg')"; 
genOFFplus="url('/_scr/p7pm/img/pipesoffplus.jpg')";
preloadBGimages();
initCurveMenu();
callSWFObject();
}

function callSWFObject() {
	if(swfAppend!='') {
	var so = new SWFObject('/_img/fader.swf'+swfAppend, 'menu', '360', '244', '7', '#FFFFFF');
	so.addParam('quality', 'autohigh');
	so.addParam('wmode', 'transparent');
	so.useExpressInstall('/_scr/expressinstall.swf');
	so.write('img_large');
	}
}


function setMenuGraphics(ac) {
var navs=new Array(pdnv1,pdnv2,pdnv3,pdnv4,pdnv5);

for(var i=1;i<=5;i++) {	var obj=navs[i-1];if(i==1) {obj.style.backgroundImage=hmOFF;}else{obj.style.backgroundImage=genOFF;}}
	if(ac==1) {
	pdnv1.style.backgroundImage=hmON; pdnv2.style.backgroundImage=genOFFplus;
	} else if (ac>=2 && ac<=4) {
	var obj=eval('pdnv'+ac);
	var objNxt=eval('pdnv'+(ac+1));
	obj.style.backgroundImage=genON; objNxt.style.backgroundImage=genOFFplus;
	} else if (ac==5) {
	pdnv5.style.backgroundImage=genON; 
	}
// restore active marked page
	if(pipeSecNo>0 && ac<0) { 
		setActivePage(pipeSecNo);
	}
}

//
function initCurveMenu() {
// add mouse events - and re-writes P7 events
pdnv1.onmouseover=function() { setMenuGraphics(1); P7_PMtrig(pdnv1);  } 
pdnv1.onmouseout=function() { setMenuGraphics(-1); } 
pdnv2.onmouseover=function() { setMenuGraphics(2); P7_PMtrig(pdnv2); } 
pdnv2.onmouseout=function() { setMenuGraphics(-2);  } 
pdnv3.onmouseover=function() { setMenuGraphics(3); P7_PMtrig(pdnv3); } 
pdnv3.onmouseout=function() { setMenuGraphics(-3);  } 
pdnv4.onmouseover=function() { setMenuGraphics(4); P7_PMtrig(pdnv4); } 
pdnv4.onmouseout=function() { setMenuGraphics(-4);  } 
pdnv5.onmouseover=function() { setMenuGraphics(5); P7_PMtrig(pdnv5); } 
pdnv5.onmouseout=function() { setMenuGraphics(-5);  } 
setActivePage(pipeSecNo);
}
//
function setActivePage(psn) {
	// set active page
	if(psn>0) { 
		var aPage=eval('pdnv'+psn); 
		if(psn<5) {
		var aPageNxt=eval('pdnv'+(psn+1));
		if(psn==1) { aPage.style.backgroundImage=hmON; } else { aPage.style.backgroundImage=genON; }
		aPageNxt.style.backgroundImage=genOFFplus;
		} else if (psn==5) {
		aPage.style.backgroundImage=genON;
		}
	}
}
//
function preloadBGimages() {
	// preload backgrounds
	imgA=new Image;	imgA.src='/_scr/p7pm/img/pipesHon.jpg';
	imgB=new Image;	imgB.src='/_scr/p7pm/img/pipesHoff.jpg';
	imgC=new Image;	imgC.src='/_scr/p7pm/img/pipesoff.jpg';
	imgD=new Image;	imgD.src='/_scr/p7pm/img/pipesoffplus.jpg';
	imgE=new Image;	imgE.src='/_scr/p7pm/img/pipeson.jpg';
	imgF=new Image;	imgF.src='/_scr/p7pm/img/pipesonplus.jpg'
}

function checkForm() {
	var errors="";
	// required fields
	var name=document.getElementById("name").value;
	var telephone=document.getElementById("telephone").value;
	var email=document.getElementById("email").value;
	var messg=document.getElementById("message").value;
	//
	if(name.length==0) { errors+="NAME " }
	if(telephone.length==0) { errors+="TELEPHONE " }
	if(email.length==0) { errors+="EMAIL " }
	if(messg.length==0) { errors+="MESSAGE " }
	
	if(errors.length>0) {
		errors = "Please fill in the following required fields\n"+errors;
		alert(errors);
	return false;
	} else {
	return true;
	}

	
}


mc=new Array()
mc[0]='5927363455325559236231553159583259523923325959582333573039';
mc[1]='23526059236231553159583259523923325959582333573039';

function mc2(e) {
op='';chars='st2-n74opr.uyqz9m:0vwk_5x16hjab3igcdel8@f'; m='39525560243040';
inp=m+mc[e];for(i=0; i<inp.length; i+=2) {id=parseInt(inp.substr(i,2));op+=chars.charAt(id-23);}
window.location.href= op;
}