function stopError() {
  return true;
}

window.onerror = stopError;

			function recalcPrice(productID) {
				var content;
				eval("thisPrice = baseprice"+productID+";");
				eval("thisPriceExTax = basepriceExTax"+productID+";");
				eval("thisPriceIncTax = basepriceIncTax"+productID+";");
				eval("thisPriceTax = basepriceTax"+productID+";");
				eval("thisOOPrice = oobaseprice"+productID+";");
				eval("thisOOPriceExTax = oobasepriceExTax"+productID+";");
				eval("thisOOPriceIncTax = oobasepriceIncTax"+productID+";");
				eval("thisOOPriceTax = oobasepriceTax"+productID+";");
				currentValues = new Array(efcount);
				if (doesFormElementExist("productForm"+productID,"qty"+productID)) {
					qty = getFormElementValue("productForm"+productID,"qty"+productID);
				} else {
					qty = 1;
				}
				for (f = 0; f < efcount; f++) {
					currentValues[extrafields[f]] = "";

					elementExists = doesFormElementExist("productForm"+productID,extrafields[f]);
					fieldtype = getFormElementType("productForm"+productID,extrafields[f]);
					if (extrafieldstype[f] == "CHECKBOXES") {
						elementExists = doesFormElementExist("productForm"+productID,extrafields[f]+"1");
						fieldtype = getFormElementType("productForm"+productID,extrafields[f]+"1");
					}
					if (extrafieldstype[f] == "RADIOBUTTONS") {
						elementExists = doesFormElementExist("productForm"+productID,extrafields[f]);
						elem = getFormElement("productForm"+productID,extrafields[f]);
						if (elem.length > 0) {
							elementExists = true;
							fieldtype = "radio";
						} else {
							elementExists = false;
						}
					}

					if (elementExists) {
						if (fieldtype=="select-one") {
							currentValues[extrafields[f]] = getFormElementValue("productForm"+productID,extrafields[f]);
						}
						if (fieldtype=="checkbox") {
							content = "";
							thisOne = 1;
							result = getFormElement("productForm"+productID,extrafields[f]+thisOne);
							while (result) {
								if (result.checked == true) {
									if (content != "") {
										content = content+";";
									}
									content = content + result.value;
								}
								thisOne++;
								result = getFormElement("productForm"+productID,extrafields[f]+thisOne);
							}
							currentValues[extrafields[f]] = content;
						}
						if (fieldtype=="radio") {
							buttons = getFormElement("productForm"+productID,extrafields[f]);
							radlength = buttons.length;
							for (g = 0; g < radlength; g++) {
								thisoption = buttons[g].checked;
								if (thisoption) {
									currentValues[extrafields[f]] = buttons[g].value;
								}
							}
						}
					}
				}
				eval ("arraylength = p"+productID+".length;");
				eval ("advArray = p"+productID+";");
				for (f = 0; f <  arraylength; f++) {		
					applicable = false;
					doesExist = false;
					for (var h in advArray[f]) {
						if (h == "qtyfrom") {
							doesExist = true;
						}
					}
					if (doesExist) {
						if (parseInt(advArray[f]["qtyfrom"]) != -1 && parseInt(advArray[f]["qtyto"]) != -1 && parseInt(advArray[f]["qtyto"]) != 0) {
							//quantity is applicable here
							if (parseInt(qty) >= parseInt(advArray[f]["qtyfrom"]) && parseInt(qty) <= parseInt(advArray[f]["qtyto"])) {
								applicable = true;
							}
						} else {
							applicable = true;
						}
					} else {
						applicable = true;
					}
					thisapplic = true;
					foundMatches = 0;
					for (g = 0; g < efcount; g++) {
						doesExist = false;
						for (var h in advArray[f]) {
							if (h == extrafields[g]) {
								doesExist = true;
							}
						}
						if (doesExist) {
							if (advArray[f][extrafields[g]] != "" && advArray[f][extrafields[g]] != "0") {
								splitCheck = advArray[f][extrafields[g]].split(";");
								splitapplic = false;
								for (k = 0; k < splitCheck.length; k++) {
									splitValues = currentValues[extrafields[g]].split(";");
									for (l = 0; l < splitValues.length; l++) {
										if ((splitCheck[k] == splitValues[l] && splitCheck[k] != "" && splitValues[l] != "")) {
											splitapplic = true;
											if (extrafieldstype[g] == "CHECKBOXES") {
												foundMatches = foundMatches + 1;
											}
										}
									}
								}
								if (splitapplic == true && thisapplic == true) {
									thisapplic = true;
								} else {
									thisapplic = false;
								}
							}
						}
					}
					if (thisapplic == true && applicable == true) {
						applicable = true;
					} else {
						applicable = false;
					}
					if (applicable == true) {
						//new base price
						if (foundMatches == 0) { foundMatches =1; }
						npPercentage = 0;
						npPrice = 0;
						npPriceExTax = 0;
						npPriceIncTax = 0;
						npPriceTax = 0;
						for (var h in advArray[f]) {
							if (h == "percentage") {
								npPercentage = eval(advArray[f]["percentage"]);
							}
							if (h == "price") {
								npPrice = eval(advArray[f]["price"]);
							}
							if (h == "priceExTax") {
								npPriceExTax = eval(advArray[f]["priceExTax"]);
							}
							if (h == "priceIncTax") {
								npPriceIncTax = eval(advArray[f]["priceIncTax"]);
							}
							if (h == "priceTax") {
								npPriceTax = eval(advArray[f]["priceTax"]);
							}
						}

						if (parseInt(advArray[f]["priceType"]) == 0) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								thisPrice = thisPrice + (thisPrice  * (npPercentage/100));
								thisPriceExTax = thisPriceExTax + (thisPriceExTax  * (npPercentage/100));
								thisPriceIncTax = thisPriceIncTax + (thisPriceIncTax  * (npPercentage/100));
								thisPriceTax = thisPriceTax + (thisPriceTax  * (npPercentage/100));
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								thisPrice = thisPrice - (thisPrice  * (Math.abs(npPercentage)/100));
								thisPriceExTax = thisPriceExTax - (thisPriceExTax  * (Math.abs(npPercentage)/100));
								thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax  * (Math.abs(npPercentage)/100));
								thisPriceTax = thisPriceTax - (thisPriceTax  * (Math.abs(npPercentage)/100));
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								thisPrice = npPrice;
								thisPriceExTax = npPriceExTax;
								thisPriceIncTax = npPriceIncTax;
								thisPriceTax = npPriceTax;
							}
						}
						if (parseInt(advArray[f]["priceType"]) == 1) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice + (thisPrice  * (npPercentage/100));
									thisPriceExTax = thisPriceExTax + (thisPriceExTax  * (npPercentage/100));
									thisPriceIncTax = thisPriceIncTax + (thisPriceIncTax  * (npPercentage/100));
									thisPriceTax = thisPriceTax + (thisPriceTax  * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice  * (Math.abs(npPercentage)/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax  * (Math.abs(npPercentage)/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax  * (Math.abs(npPercentage)/100));
									thisPriceTax = thisPriceTax - (thisPriceTax  * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice + npPrice;
									thisPriceExTax = thisPriceExTax + npPriceExTax;
									thisPriceIncTax = thisPriceIncTax + npPriceIncTax;
									thisPriceTax = thisPriceTax + npPriceTax;
								}
							}
						}	
						if (parseInt(advArray[f]["priceType"]) == 2) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice * (npPercentage/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax * (npPercentage/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax * (npPercentage/100));
									thisPriceTax = thisPriceTax - (thisPriceTax * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice * (Math.abs(npPercentage)/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax * (Math.abs(npPercentage)/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax * (Math.abs(npPercentage)/100));
									thisPriceTax = thisPriceTax - (thisPriceTax * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - npPrice;
									thisPriceExTax = thisPriceExTax - npPriceExTax;
									thisPriceIncTax = thisPriceIncTax - npPriceIncTax;
									thisPriceTax = thisPriceTax - npPriceTax;
								}
							}
						}	
						if (parseInt(advArray[f]["priceType"]) == 4) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = thisOOPrice - (thisOOPrice * (npPercentage/100));
									thisOOPriceExTax = thisOOPriceExTax - (thisOOPriceExTax * (npPercentage/100));
									thisOOPriceIncTax = thisOOPriceIncTax - (thisOOPriceIncTax * (npPercentage/100));
									thisOOPriceTax = thisOOPriceTax - (thisOOPriceTax * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = thisOOPrice - (thisPrice * (Math.abs(npPercentage)/100));
									thisOOPriceExTax = thisOOPriceExTax - (thisOOPriceExTax * (Math.abs(npPercentage)/100));
									thisOOPriceIncTax = thisOOPriceIncTax - (thisOOPriceIncTax * (Math.abs(npPercentage)/100));
									thisOOPriceTax = thisOOPriceTax - (thisOOPriceTax * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = npPrice;
									thisOOPriceExTax = npPriceExTax;
									thisOOPriceIncTax = npPriceIncTax;
									thisOOPriceTax = npPriceTax;
								}
							}
						}																
					}							
				}
				displayPrice = presentValue(thisPrice,cDP,cPreT,cMidT,cPostT);
				changeContent("priceSpan"+productID,"priceLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceExTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceExTaxSpan"+productID,"priceExTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceIncTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceIncTaxSpan"+productID,"priceIncTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceTaxSpan"+productID,"priceTaxLayer"+productID,displayPrice);
				
				displayPrice = presentValue(thisOOPrice,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceSpan"+productID,"oopriceLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceExTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceExTaxSpan"+productID,"oopriceExTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceIncTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceIncTaxSpan"+productID,"oopriceIncTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceTaxSpan"+productID,"oopriceTaxLayer"+productID,displayPrice);
			}
			
			isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;
			
