/////////////////////////////////////////////////   Window POP-up  BEGIN ////////////////////////////////////////
// used with offering 10483
/*
<script language="javascript">	
function openWin(pager) {
	myWin= open(pager, "popupWindow","width=254, height=205, status=no,scrollbars=no,toolbar=no,menubar=no");
}
</script>*/
/////////////////////////////////////////////////   Window POP-up  END ////////////////////////////////////////
/////////////////////////////////////////////////   Leaded Glass  BEGIN ////////////////////////////////////////
function openWin( windowURL, windowName, windowFeatures ) {
	return window.open( windowURL, windowName, windowFeatures ) ;
}
function sqinch(form) {

a=eval(form.a.value)  //quanity
b=eval(form.b.value)  //width
c=eval(form.c.value)  //length

// Textured
if (b > 20)
{
	alert('You Must Enter a valid Width no greater than 20 inches : Please Try Again');
	return false;
}
if (c > 44)
{
	alert('You Must Enter a valid Height no greater than 44 inches : Please Try Again');
	return false;
}

var WholeNoWidth;
var WholeNolength;

// Width Round Conversion
var StringWidth = String(b);
var width_is_decimal_there = StringWidth.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (width_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoWidth = b; //whole number don't add .5
}
else
{
	WholeNoWidth = b + .5; //if decimal then add .5 to number
	WholeNoWidth = Math.round(WholeNoWidth);
}


// Length Round Conversion
var StringLength = String(c);
var length_is_decimal_there = StringLength.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (length_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoLength = c; //whole number don't add .5
}
else
{
	WholeNoLength = c + .5; //if decimal then add .5 to number
	WholeNoLength = Math.round(WholeNoLength);
}

var SqInchTotal=WholeNoLength*WholeNoWidth;
if (SqInchTotal < 144)
	{	SqInchTotal=144;  	}

var result=SqInchTotal*a
form.ans.value=result

}
function leadedsqinch(form) {

a=eval(form.a.value)  //quanity
b=eval(form.b.value)  //width
c=eval(form.c.value)  //length

// Leaded Glass
if ((b < 12) || (b > 18))
{
	alert('You Must Enter a valid Width between 12-18 inches : Please Try Again');
	return false;
}
if ((c < 18) || (c > 36))
{
	alert('You Must Enter a valid Height between 18-36 inches : Please Try Again');
	return false;
}


var WholeNoWidth;
var WholeNolength;

// Width Round Conversion
var StringWidth = String(b);
var width_is_decimal_there = StringWidth.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (width_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoWidth = b; //whole number don't add .5
}
else
{
	WholeNoWidth = b + .5; //if decimal then add .5 to number
	WholeNoWidth = Math.round(WholeNoWidth);
}


// Length Round Conversion
var StringLength = String(c);
var length_is_decimal_there = StringLength.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (length_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoLength = c; //whole number don't add .5
}
else
{
	WholeNoLength = c + .5; //if decimal then add .5 to number
	WholeNoLength = Math.round(WholeNoLength);
}

var SqInchTotal=WholeNoLength*WholeNoWidth;
if (SqInchTotal < 144)
	{	SqInchTotal=144;  	}

var result=SqInchTotal*a
form.ans.value=result

}
/////////////////////////////////////////////////  Glass Texture END ////////////////////////////////////////

/////////////////////////////////////////////////   WOOD CALC BEGIN  ////////////////////////////////////////
// oferings 834, 835, 836, 837, 838, 839, 6047, 6049, 6052, 10525, 10526, 10527, 10528, 10529, 10530, 10531
function sqfoot(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=eval(form.c.value)
d=a*b
e=d*c
var result=Math.round(e/14.4)
form.ans.value=result
}
/////////////////////////////////////////////////   WOOD CALC END ////////////////////////////////////////

/////////////////////////////////////////////////   Balusters  BEGIN  ////////////////////////////////////////
//offerings 5480, 10784, 10785, 10786, 10787, 10794, 10826
/***** Pop-up window script created by Béatrice Karjalainen
bea@ludd.luth.se. Script and documentation can be found at
http://www.spray.se/dbb/Scripts/PopUp/pop_up_position.html
This script is free to use as long as you keep these lines
in the code. *****/
/*
	function: openPopUpWin
	parameters: pageURL, width, height
	pageURL is an adress to the web page to be opened in the new window
	width is the width of the new window
	height is the height of the new window
*/
function openPopUpWin(pageURL, width, height, topPos, leftPos){
	//Set up the window


winSettings=
	'width='+width+ 
	',' +
	'height='+height+
	',' +	
	 'top='+topPos+
  	','+
	'left='+leftPos+			
  	','+
	'scrollbars=0,'+	//0 for no scrollbars and 1 for scrollbars
	'location=0,'+		//0 for no location bar and 1 for location bar
	'directories=0,'+	//0 for no directory bar and 1 for directory bar
	'status=0,'+		//0 for no status bar and 1 for status bar
	'menubar=0,'+		//0 for no menu bar and 1 for menu bar
	'toolbar=0,'+		//0 for no tool bar and 1 for tool bar
	'resizable=0';		//0 for not resizable and 1 for resizable window 
				  
	//Launch the window	
	popUpWin = window.open(pageURL,"",winSettings); 
}

