function chkform(obj)
{	
	//	spring_tool		baseBallCap		saddleBag		anchorKit		bagFree		flybar		ladder

	//alert(obj.name);	return false;
	if(obj.name == 'spring_tool')
	{
		if(document.spring_tool.pquantity.value == '' || document.spring_tool.pquantity.value == '0' || isNaN(document.spring_tool.pquantity.value) || checkDotIndex(document.spring_tool.pquantity.value)==true)
		{
			if(document.spring_tool.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.spring_tool.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.spring_tool.pquantity.value = '';
			document.spring_tool.pquantity.focus();
			return false;
		}	
		return true;
	}
	
	if(obj.name == 'baseBallCap')
	{
		if(document.baseBallCap.pquantity.value == '' || document.baseBallCap.pquantity.value == '0' || isNaN(document.baseBallCap.pquantity.value) || checkDotIndex(document.baseBallCap.pquantity.value)==true)
		{
			if(document.baseBallCap.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.baseBallCap.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.baseBallCap.pquantity.value = '';
			document.baseBallCap.pquantity.focus();
			return false;
		}	
		return true;
	}

	if(obj.name == 'saddleBag')
	{
		if(document.saddleBag.pquantity.value == '' || document.saddleBag.pquantity.value == '0' || isNaN(document.saddleBag.pquantity.value) || checkDotIndex(document.saddleBag.pquantity.value)==true)
		{
			if(document.saddleBag.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.saddleBag.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.saddleBag.pquantity.value = '';
			document.saddleBag.pquantity.focus();
			return false;
		}	
		return true;
	}		

	if(obj.name == 'anchorKit')
	{
		if(document.anchorKit.pquantity.value == '' || document.anchorKit.pquantity.value == '0' || isNaN(document.anchorKit.pquantity.value) || checkDotIndex(document.anchorKit.pquantity.value)==true)
		{
			if(document.anchorKit.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.anchorKit.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.anchorKit.pquantity.value = '';
			document.anchorKit.pquantity.focus();
			return false;
		}	
		return true;
	}

	if(obj.name == 'bagFree')
	{
		if(document.bagFree.pquantity.value == '' || document.bagFree.pquantity.value == '0' || isNaN(document.bagFree.pquantity.value) || checkDotIndex(document.bagFree.pquantity.value)==true)
		{
			if(document.bagFree.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.bagFree.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.bagFree.pquantity.value = '';
			document.bagFree.pquantity.focus();
			return false;
		}	
		return true;
	}
	
	if(obj.name == 'flybar')
	{
		if(document.flybar.pquantity.value == '' || document.flybar.pquantity.value == '0' || document.flybar.pquantity.value == '00' || isNaN(document.flybar.pquantity.value) || checkDotIndex(document.flybar.pquantity.value)==true)
		{
			if(document.flybar.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.flybar.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.flybar.pquantity.value = '';
			document.flybar.pquantity.focus();
			return false;
		}	
		return true;
	}

	
	if(obj.name == 'ladder')
	{
		if(document.ladder.pquantity.value == '' || document.ladder.pquantity.value == '0' || isNaN(document.ladder.pquantity.value) || checkDotIndex(document.ladder.pquantity.value)==true)
		{
			if(document.ladder.pquantity.value == '')
			{
				alert("Please enter quantity!!!");
			}
			else if(isNaN(document.ladder.pquantity.value))
			{
				alert("Please enter numeric value for quantity!!!");
			}
			else
			{
				alert("Invalid quantity!!!");
			}

			document.ladder.pquantity.value = '';
			document.ladder.pquantity.focus();
			return false;
		}	
		return true;
	}

	if(obj.name == 'bounceBoard')
	{
		var color = document.bounceBoard.pidxx.options[document.bounceBoard.pidxx.selectedIndex].value;
		//var form = document.bounceBoard;
		if(color=='0')
		{
			alert("Please select bounce board color!!!");
			document.bounceBoard.pidxx.focus();
			return false;
		}
		if (document.bounceBoard.pquantity.value == "")
		{
			alert("Please enter the quantity.");
			document.bounceBoard.pquantity.focus();
			return false;
		}
		if (!(document.bounceBoard.pquantity.value <= 99999 && document.bounceBoard.pquantity.value > 0))
		{
			alert("Please enter a numeric value for quantity");
			document.bounceBoard.pquantity.value='';
			document.bounceBoard.pquantity.focus();
			return false;
		}

		if (document.bounceBoard.pquantity.value == "0" || checkDotIndex(document.bounceBoard.pquantity.value)==true)
		{
			alert("Invalid quantity.");
			document.bounceBoard.pquantity.value='';
			document.bounceBoard.pquantity.focus();
			return false;
		}

		return true;
	}
	if(obj.name == 'snow_board')
	{
		
		if (document.snow_board.pquantity.value == "")
		{
			alert("Please enter the quantity.");
			document.snow_board.pquantity.focus();
			return false;
		}
		

		

		return true;
	}
	if(obj.name == 'wake_board')
	{
		
		if (document.wake_board.pquantity.value == "")
		{
			alert("Please enter the quantity.");
			document.wake_board.pquantity.focus();
			return false;
		}
		

		

		return true;
	}

	
	
}

function checkDotIndex(objValue)
{
	var indexValue =objValue.indexOf(".");	
	
	if (indexValue != -1)
	{		
		return true;
	}
	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 call_price(price,currency,cur_sign){
	
	var pqty=document.getElementById("pquantity").value;
	
	if(document.getElementById("pquantity").value == 0 || checkDotIndex(document.getElementById("pquantity").value)==true){
		alert("Invalid quantity.");
		document.getElementById("pquantity").value="";
		document.getElementById("pquantity").focus();
		document.getElementById("Active_Price").innerHTML=cur_sign+" "+price;
	}else{
		
		document.getElementById("Active_Price").innerHTML=cur_sign+" "+round_decimals((pqty*price* currency * 1), 2);
	}

}

function call_price1(price,currency,cur_sign){
	
	var pqty=document.getElementById("pquantity").value;
	
	if(document.getElementById("pquantity").value == 0 || checkDotIndex(document.getElementById("pquantity").value)==true){
		alert("Invalid quantity.");
		document.getElementById("pquantity").value="";
		document.getElementById("pquantity").focus();
		document.getElementById("Active_Price").innerHTML=cur_sign+""+price;
	}else{
		
		document.getElementById("Active_Price").innerHTML= cur_sign+""+price+" X "+pqty+" = "+cur_sign+""+round_decimals((pqty*price* currency * 1), 2);
	}

}


function show_img()
{
	obj = document.getElementById("pidxx").options;
	for(var i=0; i < obj.length; i++)
	{
		if(obj[i].selected)
		{
			var item_name = obj[i].text;
			
			if(item_name.search("Blue")==0)
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_blue.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_blue_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_blue_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}
			else if(item_name.search("Camoflauge")==0)
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_como.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_como_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_como_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}			
			else if(item_name.search("Red")==0)//ok
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_red.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_red_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_red_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}			
			else if(item_name.search("Multi")==0)
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_multicolor.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_multicolor_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_multicolor_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}
			else if(item_name.search("Orange")==0)
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_orange.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_orange_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_orange_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}
			else if(item_name.search("Pink")==0)//ok
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_pink.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_pink_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_pink_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}
			else if(item_name.search("Grey")==0)
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_grey.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_grey_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_grey_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}
			else//ok
			{
				document.getElementById("image_div").innerHTML='<img itemprop="photo" src="images/bounce_board_new.jpg"  style="cursor:pointer" width="220" height="189" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_new_zoom.jpg\',\'\', \'scrollbars=yes,width=620, height=500\');"> <br><img src="images/zoom_1.jpg" width="61" height="24" border="0" onClick="MM_openBrWindow(\'open-popup.php?img=bounce_board_new_zoom.jpg\',\'\', \'scrollbars=yes,width=620,height=500\')" style="cursor:pointer">';
			}






		}
	}
}
