/*
	var _control can have the following values: English, Metric, Inches, Feet, Empty ( Initial )
	This variable controls the validations to be done when user clicks on Add Cart Button
*/
var cnt=1;
var contr=1;
var _control = "Empty";
function check_vars(pid, form )
{
	var form = document.Form;
	qObj = document.all("quantity["+pid+"]");
	var pqty = qObj.value;
	checkFeild = document._control;

	//diaObj = document.Form.all.item("PIDXX[]");
	diaObj = document.all.item("PIDXX[]");

	if( checkFeild == "Inches" )
	{
		if( !validText("Diameter1", document.Form.Diameter1.value,"Diameter1",0) )
		return false;
		if( !validText("Diameter2", document.Form.Diameter2.value,"Diameter2",0) )
		return false;
		var diameter1 = ( !isNaN(document.Form.Diameter1.value) ) ? parseFloat( document.Form.Diameter1.value ) : 0;
		var diameter2 = ( !isNaN(document.Form.Diameter2.value) ) ? parseFloat( document.Form.Diameter2.value ) : 0;
		
		//var pid1      = ( !isNaN(document.Form.PIDXX[0].value) ) ? parseFloat( document.Form.PIDXX[0].value ) : 0;
		//var pid2      = ( !isNaN(document.Form.PIDXX[4].value) ) ? parseFloat( document.Form.PIDXX[4].value ) : 0;

		var pid1    =    ( !isNaN(diaObj[0].value) ) ? parseFloat(diaObj[0].value ) : 0;
		var pid2    =    ( !isNaN(diaObj[4].value) ) ? parseFloat(diaObj[4].value ) : 0;
		
		document.Form.dia1.value =  diameter1 + pid1;
		document.Form.dia2.value =  diameter2 + pid2;
	
	
	// code for rule 7/13/2009 by minhaj 

		var num1 = parseInt(document.Form.dia1.value);
		var num2 = parseInt(document.Form.dia2.value);
		var avg_dia = (num1+num2)/2;	
		
		if(avg_dia < 30){
			
			if(contr == 1)
			{
			contr=2;	
			var new_window = window.open('alert_rectmat_demo.php?size=mat_size'+'&avg_dia='+avg_dia,'mywin','left=250,top=100,width=350,height=300,toolbar=1,resizable=0');						
			document.Form.Diameter1.focus();			
			new_window.focus();			
			return false;
			}
	}
	// end code for rule 7/13/2009 by minhaj 
	}

	if( checkFeild == "Feet" )
	{
		if( !validSelect(diaObj[1], "Feet" ) )
		{
			return false;
		}
		if( !validSelect(diaObj[5], "Feet" ) )
		{
			return false;
		}
		
		if( !validText("SpringCount", document.Form.SpringCount.value, "Spring Count", 0) )
		{
			return false;
		}
		
		
		/*
		var feet1 = ( !isNaN(document.Form.PIDXX[2].value) ) ? parseFloat( document.Form.PIDXX[2].value ) : 0;
		var inch1 = ( !isNaN(document.Form.PIDXX[1].value) ) ? parseFloat( document.Form.PIDXX[1].value ) : 0;
		var fraction1 = ( !isNaN(document.Form.PIDXX[3].value) ) ? parseFloat( document.Form.PIDXX[3].value ) : 0;
		var feet2 = ( !isNaN(document.Form.PIDXX[5].value) ) ? parseFloat( document.Form.PIDXX[5].value ) : 0;
		var inch2 = ( !isNaN(document.Form.PIDXX[6].value) ) ? parseFloat( document.Form.PIDXX[6].value ) : 0;
		var fraction2 = ( !isNaN(document.Form.PIDXX[7].value) ) ? parseFloat( document.Form.PIDXX[7].value ) : 0;
		*/

		var feet1 = ( !isNaN(diaObj[1].value) ) ? parseFloat( diaObj[1].value ) : 0;
        var inch1 = ( !isNaN(diaObj[2].value) ) ? parseFloat( diaObj[2].value ) : 0;
        var fraction1 = ( !isNaN(diaObj[3].value) ) ? parseFloat( diaObj[3].value ) : 0;
        var feet2 = ( !isNaN(diaObj[5].value) ) ? parseFloat( diaObj[5].value ) : 0;
        var inch2 = ( !isNaN(diaObj[6].value) ) ? parseFloat( diaObj[6].value ) : 0;
        var fraction2 = ( !isNaN(diaObj[7].value) ) ? parseFloat( diaObj[7].value ) : 0;
        
		var input1 = feet1 + "-ft " + (inch1 + fraction1);
		var input2 = feet2 + "-ft " + (inch2 + fraction2);
		document.Form.dia1.value = input1;
		document.Form.dia2.value = input2;
		
		/*if(document.Form.dia1.value == document.Form.dia2.value){
			alert("We ask for both diameter measurements because we expect slight variation.  Please be certain you've measured in both directions with the 'grain' of the weave");
		}*/
	}
	if( checkFeild == "Metric" )
	{
		if( !validText("Diameter1", document.Form.Diameter1.value,"Diameter1",0) )
		return false;
		if( !validText("Diameter2", document.Form.Diameter2.value,"Diameter2",0) )
		return false;
		var diameter1 = ( !isNaN(document.Form.Diameter1.value) ) ? parseFloat( document.Form.Diameter1.value ) : 0;
		var diameter2 = ( !isNaN(document.Form.Diameter2.value) ) ? parseFloat( document.Form.Diameter2.value ) : 0;
		
		/*
		var pid1 = ( !isNaN(document.Form.PIDXX[0].value) ) ? parseFloat( document.Form.PIDXX[0].value ) : 0;
		var pid2 = ( !isNaN(document.Form.PIDXX[4].value) ) ? parseFloat( document.Form.PIDXX[4].value ) : 0;
		*/
		var pid1      = ( !isNaN(diaObj[0].value) ) ? parseFloat( diaObj[0].value ) : 0;
		var pid2      = ( !isNaN(diaObj[4].value) ) ? parseFloat( diaObj[4].value ) : 0;
		

		var input1 = diameter1 + pid1;
		var input2 = diameter2 + pid2;

		document.Form.dia1.value = input1;
		document.Form.dia2.value = input2;

		// code for rule 7/13/2009 by minhaj 
		var num1 = parseInt(document.Form.dia1.value)/2.54;
		var num2 = parseInt(document.Form.dia2.value)/2.54;
		var avg_dia = (num1+num2)/2;	
		
		if(avg_dia < 30){
			
			if(contr == 1)
			{
			contr=2;	
			var new_window = window.open('alert_rectmat_demo.php?size=mat_size'+'&avg_dia='+avg_dia,'mywin','left=250,top=100,width=350,height=300,toolbar=1,resizable=0');						
			document.Form.Diameter1.focus();			
			new_window.focus();
			
			return false;

			}
	}
	// end code for rule 7/13/2009 by minhaj 
		
	}
	
	/* this validation is added by Minhaj */
	if(document.getElementById('nn_Fabric').value==''){
		alert('Please select mat fabric.');
		return false;
	}
	if(document.getElementById('nn_UVProtection').value==''){
		alert('Please select UV Protection Options.');
		return false;
	}
	/* this validation is added by Minhaj */
	
	if (form.SpringCount.value == "")
	{
		alert("Please enter your Spring Count.")
		document.Form.SpringCount.focus()
		return false;
	}
	if (isNaN(form.SpringCount.value))
	{
		alert("Please enter numeric value for Spring Count.")
		form.SpringCount.value='';
		document.Form.SpringCount.focus()
		return false;
	}
	if (!(form.SpringCount.value <= 99999 && form.SpringCount.value > 0))
	{
		alert("When entering Spring Count, Please do not enter decimal points.");
		form.SpringCount.value='';
		document.Form.SpringCount.focus();
		return false;
	}

	if (form.SpringCount.value != "")
	{
		if( !validText("SpringCount", document.Form.SpringCount.value,"Spring Count",0) )
		return false;
	}

	
	
	
	if (pqty == "")
	{
		alert("Please enter the quantity.");
		qObj.focus();
		return false;
	}

	if (!(pqty <= 99999 && pqty  > 0))
	{
		alert("Please enter a numeric value for Quantity");
		qObj.value='';
		qObj.focus();
		return false;
	}
	if(pqty.indexOf(".") != -1)
	{
		//alert("Invalid Quantity");
		alert("Please enter quantity in whole numbers"); 
		qObj.value='';
		qObj.focus();
		return false;
	}

	// old Array var springval = new Array("104", "100", "96", "90", "88", "84", "80", "72");

	var springval = new Array("120", "104", "100", "96", "90", "88", "84", "80", "72", "64");

	var j=0;
	for (i=0; i<springval.length; i++)
	{
		if((springval[i])==(form.SpringCount.value)) j++;
	}
	if(j=="0")
	{
		if(k==1)
		{
			k=2;			
			alert("Your spring count is unusual. Please count again. \n If your entry is correct, click Add to Cart again.");
			document.Form.SpringCount.focus();
			return false;
		}
	}
	
// code for display warning message if both measurement are identical by Minhaj 3/24/2009
if( checkFeild == "Feet" )
    {

		if(document.Form.dia1.value == document.Form.dia2.value)
		{		
			if(cnt == 1)
			{
				cnt=2;				
				var alertMSG = "We ask for both diameter measurements because we expect slight variation.  Please be certain you've measured in both directions with the 'grain' of the weave.";
				alert(alertMSG);
				diaObj[1].focus();
				return false;
			}		
		}
	}
	else
	{
		if(document.Form.dia1.value == document.Form.dia2.value)
		{		
			if(cnt == 1)
			{
				cnt=2;	
				var alertMSG = "We ask for both diameter measurements because we expect slight variation.  Please be certain you've measured in both directions with the 'grain' of the weave.";
				alert(alertMSG);
				document.Form.Diameter1.focus();
				return false;
			}		
		}
	}
// end code for display warning message if both measurement are identical by Minhaj 3/24/2009

	document.Form.submit();
    return true;
}
function display()
{	
    _control = document._control;
    link_control = e ( "chkroundmatselect" );
    //str = "d2,a1,a2,a3,a4,a16,a5,a6,a7,a8,a9,a10,a11,a12,a14";
	str = "d2,a1,a2,a3,a4,a16,a5,a14";
    hide( str );
    str1= "td1,td2,td3";
    show( str1 );
	
	inner_control    =e( "chkroundmatinchft" );
	if( link_control[0].checked )
    {
		_control        =        "English";                // Check Feild
		//str         =   "a5,d2,td1,td2,td3,td4,td5";
		str         =   "d2,td1,td2,td3";
		show( str );
		
		
		document.getElementById("a5").disabled=false;
		if( inner_control[0].checked )
		{
			
			str          =  "a1,a2,a3,a4,a5,a8,a9,a10,a11,a12,awhy";
			show( str );
			str1= "td1,td2,td3";
			hide( str1 );
			_control = "Inches";
			
			
			document.getElementById("a12").disabled=false;
			document.getElementById("AddToCart").disabled=false;
		}
		if( inner_control[1].checked )
		{
			
			str          =  "a1,a14,a3,a16,a5,a8,a9,a10,a11,a12,awhy";
			show( str );
			str1= "td1,td2,td3";
			hide( str1 );
			_control = "Feet";
			
			document.getElementById("a12").disabled=false;
			document.getElementById("AddToCart").disabled=false;
		}
    }
    if( link_control[1].checked )
    {
	
		//str      =        "a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12";
		str      =        "a1,a2,a3,a4,a5,awhy";
		show( str );
		str1= "td1,td2,td3";
		hide( str1 );
		_control        =        "Metric";
		document.getElementById("a5").disabled=false;
    }
	
	document._control = _control;

	if(document._control=="Feet")
    {
         document.Form.txtinchft1.value = "Feet & Inches";
         document.Form.txtinchft2.value = "Feet & Inches";
			
		if(inner_control[0].checked || inner_control[1].checked )
		{
			document.getElementById("a12").disabled=false;
			document.getElementById("AddToCart").disabled=false;
		}
    }
    else if(document._control=="Inches")
    {
         document.Form.txtinch1.value = "Inches";
         document.Form.txtinch2.value = "Inches";
		
		if(inner_control[0].checked || inner_control[1].checked )
		{
			document.getElementById("a12").disabled=false;
			document.getElementById("AddToCart").disabled=false;
		}
    }
    else if(document._control=="Metric")
    {
        document.Form.txtinch1.value = "Centimeters";
        document.Form.txtinch2.value = "Centimeters";

		if(inner_control[0].checked || inner_control[1].checked )
		{
			document.getElementById("a12").disabled=false;
			document.getElementById("AddToCart").disabled=false;
		}
    }
}
function show( str )
{
	var controls        =        str.split( "," );
    for( i = 0; i < controls.length; i++ )
    {
		element                =        e( controls[i] );
        if( element.style.display        ==        "none" )
			element.style.display        =        '';
    }
}
function hide( str )
{
    var controls    =        str.split( "," );
    for( i = 0; i < controls.length; i++ )
    {
		element     =        e( controls[i] );
        if( element.style.display !=   "none" )
            element.style.display  =   "none";
    }
}
function e( name )
{
	return document.all[name];
}
var k=1;
function validSelect2(feildName, msg)
{
	element                =        eval( "document.Form." + feildName );
	
	if( element.selectedIndex <= 0 )
	{
		alert("Please select a valid option for " + msg );
		eval( "document.Form." + feildName + ".focus();" );
		return false;
	}
	return true;
	
}