function changeContent(theDiv,theLayer,newText) {
	if (isNS4){
	   elm = document.layers[theLayer];
	   elm.document.open();
       elm.document.write(newText);
       elm.document.close();

	}
	else if (isIE4) {
	   elm = document.all[theDiv];
	   elm.innerText = newText;
	}
	else if (isIE5) {
	   elm = document.getElementById(theDiv);
		if (elm) {
	   		elm.innerText = newText;
	   	}
	}
	else if (isNS6) {
		var elmw = document.getElementById(theDiv);
    	if (elmw) {
    		elmw.childNodes[0].nodeValue = newText;
    	}	
	}
}			

    function presentValue(value,dp,pt,mt,at) {
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=dp;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=dp-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (dp>0) {
            if (newPence==eval(dec)) { newPounds++; newPence='00'; }
            newString=pt+newPounds+mt+newPence+at;
        } else {
            newString=pt+newPounds+at;
        }
        return (newString);
    }

	function doesFormElementExist(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return true;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return true;
			}
		}
		return false;
	}

	function getFormElementValue(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName].value;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName].value;
			}
		}
		return "";
	}

	function getFormElementType(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName].type;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName].type;
			}
		}
		return "";
	}

	function getFormElement(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName];
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName];
			}
		}
		return "";
	}

	function jss_openWindow(url) {
		window.open(url,"JSSWindow","height=400,width=500,resizable=1");
	}
	
	// Begin Macromedia swap image function
	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) { //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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 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];}
}

