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_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_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];}

}



function popupWin(win_name, win_link, width, height, scrollb){

	new_win = window.open(win_link, win_name, 'width='+width+',height='+height+',scrollbars='+scrollb+',resizable=1');

}

function updateQty(){
	opener.document.view_product.p_quantity.value = calculator.txtAllTotal.value;
	window.close();
}
function CalcDimensions(){
	S1Value = 0;
	S1Length = calculator.txtS1Length.value*1;
	S1Width = calculator.txtS1Width.value*1;
	if(S1Length != '' && S1Width != ''){
		S1Value = S1Length * S1Width;
		calculator.txtS1Total.value = S1Value.toFixed(2);
	}

	S2Value	= 0;
	S2Length = calculator.txtS2Length.value*1;
	S2Width = calculator.txtS2Width.value*1;
	if(S2Length != '' && S2Width != ''){
		S2Value = S2Length * S2Width;
		calculator.txtS2Total.value = S2Value.toFixed(2);
	}

	S3Value = 0;
	S3Length = calculator.txtS3Length.value*1;
	S3Width = calculator.txtS3Width.value*1;
	if(S3Length != '' && S3Width != ''){
		S3Value = S3Length * S3Width;
		calculator.txtS3Total.value = S3Value.toFixed(2);
	}
	
	S4Value = 0;
	S4Length = calculator.txtS4Length.value*1;
	S4Width = calculator.txtS4Width.value*1;
	if(S4Length != '' && S4Width != ''){
		S4Value = S4Length * S4Width;
		calculator.txtS4Total.value = S4Value.toFixed(2);
	}
		
	S5Value = 0;
	S5Length = calculator.txtS5Length.value*1;
	S5Width = calculator.txtS5Width.value*1;
	if(S5Length != '' && S5Width != ''){
		S5Value = S5Length * S5Width;
		calculator.txtS5Total.value = S5Value.toFixed(2);
	}
	
	totalValue = S1Value + S2Value + S3Value + S4Value + S5Value;
	view_product.p_quantity.value = totalValue.toFixed(2);
}


// Browser Slide-Show script.
// With image cross fade effect for those browsers that support it.
// Script copyright (c) 2004-2008 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs)
{
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);
  var picture = document.getElementById(pictureName);
  if (picture.filters)
  {
    picture.style.filter="blendTrans(duration=2)";
    picture.filters.blendTrans.Apply();
  }
  picture.src = nextImage;
  if (picture.filters)
  {
    picture.filters.blendTrans.Play();
  }
  var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length) + ';' + nextImage;
  setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
  // Cache the next image to improve performance.
  imageSeparator = futureImages.indexOf(";");
  nextImage = futureImages.substring(0,imageSeparator);
  if (slideCache[nextImage] == null) {
    slideCache[nextImage] = new Image;
    slideCache[nextImage].src = nextImage;
  }
}
