
<!--
//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var sitePrefix = '/';  //change to '/' for final site

var imageDir = sitePrefix + 'images/';

var picUrl = '';
var picUrl1 = sitePrefix + 'weather-seals/index.php';
var picUrl2 = sitePrefix + 'fire-smoke-seals/index.php';
var picUrl3 = sitePrefix + 'other-services/index.php';
var picUrl4 = sitePrefix + 'further-info/index.php';
picUrl = picUrl1;

function makevisible(cur,which){
strength=(which==0)? 1 : 0.3

if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}

function CSAction(array) {
	var result;
	for (var i=0;i<array.length;i++) {
		result = CSAct[array[i]][0](CSAct[array[i]]);
	}
	return result;
}
CSAct = new Object;
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}
function CSSetStyleVis(s,v) { if (IsIE()) CSIEStyl(s).visibility = (v == 0) ? "hidden" : "visible";
	else CSNSStyl(s).visibility = (v == 0) ? 'hide' : 'show'; }
function CSGetStyleVis(s) { if (IsIE()) return (CSIEStyl(s).visibility == "hidden") ? 0 : 1;
	else return (CSNSStyl(s).visibility == 'hide') ? 0 : 1;}
function CSShowHide(action) {
	if (action[1] == '') return;
	var type=action[2];
	if(type==0) CSSetStyleVis(action[1],0);
	else if(type==1) CSSetStyleVis(action[1],1);
	else if(type==2) {
		if (CSGetStyleVis(action[1]) == 0) CSSetStyleVis(action[1],1);
		else CSSetStyleVis(action[1],0);
	}
}
// -->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openPage(whichPic) {
	if (whichPic == 0) {
		window.location = picUrl;
	} else if (whichPic == 1) {
		window.location = picUrl1;
	} else if (whichPic == 2) {
		window.location = picUrl2;
	} else if (whichPic == 3) {
		window.location = picUrl3;
	} else if (whichPic == 4) {
		window.location = picUrl4;
	}
}

function changePic(whichPic) {<!-- -->
	if (whichPic == 1) {
		//picText = picText1;
		picUrl = picUrl1;
		MM_swapImage('rollimage','',imageDir + '1.jpg',1);
	} else if (whichPic == 2) {
		//picText = picText2;
		picUrl = picUrl2;
		MM_swapImage('rollimage','',imageDir + '2.jpg',1);
	} else if (whichPic == 3) {
		//picText = picText3;
		picUrl = picUrl3;
		MM_swapImage('rollimage','',imageDir + '3.jpg',1);
	} else if (whichPic == 4) {
		//picText = picText4;
		picUrl = picUrl4;
		MM_swapImage('rollimage','',imageDir + '4.jpg',1);
	} 
}

function addToFavorites(urlAddress, pageName) { 
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel('Sealmaster - ' + pageName,urlAddress,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite(urlAddress,'Sealmaster - ' + pageName); 
	} else { 
		alert("Sorry! Your browser doesn't support this function."); 
	}
}

function toggle(objId, togId) {
	var o = document.getElementById(objId), t = document.getElementById(togId);
	if (o.style.display == 'none') {
		o.style.display = 'block';
		t.innerHTML = '<a href=\'#\'>Hide product range...</a>';
	} else {
		o.style.display = 'none';
		t.innerHTML = '<a href=\'#\'>Show product range...</a>';
	}
}

function checkorderoptions_new() {
	//alert("yes");
	var message = "";
	var emailError = false;
	with (document.contactform) { 
		if ('undefined' != typeof(option_count)) {	
			for (i=1;i<=option_count.value;++i) {
				try {
					var optionvalue = eval('option_value'+i+'.options[option_value'+i+'.selectedIndex].value;');	
				} catch (e) {
					var optionvalue = eval('option_value'+i+'.value;');
				}
				var optionname = eval('option_name'+i+'.value;');
				if (optionvalue == '') {
					message = message + optionname;
					i = option_count.value + 1;
					//message = message + "\n\t"+optionname;
				} else if (i == 2 && !echeck(optionvalue)) {
					message = "Invalid Email Address, please try again.";
					emailError = true;
					i = option_count.value + 1;
				}
			}
		}
	}
	if (message != "") {
		if (emailError) alert(message);
		else alert("The "+message+" entry is required, please try again.");
		return false;
	} else {
		//alert("Please note:\nYour selection has been added to your shopping basket.\n");
		return true;
	}
}

function echeck(str) {

	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   //alert("Invalid E-mail ID");
	   return false;
	}
	
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   //alert("Invalid E-mail ID");
	   return false;
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    //alert("Invalid E-mail ID");
	    return false;
	}
	
	 if (str.indexOf(at,(lat+1))!=-1){
	    //alert("Invalid E-mail ID");
	    return false;
	 }
	
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    //alert("Invalid E-mail ID");
	    return false;
	 }
	
	 if (str.indexOf(dot,(lat+2))==-1){
	    //alert("Invalid E-mail ID");
	    return false;
	 }
	
	 if (str.indexOf(" ")!=-1){
	    //alert("Invalid E-mail ID");
	    return false;
	 }
	
	 return true;		
}
//-->