/////////////////////////////////////////////////   Balusters END ////////////////////////////////////////

/////////////////////////////////////////////////   Classic Brass  BEGIN  ////////////////////////////////////////
//offerings 5694, 5695, 5696, 5698, 5699, 5997, 5999, 10296, 10297, 10298
var ClampPic = new Array()
  ClampPic[1] = "/rockler/images/54487-polished_lg.jpg";
  ClampPic[2] = "/rockler/images/54487-rubbed_lg.jpg";
  ClampPic[3] = "/rockler/images/54487-satin_lg.jpg";
  ClampPic[4] = "/rockler/images/54487-weathered_brass_lg.jpg";
  ClampPic[5] = "/rockler/images/54487-weathered_pewter_lg.jpg";

function swapImageField(num) {
     document.imageflip.src=ClampPic[num];
}

/////////////////////////////////////////////////   Classic Brass END ////////////////////////////////////////

/////////////////////////////////////////////////   Custom Door and Drawer Front Program  BEGIN  ////////////////////////////////////////
// offerings 5986, 5993
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) { //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];}
}


loadimg0 = new Image();
loadimg0.src = "/rockler/images/11162_Custom_Doors_After.jpg";
loadimg1 = new Image();
loadimg1.src = "/rockler/images/Door_14b.jpg";
loadimg2 = new Image();
loadimg2.src = "/rockler/images/Door_15b.jpg";
loadimg3 = new Image();
loadimg3.src = "/rockler/images/Door_16b.jpg";
/////////////////////////////////////////////////   Custom Door and Drawer Front Program END ////////////////////////////////////////

/////////////////////////////////////////////////   Leaded Glass  BEGIN  ////////////////////////////////////////
// offering 10826
function sqinch(form) {

a=eval(form.a.value)  //quanity
b=eval(form.b.value)  //width
c=eval(form.c.value)  //length

// Textured 
if (b > 20)
{
	alert('You Must Enter a valid Width no greater than 20 inches : Please Try Again');
	return false;
}
if (c > 44) 
{
	alert('You Must Enter a valid Height no greater than 44 inches : Please Try Again');
	return false;
}

var WholeNoWidth;
var WholeNolength;

// Width Round Conversion
var StringWidth = String(b);
var width_is_decimal_there = StringWidth.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (width_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoWidth = b; //whole number don't add .5
}
else
{
	WholeNoWidth = b + .5; //if decimal then add .5 to number
	WholeNoWidth = Math.round(WholeNoWidth);
}


// Length Round Conversion
var StringLength = String(c);
var length_is_decimal_there = StringLength.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (length_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoLength = c; //whole number don't add .5
}
else
{
	WholeNoLength = c + .5; //if decimal then add .5 to number
	WholeNoLength = Math.round(WholeNoLength);
}

var SqInchTotal=WholeNoLength*WholeNoWidth;
if (SqInchTotal < 144)
	{	SqInchTotal=144;  	}

var result=SqInchTotal*a
form.ans.value=result

}

function leadedsquareinch(form) {

a=eval(form.a.value)  //quanity
b=eval(form.b.value)  //width
c=eval(form.c.value)  //length

// Leaded Glass
if ((b < 12) || (b > 18))
{
	alert('You Must Enter a valid Width between 12-18 inches : Please Try Again');
	return false;
}
if ((c < 18) || (c > 36))
{
	alert('You Must Enter a valid Height between 18-36 inches : Please Try Again');
	return false;
}


var WholeNoWidth;
var WholeNolength;

// Width Round Conversion
var StringWidth = String(b);
var width_is_decimal_there = StringWidth.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (width_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoWidth = b; //whole number don't add .5
}
else
{
	WholeNoWidth = b + .5; //if decimal then add .5 to number
	WholeNoWidth = Math.round(WholeNoWidth);
}


// Length Round Conversion
var StringLength = String(c);
var length_is_decimal_there = StringLength.indexOf('.');  // Use indexOf to return -1 if a decimal is not contained within the number string.
if (length_is_decimal_there == -1) // if -1 returned then number is whole
{
	WholeNoLength = c; //whole number don't add .5
}
else
{
	WholeNoLength = c + .5; //if decimal then add .5 to number
	WholeNoLength = Math.round(WholeNoLength);
}

var SqInchTotal=WholeNoLength*WholeNoWidth;
if (SqInchTotal < 144)
	{	SqInchTotal=144;  	}

var result=SqInchTotal*a
form.ans.value=result

}
/////////////////////////////////////////////////   Leaded Glass END ////////////////////////////////////////

/////////////////////////////////////////////////   Blumotion for Cabinet Doors  Begin ////////////////////////////////////////
// offerings 10844
	function openslideshow(aLink, aSize) {
		window.open(aLink, 'wndSlideshow', 'width=630,height=410,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,');
	}
/////////////////////////////////////////////////   Blumotion for Cabinet Doors  End ////////////////////////////////////////

/////////////////////////////////////////////////   Straight Line Laser  Begin ////////////////////////////////////////
// offerings 10647
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

/////////////////////////////////////////////////   Straight Line Laser  End ////////////////////////////////////////
