/**
 * @author lyykfi
**/
 
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
var IE7 = false /*@cc_on || @_jscript_version == 5.7 @*/;
var gteIE7 = false /*@cc_on || @_jscript_version >= 5.7 @*/;
var isMSIE = /*@cc_on!@*/false;

//Cufon.replace('test', { fontFamily: 'test',hover: true });


var global_flag1 = 1;

/* calculator */
function calculator_event() {
	$("#calculate").html("0");
	
	all_event = 1;
	
	$(".calc_item").each(
		function(intIndex){
			calc_value = $(this).attr("value");
			price = $("#calc_item_price"+intIndex).html();
			
			flag = 0;
			
			reg = RegExp("^[0-9]+$");
			
			if(reg.test(calc_value)) {
				flag = 1;
			}
			
			if(flag == 0) {
				$(this).css("border","1px solid red");
				
				global_flag1 = 0;
				all_event = 0;
			} else { 
				$("#calculate").html(parseInt($("#calculate").html())+(parseInt(calc_value)*parseInt(price)));
				$(this).css("border","1px solid #C4C4C4");
				
			}
		}
	);
	
	if(all_event == 1) {
		global_flag1 = 1;
	}
	 
	if(global_flag1 == 1) {
		$("#addToCart").removeAttr("disabled");
		$("#addToCart").css("background","#006600");
	} else {
		$("#addToCart").attr("disabled","disabled");
		$("#addToCart").css("background","#EE184C");
	}
	
	
}

$(document).ready( function() {
	calculator_event();
	
	$("#center").height($(".center2_i1").height()-400);
	
	$(window).resize(
		function() {
			$("#center").height($(".center2_i1").height()-400);
		}
	);
	
});