function validSelect(feildName, msg)
{
        element                =    eval(feildName);//    eval( "document.Form." + feildName );
        if( element.selectedIndex <= 0 )
        {
                alert("Please select a valid option for " + msg );
                element.focus();
                return false;
        }
        return true;
}

function validText(fieldName, fieldValue, msg, decallowed)
{
	if(decallowed !='0') decallowed   =   2;  // how many decimals are allowed?
	
	if (isNaN(fieldValue) || fieldValue == "")
	{
		if(fieldValue == "")
		{
			if(fieldName=="SpringCount")
			{
				alert("When entering "+msg+". Please do not enter decimal points.");
			}
			else
			{
				alert("When entering "+msg+", please select fraction using pull down menu. Please do not enter decimal points.");
			}
		}
		else
		{
			if(fieldName=="SpringCount")
			{
				alert("Please enter numeric value for "+msg+".");
			}
			else
			{
				alert("Please enter numeric value for  "+msg+".");
			}
		}
//		alert("Please enter a valid decimal number for "+msg+".");
		eval( "document.Form." + fieldName + ".value=''" );
		eval( "document.Form." + fieldName + ".focus();" );
		return false;
	}
	else
	{
		/*if (fieldValue.indexOf('.') == -1)
		{
			fieldValue += ".";
		}
		
		dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
		*/
		//if (dectext.length > decallowed)
		
		//alert(fieldValue.indexOf('.'));
		
		if (fieldValue.indexOf('.') > -1)
		{
			//alert ("Decimal number up to " + decallowed + " decimal places allowed for "+msg+".");
			
			if(fieldName=="SpringCount")
			{
				alert("When entering "+msg+". Please do not enter decimal points.");
			}
			else
			{
				alert("When entering "+msg+", please select fraction using pull down menu. Please do not enter decimal points.");
			}
			eval( "document.Form." + fieldName + ".value='';" );
			eval( "document.Form." + fieldName + ".focus();" );
			return false;
		}
	}
	if (fieldValue<=0)
	{
		alert("Please enter value greater than '0' for "+msg+".");
		eval( "document.Form." + fieldName + ".value=''" );
		eval( "document.Form." + fieldName + ".focus();" );
		return false;
	}
    return true;
}
function getpid(form, allow, cartQty, pid, btnval)
{	
	var frmObj  =  eval( "document." + form );
	var btn;
	frmObj.btn.value = btnval.value;
	if(btnval.value=="View Cart")
	{
		if(cartQty==0)
		{
			alert("Your shopping cart is currently empty");
			return false;
		}
		else
		{
			window.open("shopping_cart.php", "_self");
			return true;
		}
	}
	if(btnval.value=="Check Out")
	{
		//qObj = frmObj.all("quantity["+pid+"]");
		qObj = frmObj.quantity["+pid+"];
		var pqty = qObj.value;
		if(allow==0 && pqty<0)
		{
			alert("Your shopping cart is currently empty");
			return false;
		}
	}
	if(document.Form.matoptions[0].checked == false && document.Form.matoptions[1].checked == false && document.Form.matoptions[2].checked == false)
	{
		alert("Please select Round Mat Configuration");
		document.Form.matoptions[0].focus();
		return false;
	}

	if (!(document.Form.chkroundmatselect[0].checked)&& !(document.Form.chkroundmatselect[1].checked))
    {
		alert("Please select measuring unit");
        document.Form.chkroundmatselect[0].focus();
        return false;
    }
	
	if (document.Form.chkroundmatselect[0].checked == true)
	{
		if (!(document.Form.chkroundmatinchft[0].checked)&& !(document.Form.chkroundmatinchft[1].checked))
		{
			alert("Please select inches or feet");
			document.Form.chkroundmatinchft[0].focus();
			return false;
		}
	}
	if( !check_vars(pid, form ) ) return false;
	else return false;
}
function round_decimals(original_number, decimals) 
{
	var result1 = original_number * Math.pow(10, decimals)
	var result2 = Math.round(result1)
	var result3 = result2 / Math.pow(10, decimals)
	return pad_with_zeros(result3, decimals)
}
function pad_with_zeros(rounded_value, decimal_places) 
{
    // Convert the number to a string
	var value_string = rounded_value.toString()
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")
    // Is there a decimal point?
    if (decimal_location == -1) 
	{
        // If no, then all decimal places will be padded with 0s
		decimal_part_length = 0
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else 
	{
        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    if (pad_total > 0) 
	{
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++)
            value_string += "0"
	}
    return value_string
}

function calPrice_new(pPrice, currency, cur_sign, cur_charges)
{
	//alert(pPrice+"   "+currency+"      "+cur_sign+"      "+cur_charges);
	cur_charges = cur_charges/100;
	optProd = new Array(5)	
	optProd["solidBlack"]=0
	optProd["blue"]=9.95
	optProd["green"]=9.95
	optProd["purple"]=9.95
	optProd["half_half"]=19.95
	optProd["targeted"]=29.95
	optProd["4-check"]=29.95
	optProd["sunShield"]=29.95
	optProd["white"] = 29.95
	optProd["taupe"] = 29.95
	optProd["irishgreen"]=29.95
	optProd["duraClip"]=49.95
	optProd["none"]=0
	var totPrice = pPrice;

	

	document.Form.txtPrice.value=totPrice;
	document.Form.txtPricebottom.value=totPrice;

	
	_control = document._control;
	link_control = e( "chkroundmatselect" );
var checkradio = false;
for(i=0;i<link_control.length;i++){
	if(link_control[i].checked){
	checkradio = true;
	}
}



if (document.getElementById('price_Fabric')){
	if (document.getElementById('price_Fabric').value!='')
	{	
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_Fabric').value + document.getElementById('price_Fabric').value * currency*cur_charges));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}
if (document.getElementById('price_UVProtection')){
	if (document.getElementById('price_UVProtection').value!='')
	{
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_UVProtection').value + document.getElementById('price_UVProtection').value*currency*cur_charges));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}



	
	var MID = document.Form.MID.value;
	var form = document.Form;
	qObj = document.all("quantity["+MID+"]");
	var pqty = qObj.value;	
	
	if(pqty == '')
	{
		pqty = 1;
	}
	//alert('aaa===>'+document.Form.txtPrice.value * currency+document.Form.txtPrice.value * currency*cur_charges)	
	//	document.Form.txtPrice.value = round_decimals(document.Form.txtPrice.value, 2);
	//document.Form.txtPrice.value = cur_sign+""+round_decimals((document.Form.txtPrice.value * currency), 2);
	//document.Form.txtPrice.value = cur_sign+""+round_decimals((document.Form.txtPrice.value * currency * pqty), 2);
	document.Form.txtPrice.value = cur_sign+" "+round_decimals((document.Form.txtPrice.value * pqty), 2);
	document.Form.txtPricebottom.value = cur_sign+" "+round_decimals((document.Form.txtPricebottom.value * pqty), 2);

	if(isNaN(pqty))
	{
	   document.Form.txtPrice.value = '';
	   document.Form.txtPricebottom.value = '';
	   qObj.value = '';
	   alert('Please enter the numeric quantity.')
	}
	if(pqty==0)
	{
	   document.Form.txtPrice.value = '';
	   document.Form.txtPricebottom.value = '';
	   qObj.value = '';
	   alert('Please enter the quantity > 0.')
	}
}


function calPrice(pPrice, currency, cur_sign)
{
	optProd = new Array(11)
	optProd["solidBlack"]=0
	optProd["blue"]=9.95
	optProd["green"]=9.95
	optProd["purple"]=9.95
	optProd["half_half"]=19.95
	optProd["targeted"]=29.95
	optProd["4-check"]=29.95
	optProd["sunShield"]=29.95
	optProd["white"] = 29.95
	optProd["taupe"] = 29.95
	optProd["irishgreen"]=29.95
	optProd["duraClip"]=49.95
	optProd["none"]=0
	var totPrice = pPrice;
	
	document.Form.txtPrice.value=totPrice;
	document.Form.txtPricebottom.value=totPrice;

	
	_control = document._control;
	link_control = e( "chkroundmatselect" );
var checkradio = false;
for(i=0;i<link_control.length;i++){
	if(link_control[i].checked){
	checkradio = true;
	}
}
if(checkradio == true){
if (document.getElementById('price_Fabric')){
	if (document.getElementById('price_Fabric').value!='')
	{	
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_Fabric').value));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}
if (document.getElementById('price_UVProtection')){
	if (document.getElementById('price_UVProtection').value!='')
	{
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_UVProtection').value));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}
}
if(checkradio == false){
if (document.getElementById('price_1_Fabric')){
	if (document.getElementById('price_1_Fabric').value!='')
	{	
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_1_Fabric').value));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}
if (document.getElementById('price_1_UVProtection')){
	if (document.getElementById('price_1_UVProtection').value!='')
	{
		totPrice =(parseFloat(totPrice)+parseFloat(document.getElementById('price_1_UVProtection').value));
		document.Form.txtPrice.value=totPrice;
		document.Form.txtPricebottom.value=totPrice;
	}
}
}

	
	var MID = document.Form.MID.value;
	var form = document.Form;
	qObj = document.all("quantity["+MID+"]");
	var pqty = qObj.value;	
	
	if(pqty == '')
	{
		pqty = 1;
	}
		
	//	document.Form.txtPrice.value = round_decimals(document.Form.txtPrice.value, 2);
	//document.Form.txtPrice.value = cur_sign+""+round_decimals((document.Form.txtPrice.value * currency), 2);
	document.Form.txtPrice.value = cur_sign+""+round_decimals((document.Form.txtPrice.value * currency * pqty), 2);
	document.Form.txtPricebottom.value = cur_sign+""+round_decimals((document.Form.txtPricebottom.value * currency * pqty), 2);

	if(isNaN(pqty))
	{
	   document.Form.txtPrice.value = '';
	   document.Form.txtPricebottom.value = '';
	   qObj.value = '';
	   alert('Please enter the numeric quantity.')
	}
	if(pqty==0)
	{
	   document.Form.txtPrice.value = '';
	   document.Form.txtPricebottom.value = '';
	   qObj.value = '';
	   alert('Please enter the quantity > 0.')
	}
}

function onloadfunction()
{
//d2.style.visibility="hidden";
}
/*
function showftinch()
{
  if (document.Form.chkroundmatselect[0].checked==true)
  {
      roundinchft.style.visibility="visible";
  }
  else
  {   roundinchft.style.visibility="hidden";

  }
}
*/
function MM_openBrWindow(site,target,para)
{
	window.open(site,target,para);
}
function mat_options_PopUp(fabric, width, height)
{
    window.open("mat_options.php?type="+fabric+"", "", "toolbar=no, menubar=no, width="+width+", height="+height+", status=no, scrollbars=yes", false)
}