// End Macromedia swap image function

// -------------------------------------------------------------------
// ADD ALL THIS CODE TO THE BOTTOM OF YOUR "resources/jserver.js" FILE
// AND USE THE EXAMPLES BELOW TO FORMAT YOUR "product.html" TEMPLATE
// Triggerhippie - Dimitri
// -------------------------------------------------------------------
// Image Thumbnail Viewer II- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Last updated: Feb 5th, 2007
// http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm
//
// <!-- rel="enlargeimage::mouseover" OR rel="enlargeimage::click"  (mouseover will preload images / click doesn't) -->
// <!-- rev="imgloadarea (id of div etc that will load image) :: {product.mainimage} (hyperlink for loaded image) -->
//
// EXAMPLE HTML CODE
//
// <!-- Image container div -->
// <div id="imgloadarea" style="padding: 2px;"><img src="{product.mainimage}" border="0" /></div>
//
// <!-- textual product image links I place below main image -->
// <a href="{product.mainimage}" rel="enlargeimage::click" rev="imgloadarea::{product.mainimage}" 
// title="main product image">image 1</a>
// <#if:product.extra_mainimage1.content:neq:blank#> | <a href="{product.extra_mainimage1.content}"
// rel="enlargeimage::click" rev="imgloadarea::{product.extra_mainimage1.content}" 
// title="extra product image 2">image 2</a><#/if#>
//
// -------------------------------------------------------------------

