/*
+----------------------------------------------------------------------+
| Back in Stock Notification                                           |
+----------------------------------------------------------------------+
| Copyright (c) 2007-2010 BCSE LLC. dba BCS Engineering                |
+----------------------------------------------------------------------+
|                                                                      |
| Advanced Filter Mod is subject for version 2.0 of the BCSE           |
| proprietary license. That license file can be found bundled with     |
| this package in the file BCSE_LICENSE. A copy of this license can    |
| also be found at                                                     |
| http://www.bcsengineering.com/license/BCSE_LICENSE_2.0.txt           |
|                                                                      |
+----------------------------------------------------------------------+
*/

if(bcse_oos_active === true && typeof check_options == 'function' && document.getElementById('bcse-stock-notify-text')){

	window.bcse_bis_check_options = window.check_options;

	window.check_options = function(){

		bcse_bis_check_options();

		var variantid = false;
		for (var x in variants) {
			if (variants[x][1].length == 0)
				continue;

			variantid = x;
			for (var c in variants[x][1]) {
				if (getPOValue(c) != variants[x][1][c]) {
					variantid = false;
					break;
				}
			}

			if (variantid)
				break;
		}

		if (variantid){
			if(bcse_oos_variants[variantid] === true) {
				var bcse_bis_variant_html = bcse_bis_html.replace('BCSEVID',variantid);
				document.getElementById('bcse-stock-notify-text').innerHTML = bcse_bis_variant_html;
				document.getElementById('bcse-stock-notify-text').style.paddingTop = '10px';
				document.getElementById('bcse-stock-notify-text').style.paddingBottom = '10px';

				if(document.getElementById('atc-row')){
					document.getElementById('atc-row').style.display = 'none';
				}

			}else{
				document.getElementById('bcse-stock-notify-text').innerHTML = '';
				document.getElementById('bcse-stock-notify-text').style.paddingTop = '0px';
				document.getElementById('bcse-stock-notify-text').style.paddingBottom = '0px';

				if(document.getElementById('atc-row')){
					document.getElementById('atc-row').style.display = '';
				}

			}
		}
	}
}

