function init()
	{
		this.oz1 = document.getElementById("oz1");
		this.oz2 = document.getElementById("oz2");
		this.addEvent(this.oz1, "mouseup", this.submitClick);
		this.addEvent(this.oz1, "mouseover", this.submitOver);
		this.addEvent(this.oz2, "mouseup", this.submitClick2);
		this.addEvent(this.oz2, "mouseover", this.submitOver2);
	}

this.addEvent = function(obj, evType, fn)
	{
		if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; }
		else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
		else { return false; }
	}
	
this.targetElement = function(e)
	{
		if(e.target) {
			this.target = e.target;
		} else {
			this.target = e.srcElement;
		}
	}

this.submitOver = function (e) {
	this.pay1 = document.getElementById("pay1");
	if (this.pay1.os0.value == 'Size. Jeans size'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Pink Cotton Candy'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Black Licorice'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Sour Apple Candy'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Black Licorice'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Sour Apple Candy'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Blueberry Gum Drops'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'White Marshmallow'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'White Marshmallow'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Candy Confetti'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'White Marshmallow'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Pink Cotton Candy'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Pink Cotton Candy'){
		this.pay1.action = "";
	}else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Black Licorice'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Blueberry Gum Drops'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Lemon Jellybean'){
		this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Extra Sweet (XSmall) 2-4' && (this.pay1.os1.value != 'Cherry Pop') && (this.pay1.os1.value != 'Grape Pop') && (this.pay1.os1.value != 'Watermelon Pop')) {
	    	this.pay1.action = "";
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Black Licorice') {
	    	this.pay1.action = "";
	}
	else {this.pay1.action = "https://www.paypal.com/cgi-bin/webscr";}
}

this.submitClick = function (e) {
	targetElement(e);
	this.pay1 = document.getElementById("pay1");
	if (this.pay1.os0.value == 'Size. Jeans size'){
	    alert( "Please Select a Size" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Pink Cotton Candy'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Sour Apple Candy'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Candy Confetti'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Black Licorice'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Black Licorice'){
	    alert( "Out of Stock" );
	}else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Pink Cotton Candy'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'White Marshmallow'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'White Marshmallow'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweetest (Large) 10-12' && this.pay1.os1.value == 'Sour Apple Candy'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Pink Cotton Candy'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweeter (Medium) 7-9' && this.pay1.os1.value == 'Blueberry Gum Drops'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'White Marshmallow'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Black Licorice'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Blueberry Gum Drops'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Black Licorice'){
	    alert( "Out of Stock" );
	} else if (this.pay1.os0.value == 'Sweet (Small) 4-6' && this.pay1.os1.value == 'Lemon Jellybean'){
	    alert( "Sold Out" );
	} else if (this.pay1.os0.value == 'Extra Sweet (XSmall) 2-4' && (this.pay1.os1.value != 'Cherry Pop') && (this.pay1.os1.value != 'Grape Pop') && (this.pay1.os1.value != 'Watermelon Pop')) {
	    alert( "Sold Out" );
	}
}

this.submitOver2 = function (e) {

	this.pay2 = document.getElementById("pay2");
	if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Black Licorice') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Sour Apple Candy') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweetest (Large) 10-12' && this.pay2.os1.value == 'Black Licorice') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Lemon Jellybean') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweetest (Large) 10-12' && this.pay2.os1.value == 'Blueberry Gum Drops') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'White Marshmallow') {
	    	this.pay2.action = "";
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Pink Cotton Candy') {
	    	this.pay2.action = "";
	} else {
		this.pay2.action = "https://www.paypal.com/cgi-bin/webscr";
	}
}

this.submitClick2 = function (e) {

	targetElement(e);
	this.pay2 = document.getElementById("pay2");
	if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Black Licorice') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Sour Apple Candy') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweetest (Large) 10-12' && this.pay2.os1.value == 'Black Licorice') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Lemon Jellybean') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweetest (Large) 10-12' && this.pay2.os1.value == 'Blueberry Gum Drops') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'White Marshmallow') {
	    alert( "Out of Stock" );
	} else if (this.pay2.os0.value == 'Sweet (Small) 4-6' && this.pay2.os1.value == 'Pink Cotton Candy') {
	    alert( "Out of Stock" );
	}
}