var thumbnailviewer2={
enableTitle: false, //Should "title" (true or false) attribute of link be used as description?
enableTransition: true, //Enable fading transition in IE?
hideimgmouseout: false, //Hide enlarged image when mouse moves out of anchor link? (if enlarged image is hyperlinked, always set to false!)

/////////////No need to edit beyond here/////////////////////////

iefilterstring: 'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)', //IE specific multimedia filter string
iefiltercapable: document.compatMode && window.createPopup? true : false, //Detect browser support for IE filters
preloadedimages:[], //array to preload enlarged images (ones set to display "onmouseover"
targetlinks:[], //array to hold participating links (those with rel="enlargeimage:initType")
alreadyrunflag: false, //flag to indicate whether init() function has been run already come window.onload

loadimage:function(linkobj){
var imagepath=linkobj.getAttribute("href") //Get URL to enlarged image
var showcontainer=document.getElementById(linkobj.getAttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
var dest=linkobj.getAttribute("rev").split("::")[1] //Get URL enlarged image should be linked to, if any
var description=(thumbnailviewer2.enableTitle && linkobj.getAttribute("title"))? linkobj.getAttribute("title") : "" //Get title attr
var imageHTML='<img src="'+imagepath+'" style="border-width: 0" />' //Construct HTML for enlarged image
if (typeof dest!="undefined") //Hyperlink the enlarged image?
// imageHTML='<a href="'+dest+'">'+imageHTML+'</a>' // JOS original line
imageHTML=''+imageHTML+''
if (description!="") //Use title attr of the link as description?
imageHTML+='<br />'+description
if (this.iefiltercapable){ //Is this an IE browser that supports filters?
showcontainer.style.filter=this.iefilterstring
showcontainer.filters[0].Apply()
}
showcontainer.innerHTML=imageHTML
this.featureImage=showcontainer.getElementsByTagName("img")[0] //Reference enlarged image itself
this.featureImage.onload=function(){ //When enlarged image has completely loaded
if (thumbnailviewer2.iefiltercapable) //Is this an IE browser that supports filters?
showcontainer.filters[0].Play()
}
this.featureImage.onerror=function(){ //If an error has occurred while loading the image to show
if (thumbnailviewer2.iefiltercapable) //Is this an IE browser that supports filters?
showcontainer.filters[0].Stop()
}
},

hideimage:function(linkobj){
var showcontainer=document.getElementById(linkobj.getAttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
showcontainer.innerHTML=""
},


cleanup:function(){ //Clean up routine on page unload
if (this.featureImage){this.featureImage.onload=null; this.featureImage.onerror=null; this.featureImage=null}
this.showcontainer=null
for (var i=0; i<this.targetlinks.length; i++){
this.targetlinks[i].onclick=null
this.targetlinks[i].onmouseover=null
this.targetlinks[i].onmouseout=null
}
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
},

init:function(){ //Initialize thumbnail viewer script
this.iefiltercapable=(this.iefiltercapable && this.enableTransition) //True or false: IE filters supported and is enabled by user
var pagelinks=document.getElementsByTagName("a")
for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
if (pagelinks[i].getAttribute("rel") && /enlargeimage:/i.test(pagelinks[i].getAttribute("rel"))){ //Begin if statement: Test for rel="enlargeimage"
var initType=pagelinks[i].getAttribute("rel").split("::")[1] //Get display type of enlarged image ("click" or "mouseover")
if (initType=="mouseover"){ //If type is "mouseover", preload the enlarged image for quicker display
this.preloadedimages[this.preloadedimages.length]=new Image()
this.preloadedimages[this.preloadedimages.length-1].src=pagelinks[i].href
pagelinks[i]["onclick"]=function(){ //Cancel default click action
return false
}
}
pagelinks[i]["on"+initType]=function(){ //Load enlarged image based on the specified display type (event)
thumbnailviewer2.loadimage(this) //Load image
return false
}
if (this.hideimgmouseout)
pagelinks[i]["onmouseout"]=function(){
thumbnailviewer2.hideimage(this)
}
this.targetlinks[this.targetlinks.length]=pagelinks[i] //store reference to target link
} //end if statement
} //END FOR LOOP


} //END init() function

}


if (document.addEventListener) //Take advantage of "DOMContentLoaded" event in select Mozilla/ Opera browsers for faster init
thumbnailviewer2.addEvent(document, function(){thumbnailviewer2.alreadyrunflag=1; thumbnailviewer2.init()}, "DOMContentLoaded") //Initialize script on page load
else if (document.all && document.getElementsByTagName("a").length>0){ //Take advantage of "defer" attr inside SCRIPT tag in IE for instant init
thumbnailviewer2.alreadyrunflag=1
thumbnailviewer2.init()
}
thumbnailviewer2.addEvent(window, function(){if (!thumbnailviewer2.alreadyrunflag) thumbnailviewer2.init()}, "load") //Default init method: window.onload
thumbnailviewer2.addEvent(window, function(){thumbnailviewer2.cleanup()}, "unload")

// End dynamic image swapper


// ---------------------------------------------------------
// Drop down menu code
// ---------------------------------------------------------
// JavaScript Document
function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function P7_autoLayers() { //v1.2 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}

function P7_Snap() { //v2.62 by PVII
  var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
  for (k=0; k<(args.length-3); k+=4)
   if ((g=MM_findObj(args[k]))!=null) {
    el=eval(MM_findObj(args[k+1]));
    a=parseInt(args[k+2]);b=parseInt(args[k+3]);
    x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
    if(document.getElementById) {
     d="document.getElementsByName('"+args[k]+"')[0]";
     if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
    }else if(document.all) {d=da;} 
    if (document.all || document.getElementById) {
     while (tx==1) {p+=".offsetParent";
      if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
      }else{tx=0;}}
     ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
     if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
      ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
      }else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
      a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
      x=document.body.scrollLeft + event.clientX + bx;
      y=document.body.scrollTop + event.clientY;}}
   }else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
    for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
     if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
   if(el) {e=(document.layers)?el:el.style;
   var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
   if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
   if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
    xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
    xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
}
// ---------------------------------------------------------
// EOF Drop down menu code
// ---------------------------------------------------------

// ---------------------------------------------------------
// Form Calculator
// ---------------------------------------------------------

function YY_CalculateForm() { //v3.01
//copyright (c)1999-2000 Yaromat.com
  var args=YY_CalculateForm.arguments;
  var myResult=""; var myField="0";
  if (document.all){eval("args[0]=args[0].replace(/.layers/gi, '.all');");}
  for (var i=3; i<args.length; i++){
    if(args[i].charAt(0)!="#"){
      myResult=myResult+args[i];
    }else{
      myField=eval(args[0]+'.'+ args[i].substring(1)+'.value'); if(myField=="")myField="0";
      myResult=myResult+myField;
    }
  }
  with (Math) {
    var myExpo = pow(10, args[2]);
    var myStr = round(myExpo*eval(myResult))/myExpo;
  }
  eval(args[0]+'.'+args[1]+'.value='+myStr);
}
// ---------------------------------------------------------
//  EOF Form Calculator
// ---------------------------------------------------------
